hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f29e42c78694697601b6b4a5aaa8bfee24587a4a | 1,153 | cpp | C++ | LeetCode/Solutions/LC0304.cpp | Mohammed-Shoaib/HackerRank-Problems | ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b | [
"MIT"
] | 54 | 2019-05-13T12:13:09.000Z | 2022-02-27T02:59:00.000Z | LeetCode/Solutions/LC0304.cpp | Mohammed-Shoaib/HackerRank-Problems | ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b | [
"MIT"
] | 2 | 2020-10-02T07:16:43.000Z | 2020-10-19T04:36:19.000Z | LeetCode/Solutions/LC0304.cpp | Mohammed-Shoaib/HackerRank-Problems | ccfb9fc2f0d8dff454439d75ce519cf83bad7c3b | [
"MIT"
] | 20 | 2020-05-26T09:48:13.000Z | 2022-03-18T15:18:27.000Z | /*
Problem Statement: https://leetcode.com/problems/range-sum-query-2d-immutable/
Space: O(m • n)
Author: Mohammed Shoaib, github.com/Mohammed-Shoaib
|-----------------------------------|----------|-------|
| Operations | Time | Space |
|-----------------------------------|----------|-------|
| NumMatrix(matrix) | O(m • n) | O(1) |
| sumRegion(row1, col1, row2, col2) | O(1) | O(1) |
|-----------------------------------|----------|-------|
*/
class NumMatrix {
private:
vector<vector<int>> prefix;
public:
NumMatrix(vector<vector<int>>& matrix) {
// base case
if (matrix.empty())
return;
int m = matrix.size(), n = matrix[0].size();
prefix = vector<vector<int>>(m + 1, vector<int>(n + 1));
// 2-dimensional prefix sum
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
prefix[i + 1][j + 1] = matrix[i][j]
+ prefix[i + 1][j]
+ prefix[i][j + 1]
- prefix[i][j];
}
int sumRegion(int row1, int col1, int row2, int col2) {
return prefix[row2 + 1][col2 + 1]
- prefix[row2 + 1][col1]
- prefix[row1][col2 + 1]
+ prefix[row1][col1];
}
}; | 28.121951 | 78 | 0.469211 | [
"vector"
] |
f2a0bf622523f8eff70ecbbadf5c6ccfe723eeb5 | 13,334 | cpp | C++ | source/LibFgBase/src/FgGeometryTest.cpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | null | null | null | source/LibFgBase/src/FgGeometryTest.cpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | null | null | null | source/LibFgBase/src/FgGeometryTest.cpp | MikhailGorobets/FaceGenBaseLibrary | 3ea688f9e3811943adb18e23e7bb2addc5f688a5 | [
"MIT"
] | 1 | 2020-05-27T17:23:50.000Z | 2020-05-27T17:23:50.000Z | //
// Coypright (c) 2020 Singular Inversions Inc. (facegen.com)
// Use, modification and distribution is subject to the MIT License,
// see accompanying file LICENSE.txt or facegen.com/base_library_license.txt
//
#include "stdafx.h"
#include "FgGeometry.hpp"
#include "FgRandom.hpp"
#include "FgSimilarity.hpp"
#include "FgMath.hpp"
#include "FgApproxEqual.hpp"
#include "FgImageDraw.hpp"
#include "FgBounds.hpp"
#include "FgMath.hpp"
#include "FgMain.hpp"
using namespace std;
namespace Fg {
namespace {
static
void
closestBarycentricPoint()
{
for (size_t ii=0; ii<100; ++ii) {
Vec3D p0 = Vec3D::randNormal(),
p1 = Vec3D::randNormal(),
p2 = Vec3D::randNormal();
Plane plane = cPlane(p0,p1,p2);
// Closest point in plane to origin equation derived using Lagrange's method:
Vec3D closest0 = -plane.scalar * plane.norm / cMag(plane.norm),
bary = closestBarycentricPoint(p0,p1,p2),
closest1 = bary[0]*p0 + bary[1]*p1 + bary[2]*p2;
FGASSERT(isApproxEqualRelPrec(closest0,closest1));
Opt<Vec3D> bary1 = barycentricCoord(closest1,p0,p1,p2);
FGASSERT(isApproxEqualRelPrec(bary,bary1.val()));
}
}
static
void
originToSegmentDistSqr()
{
Vec3D p0(1.0,0.0,0.0),
p1(0.0,1.0,0.0),
p2(2.0,-1.0,0.0);
Mat33D rot;
rot.setIdentity();
for (uint ii=0; ii<10; ++ii) {
Vec3D r0 = rot * p0,
r1 = rot * p1,
r2 = rot * p2;
VecMagD delta;
// Degenerate case:
delta = closestPointInSegment(r0,r0);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0,0.0,0.0),30));
// edge closest point (both directions):
delta = closestPointInSegment(r0,r1);
FGASSERT(isApproxEqualRelPrec(delta.mag,0.5));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(0.5,0.5,0.0),30));
delta = closestPointInSegment(r1,r2);
FGASSERT(isApproxEqualRelPrec(delta.mag,0.5));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(0.5,0.5,0.0),30));
// vertex closest point:
delta = closestPointInSegment(r0,r2);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0,0.0,0.0),30));
rot = QuaternionD::rand().asMatrix();
}
}
static
void
pointToFacetDistSqr()
{
Vec3D origin {0},
p0(1.0,0.0,0.0),
p1(0.0,1.0,0.0),
p2(0.0,0.0,1.0),
p3(2.0,-1.0,0.0),
p4(2.0,0.0,1.0);
Mat33D rot;
rot.setIdentity();
for (uint ii=0; ii<10; ++ii) {
Vec3D r0 = rot * p0,
r1 = rot * p1,
r2 = rot * p2,
r3 = rot * p3,
r4 = rot * p4;
VecMagD delta;
// surface closest point (both orientations):
delta = closestPointInTri(origin,r0,r1,r2);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0/3.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0/3.0),30));
delta = closestPointInTri(origin,r0,r2,r1);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0/3.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0/3.0),30));
// degenerate facet edge closest point:
delta = closestPointInTri(origin,r0,r1,r3);
FGASSERT(isApproxEqualRelPrec(delta.mag,0.5));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(0.5,0.5,0.0),30));
// edge closest point (both orientations):
delta = closestPointInTri(origin,r0,r2,r3);
FGASSERT(isApproxEqualRelPrec(delta.mag,0.5));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(0.5,0.0,0.5),30));
delta = closestPointInTri(origin,r0,r3,r2);
FGASSERT(isApproxEqualRelPrec(delta.mag,0.5));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(0.5,0.0,0.5),30));
// vertex closest point:
delta = closestPointInTri(origin,r0,r3,r4);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0,0.0,0.0),30));
delta = closestPointInTri(origin,r0,r0*2.0,r3);
FGASSERT(isApproxEqualRelPrec(delta.mag,1.0));
FGASSERT(isApproxEqualRelMag(delta.vec,rot * Vec3D(1.0,0.0,0.0),30));
rot = QuaternionD::rand().asMatrix();
}
}
static
void
barycentricCoords()
{
// Test points inside triangle:
for (uint ii=0; ii<100; ++ii) {
Vec2D v0 = Vec2D::randNormal(),
v1 = Vec2D::randNormal(),
v2 = Vec2D::randNormal(),
del1 = v1-v0,
del2 = v2-v0;
if ((del1[0]*del2[1]-del1[1]*del2[0]) > 0.001) {
double c0 = randUniform(),
c1 = randUniform() * (1.0 - c0),
c2 = 1.0 - c1 - c0;
Vec2D pnt = v0*c0 + v1*c1 + v2*c2;
Vec3D res = barycentricCoord(pnt,v0,v1,v2).val();
FGASSERT(cMinElem(res)>=0.0f); // Inside.
Vec2D chk = v0*res[0] + v1*res[1] + v2*res[2];
FGASSERT(isApproxEqualRelMag(pnt,chk,30));
FGASSERT(isApproxEqualRelPrec(res[0]+res[1]+res[2],1.0));
}
}
// Test points outside triangle:
for (uint ii=0; ii<100; ++ii) {
Vec2D v0 = Vec2D::randNormal(),
v1 = Vec2D::randNormal(),
v2 = Vec2D::randNormal(),
del1 = v1-v0,
del2 = v2-v0;
if ((del1[0]*del2[1]-del1[1]*del2[0]) > 0.001) {
Vec3D c;
c[0] = -float(randUniform()),
c[1] = float(randUniform()) * (1.0f - c[0]),
c[2] = 1.0f - c[1] - c[0];
c = permuteAxes<double>(ii%3) * c;
Vec2D pnt = v0*c[0] + v1*c[1] + v2*c[2];
Vec3D res = barycentricCoord(pnt,v0,v1,v2).val();
FGASSERT(cMinElem(res)<0.0f); // Outside
Vec2D chk = v0*res[0] + v1*res[1] + v2*res[2];
FGASSERT(isApproxEqualRelMag(pnt,chk,30));
FGASSERT(isApproxEqualRelPrec(res[0]+res[1]+res[2],1.0));
}
}
}
static
void
barycentricCoords3D()
{
fgout << fgnl << "Barycentric 3d: " << fgpush;
for (uint ii=0; ii<50; ++ii) {
Vec3D v0 = Vec3D::randNormal(),
v1 = Vec3D::randNormal(),
v2 = Vec3D::randNormal(),
bc = Vec3D::randNormal();
bc /= bc[0] + bc[1] + bc[2];
Vec3D pt = bc[0]*v0 + bc[1]*v1 + bc[2]*v2;
Opt<Vec3D> ret = barycentricCoord(pt,v0,v1,v2);
if (ret.valid()) {
Vec3D res = ret.val(),
delta = res-bc;
//fgout << fgnl << bc << " -> " << res << " delta: " << res-bc;
FGASSERT(delta.mag() < sqr(0.000001));
}
}
fgout << fgpop;
}
static
void
planeH()
{
Vec3D v0(0,0,0),
v1(1,0,0),
v2(0,1,0);
randSeedRepeatable();
for (size_t ii=0; ii<100; ++ii) {
Affine3D s = similarityRand().asAffine();
Plane pln = cPlane(s*v0,s*v1,s*v2);
double a = randUniform(),
b = randUniform(),
c = 1.0 - a - b;
Vec3D pt = s * (v0*a + v1*b + v2*c);
double r = cDot(pt,pln.norm),
mag = sqrt(pln.norm.mag()+sqr(pln.scalar));
FGASSERT(isApproxEqualAbsPrec(-r,pln.scalar,mag));
}
}
static
void
rayPlaneIntersect()
{
Vec2D v0(0,0),
v1(1,0),
v2(0,1),
zero;
randSeedRepeatable();
for (size_t ii=0; ii<100; ++ii) {
Mat22D rot = matRotate(randUniform()*2.0*pi());
Vec2D r0 = rot * v0,
r1 = rot * v1,
r2 = rot * v2;
Mat33D rot3 = matRotateAxis((randUniform()*0.5-0.25)*pi(),Vec3D::randNormal());
Vec3D p0 = rot3 * asHomogVec(r0),
p1 = rot3 * asHomogVec(r1),
p2 = rot3 * asHomogVec(r2),
pt = rot3 * asHomogVec(zero + Vec2D::randUniform(-0.1,0.1));
Plane pln = cPlane(p0,p1,p2);
Vec4D is = linePlaneIntersect(pt*exp(randNormal()),pln);
FGASSERT(isApproxEqualRelMag(pt,fromHomogVec(is),30));
}
}
static
void
pit0(Vec2D pt,Vec2D v0,Vec2D v1,Vec2D v2,int res)
{
FGASSERT(pointInTriangle(pt,v0,v1,v2) == res);
FGASSERT(pointInTriangle(pt,v0,v2,v1) == res*-1); //-V764 (PVS Studio)
}
static
void
pit1(Vec2D pt,Vec2D v0,Vec2D v1,Vec2D v2,int res)
{
for (size_t ii=0; ii<5; ++ii) {
Mat22D rot = matRotate(randUniform()*2.0*pi());
Vec2D trn(randUniform(),randUniform());
Affine2D s(rot,trn);
pit0(s*pt,s*v0,s*v1,s*v2,res); }
}
static
void
pointInTriangle()
{
Vec2D v0(0.0,0.0),
v1(1.0,0.0),
v2(0.0,1.0);
double d = epsilonD() * 100,
d1 = 1.0 - d * 2.0;
randSeedRepeatable();
// In middle:
pit1(Vec2D(0.25,0.25),v0,v1,v2,1);
// Near vertices:
pit1(Vec2D(d,d),v0,v1,v2,1);
pit1(Vec2D(d1,d),v0,v1,v2,1);
pit1(Vec2D(d,d1),v0,v1,v2,1);
// Near edges:
pit1(Vec2D(0.5,d),v0,v1,v2,1);
pit1(Vec2D(d,0.5),v0,v1,v2,1);
pit1(Vec2D(0.5-d,0.5-d),v0,v1,v2,1);
// Miss cases:
pit1(Vec2D(0.5+d,0.5+d),v0,v1,v2,0);
pit1(Vec2D(1.0+d,0.0),v0,v1,v2,0);
pit1(Vec2D(0.0,1.0+d),v0,v1,v2,0);
pit1(Vec2D(-d,0.5),v0,v1,v2,0);
pit1(Vec2D(0.5,-d),v0,v1,v2,0);
pit1(Vec2D(-d,-d),v0,v1,v2,0);
}
static
void
lineFacetIntersect()
{
double s = 0.1;
Vec3D v0(0,0,0),
v1(1,0,0),
v2(0,1,0);
Opt<Vec3D> ret;
ret = lineTriIntersect(Vec3D(s,s,1),Vec3D(0,0,-1),v0,v1,v2);
FGASSERT(ret.val() == Vec3D(s,s,0));
ret = lineTriIntersect(Vec3D(s,s,1),Vec3D(0,0,1),v0,v1,v2);
FGASSERT(ret.val() == Vec3D(s,s,0));
ret = lineTriIntersect(Vec3D(-s,-s,1),Vec3D(0,0,1),v0,v1,v2);
FGASSERT(!ret.valid());
ret = lineTriIntersect(Vec3D(0,0,1),Vec3D(-s,-s,-1),v0,v1,v2);
FGASSERT(!ret.valid());
ret = lineTriIntersect(Vec3D(0,0,1),Vec3D(s,s,-1),v0,v1,v2);
FGASSERT(ret.val() == Vec3D(s,s,0));
}
// Test tensor-based 3D triangle / parallelogram area formula:
static void
triTensorArea()
{
randSeedRepeatable();
for (size_t tt=0; tt<10; ++tt) {
// tri verts in CC winding order:
Vec3D pnts[3] {Vec3D::randNormal(),Vec3D::randNormal(),Vec3D::randNormal()},
// parallelogram area vectors:
area0 = crossProduct(pnts[1]-pnts[0],pnts[2]-pnts[0]), // traditional formula
area1 {0}; // tensor formula
for (uint ii=0; ii<3; ++ii) { // even permutation tensor
uint jj = (ii+1)%3,
kk = (ii+2)%3;
for (uint xx=0; xx<3; ++xx) { // alternating tensor even permutes
uint yy = (xx+1)%3,
zz = (xx+2)%3;
area1[xx] += pnts[jj][yy] * pnts[kk][zz]; // even permutation of alternating tensor
area1[xx] -= pnts[jj][zz] * pnts[kk][yy]; // odd "
}
}
FGASSERT(isApproxEqualRelPrec(area0,area1,30U));
}
}
} // namespace
void
testGeometry(CLArgs const &)
{
randSeedRepeatable();
closestBarycentricPoint();
originToSegmentDistSqr();
pointToFacetDistSqr();
barycentricCoords();
barycentricCoords3D();
planeH();
rayPlaneIntersect();
pointInTriangle();
lineFacetIntersect();
triTensorArea();
}
void
testmGeometry(CLArgs const &)
{
// Give visual feedback on continuity along a line passing through all 3 cases;
// facet, edge and vertex closest point:
const uint ns = 800;
Vec3D v0(0.0,0.0,1.0),
v1(1.0,1.0,1.0),
v2(2.0,-1.0,1.0),
pnt(-1.0,0.0,0.0);
vector<double> func;
double step = 6.0 / double(ns-1);
for (uint ii=0; ii<ns; ++ii) {
pnt[0] += step;
func.push_back(closestPointInTri(pnt,v0,v1,v2).mag);
}
uint sz = ns-2;
MatD derivs(sz,3);
for (size_t ii=0; ii<sz; ++ii) {
derivs.rc(ii,0) = func[ii+1];
derivs.rc(ii,1) = func[ii+2]-func[ii];
derivs.rc(ii,2) = func[ii+2] + func[ii] - 2.0 * func[ii+1];
}
fgDrawFunctions(derivs);
}
} // namespace Fg
| 35.182058 | 103 | 0.502025 | [
"vector",
"3d"
] |
f2a9bb91f868b666eee3abcb6d9e3d3b3a88dc55 | 2,462 | cpp | C++ | modules/ui/src/systems/update_transform_hierarchy.cpp | LaudateCorpus1/lagrange | 2a49d3ee93c1f1e712c93c5c87ea25b9a83c8f40 | [
"Apache-2.0"
] | 156 | 2021-01-08T19:53:06.000Z | 2022-03-25T18:32:52.000Z | modules/ui/src/systems/update_transform_hierarchy.cpp | LaudateCorpus1/lagrange | 2a49d3ee93c1f1e712c93c5c87ea25b9a83c8f40 | [
"Apache-2.0"
] | 2 | 2021-01-11T20:18:07.000Z | 2021-08-04T15:53:57.000Z | modules/ui/src/systems/update_transform_hierarchy.cpp | LaudateCorpus1/lagrange | 2a49d3ee93c1f1e712c93c5c87ea25b9a83c8f40 | [
"Apache-2.0"
] | 10 | 2021-01-11T21:03:54.000Z | 2022-01-24T06:27:44.000Z | /*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you 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 REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
#include <lagrange/ui/components/Transform.h>
#include <lagrange/ui/systems/update_transform_hierarchy.h>
#include <lagrange/ui/utils/treenode.h>
#include <lagrange/ui/default_events.h>
#include <lagrange/ui/utils/events.h>
namespace lagrange {
namespace ui {
void update_transform_recursive(
Registry& registry,
Entity e,
const Eigen::Affine3f& parent_global_transform,
bool check_change = false
)
{
assert(registry.has<TreeNode>(e));
if (registry.has<Transform>(e)) {
auto& transform = registry.get<Transform>(e);
if (check_change) {
auto new_global = (parent_global_transform * transform.local);
const bool is_changed = transform.global.matrix() != new_global.matrix();
transform.global = new_global;
if (is_changed) {
ui::publish<TransformChangedEvent>(registry, e);
}
}
else {
transform.global = (parent_global_transform * transform.local);
}
foreach_child(registry, e, [&](Entity e) {
update_transform_recursive(registry, e, transform.global, check_change);
});
} else {
// Passthrough if entity doesn't have Transform component
foreach_child(registry, e, [&](Entity e) {
update_transform_recursive(registry, e, parent_global_transform, check_change);
});
}
}
void update_transform_hierarchy(Registry& registry)
{
auto view = registry.view<TreeNode>();
const bool check_change = !(ui::get_event_emitter(registry).empty<TransformChangedEvent>());
for (auto e : view) {
if (view.get<TreeNode>(e).parent == NullEntity) {
update_transform_recursive(registry, e, Eigen::Affine3f::Identity(), check_change);
}
}
}
} // namespace ui
} // namespace lagrange | 34.194444 | 96 | 0.674655 | [
"transform"
] |
f2b090b6ac283658386908cbb3657a27ff120541 | 1,365 | cpp | C++ | devdc48.cpp | vidit1999/coding_problems | b6c9fa7fda37d9424cd11bcd54b385fd8cf1ee0a | [
"BSD-2-Clause"
] | 1 | 2020-02-24T18:28:48.000Z | 2020-02-24T18:28:48.000Z | devdc48.cpp | vidit1999/coding_problems | b6c9fa7fda37d9424cd11bcd54b385fd8cf1ee0a | [
"BSD-2-Clause"
] | null | null | null | devdc48.cpp | vidit1999/coding_problems | b6c9fa7fda37d9424cd11bcd54b385fd8cf1ee0a | [
"BSD-2-Clause"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
/*
Create a like system from Facebook; a text which displays the names of people who liked an item.
For example:
likes [] must be "no one likes this"
likes ["Peter"] must be "Peter likes this"
likes ["Jacob", "Alex"] must be "Jacob and Alex like this"
likes ["Max", "John", "Mark"] must be "Max, John and Mark like this"
likes ["Alex", "Jacob", "Mark", "Max"] must be "Alex, Jacob and 2 others like this"
Note: For 4 or more names, the number in and 2 others simply increases.
*/
string facebookLikes(vector<string> persons){
switch(persons.size()){
case 0:
return "no one likes this";
case 1:
return persons[0] + " likes this";
case 2:
return persons[0] + " and " + persons[1] + " like this";
case 3:
return persons[0] + ", " + persons[1] + " and " + persons[2] + " like this";
default:
return persons[0] + ", " + persons[1] + " and " + to_string(persons.size()-2) + " others like this";
}
}
// main function
int main(){
cout << facebookLikes({}) << "\n";
cout << facebookLikes({"Peter"}) << "\n";
cout << facebookLikes({"Jacob", "Alex"}) << "\n";
cout << facebookLikes({"Max", "John", "Mark"}) << "\n";
cout << facebookLikes({"Alex", "Jacob", "Mark", "Max"}) << "\n";
return 0;
} | 33.292683 | 112 | 0.574359 | [
"vector"
] |
f2b0a0732f13adf4f6f2b8be681c51c974dd6d21 | 2,311 | hpp | C++ | pwiz/analysis/peptideid/PeptideID_pepXML.hpp | edyp-lab/pwiz-mzdb | d13ce17f4061596c7e3daf9cf5671167b5996831 | [
"Apache-2.0"
] | 11 | 2015-01-08T08:33:44.000Z | 2019-07-12T06:14:54.000Z | pwiz/analysis/peptideid/PeptideID_pepXML.hpp | shze/pwizard-deb | 4822829196e915525029a808470f02d24b8b8043 | [
"Apache-2.0"
] | 61 | 2015-05-27T11:20:11.000Z | 2019-12-20T15:06:21.000Z | pwiz/analysis/peptideid/PeptideID_pepXML.hpp | shze/pwizard-deb | 4822829196e915525029a808470f02d24b8b8043 | [
"Apache-2.0"
] | 4 | 2016-02-03T09:41:16.000Z | 2021-08-01T18:42:36.000Z | //
// $Id: PeptideID_pepXML.hpp 3095 2011-11-01 21:12:23Z broter $
//
//
// Original author: Robert Burke <robert.burke@cshs.org>
//
// Copyright 2007 Spielberg Family Center for Applied Proteomics
// Cedars-Sinai Medical Center, Los Angeles, California 90048
//
// 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.
//
#ifndef _PEPTIDEID_PEPXML_HPP_
#define _PEPTIDEID_PEPXML_HPP_
#include "pwiz/utility/misc/Export.hpp"
#include <map>
#include <boost/shared_ptr.hpp>
#include "PeptideID.hpp"
namespace pwiz {
namespace peptideid {
/// This class allows access to identified proteins in PeptideProphet files.
/// A PeptideID_pepXML object is contructed with either the path to a
/// PeptideProphet format file (*.pep.xml), or an std::istream open to
/// the beginning of a pep.xml file.
class PWIZ_API_DECL PeptideID_pepXml : public PeptideID
{
public:
/// Constructor taking path to input file in std::string.
PeptideID_pepXml(const std::string& filename);
/// Constructor taking path to input file from const char*.
PeptideID_pepXml(const char* filename);
/// Constructor taking std::istream as input.
PeptideID_pepXml(std::istream* in);
/// Destructor.
virtual ~PeptideID_pepXml() {}
/// Returns the Record object associated with the given nativeID.
/// A range_error is thrown if the nativeID isn't associated with
/// a Record.
virtual Record record(const Location& location) const;
virtual std::multimap<double, boost::shared_ptr<PeptideID::Record> >::const_iterator
record(double retention_time_sec) const;
virtual Iterator begin() const;
virtual Iterator end() const;
private:
class Impl;
boost::shared_ptr<Impl> pimpl;
};
} // namespace peptideid
} // namespace pwiz
#endif // _PEPTIDEID_PEPXML_HPP_
| 29.628205 | 88 | 0.729122 | [
"object"
] |
f2b2244adc0442742f69f8f479a2be5afa7c8277 | 4,484 | cpp | C++ | test/distance_calculator_test.cpp | nanprogramer/ghostz-gpu | 89f51c54ec8f6141801287dadc35174f9d7c70e0 | [
"BSD-2-Clause"
] | null | null | null | test/distance_calculator_test.cpp | nanprogramer/ghostz-gpu | 89f51c54ec8f6141801287dadc35174f9d7c70e0 | [
"BSD-2-Clause"
] | 1 | 2021-01-21T14:09:32.000Z | 2021-01-21T14:09:32.000Z | test/distance_calculator_test.cpp | Surfndez/ghostz-gpu | 89f51c54ec8f6141801287dadc35174f9d7c70e0 | [
"BSD-2-Clause"
] | null | null | null | #include <gtest/gtest.h>
#include <algorithm>
#include <string>
#include <sstream>
#include <stdint.h>
#include <fstream>
#include <vector>
#include "../src/protein_type.h"
#include "../src/alphabet_coder.h"
#include "../src/score_matrix_reader.h"
#include "../src/score_matrix.h"
#include "../src/reduced_alphabet_file_reader.h"
#include "../src/reduced_alphabet_coder.h"
#include "../src/reduced_alphabet_variable_hash_function.h"
#include "../src/distance_calculator.h"
using namespace std;
class DistanceCalculatorTest: public ::testing::Test {
protected:
virtual void SetUp() {
ProteinType protein_type;
const std::string reduced_alphabet = "A KR EDNQ C G H ILVM FYW P ST";
std::istringstream in(reduced_alphabet);
std::vector<std::string> alphabet_sets;
ReducedAlphabetFileReader reduced_alphabet_reader;
reduced_alphabet_reader.Read(in, alphabet_sets);
coder_ = AlphabetCoder(protein_type);
ReducedAlphabetCoder reduced_alphabet_coder(protein_type,
alphabet_sets);
AlphabetCoder::Code max_code = coder_.GetMaxRegularLetterCode();
reduced_code_map_.resize(max_code + 1);
for (AlphabetCoder::Code code = coder_.GetMinCode(); code <= max_code;
++code) {
char c = coder_.Decode(code);
AlphabetCoder::Code reduced_code = reduced_alphabet_coder.Encode(c);
reduced_code_map_[code] = reduced_code;
}
max_code_ = reduced_alphabet_coder.GetMaxRegularLetterCode();
max_length_ = 2;
}
virtual void TearDown() {
}
AlphabetCoder::Code max_code_;
uint32_t max_length_;
int score_threshold_;
std::vector<AlphabetCoder::Code> reduced_code_map_;
std::vector<int> code_score_;
AlphabetCoder coder_;
};
TEST_F(DistanceCalculatorTest, CalculateDistanceEqual) {
string sequence0 = "GMEHQS";
vector<AlphabetCoder::Code> coded_sequence0(sequence0.length());
coder_.Encode(&sequence0[0], sequence0.length(), &coded_sequence0[0]);
string sequence1 = "GMEHQS";
vector<AlphabetCoder::Code> coded_sequence1(sequence1.length());
coder_.Encode(&sequence1[0], sequence1.length(), &coded_sequence1[0]);
size_t center_position = sequence0.length() / 2;
DistanceCalculator distance_calculator;
distance_calculator.SetQueries(&coded_sequence0[0]);
distance_calculator.SetDatabase(&coded_sequence1[0]);
distance_calculator.SetReducedCodeMap(&reduced_code_map_[0]);
DistanceCalculator::Distance s = distance_calculator.CalculateDistance(
center_position, center_position, sequence0.length());
EXPECT_EQ(0, s);
}
TEST_F(DistanceCalculatorTest, CalculateDistance1Mismatch) {
string sequence0 = "IMEHQS";
vector<AlphabetCoder::Code> coded_sequence0(sequence0.length());
coder_.Encode(&sequence0[0], sequence0.length(), &coded_sequence0[0]);
string sequence1 = "LMEHQA";
vector<AlphabetCoder::Code> coded_sequence1(sequence1.length());
coder_.Encode(&sequence1[0], sequence1.length(), &coded_sequence1[0]);
size_t center_position = sequence0.length() / 2;
DistanceCalculator distance_calculator;
distance_calculator.SetQueries(&coded_sequence0[0]);
distance_calculator.SetDatabase(&coded_sequence1[0]);
distance_calculator.SetReducedCodeMap(&reduced_code_map_[0]);
DistanceCalculator::Distance s = distance_calculator.CalculateDistance(
center_position, center_position, sequence0.length());
EXPECT_EQ(1, s);
}
TEST_F(DistanceCalculatorTest, CalculateDistances) {
size_t subsequence_length = 4;
string sequence0 = "IMEHQSIMEHQS";
vector<AlphabetCoder::Code> coded_sequence0(sequence0.length());
coder_.Encode(&sequence0[0], sequence0.length(), &coded_sequence0[0]);
string sequence1 = "LMEHQALMEHQA";
vector<AlphabetCoder::Code> coded_sequence1(sequence1.length());
coder_.Encode(&sequence1[0], sequence1.length(), &coded_sequence1[0]);
vector<uint32_t> sequence0_positions;
vector<uint32_t> sequence1_positions;
vector<DistanceCalculator::Distance> distances(3,0);
sequence0_positions.push_back(2);
sequence1_positions.push_back(2);
sequence0_positions.push_back(6);
sequence1_positions.push_back(6);
sequence0_positions.push_back(10);
sequence1_positions.push_back(10);
DistanceCalculator distance_calculator;
distance_calculator.SetQueries(&coded_sequence0[0]);
distance_calculator.SetDatabase(&coded_sequence1[0]);
distance_calculator.SetReducedCodeMap(&reduced_code_map_[0]);
distance_calculator.CalculateDistances(3, &sequence0_positions[0], &sequence1_positions[0], subsequence_length, &distances[0]);
EXPECT_EQ(0, distances[0]);
EXPECT_EQ(1, distances[1]);
EXPECT_EQ(1, distances[2]);
}
| 37.366667 | 128 | 0.783452 | [
"vector"
] |
f2bc42a0b76d51e654493012b6f46fd96f334f62 | 13,411 | hpp | C++ | approxik/approxik.hpp | rock-learning/approxik | 877d50d4d045457593a2fafefd267339a11de20f | [
"BSD-3-Clause"
] | 1 | 2020-03-27T01:53:57.000Z | 2020-03-27T01:53:57.000Z | approxik/approxik.hpp | rock-learning/approxik | 877d50d4d045457593a2fafefd267339a11de20f | [
"BSD-3-Clause"
] | null | null | null | approxik/approxik.hpp | rock-learning/approxik | 877d50d4d045457593a2fafefd267339a11de20f | [
"BSD-3-Clause"
] | 1 | 2020-12-18T02:09:21.000Z | 2020-12-18T02:09:21.000Z | #include <string>
#include <iostream>
#include <fstream>
#include <ios>
#include <stdexcept>
#include <limits>
#include <urdf_model/model.h>
#include <urdf_parser/urdf_parser.h>
#include <kdl_parser/kdl_parser.hpp>
#include <kdl/frames_io.hpp>
#include <kdl/chain.hpp>
#include <kdl/chainfksolverpos_recursive.hpp>
#include <kdl/chainiksolvervel_pinv.hpp>
#include <kdl/chainiksolverpos_nr_jl.hpp>
#include <Eigen/Core>
// TODO make dependency for timing optional
#include <boost/date_time/posix_time/posix_time.hpp>
// TODO correct paths
#include "cppoptlib/problem.h"
#include "cppoptlib/solver/lbfgsbsolver.h"
void chainFromUrdf(const std::string& file, const std::string& root,
const std::string& tip, KDL::Chain& chain,
Eigen::VectorXd& qlo, Eigen::VectorXd& qhi, bool verbose=0)
{
std::ifstream f(file.c_str());
if(!f.good())
throw std::ios_base::failure("Cannot read from file '" + file + "'.");
boost::shared_ptr<urdf::ModelInterface> robot_model =
urdf::parseURDFFile(file);
KDL::Tree tree;
#ifdef ROCK // uses an old version of kdl_parser
if(!kdl_parser::treeFromUrdfModel(*robot_model, tree))
#else
if(!kdl_parser::treeFromUrdfModel(robot_model, tree))
#endif
throw std::runtime_error("Could not extract kdl tree");
if(verbose >= 1)
std::cout << "[IK] KDL::Tree (" << tree.getNrOfJoints() << " joints, "
<< tree.getNrOfSegments() << " segments)" << std::endl;
tree.getChain(root, tip, chain);
if(verbose >= 1)
std::cout << "[IK] KDL::Chain (" << chain.getNrOfJoints() << " joints, "
<< chain.getNrOfSegments() << " segments)" << std::endl;
std::list<double> lo, hi;
for(unsigned int i = 0; i < chain.getNrOfSegments(); i++)
{
KDL::Segment segment = chain.getSegment(i);
KDL::Joint joint = segment.getJoint();
if(joint.getType() != KDL::Joint::None)
{
std::string name = joint.getName();
const double lower = robot_model->getJoint(name)->limits->lower;
const double upper = robot_model->getJoint(name)->limits->upper;
if(verbose >= 1)
{
std::cout << " joint #" << lo.size() << ": '" << name << "'" << std::endl
<< " limits: [" << lower << ", " << upper << "]" << std::endl;
}
lo.push_back(lower);
hi.push_back(upper);
}
}
const unsigned int numJoints = chain.getNrOfJoints();
if(numJoints != lo.size() || numJoints != hi.size())
throw std::runtime_error(
"Number of joints in chain and limits is not equal!");
qlo.resize(numJoints);
qhi.resize(numJoints);
std::list<double>::iterator loIt = lo.begin(), hiIt = hi.begin();
for(unsigned int i = 0; i < numJoints; i++, loIt++, hiIt++)
{
qlo(i) = *loIt;
qhi(i) = *hiIt;
}
}
template <typename Derived>
KDL::JntArray jntEigen2KDL(const Eigen::MatrixBase<Derived>& qin)
{
KDL::JntArray qout;
qout.data = qin;
return qout;
}
template <typename Derived>
void poseKDL2Eigen(const KDL::Frame& frame, Eigen::MatrixBase<Derived>& pose)
{
for(unsigned int i = 0; i < 3; i++)
pose(i) = frame.p(i);
frame.M.GetQuaternion(pose(4), pose(5), pose(6), pose(3)); // x, y, z, w
}
template <typename Derived>
void poseEigen2KDL(const Eigen::MatrixBase<Derived>& pose, KDL::Frame& frame)
{
for(unsigned int i = 0; i < 3; i++)
frame.p(i) = pose(i);
frame.M = KDL::Rotation::Quaternion(pose(4), pose(5), pose(6), pose(3));
}
class ForwardKinematics
{
const int verbose;
unsigned int numJoints;
KDL::JntArray q;
KDL::Frame p;
public:
KDL::Chain chain;
Eigen::VectorXd qlo, qhi;
KDL::ChainFkSolverPos_recursive* fk;
ForwardKinematics(const std::string& file, const std::string& root,
const std::string& tip, int verbose=0)
: verbose(verbose)
{
chainFromUrdf(file, root, tip, chain, qlo, qhi, verbose);
numJoints = chain.getNrOfJoints();
fk = new KDL::ChainFkSolverPos_recursive(chain);
}
~ForwardKinematics()
{
delete fk;
}
const unsigned int getNumJoints()
{
return numJoints;
}
template <typename Derived1, typename Derived2>
bool JntToCart(const Eigen::MatrixBase<Derived1>& q,
Eigen::MatrixBase<Derived2>& p)
{
this->q.data = q;
const bool result = fk->JntToCart(this->q, this->p) >= 0;
poseKDL2Eigen(this->p, p);
return result;
}
};
class IKProblem : public cppoptlib::Problem<double>
{
ForwardKinematics& fk;
const Eigen::VectorXd* desiredPose;
Eigen::VectorXd pose;
const double positionWeight;
const double rotationWeight;
public:
IKProblem(ForwardKinematics& fk, double positionWeight=1.0,
double rotationWeight=1.0)
: fk(fk), desiredPose(0), pose(7),
positionWeight(positionWeight), rotationWeight(rotationWeight)
{
}
void setDesiredPose(const Eigen::VectorXd& newPose)
{
desiredPose = &newPose;
}
double value(const cppoptlib::Vector<double>& q)
{
const bool success = fk.JntToCart(q, pose);
if(success)
{
const double sqPositionDist = (pose.head<3>() - desiredPose->head<3>()).squaredNorm();
const Eigen::Quaterniond q1(pose.tail<4>().data());
const Eigen::Quaterniond q2(desiredPose->tail<4>());
const double angle = 2.0 * std::acos((q1 * q2.conjugate()).w());
const double angularDist = std::min(angle, 2.0 * M_PI - angle);
//const double angularDist = q1.angularDistance(q2);
const double sqAngularDist = angularDist * angularDist;
return positionWeight * sqPositionDist + rotationWeight * sqAngularDist;
}
else
{
return std::numeric_limits<double>::max();
}
}
};
class ApproximateInverseKinematics
{
protected:
ForwardKinematics fk;
IKProblem objective;
unsigned int maxiter;
const int verbose;
// TODO make optional
boost::posix_time::ptime start_time;
boost::posix_time::ptime stop_time;
public:
ApproximateInverseKinematics(
const std::string& file, const std::string& root,
const std::string& tip, double positionWeight=1.0,
double rotationWeight=1.0, unsigned int maxiter=100000,
int verbose=0)
: fk(file, root, tip, verbose),
objective(fk, positionWeight, rotationWeight), maxiter(maxiter),
verbose(verbose)
{
}
virtual ~ApproximateInverseKinematics()
{
}
const unsigned int getNumJoints()
{
return fk.getNumJoints();
}
template <typename Derived1, typename Derived2>
void JntToCart(const Eigen::MatrixBase<Derived1>& q,
Eigen::MatrixBase<Derived2>& pose)
{
fk.JntToCart(q, pose);
}
void JntToCart(double* q, double* pose)
{
Eigen::Map<Eigen::VectorXd> qvec(q, fk.getNumJoints());
Eigen::Map<Eigen::VectorXd> pvec(pose, 7);
fk.JntToCart(qvec, pvec);
}
template <typename Derived1, typename Derived2>
bool CartToJnt(const Eigen::MatrixBase<Derived1>& pose,
Eigen::MatrixBase<Derived2>& currentQ)
{
// TODO ctor args
cppoptlib::ISolver<double, 1>::Info stopControl;
stopControl.rate = 0.0;
stopControl.iterations = maxiter;
stopControl.gradNorm = 0.0;
stopControl.m = 10;
// TODO check whether we can make the solver a member
cppoptlib::LbfgsbSolver<double> solver(stopControl);
// We cannot pass currentQ directly to solver.minimize() because the
// interface is not generic enough
Eigen::VectorXd q = currentQ;
setProblemBounds(&q); // must be done before any clipping is performed
clipToLimits(q);
Eigen::VectorXd p = pose;
objective.setDesiredPose(p);
if(verbose >= 2)
{
std::cout << "[IK] Limits:" << std::endl
<< " " << objective.lowerBound().transpose() << std::endl
<< " " << objective.upperBound().transpose() << std::endl;
}
start_time = boost::posix_time::microsec_clock::local_time(); // TODO optional
solver.minimize(objective, q);
// Workaround for a serious problem: for some poses we are completely stuck
// in a local minimum
if(q == currentQ)
{
if(verbose >= 2)
std::cout << "[IK] Workaround is active" << std::endl;
p(0) += 0.001;
p(1) -= 0.001;
p(2) += 0.001;
objective.setDesiredPose(p);
solver.minimize(objective, q);
p(0) -= 0.001;
p(1) += 0.001;
p(2) -= 0.001;
objective.setDesiredPose(p);
solver.minimize(objective, q);
}
stop_time = boost::posix_time::microsec_clock::local_time(); // TODO optional
// TODO check why limits are sometimes violated
clipToLimits(q);
currentQ = q;
if(verbose >= 1)
{
std::cout << "[IK] Optimized joints:" << std::endl
<< " " << currentQ.transpose() << std::endl
<< " Objective: " << objective(currentQ) << std::endl;
if(verbose >= 2)
{
Eigen::VectorXd actualPose(7);
fk.JntToCart(currentQ, actualPose);
std::cout << "[IK] Desired pose:" << std::endl
<< " " << pose.transpose() << std::endl;
std::cout << "[IK] Actual pose:" << std::endl
<< " " << actualPose.transpose() << std::endl;
}
}
return true;
}
void CartToJnt(double* pose, double* q)
{
Eigen::Map<Eigen::VectorXd> pvec(pose, 7);
Eigen::Map<Eigen::VectorXd> qvec(q, fk.getNumJoints());
CartToJnt(pvec, qvec);
}
// TODO optional
double getLastTiming() // in seconds
{
return (stop_time - start_time).total_nanoseconds() / 1000000000.0;
}
protected:
virtual void setProblemBounds(Eigen::VectorXd* currentQ = 0)
{
objective.setBoxConstraint(fk.qlo, fk.qhi);
}
template <typename Derived>
void clipToLimits(Eigen::MatrixBase<Derived>& q)
{
q = q.cwiseMax(objective.lowerBound()).cwiseMin(objective.upperBound());
}
};
class ApproximateLocalInverseKinematics : public ApproximateInverseKinematics
{
bool initialized;
double maxJump;
public:
ApproximateLocalInverseKinematics(
const std::string& file, const std::string& root,
const std::string& tip, double positionWeight=1.0,
double rotationWeight=1.0, double maxJump=1.0,
unsigned int maxiter=100000, int verbose=0)
: ApproximateInverseKinematics(file, root, tip, positionWeight,
rotationWeight, maxiter, verbose),
initialized(false), maxJump(maxJump)
{
}
void reset()
{
initialized = false;
}
protected:
virtual void setProblemBounds(Eigen::VectorXd* currentQ)
{
if(!initialized)
{
ApproximateInverseKinematics::setProblemBounds();
initialized = true;
return;
}
Eigen::VectorXd lo = (currentQ->array() - maxJump).matrix().cwiseMax(fk.qlo);
Eigen::VectorXd hi = (currentQ->array() + maxJump).matrix().cwiseMin(fk.qhi);
objective.setBoxConstraint(lo, hi);
}
};
class ExactInverseKinematics
{
ForwardKinematics fk;
KDL::ChainIkSolverVel_pinv velIk;
KDL::ChainIkSolverPos_NR_JL posIk;
const int verbose;
KDL::JntArray qout;
KDL::Frame frame;
// TODO make optional
boost::posix_time::ptime start_time;
boost::posix_time::ptime stop_time;
public:
ExactInverseKinematics(
const std::string& file, const std::string& root,
const std::string& tip, double eps=1e-5, int maxiter=150,
int verbose=0)
: fk(file, root, tip, verbose), velIk(fk.chain, eps, maxiter),
posIk(fk.chain, jntEigen2KDL(fk.qlo), jntEigen2KDL(fk.qhi), *fk.fk,
velIk, maxiter, eps), verbose(verbose)
{
qout.resize(fk.getNumJoints());
}
const unsigned int getNumJoints()
{
return fk.getNumJoints();
}
template <typename Derived1, typename Derived2>
void JntToCart(const Eigen::MatrixBase<Derived1>& q,
Eigen::MatrixBase<Derived2>& pose)
{
fk.JntToCart(q, pose);
}
void JntToCart(double* q, double* pose)
{
Eigen::Map<Eigen::VectorXd> qvec(q, fk.getNumJoints());
Eigen::Map<Eigen::VectorXd> pvec(pose, 7);
fk.JntToCart(qvec, pvec);
}
template <typename Derived1, typename Derived2>
bool CartToJnt(const Eigen::MatrixBase<Derived1>& pose,
Eigen::MatrixBase<Derived2>& currentQ)
{
poseEigen2KDL(pose, frame);
start_time = boost::posix_time::microsec_clock::local_time(); // TODO optional
const int result = posIk.CartToJnt(jntEigen2KDL(currentQ), frame, qout);
stop_time = boost::posix_time::microsec_clock::local_time(); // TODO optional
currentQ = qout.data;
if(verbose >= 1)
{
if(result == -3)
std::cout << "[IK] FAILED: Maximum number of iterations reached!"
<< std::endl;
std::cout << "[IK] Optimized joints:" << std::endl
<< " " << currentQ.transpose() << std::endl;
if(verbose >= 2)
{
Eigen::VectorXd actualPose(7);
fk.JntToCart(currentQ, actualPose);
std::cout << "[IK] Desired pose:" << std::endl
<< " " << pose.transpose() << std::endl;
std::cout << "[IK] Actual pose:" << std::endl
<< " " << actualPose.transpose() << std::endl;
}
}
return result >= 0;
}
bool CartToJnt(double* pose, double* q)
{
Eigen::Map<Eigen::VectorXd> pvec(pose, 7);
Eigen::Map<Eigen::VectorXd> qvec(q, fk.getNumJoints());
return CartToJnt(pvec, qvec);
}
// TODO optional
double getLastTiming() // in seconds
{
return (stop_time - start_time).total_nanoseconds() / 1000000000.0;
}
};
| 28.717345 | 92 | 0.636567 | [
"vector",
"model"
] |
f2bf685e34fcae25550d0124ce09cafa93937915 | 31,535 | cpp | C++ | test/callback_tests.cpp | mkm85/cpr | cc0b80c3c9ccf5613c092e0bc51929f04c0ca041 | [
"MIT"
] | 59 | 2020-01-10T06:27:12.000Z | 2021-12-16T06:37:36.000Z | test/callback_tests.cpp | luntan365/cpr | 07d784ccfe6760fc6da47c24f7326e64d8e11460 | [
"MIT"
] | 21 | 2020-01-04T09:04:27.000Z | 2020-02-01T04:38:25.000Z | test/callback_tests.cpp | luntan365/cpr | 07d784ccfe6760fc6da47c24f7326e64d8e11460 | [
"MIT"
] | 21 | 2019-03-22T09:06:00.000Z | 2022-01-12T01:29:30.000Z | #include <gtest/gtest.h>
#include <string>
#include <vector>
#include <cpr/cpr.h>
#include "server.h"
using namespace cpr;
static Server* server = new Server();
auto base = server->GetBaseUrl();
auto sleep_time = std::chrono::milliseconds(50);
auto zero = std::chrono::seconds(0);
int status_callback(int& status_code, Response r) {
status_code = r.status_code;
return r.status_code;
}
int status_callback_ref(int& status_code, const Response& r) {
status_code = r.status_code;
return r.status_code;
}
std::string text_callback(std::string& expected_text, Response r) {
expected_text = r.text;
return r.text;
}
std::string text_callback_ref(std::string& expected_text, const Response& r) {
expected_text = r.text;
return r.text;
}
TEST(CallbackGetTests, CallbackGetLambdaStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::GetCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackGetTests, CallbackGetLambdaTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::GetCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackGetTests, CallbackGetLambdaStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::GetCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackGetTests, CallbackGetLambdaTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::GetCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackGetTests, CallbackGetFunctionStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::GetCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackGetTests, CallbackGetFunctionTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::GetCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackGetTests, CallbackGetFunctionStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::GetCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackGetTests, CallbackGetFunctionTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::GetCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteLambdaStatusTest) {
auto url = Url{base + "/delete.html"};
auto status_code = 0;
auto future = cpr::DeleteCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteLambdaTextTest) {
auto url = Url{base + "/delete.html"};
auto expected_text = std::string{};
auto future = cpr::DeleteCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteLambdaStatusReferenceTest) {
auto url = Url{base + "/delete.html"};
auto status_code = 0;
auto future = cpr::DeleteCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteLambdaTextReferenceTest) {
auto url = Url{base + "/delete.html"};
auto expected_text = std::string{};
auto future = cpr::DeleteCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteFunctionStatusTest) {
auto url = Url{base + "/delete.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::DeleteCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteFunctionTextTest) {
auto url = Url{base + "/delete.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::DeleteCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteFunctionStatusReferenceTest) {
auto url = Url{base + "/delete.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::DeleteCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackDeleteTests, CallbackDeleteFunctionTextReferenceTest) {
auto url = Url{base + "/delete.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::DeleteCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackHeadTests, CallbackHeadLambdaStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::HeadCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackHeadTests, CallbackHeadLambdaTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::HeadCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackHeadTests, CallbackHeadLambdaStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::HeadCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackHeadTests, CallbackHeadLambdaTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::HeadCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackHeadTests, CallbackHeadFunctionStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::HeadCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackHeadTests, CallbackHeadFunctionTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::HeadCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackHeadTests, CallbackHeadFunctionStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::HeadCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackHeadTests, CallbackHeadFunctionTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::HeadCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPostTests, CallbackPostLambdaStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PostCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPostTests, CallbackPostLambdaTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PostCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPostTests, CallbackPostLambdaStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PostCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPostTests, CallbackPostLambdaTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PostCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPostTests, CallbackPostFunctionStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PostCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPostTests, CallbackPostFunctionTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PostCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPostTests, CallbackPostFunctionStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PostCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPostTests, CallbackPostFunctionTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PostCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPutTests, CallbackPutLambdaStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PutCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPutTests, CallbackPutLambdaTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PutCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPutTests, CallbackPutLambdaStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PutCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPutTests, CallbackPutLambdaTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PutCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPutTests, CallbackPutFunctionStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PutCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPutTests, CallbackPutFunctionTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PutCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPutTests, CallbackPutFunctionStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PutCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPutTests, CallbackPutFunctionTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PutCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsLambdaStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::OptionsCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsLambdaTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::OptionsCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsLambdaStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto future = cpr::OptionsCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsLambdaTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto future = cpr::OptionsCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsFunctionStatusTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::OptionsCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsFunctionTextTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::OptionsCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsFunctionStatusReferenceTest) {
auto url = Url{base + "/hello.html"};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::OptionsCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackOptionsTests, CallbackOptionsFunctionTextReferenceTest) {
auto url = Url{base + "/hello.html"};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::OptionsCallback(callback, url);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPatchTests, CallbackPatchLambdaStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PatchCallback([&status_code] (Response r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPatchTests, CallbackPatchLambdaTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PatchCallback([&expected_text] (Response r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPatchTests, CallbackPatchLambdaStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto future = cpr::PatchCallback([&status_code] (const Response& r) {
status_code = r.status_code;
return r.status_code;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPatchTests, CallbackPatchLambdaTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto future = cpr::PatchCallback([&expected_text] (const Response& r) {
expected_text = r.text;
return r.text;
}, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPatchTests, CallbackPatchFunctionStatusTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback, std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PatchCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPatchTests, CallbackPatchFunctionTextTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PatchCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
TEST(CallbackPatchTests, CallbackPatchFunctionStatusReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto status_code = 0;
auto callback = std::function<int(Response)>(std::bind(status_callback_ref,
std::ref(status_code),
std::placeholders::_1));
auto future = cpr::PatchCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(status_code, future.get());
}
TEST(CallbackPatchTests, CallbackPatchFunctionTextReferenceTest) {
auto url = Url{base + "/url_post.html"};
auto payload = Payload{{"x", "5"}};
auto expected_text = std::string{};
auto callback = std::function<std::string(Response)>(std::bind(text_callback_ref,
std::ref(expected_text),
std::placeholders::_1));
auto future = cpr::PatchCallback(callback, url, payload);
std::this_thread::sleep_for(sleep_time);
EXPECT_EQ(future.wait_for(zero), std::future_status::ready);
EXPECT_EQ(expected_text, future.get());
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
::testing::AddGlobalTestEnvironment(server);
return RUN_ALL_TESTS();
}
| 43.139535 | 98 | 0.610274 | [
"vector"
] |
f2c4a9b2c1b2c29dcc4197c5311639766658dad6 | 9,794 | cpp | C++ | projects/app/src/mvc/itemstoragemodel.cpp | junebug12851/pokered-save-editor-2 | af883fd4c12097d408e1756c7181709cf2b797d8 | [
"Apache-2.0"
] | null | null | null | projects/app/src/mvc/itemstoragemodel.cpp | junebug12851/pokered-save-editor-2 | af883fd4c12097d408e1756c7181709cf2b797d8 | [
"Apache-2.0"
] | null | null | null | projects/app/src/mvc/itemstoragemodel.cpp | junebug12851/pokered-save-editor-2 | af883fd4c12097d408e1756c7181709cf2b797d8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2020 June Hanabi
*
* 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 <algorithm>
#include <QCollator>
#include <QDebug>
#include <pse-db/itemsdb.h>
#include "./itemstoragemodel.h"
#include <pse-savefile/expanded/fragments/itemstoragebox.h>
#include <pse-savefile/expanded/fragments/item.h>
#include "../bridge/router.h"
ItemStorageModel::ItemStorageModel(ItemStorageBox* items, Router* router)
: items(items),
router(router)
{
// Connect signals from the box
connect(this->items, &ItemStorageBox::itemMoveChange, this, &ItemStorageModel::onMove);
connect(this->items, &ItemStorageBox::itemRemoveChange, this, &ItemStorageModel::onRemove);
// Doesn't work, no idea why
//connect(this->items, &ItemStorageBox::itemInsertChange, this, &ItemStorageModel::onInsert);
// A hack because insert doesn't work as advertised, yet another millionth QML
// and Qt Gotcha I could spend hours, days, weeks, or months trying ti fix
connect(this->items, &ItemStorageBox::itemInsertChange, this, &ItemStorageModel::onReset);
connect(this->items, &ItemStorageBox::itemsResetChange, this, &ItemStorageModel::onReset);
// Clear checked on non-modal screen change. The checked state is completely
// temporary, it should not persist between non-modal screens
connect(this->router, &Router::closeNonModal, this, &ItemStorageModel::pageClosing);
connect(this->router, &Router::goHome, this, &ItemStorageModel::pageClosing);
connect(this->items, &ItemStorageBox::beforeItemRelocate, this, &ItemStorageModel::onBeforeRelocate);
connect(this, &ItemStorageModel::hasCheckedChanged, this, &ItemStorageModel::checkStateDirty);
}
int ItemStorageModel::rowCount(const QModelIndex& parent) const
{
// Not a tree, just a list, there's no parent
Q_UNUSED(parent)
// Return list count
return items->items.size() + 1;
}
QVariant ItemStorageModel::data(const QModelIndex& index, int role) const
{
// If index is invalid in any way, return nothing
if (!index.isValid())
return QVariant();
if (index.row() > items->items.size())
return QVariant();
if(index.row() == (items->items.size()))
return getPlaceHolderData(role);
// Get Item from Item List Cache
auto item = items->items.at(index.row());
if(item == nullptr)
return QVariant();
// Now return requested information
if (role == IdRole)
return item->ind;
else if (role == CountRole)
return item->amount;
else if (role == CheckedRole)
return item->property(isCheckedKey).toBool();
else if (role == PlaceholderRole)
return false;
// All else fails, return nothing
return QVariant();
}
QHash<int, QByteArray> ItemStorageModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[IdRole] = "itemId";
roles[CountRole] = "itemCount";
roles[CheckedRole] = "itemChecked";
roles[PlaceholderRole] = "itemIsPlaceholder";
return roles;
}
bool ItemStorageModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
if(!index.isValid())
return false;
if(index.row() >= items->items.size())
return false;
auto item = items->items.at(index.row());
if(item == nullptr)
return false;
// Now set requested information
if (role == IdRole) {
item->ind = value.toInt();
dataChanged(index, index);
return true;
}
else if (role == CountRole) {
item->amount = value.toInt();
dataChanged(index, index);
return true;
}
else if (role == CheckedRole) {
item->setProperty(isCheckedKey, value.toBool());
hasCheckedChanged();
dataChanged(index, index);
return true;
}
return false;
}
QVariant ItemStorageModel::getPlaceHolderData(int role) const
{
if (role == IdRole)
return -1;
else if (role == CountRole)
return 0;
else if (role == CheckedRole)
return 0;
else if (role == PlaceholderRole)
return true;
return QVariant();
}
// QML ListView is the worst I've ever used in any language, so many hours and
// days have been lost fixing ListView issues, bugs, and gotchas
//
// beginMoveRows is the only way to move rows and it's terminology is different
// than other Qt terminology.
// "to" is 1 past the item to move to, elsewhere in Qt "to" is the index to move
// to. This creates all kinds of havoc as the two cannot properly communicate
// and translation is very error prone leading to all my problems.
void ItemStorageModel::onMove(int from, int to)
{
// I'm convinced I'm never going to be able to remove these for the life of
// the entire program because I'm convinced that seeking out ListView bugs
// specifically and only related to beginMoveRow bugs will never end. Ever!
//qDebug() << "[Pre-Move] From" << from << "to" << to;
if(from == to)
return;
if(to > from)
to++;
//qDebug() << "[To-Move] From" << from << "to" << to;
beginMoveRows(QModelIndex(), from, from, QModelIndex(), to);
endMoveRows();
}
void ItemStorageModel::onRemove(int ind)
{
beginRemoveRows(QModelIndex(), ind, ind);
endRemoveRows();
hasCheckedChanged();
}
void ItemStorageModel::onInsert()
{
// Doesn't work, no idea why
beginInsertRows(QModelIndex(), items->items.size()+1, items->items.size()+1);
endInsertRows();
}
void ItemStorageModel::onReset()
{
beginResetModel();
endResetModel();
hasCheckedChanged();
}
bool ItemStorageModel::hasChecked()
{
bool ret = false;
for(auto el : items->items) {
if(el->property(isCheckedKey).toBool() == true)
ret = true;
}
return ret;
}
bool ItemStorageModel::hasCheckedCached()
{
return checkedStateDirty;
}
QVector<Item*> ItemStorageModel::getChecked()
{
QVector<Item*> ret;
for(auto el : items->items) {
if(el->property(isCheckedKey).toBool() == true)
ret.append(el);
}
return ret;
}
void ItemStorageModel::clearCheckedState()
{
for(auto el : items->items) {
el->setProperty(isCheckedKey, false);
}
hasCheckedChanged();
}
void ItemStorageModel::clearCheckedStateGone()
{
for(int i = 0; i < items->items.size(); i++) {
auto el = items->items.at(i);
el->setProperty(isCheckedKey, false);
dataChanged(index(i), index(i));
}
hasCheckedChanged();
}
void ItemStorageModel::checkedMoveToTop()
{
for(auto el : getChecked()) {
int ind = items->items.indexOf(el);
items->itemMove(ind, 0);
}
}
void ItemStorageModel::checkedMoveUp()
{
for(auto el : getChecked()) {
int ind = items->items.indexOf(el);
items->itemMove(ind, ind - 1);
}
}
void ItemStorageModel::checkedMoveDown()
{
auto checkedItems = getChecked();
// For stupid ListView, these need to be done in reverse
// If moving down
for(int i = checkedItems.size() - 1; i >= 0; i--) {
auto el = checkedItems.at(i);
int ind = items->items.indexOf(el);
items->itemMove(ind, ind + 1);
}
}
void ItemStorageModel::checkedMoveToBottom()
{
auto checkedItems = getChecked();
// For stupid ListView, these need to be done in reverse
// If moving down
for(int i = checkedItems.size() - 1; i >= 0; i--) {
auto el = checkedItems.at(i);
int ind = items->items.indexOf(el);
items->itemMove(ind, items->items.size() - 1);
}
}
void ItemStorageModel::checkedDelete()
{
for(auto el : getChecked()) {
int ind = items->items.indexOf(el);
items->itemRemove(ind);
}
}
void ItemStorageModel::checkedTransfer()
{
for(auto el : getChecked()) {
int ind = items->items.indexOf(el);
items->relocateOne(ind);
}
hasCheckedChanged();
}
void ItemStorageModel::checkedToggleAll()
{
if(items->items.size() == 0)
return;
bool allValue = !items->items.at(0)->property(isCheckedKey).toBool();
for(int i = 0; i < items->items.size(); i++) {
auto el = items->items.at(i);
el->setProperty(isCheckedKey, allValue);
}
// As far as I can tell there is no way to force a ListView row to be
// re-created. This means dataChanged is completely and utterly useless. I've
// tried all kinds of tricks, I've searched Google for hours, I've even tried
// a hack where I remove and re-insert all rows to force the rows to be
// re-created. I'm left with no other option but to completely destroy the
// model and re-create it.
//
// The issue stems from another Qt gotcha. Models are expected to change only
// from their delegates, they are never expected to externally change and as
// such any external changes have no way of being reflected in the model
// without a reset.
beginResetModel();
endResetModel();
hasCheckedChanged();
}
void ItemStorageModel::onBeforeRelocate(Item* item)
{
item->setProperty(isCheckedKey, false);
hasCheckedChanged();
}
void ItemStorageModel::checkStateDirty()
{
bool _val = hasChecked();
if(checkedStateDirty == _val)
return;
checkedStateDirty = hasChecked();
hasCheckedChangedCached();
}
void ItemStorageModel::pageClosing()
{
if(checkedStateDirty)
clearCheckedState();
}
| 26.980716 | 104 | 0.664488 | [
"model"
] |
f2c771777cc6e65b5b8865adbcda2fe2f18703f7 | 6,184 | cpp | C++ | admin/wmi/wbem/providers/win32provider/common/secureshare.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | admin/wmi/wbem/providers/win32provider/common/secureshare.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | admin/wmi/wbem/providers/win32provider/common/secureshare.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*
* SecurityDescriptor.cpp - implementation file for CSecureShare class.
*
* Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
*
*
* Created: 12-14-1997 by Sanjeev Surati
* (based on classes from Windows NT Security by Nik Okuntseff)
*/
#include "precomp.h"
#include "AccessEntry.h" // CAccessEntry class
#include "AccessEntryList.h"
#include "DACL.h" // CDACL class
#include "SACL.h"
#include "securitydescriptor.h"
#include "secureshare.h"
#include "tokenprivilege.h"
#include <windef.h>
#include <lmcons.h>
#include <lmshare.h>
#include "wbemnetapi32.h"
#ifdef NTONLY
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::CSecureShare
//
// Default class constructor.
//
// Inputs:
// None.
//
// Outputs:
// None.
//
// Returns:
// None.
//
// Comments:
//
///////////////////////////////////////////////////////////////////
CSecureShare::CSecureShare()
: CSecurityDescriptor(),
m_strFileName()
{
}
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::CSecureShare
//
// Alternate Class CTOR
//
// Inputs:
// LPCTSTR pszFileName - The FileName to handle
// security for.
// BOOL fGetSACL - Should we get the SACL?
//
// Outputs:
// None.
//
// Returns:
// None.
//
// Comments:
//
///////////////////////////////////////////////////////////////////
CSecureShare::CSecureShare( PSECURITY_DESCRIPTOR pSD)
: CSecurityDescriptor(pSD)
{
// SetFileName( pszFileName );
}
CSecureShare::CSecureShare( CHString& chsShareName)
: CSecurityDescriptor()
{
SetShareName( chsShareName);
}
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::~CSecureShare
//
// Class Destructor.
//
// Inputs:
// None.
//
// Outputs:
// None.
//
// Returns:
// None.
//
// Comments:
//
///////////////////////////////////////////////////////////////////
CSecureShare::~CSecureShare( void )
{
}
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::SetFileName
//
// Public Entry point to set which file/directory this instance
// of the class is to supply security for.
//
// Inputs:
// LPCTSTR pszFileName - The FileName to handle
// security for.
// BOOL fGetSACL - Should we get the SACL?
//
// Outputs:
// None.
//
// Returns:
// DWORD ERROR_SUCCESS if successful
//
// Comments:
//
// This will clear any previously set filenames and/or security
// information.
//
///////////////////////////////////////////////////////////////////
DWORD CSecureShare::SetShareName( const CHString& chsShareName)
{
#ifdef WIN9XONLY
return WBEM_E_FAILED;
#endif
#ifdef NTONLY
_bstr_t bstrName ( chsShareName.AllocSysString(), false ) ;
SHARE_INFO_502 *pShareInfo502 = NULL ;
DWORD dwError = ERROR_INVALID_PARAMETER ;
CNetAPI32 NetAPI;
try
{
if( NetAPI.Init() == ERROR_SUCCESS &&
NetAPI.NetShareGetInfo( NULL,
(LPTSTR) bstrName,
502,
(LPBYTE *) &pShareInfo502) == NERR_Success )
{
//Sec. Desc. is not returned for IPC$ ,C$ ...shares for Admin purposes
if(pShareInfo502->shi502_security_descriptor)
{
if(InitSecurity(pShareInfo502->shi502_security_descriptor) )
{
dwError = ERROR_SUCCESS ;
}
}
NetAPI.NetApiBufferFree(pShareInfo502) ;
pShareInfo502 = NULL ;
}
return dwError ;
}
catch ( ... )
{
if ( pShareInfo502 )
{
NetAPI.NetApiBufferFree(pShareInfo502) ;
pShareInfo502 = NULL ;
}
throw ;
}
#endif
}
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::WriteAcls
//
// Protected entry point called by CSecurityDescriptor when
// a user Applies Security and wants to apply security for
// the DACL and/or SACL.
//
// Inputs:
// PSECURITY_DESCRIPTOR pAbsoluteSD - Security
// descriptor to apply to
// the file.
// SECURITY_INFORMATION securityinfo - Flags
// indicating which ACL(s)
// to set.
//
// Outputs:
// None.
//
// Returns:
// DWORD ERROR_SUCCESS if successful
//
// Comments:
//
///////////////////////////////////////////////////////////////////
#ifdef NTONLY
DWORD CSecureShare::WriteAcls( PSECURITY_DESCRIPTOR pAbsoluteSD, SECURITY_INFORMATION securityinfo )
{
DWORD dwError = ERROR_SUCCESS;
// We must have the security privilege enabled in order to access the object's SACL
/* CTokenPrivilege securityPrivilege( SE_SECURITY_NAME );
BOOL fDisablePrivilege = FALSE;
if ( securityinfo & SACL_SECURITY_INFORMATION )
{
fDisablePrivilege = ( securityPrivilege.Enable() == ERROR_SUCCESS );
}
if ( !::SetFileSecurity( m_strFileName,
securityinfo,
pAbsoluteSD ) )
{
dwError = ::GetLastError();
}
// Cleanup the Name Privilege as necessary.
if ( fDisablePrivilege )
{
securityPrivilege.Enable(FALSE);
}
*/ return dwError;
}
#endif
///////////////////////////////////////////////////////////////////
//
// Function: CSecureShare::WriteOwner
//
// Protected entry point called by CSecurityDescriptor when
// a user Applies Security and wants to apply security for
// the owner.
//
// Inputs:
// PSECURITY_DESCRIPTOR pAbsoluteSD - Security
// descriptor to apply to
// the file.
//
// Outputs:
// None.
//
// Returns:
// DWORD ERROR_SUCCESS if successful
//
// Comments:
//
///////////////////////////////////////////////////////////////////
DWORD CSecureShare::WriteOwner( PSECURITY_DESCRIPTOR pAbsoluteSD )
{
DWORD dwError = ERROR_SUCCESS;
// Open with the appropriate access, set the security and leave
/* if ( !::SetFileSecurity( m_strFileName,
OWNER_SECURITY_INFORMATION,
pAbsoluteSD ) )
{
dwError = ::GetLastError();
}
*/ return dwError;
}
DWORD CSecureShare::AllAccessMask( void )
{
// File specific All Access Mask
return FILE_ALL_ACCESS;
}
#endif
| 21.472222 | 101 | 0.556436 | [
"object"
] |
f2c87a28d149785a32ad1d322b06bf53077829c9 | 39,495 | cpp | C++ | libpdraw-backend/src/pdraw_backend_wrapper.cpp | Parrot-Developers/pdraw | 7d0983e88291d9224ec79be2bcf3ad045bb09044 | [
"BSD-3-Clause"
] | 15 | 2019-05-06T17:01:52.000Z | 2021-09-18T08:59:42.000Z | libpdraw-backend/src/pdraw_backend_wrapper.cpp | Parrot-Developers/pdraw | 7d0983e88291d9224ec79be2bcf3ad045bb09044 | [
"BSD-3-Clause"
] | 1 | 2021-03-18T14:32:48.000Z | 2021-03-18T14:32:48.000Z | libpdraw-backend/src/pdraw_backend_wrapper.cpp | Parrot-Developers/pdraw | 7d0983e88291d9224ec79be2bcf3ad045bb09044 | [
"BSD-3-Clause"
] | 10 | 2019-07-18T19:35:59.000Z | 2021-09-14T13:41:33.000Z | /**
* Parrot Drones Awesome Video Viewer
* PDrAW back-end library
*
* Copyright (c) 2018 Parrot Drones SAS
* Copyright (c) 2016 Aurelien Barre
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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 <errno.h>
#include <string>
#include <vector>
#define ULOG_TAG pdraw_backend
#include <ulog.h>
#include <pdraw/pdraw_backend.h>
#include "pdraw_backend_impl.hpp"
class PdrawBackendListener : public Pdraw::IPdraw::Listener {
public:
PdrawBackendListener(struct pdraw_backend *pdraw,
const struct pdraw_backend_cbs *cbs,
void *userdata) :
mPdraw(pdraw),
mCbs(*cbs), mUserdata(userdata)
{
}
~PdrawBackendListener() {}
void stopResponse(Pdraw::IPdraw *pdraw, int status)
{
if (mCbs.stop_resp) {
(*mCbs.stop_resp)(mPdraw, status, mUserdata);
}
}
void onMediaAdded(Pdraw::IPdraw *pdraw,
const struct pdraw_media_info *info)
{
if (mCbs.media_added) {
(*mCbs.media_added)(mPdraw, info, mUserdata);
}
}
void onMediaRemoved(Pdraw::IPdraw *pdraw,
const struct pdraw_media_info *info)
{
if (mCbs.media_removed) {
(*mCbs.media_removed)(mPdraw, info, mUserdata);
}
}
void onSocketCreated(Pdraw::IPdraw *pdraw, int fd)
{
if (mCbs.socket_created)
(*mCbs.socket_created)(mPdraw, fd, mUserdata);
}
private:
struct pdraw_backend *mPdraw;
struct pdraw_backend_cbs mCbs;
void *mUserdata;
};
class PdrawBackendDemuxerListener : public Pdraw::IPdraw::IDemuxer::Listener {
public:
PdrawBackendDemuxerListener(struct pdraw_backend *pdraw,
const struct pdraw_backend_demuxer_cbs *cbs,
void *userdata) :
mPdraw(pdraw),
mCbs(*cbs), mUserdata(userdata), mDemuxer(nullptr)
{
}
~PdrawBackendDemuxerListener() {}
void demuxerOpenResponse(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
int status)
{
if (mCbs.open_resp) {
(*mCbs.open_resp)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
status,
mUserdata);
}
}
void demuxerCloseResponse(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
int status)
{
if (mCbs.close_resp) {
(*mCbs.close_resp)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
status,
mUserdata);
}
}
void onDemuxerUnrecoverableError(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer)
{
if (mCbs.unrecoverable_error) {
(*mCbs.unrecoverable_error)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
mUserdata);
}
}
int demuxerSelectMedia(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
const struct pdraw_demuxer_media *medias,
size_t count)
{
if (mCbs.select_media) {
return (*mCbs.select_media)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
medias,
count,
mUserdata);
}
return -ENOSYS;
}
void demuxerReadyToPlay(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
bool ready)
{
if (mCbs.ready_to_play) {
(*mCbs.ready_to_play)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
ready ? 1 : 0,
mUserdata);
}
}
void onDemuxerEndOfRange(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
uint64_t timestamp)
{
if (mCbs.end_of_range) {
(*mCbs.end_of_range)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
timestamp,
mUserdata);
}
}
void demuxerPlayResponse(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
int status,
uint64_t timestamp,
float speed)
{
if (mCbs.play_resp) {
(*mCbs.play_resp)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
status,
timestamp,
speed,
mUserdata);
}
}
void demuxerPauseResponse(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
int status,
uint64_t timestamp)
{
if (mCbs.pause_resp) {
(*mCbs.pause_resp)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
status,
timestamp,
mUserdata);
}
}
void demuxerSeekResponse(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IDemuxer *demuxer,
int status,
uint64_t timestamp,
float speed)
{
if (mCbs.seek_resp) {
(*mCbs.seek_resp)(
mPdraw,
reinterpret_cast<struct pdraw_demuxer *>(
demuxer),
status,
timestamp,
speed,
mUserdata);
}
}
Pdraw::IPdraw::IDemuxer *getDemuxer()
{
return mDemuxer;
}
void setDemuxer(Pdraw::IPdraw::IDemuxer *demuxer)
{
mDemuxer = demuxer;
}
private:
struct pdraw_backend *mPdraw;
struct pdraw_backend_demuxer_cbs mCbs;
void *mUserdata;
Pdraw::IPdraw::IDemuxer *mDemuxer;
};
class PdrawBackendVideoRendererListener
: public Pdraw::IPdraw::IVideoRenderer::Listener {
public:
PdrawBackendVideoRendererListener(
struct pdraw_backend *pdraw,
const struct pdraw_backend_video_renderer_cbs *cbs,
void *userdata) :
mPdraw(pdraw),
mCbs(*cbs), mUserdata(userdata), mRenderer(nullptr)
{
}
~PdrawBackendVideoRendererListener() {}
void onVideoRendererMediaAdded(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IVideoRenderer *renderer,
const struct pdraw_media_info *info)
{
if (mCbs.media_added)
(*mCbs.media_added)(
mPdraw,
reinterpret_cast<struct pdraw_video_renderer *>(
renderer),
info,
mUserdata);
}
void
onVideoRendererMediaRemoved(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IVideoRenderer *renderer,
const struct pdraw_media_info *info)
{
if (mCbs.media_removed)
(*mCbs.media_removed)(
mPdraw,
reinterpret_cast<struct pdraw_video_renderer *>(
renderer),
info,
mUserdata);
}
void onVideoRenderReady(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IVideoRenderer *renderer)
{
if (mCbs.render_ready)
(*mCbs.render_ready)(
mPdraw,
reinterpret_cast<struct pdraw_video_renderer *>(
renderer),
mUserdata);
}
int loadVideoTexture(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IVideoRenderer *renderer,
unsigned int textureWidth,
unsigned int textureHeight,
const struct pdraw_media_info *mediaInfo,
struct mbuf_raw_video_frame *frame,
const void *frameUserdata,
size_t frameUserdataLen)
{
if (mCbs.load_texture == nullptr)
return -ENOSYS;
return (*mCbs.load_texture)(
mPdraw,
reinterpret_cast<struct pdraw_video_renderer *>(
renderer),
textureWidth,
textureHeight,
mediaInfo,
frame,
frameUserdata,
frameUserdataLen,
mUserdata);
}
int renderVideoOverlay(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IVideoRenderer *renderer,
const struct pdraw_rect *renderPos,
const struct pdraw_rect *contentPos,
const float *viewMat,
const float *projMat,
const struct pdraw_media_info *mediaInfo,
struct vmeta_frame *frameMeta,
const struct pdraw_video_frame_extra *frameExtra)
{
if (mCbs.render_overlay == nullptr)
return -ENOSYS;
if ((renderer == nullptr) || (renderPos == nullptr) ||
(contentPos == nullptr) || (viewMat == nullptr) ||
(projMat == nullptr) || (mediaInfo == nullptr))
return -EINVAL;
(*mCbs.render_overlay)(
mPdraw,
reinterpret_cast<struct pdraw_video_renderer *>(
renderer),
renderPos,
contentPos,
viewMat,
projMat,
mediaInfo,
frameMeta,
frameExtra,
mUserdata);
return 0;
}
Pdraw::IPdraw::IVideoRenderer *getVideoRenderer()
{
return mRenderer;
}
void setVideoRenderer(Pdraw::IPdraw::IVideoRenderer *renderer)
{
mRenderer = renderer;
}
private:
struct pdraw_backend *mPdraw;
struct pdraw_backend_video_renderer_cbs mCbs;
void *mUserdata;
Pdraw::IPdraw::IVideoRenderer *mRenderer;
};
class PdrawBackendCodedVideoSinkListener
: public Pdraw::IPdraw::ICodedVideoSink::Listener {
public:
PdrawBackendCodedVideoSinkListener(
struct pdraw_backend *pdraw,
const struct pdraw_backend_coded_video_sink_cbs *cbs,
void *userdata) :
mPdraw(pdraw),
mCbs(*cbs), mUserdata(userdata), mSink(nullptr)
{
}
~PdrawBackendCodedVideoSinkListener() {}
void onCodedVideoSinkFlush(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::ICodedVideoSink *sink)
{
if (mCbs.flush)
(*mCbs.flush)(
mPdraw,
reinterpret_cast<
struct pdraw_coded_video_sink *>(sink),
mUserdata);
}
Pdraw::IPdraw::ICodedVideoSink *getCodedVideoSink()
{
return mSink;
}
void setCodedVideoSink(Pdraw::IPdraw::ICodedVideoSink *sink)
{
mSink = sink;
}
private:
struct pdraw_backend *mPdraw;
struct pdraw_backend_coded_video_sink_cbs mCbs;
void *mUserdata;
Pdraw::IPdraw::ICodedVideoSink *mSink;
};
class PdrawBackendRawVideoSinkListener
: public Pdraw::IPdraw::IRawVideoSink::Listener {
public:
PdrawBackendRawVideoSinkListener(
struct pdraw_backend *pdraw,
const struct pdraw_backend_raw_video_sink_cbs *cbs,
void *userdata) :
mPdraw(pdraw),
mCbs(*cbs), mUserdata(userdata), mSink(nullptr)
{
}
~PdrawBackendRawVideoSinkListener() {}
void onRawVideoSinkFlush(Pdraw::IPdraw *pdraw,
Pdraw::IPdraw::IRawVideoSink *sink)
{
if (mCbs.flush)
(*mCbs.flush)(
mPdraw,
reinterpret_cast<struct pdraw_raw_video_sink *>(
sink),
mUserdata);
}
Pdraw::IPdraw::IRawVideoSink *getRawVideoSink()
{
return mSink;
}
void setRawVideoSink(Pdraw::IPdraw::IRawVideoSink *sink)
{
mSink = sink;
}
private:
struct pdraw_backend *mPdraw;
struct pdraw_backend_raw_video_sink_cbs mCbs;
void *mUserdata;
Pdraw::IPdraw::IRawVideoSink *mSink;
};
struct pdraw_backend {
PdrawBackend::IPdrawBackend *pdraw;
PdrawBackendListener *listener;
std::vector<PdrawBackendDemuxerListener *> *demuxerListeners;
std::vector<PdrawBackendVideoRendererListener *>
*videoRendererListeners;
std::vector<PdrawBackendCodedVideoSinkListener *>
*codedVideoSinkListeners;
std::vector<PdrawBackendRawVideoSinkListener *> *rawVideoSinkListeners;
};
int pdraw_be_new(const struct pdraw_backend_cbs *cbs,
void *userdata,
struct pdraw_backend **ret_obj)
{
int res = 0;
struct pdraw_backend *self;
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
self = (struct pdraw_backend *)calloc(1, sizeof(*self));
if (self == nullptr)
return -ENOMEM;
self->demuxerListeners =
new std::vector<PdrawBackendDemuxerListener *>();
if (self->demuxerListeners == nullptr) {
res = -ENOMEM;
goto error;
}
self->videoRendererListeners =
new std::vector<PdrawBackendVideoRendererListener *>();
if (self->videoRendererListeners == nullptr) {
res = -ENOMEM;
goto error;
}
self->codedVideoSinkListeners =
new std::vector<PdrawBackendCodedVideoSinkListener *>();
if (self->codedVideoSinkListeners == nullptr) {
res = -ENOMEM;
goto error;
}
self->rawVideoSinkListeners =
new std::vector<PdrawBackendRawVideoSinkListener *>();
if (self->rawVideoSinkListeners == nullptr) {
res = -ENOMEM;
goto error;
}
self->listener = new PdrawBackendListener(self, cbs, userdata);
if (self->listener == nullptr) {
res = -ENOMEM;
goto error;
}
res = createPdrawBackend(self->listener, &self->pdraw);
if (res < 0)
goto error;
res = self->pdraw->start();
if (res < 0)
goto error;
*ret_obj = self;
return 0;
error:
pdraw_be_destroy(self);
*ret_obj = nullptr;
return res;
}
int pdraw_be_destroy(struct pdraw_backend *self)
{
if (self == nullptr)
return 0;
if (self->pdraw != nullptr) {
self->pdraw->stop();
delete self->pdraw;
self->pdraw = nullptr;
}
if (self->listener != nullptr)
delete self->listener;
if (self->codedVideoSinkListeners != nullptr) {
std::vector<PdrawBackendCodedVideoSinkListener *>::iterator l =
self->codedVideoSinkListeners->begin();
while (l != self->codedVideoSinkListeners->end()) {
if (*l != nullptr)
delete (*l);
l++;
}
self->codedVideoSinkListeners->clear();
delete self->codedVideoSinkListeners;
}
if (self->rawVideoSinkListeners != nullptr) {
std::vector<PdrawBackendRawVideoSinkListener *>::iterator l =
self->rawVideoSinkListeners->begin();
while (l != self->rawVideoSinkListeners->end()) {
if (*l != nullptr)
delete (*l);
l++;
}
self->rawVideoSinkListeners->clear();
delete self->rawVideoSinkListeners;
}
if (self->videoRendererListeners != nullptr) {
std::vector<PdrawBackendVideoRendererListener *>::iterator r =
self->videoRendererListeners->begin();
while (r != self->videoRendererListeners->end()) {
if (*r != nullptr)
delete (*r);
r++;
}
self->videoRendererListeners->clear();
delete self->videoRendererListeners;
}
if (self->demuxerListeners != nullptr) {
std::vector<PdrawBackendDemuxerListener *>::iterator l =
self->demuxerListeners->begin();
while (l != self->demuxerListeners->end()) {
if (*l != nullptr)
delete (*l);
l++;
}
self->demuxerListeners->clear();
delete self->demuxerListeners;
}
free(self);
return 0;
}
int pdraw_be_stop(struct pdraw_backend *self)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
return self->pdraw->stop();
}
struct pomp_loop *pdraw_be_get_loop(struct pdraw_backend *self)
{
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, nullptr);
return self->pdraw->getLoop();
}
int pdraw_be_demuxer_new_from_url(struct pdraw_backend *self,
const char *url,
const struct pdraw_backend_demuxer_cbs *cbs,
void *userdata,
struct pdraw_demuxer **ret_obj)
{
int res;
Pdraw::IPdraw::IDemuxer *demuxer = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendDemuxerListener *l =
new PdrawBackendDemuxerListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create demuxer listener");
return -ENOMEM;
}
std::string u(url ? url : "");
res = self->pdraw->createDemuxer(u, l, &demuxer);
if (res < 0) {
delete l;
return res;
}
l->setDemuxer(demuxer);
self->demuxerListeners->push_back(l);
*ret_obj = reinterpret_cast<struct pdraw_demuxer *>(demuxer);
return 0;
}
int pdraw_be_demuxer_new_single_stream(
struct pdraw_backend *self,
const char *local_addr,
uint16_t local_stream_port,
uint16_t local_control_port,
const char *remote_addr,
uint16_t remote_stream_port,
uint16_t remote_control_port,
const struct pdraw_backend_demuxer_cbs *cbs,
void *userdata,
struct pdraw_demuxer **ret_obj)
{
int res;
Pdraw::IPdraw::IDemuxer *demuxer = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendDemuxerListener *l =
new PdrawBackendDemuxerListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create demuxer listener");
return -ENOMEM;
}
std::string local(local_addr ? local_addr : "");
std::string remote(remote_addr ? remote_addr : "");
res = self->pdraw->createDemuxer(local,
local_stream_port,
local_control_port,
remote,
remote_stream_port,
remote_control_port,
l,
&demuxer);
if (res < 0) {
delete l;
return res;
}
l->setDemuxer(demuxer);
self->demuxerListeners->push_back(l);
*ret_obj = reinterpret_cast<struct pdraw_demuxer *>(demuxer);
return 0;
}
int pdraw_be_demuxer_new_from_url_on_mux(
struct pdraw_backend *self,
const char *url,
struct mux_ctx *mux,
const struct pdraw_backend_demuxer_cbs *cbs,
void *userdata,
struct pdraw_demuxer **ret_obj)
{
int res;
Pdraw::IPdraw::IDemuxer *demuxer = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendDemuxerListener *l =
new PdrawBackendDemuxerListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create demuxer listener");
return -ENOMEM;
}
std::string u(url ? url : "");
res = self->pdraw->createDemuxer(u, mux, l, &demuxer);
if (res < 0) {
delete l;
return res;
}
l->setDemuxer(demuxer);
self->demuxerListeners->push_back(l);
*ret_obj = reinterpret_cast<struct pdraw_demuxer *>(demuxer);
return 0;
}
int pdraw_be_demuxer_destroy(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
std::vector<PdrawBackendDemuxerListener *>::iterator l;
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
l = self->demuxerListeners->begin();
while (l != self->demuxerListeners->end()) {
if ((*l)->getDemuxer() != d) {
l++;
continue;
}
delete *l;
self->demuxerListeners->erase(l);
break;
}
delete d;
return 0;
}
int pdraw_be_demuxer_close(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->close();
}
uint16_t pdraw_be_demuxer_get_single_stream_local_stream_port(
struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, 0);
ULOG_ERRNO_RETURN_VAL_IF(demuxer == nullptr, EINVAL, 0);
return d->getSingleStreamLocalStreamPort();
}
uint16_t pdraw_be_demuxer_get_single_stream_local_control_port(
struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, 0);
ULOG_ERRNO_RETURN_VAL_IF(demuxer == nullptr, EINVAL, 0);
return d->getSingleStreamLocalControlPort();
}
int pdraw_be_demuxer_play(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->play();
}
int pdraw_be_demuxer_play_with_speed(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer,
float speed)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->play(speed);
}
int pdraw_be_demuxer_is_ready_to_play(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return (d->isReadyToPlay()) ? 1 : 0;
}
int pdraw_be_demuxer_pause(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->pause();
}
int pdraw_be_demuxer_is_paused(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return (d->isPaused()) ? 1 : 0;
}
int pdraw_be_demuxer_previous_frame(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->previousFrame();
}
int pdraw_be_demuxer_next_frame(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->nextFrame();
}
int pdraw_be_demuxer_seek(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer,
int64_t delta,
int exact)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->seek(delta, exact ? true : false);
}
int pdraw_be_demuxer_seek_forward(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer,
uint64_t delta,
int exact)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->seekForward(delta, exact ? true : false);
}
int pdraw_be_demuxer_seek_back(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer,
uint64_t delta,
int exact)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->seekBack(delta, exact ? true : false);
}
int pdraw_be_demuxer_seek_to(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer,
uint64_t timestamp,
int exact)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(demuxer == nullptr, EINVAL);
return d->seekTo(timestamp, exact ? true : false);
}
uint64_t pdraw_be_demuxer_get_duration(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, 0);
ULOG_ERRNO_RETURN_VAL_IF(demuxer == nullptr, EINVAL, 0);
return d->getDuration();
}
uint64_t pdraw_be_demuxer_get_current_time(struct pdraw_backend *self,
struct pdraw_demuxer *demuxer)
{
Pdraw::IPdraw::IDemuxer *d =
reinterpret_cast<Pdraw::IPdraw::IDemuxer *>(demuxer);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, 0);
ULOG_ERRNO_RETURN_VAL_IF(demuxer == nullptr, EINVAL, 0);
return d->getCurrentTime();
}
int pdraw_be_muxer_new(struct pdraw_backend *self,
const char *url,
struct pdraw_muxer **ret_obj)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
#if MUXER_TEST
int res;
Pdraw::IPdraw::IMuxer *muxer = nullptr;
std::string u(url ? url : "");
res = self->pdraw->createMuxer(u, &muxer);
if (res < 0)
return res;
*ret_obj = reinterpret_cast<struct pdraw_muxer *>(muxer);
return 0;
#else
/* Not supported yet */
return -ENOSYS;
#endif
}
int pdraw_be_muxer_destroy(struct pdraw_backend *self,
struct pdraw_muxer *muxer)
{
Pdraw::IPdraw::IMuxer *m =
reinterpret_cast<Pdraw::IPdraw::IMuxer *>(muxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(muxer == nullptr, EINVAL);
delete m;
return 0;
}
int pdraw_be_muxer_add_media(
struct pdraw_backend *self,
struct pdraw_muxer *muxer,
unsigned int media_id,
const struct pdraw_muxer_video_media_params *params)
{
Pdraw::IPdraw::IMuxer *m =
reinterpret_cast<Pdraw::IPdraw::IMuxer *>(muxer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(muxer == nullptr, EINVAL);
return m->addMedia(media_id, params);
}
int pdraw_be_video_renderer_new(
struct pdraw_backend *self,
unsigned int media_id,
const struct pdraw_rect *render_pos,
const struct pdraw_video_renderer_params *params,
const struct pdraw_backend_video_renderer_cbs *cbs,
void *userdata,
struct pdraw_video_renderer **ret_obj)
{
return pdraw_be_video_renderer_new_egl(self,
media_id,
render_pos,
params,
cbs,
userdata,
nullptr,
ret_obj);
}
int pdraw_be_video_renderer_new_egl(
struct pdraw_backend *self,
unsigned int media_id,
const struct pdraw_rect *render_pos,
const struct pdraw_video_renderer_params *params,
const struct pdraw_backend_video_renderer_cbs *cbs,
void *userdata,
struct egl_display *egl_display,
struct pdraw_video_renderer **ret_obj)
{
int res;
Pdraw::IPdraw::IVideoRenderer *renderer = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendVideoRendererListener *l =
new PdrawBackendVideoRendererListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create video renderer listener");
return -ENOMEM;
}
res = self->pdraw->createVideoRenderer(
media_id, render_pos, params, l, &renderer, egl_display);
if (res < 0) {
delete l;
return res;
}
self->videoRendererListeners->push_back(l);
l->setVideoRenderer(renderer);
*ret_obj = reinterpret_cast<struct pdraw_video_renderer *>(renderer);
return 0;
}
int pdraw_be_video_renderer_destroy(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
std::vector<PdrawBackendVideoRendererListener *>::iterator l =
self->videoRendererListeners->begin();
while (l != self->videoRendererListeners->end()) {
if ((*l)->getVideoRenderer() != rnd) {
l++;
continue;
}
delete *l;
self->videoRendererListeners->erase(l);
break;
}
delete rnd;
return 0;
}
int pdraw_be_video_renderer_resize(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
const struct pdraw_rect *render_pos)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->resize(render_pos);
}
int pdraw_be_video_renderer_set_media_id(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
unsigned int media_id)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->setMediaId(media_id);
}
unsigned int
pdraw_be_video_renderer_get_media_id(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, 0);
ULOG_ERRNO_RETURN_VAL_IF(renderer == nullptr, EINVAL, 0);
return rnd->getMediaId();
}
int pdraw_be_video_renderer_set_params(
struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
const struct pdraw_video_renderer_params *params)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->setParams(params);
}
int pdraw_be_video_renderer_get_params(
struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
struct pdraw_video_renderer_params *params)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->getParams(params);
}
int pdraw_be_video_renderer_render(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
struct pdraw_rect *content_pos)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->render(content_pos, nullptr, nullptr);
}
int pdraw_be_video_renderer_render_mat(struct pdraw_backend *self,
struct pdraw_video_renderer *renderer,
struct pdraw_rect *content_pos,
const float *view_mat,
const float *proj_mat)
{
Pdraw::IPdraw::IVideoRenderer *rnd =
reinterpret_cast<Pdraw::IPdraw::IVideoRenderer *>(renderer);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(renderer == nullptr, EINVAL);
return rnd->render(content_pos, view_mat, proj_mat);
}
int pdraw_be_coded_video_sink_new(
struct pdraw_backend *self,
unsigned int media_id,
const struct pdraw_video_sink_params *params,
const struct pdraw_backend_coded_video_sink_cbs *cbs,
void *userdata,
struct pdraw_coded_video_sink **ret_obj)
{
int res;
Pdraw::IPdraw::ICodedVideoSink *sink = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(params == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs->flush == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendCodedVideoSinkListener *l =
new PdrawBackendCodedVideoSinkListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create video sink listener");
return -ENOMEM;
}
res = self->pdraw->createCodedVideoSink(media_id, params, l, &sink);
if (res < 0) {
delete l;
return res;
}
l->setCodedVideoSink(sink);
self->codedVideoSinkListeners->push_back(l);
*ret_obj = reinterpret_cast<struct pdraw_coded_video_sink *>(sink);
return 0;
}
int pdraw_be_coded_video_sink_destroy(struct pdraw_backend *self,
struct pdraw_coded_video_sink *sink)
{
std::vector<PdrawBackendCodedVideoSinkListener *>::iterator l;
Pdraw::IPdraw::ICodedVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::ICodedVideoSink *>(sink);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(sink == nullptr, EINVAL);
l = self->codedVideoSinkListeners->begin();
while (l != self->codedVideoSinkListeners->end()) {
if ((*l)->getCodedVideoSink() != s) {
l++;
continue;
}
delete *l;
self->codedVideoSinkListeners->erase(l);
break;
}
delete s;
return 0;
}
int pdraw_be_coded_video_sink_resync(struct pdraw_backend *self,
struct pdraw_coded_video_sink *sink)
{
Pdraw::IPdraw::ICodedVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::ICodedVideoSink *>(sink);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(sink == nullptr, EINVAL);
return s->resync();
}
struct mbuf_coded_video_frame_queue *
pdraw_be_coded_video_sink_get_queue(struct pdraw_backend *self,
struct pdraw_coded_video_sink *sink)
{
Pdraw::IPdraw::ICodedVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::ICodedVideoSink *>(sink);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, nullptr);
ULOG_ERRNO_RETURN_VAL_IF(sink == nullptr, EINVAL, nullptr);
return s->getQueue();
}
int pdraw_be_coded_video_sink_queue_flushed(struct pdraw_backend *self,
struct pdraw_coded_video_sink *sink)
{
Pdraw::IPdraw::ICodedVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::ICodedVideoSink *>(sink);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(sink == nullptr, EINVAL);
return s->queueFlushed();
}
int pdraw_be_raw_video_sink_new(
struct pdraw_backend *self,
unsigned int media_id,
const struct pdraw_video_sink_params *params,
const struct pdraw_backend_raw_video_sink_cbs *cbs,
void *userdata,
struct pdraw_raw_video_sink **ret_obj)
{
int res;
Pdraw::IPdraw::IRawVideoSink *sink = nullptr;
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(params == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(cbs->flush == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(ret_obj == nullptr, EINVAL);
PdrawBackendRawVideoSinkListener *l =
new PdrawBackendRawVideoSinkListener(self, cbs, userdata);
if (l == nullptr) {
ULOGE("failed to create video sink listener");
return -ENOMEM;
}
res = self->pdraw->createRawVideoSink(media_id, params, l, &sink);
if (res < 0) {
delete l;
return res;
}
l->setRawVideoSink(sink);
self->rawVideoSinkListeners->push_back(l);
*ret_obj = reinterpret_cast<struct pdraw_raw_video_sink *>(sink);
return 0;
}
int pdraw_be_raw_video_sink_destroy(struct pdraw_backend *self,
struct pdraw_raw_video_sink *sink)
{
std::vector<PdrawBackendRawVideoSinkListener *>::iterator l;
Pdraw::IPdraw::IRawVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::IRawVideoSink *>(sink);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(sink == nullptr, EINVAL);
l = self->rawVideoSinkListeners->begin();
while (l != self->rawVideoSinkListeners->end()) {
if ((*l)->getRawVideoSink() != s) {
l++;
continue;
}
delete *l;
self->rawVideoSinkListeners->erase(l);
break;
}
delete s;
return 0;
}
struct mbuf_raw_video_frame_queue *
pdraw_be_raw_video_sink_get_queue(struct pdraw_backend *self,
struct pdraw_raw_video_sink *sink)
{
Pdraw::IPdraw::IRawVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::IRawVideoSink *>(sink);
ULOG_ERRNO_RETURN_VAL_IF(self == nullptr, EINVAL, nullptr);
ULOG_ERRNO_RETURN_VAL_IF(sink == nullptr, EINVAL, nullptr);
return s->getQueue();
}
int pdraw_be_raw_video_sink_queue_flushed(struct pdraw_backend *self,
struct pdraw_raw_video_sink *sink)
{
Pdraw::IPdraw::IRawVideoSink *s =
reinterpret_cast<Pdraw::IPdraw::IRawVideoSink *>(sink);
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(sink == nullptr, EINVAL);
return s->queueFlushed();
}
int pdraw_be_get_friendly_name_setting(struct pdraw_backend *self,
char *str,
size_t len)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
std::string fn;
self->pdraw->getFriendlyNameSetting(&fn);
if ((str) && (fn.length() >= len))
return -ENOBUFS;
if (str)
strcpy(str, fn.c_str());
return 0;
}
int pdraw_be_set_friendly_name_setting(struct pdraw_backend *self,
const char *friendly_name)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(friendly_name == nullptr, EINVAL);
std::string fn(friendly_name);
self->pdraw->setFriendlyNameSetting(fn);
return 0;
}
int pdraw_be_get_serial_number_setting(struct pdraw_backend *self,
char *str,
size_t len)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
std::string sn;
self->pdraw->getSerialNumberSetting(&sn);
if ((str) && (sn.length() >= len))
return -ENOBUFS;
if (str)
strcpy(str, sn.c_str());
return 0;
}
int pdraw_be_set_serial_number_setting(struct pdraw_backend *self,
const char *serial_number)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(serial_number == nullptr, EINVAL);
std::string sn(serial_number);
self->pdraw->setSerialNumberSetting(sn);
return 0;
}
int pdraw_be_get_software_version_setting(struct pdraw_backend *self,
char *str,
size_t len)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
std::string sv;
self->pdraw->getSoftwareVersionSetting(&sv);
if ((str) && (sv.length() >= len))
return -ENOBUFS;
if (str)
strcpy(str, sv.c_str());
return 0;
}
int pdraw_be_set_software_version_setting(struct pdraw_backend *self,
const char *software_version)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
ULOG_ERRNO_RETURN_ERR_IF(software_version == nullptr, EINVAL);
std::string sv(software_version);
self->pdraw->setSoftwareVersionSetting(sv);
return 0;
}
enum pdraw_pipeline_mode
pdraw_be_get_pipeline_mode_setting(struct pdraw_backend *self)
{
ULOG_ERRNO_RETURN_VAL_IF(
self == nullptr, EINVAL, PDRAW_PIPELINE_MODE_DECODE_ALL);
return self->pdraw->getPipelineModeSetting();
}
int pdraw_be_set_pipeline_mode_setting(struct pdraw_backend *self,
enum pdraw_pipeline_mode mode)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
self->pdraw->setPipelineModeSetting(mode);
return 0;
}
int pdraw_be_get_display_screen_settings(struct pdraw_backend *self,
float *xdpi,
float *ydpi,
float *device_margin_top,
float *device_margin_bottom,
float *device_margin_left,
float *device_margin_right)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
self->pdraw->getDisplayScreenSettings(xdpi,
ydpi,
device_margin_top,
device_margin_bottom,
device_margin_left,
device_margin_right);
return 0;
}
int pdraw_be_set_display_screen_settings(struct pdraw_backend *self,
float xdpi,
float ydpi,
float device_margin_top,
float device_margin_bottom,
float device_margin_left,
float device_margin_right)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
self->pdraw->setDisplayScreenSettings(xdpi,
ydpi,
device_margin_top,
device_margin_bottom,
device_margin_left,
device_margin_right);
return 0;
}
enum pdraw_hmd_model pdraw_be_get_hmd_model_setting(struct pdraw_backend *self)
{
ULOG_ERRNO_RETURN_VAL_IF(
self == nullptr, EINVAL, PDRAW_HMD_MODEL_UNKNOWN);
return self->pdraw->getHmdModelSetting();
}
int pdraw_be_set_hmd_model_setting(struct pdraw_backend *self,
enum pdraw_hmd_model hmd_model)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
self->pdraw->setHmdModelSetting(hmd_model);
return 0;
}
int pdraw_be_set_android_jvm(struct pdraw_backend *self, void *jvm)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
self->pdraw->setAndroidJvm(jvm);
return 0;
}
int pdraw_be_dump_pipeline(struct pdraw_backend *self, const char *file_name)
{
ULOG_ERRNO_RETURN_ERR_IF(self == nullptr, EINVAL);
std::string f(file_name ? file_name : "");
return self->pdraw->dumpPipeline(f);
}
| 24.36459 | 80 | 0.72356 | [
"render",
"vector"
] |
f2c883ae3f78188a2ba8ec400e407a98a596765f | 7,450 | cpp | C++ | src/main/CodestreamSequence.cpp | sandflow/jid | ba6e866164ab29ad26b94f2a3894d76b50f7baf4 | [
"BSD-2-Clause"
] | 8 | 2020-03-10T15:34:14.000Z | 2022-01-14T17:04:51.000Z | src/main/CodestreamSequence.cpp | sandflow/jid | ba6e866164ab29ad26b94f2a3894d76b50f7baf4 | [
"BSD-2-Clause"
] | 23 | 2020-03-28T00:53:50.000Z | 2022-02-02T05:27:24.000Z | src/main/CodestreamSequence.cpp | sandflow/jid | ba6e866164ab29ad26b94f2a3894d76b50f7baf4 | [
"BSD-2-Clause"
] | null | null | null | /*
* Copyright (c), Pierre-Anthony Lemieux (pal@palemieux.com)
* 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.
*
* 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 "CodestreamSequence.h"
#include <stdexcept>
/* J2CFile */
J2CFile::J2CFile(FILE *fp,
std::vector<uint8_t>::size_type initial_buf_sz,
std::vector<uint8_t>::size_type read_buf_sz) :
good_(true),
codestream_(),
file_paths_stack_(),
initial_buf_sz_(initial_buf_sz),
read_buf_sz_(read_buf_sz)
{
this->_fill_from_fp(fp);
};
J2CFile::J2CFile(const std::vector<std::string>& file_paths,
std::vector<uint8_t>::size_type initial_buf_sz,
std::vector<uint8_t>::size_type read_buf_sz) :
good_(true),
codestream_(),
file_paths_stack_(file_paths.rbegin(), file_paths.rend()),
initial_buf_sz_(initial_buf_sz),
read_buf_sz_(read_buf_sz)
{
this->next();
};
void J2CFile::_fill_from_fp(FILE* fp) {
this->codestream_.reserve(this->initial_buf_sz_);
this->codestream_.resize(0);
while (true) {
std::vector<uint8_t>::size_type old_sz = this->codestream_.size();
this->codestream_.resize(old_sz + this->read_buf_sz_);
size_t sz = fread(this->codestream_.data() + old_sz, 1, this->read_buf_sz_, fp);
if (sz != this->read_buf_sz_) {
this->codestream_.resize(old_sz + sz);
break;
}
}
}
void J2CFile::next() {
if (this->file_paths_stack_.size() == 0) {
this->good_ = false;
return;
}
FILE* fp = fopen(file_paths_stack_.back().c_str(), "rb");
if (!fp) {
throw std::runtime_error("Cannot open file: " + file_paths_stack_.back());
}
this->_fill_from_fp(fp);
fclose(fp);
file_paths_stack_.pop_back();
};
bool J2CFile::good() const { return this->good_; };
void J2CFile::fill(ASDCP::JP2K::FrameBuffer &fb)
{
ASDCP::Result_t result = ASDCP::RESULT_OK;
result = fb.SetData(this->codestream_.data(), (uint32_t)this->codestream_.size());
if (ASDCP_FAILURE(result)) {
throw std::runtime_error("Frame buffer allocation failed");
}
assert(ASDCP_SUCCESS(result));
uint32_t sz = fb.Size((uint32_t)this->codestream_.size());
if (sz != this->codestream_.size()) {
throw std::runtime_error("Frame buffer resizing failed");
}
};
/* MJCFile */
MJCFile::MJCFile(FILE *fp) : good_(true), codestream_(), fp_(fp)
{
uint8_t header[16];
size_t sz = fread(header, 1, sizeof header, this->fp_);
if (sz != sizeof header || header[0] != 'M' || header[1] != 'J' || header[2] != 'C' || header[3] != '2')
{
throw std::runtime_error("Bad MJC file");
}
this->next();
}
void MJCFile::next()
{
/* read length */
uint8_t be_len[4];
size_t rd_sz = fread(be_len, 1, sizeof be_len, this->fp_);
if (rd_sz != sizeof be_len)
{
this->good_ = false;
return;
}
uint32_t len = (be_len[0] << 24) + (be_len[1] << 16) + (be_len[2] << 8) + be_len[3];
/* read codestream */
this->codestream_.resize(len);
rd_sz = fread(this->codestream_.data(), 1, len, this->fp_);
if (rd_sz != len)
{
this->good_ = false;
return;
}
};
bool MJCFile::good() const { return this->good_; };
void MJCFile::fill(ASDCP::JP2K::FrameBuffer &fb)
{
ASDCP::Result_t result = ASDCP::RESULT_OK;
result = fb.SetData(this->codestream_.data(), (uint32_t)this->codestream_.size());
if (ASDCP_FAILURE(result)) {
throw std::runtime_error("Frame buffer allocation failed");
}
uint32_t sz = fb.Size((uint32_t)this->codestream_.size());
if (sz != this->codestream_.size()) {
throw std::runtime_error("Frame buffer resizing failed");
}
};
/* FakeSequence */
FakeSequence::FakeSequence(uint32_t frame_count, uint32_t frame_size) :
frame_count_(frame_count), cur_frame_(0), codestream_(frame_size)
{
std::copy(CODESTREAM_HEADER_, CODESTREAM_HEADER_ + sizeof CODESTREAM_HEADER_, codestream_.begin());
std::fill(codestream_.begin() + sizeof CODESTREAM_HEADER_, codestream_.end(), (uint8_t)0x00);
};
void FakeSequence::next()
{
this->cur_frame_++;
};
bool FakeSequence::good() const { return this->cur_frame_ < this->frame_count_; };
void FakeSequence::fill(ASDCP::JP2K::FrameBuffer &fb)
{
ASDCP::Result_t result = ASDCP::RESULT_OK;
result = fb.SetData(this->codestream_.data(), (uint32_t)this->codestream_.size());
assert(ASDCP_SUCCESS(result));
uint32_t sz = fb.Size((uint32_t)this->codestream_.size());
if (sz != this->codestream_.size()) {
throw std::runtime_error("Frame buffer resizing failed");
}
};
const uint8_t FakeSequence::CODESTREAM_HEADER_[236] = {
0xFF, 0x4F, 0xFF, 0x51, 0x00, 0x2F, 0x40, 0x00, 0x00, 0x00, 0x0F, 0x00,
0x00, 0x00, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x01, 0x01, 0x0F, 0x01, 0x01,
0x0F, 0x01, 0x01, 0xFF, 0x50, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00,
0x0C, 0xFF, 0x52, 0x00, 0x12, 0x01, 0x02, 0x00, 0x01, 0x01, 0x05, 0x03,
0x03, 0x40, 0x01, 0x77, 0x88, 0x88, 0x88, 0x88, 0x88, 0xFF, 0x5C, 0x00,
0x13, 0x20, 0x90, 0x98, 0x98, 0xA0, 0x98, 0x98, 0xA0, 0x98, 0x98, 0xA0,
0x98, 0x98, 0x98, 0x90, 0x90, 0x98, 0xFF, 0x64, 0x00, 0x18, 0x00, 0x01,
0x4B, 0x61, 0x6B, 0x61, 0x64, 0x75, 0x2D, 0x76, 0x78, 0x74, 0x37, 0x2E,
0x31, 0x31, 0x2D, 0x42, 0x65, 0x74, 0x61, 0x34, 0xFF, 0x64, 0x00, 0x5C,
0x00, 0x01, 0x4B, 0x64, 0x75, 0x2D, 0x4C, 0x61, 0x79, 0x65, 0x72, 0x2D,
0x49, 0x6E, 0x66, 0x6F, 0x3A, 0x20, 0x6C, 0x6F, 0x67, 0x5F, 0x32, 0x7B,
0x44, 0x65, 0x6C, 0x74, 0x61, 0x2D, 0x44, 0x28, 0x73, 0x71, 0x75, 0x61,
0x72, 0x65, 0x64, 0x2D, 0x65, 0x72, 0x72, 0x6F, 0x72, 0x29, 0x2F, 0x44,
0x65, 0x6C, 0x74, 0x61, 0x2D, 0x4C, 0x28, 0x62, 0x79, 0x74, 0x65, 0x73,
0x29, 0x7D, 0x2C, 0x20, 0x4C, 0x28, 0x62, 0x79, 0x74, 0x65, 0x73, 0x29,
0x0A, 0x2D, 0x31, 0x39, 0x32, 0x2E, 0x30, 0x2C, 0x20, 0x20, 0x33, 0x2E,
0x37, 0x65, 0x2B, 0x30, 0x37, 0x0A, 0xFF, 0x90, 0x00, 0x0A, 0x00, 0x00,
0x02, 0x2D, 0x2F, 0xD0, 0x00, 0x01, 0xFF, 0x93
}; | 30.284553 | 106 | 0.66 | [
"vector"
] |
f2d43d4c0273eff4f184b680d61dd487e672963d | 24,202 | cpp | C++ | zerobuf/examples/schema2.cpp | adrians/rumprun-packages | 643187aad4c10bb4d1466cabd1ec26611395fd5d | [
"CC0-1.0"
] | 217 | 2015-07-04T22:11:11.000Z | 2022-03-08T07:52:41.000Z | zerobuf/examples/schema2.cpp | adrians/rumprun-packages | 643187aad4c10bb4d1466cabd1ec26611395fd5d | [
"CC0-1.0"
] | 122 | 2015-07-07T09:39:46.000Z | 2019-12-20T02:52:45.000Z | zerobuf/examples/schema2.cpp | adrians/rumprun-packages | 643187aad4c10bb4d1466cabd1ec26611395fd5d | [
"CC0-1.0"
] | 90 | 2015-07-03T05:21:45.000Z | 2021-08-24T02:59:45.000Z | // Generated by zerobufCxx.py
#include "schema2.h"
#include <zerobuf/NonMovingAllocator.h>
#include <zerobuf/NonMovingSubAllocator.h>
#include <zerobuf/StaticSubAllocator.h>
#include <zerobuf/json.h>
double* DoubleTable::getDoublearray()
{
return getAllocator().template getItemPtr< double >( 4 );
}
const double* DoubleTable::getDoublearray() const
{
return getAllocator().template getItemPtr< double >( 4 );
}
std::vector< double > DoubleTable::getDoublearrayVector() const
{
const double* ptr = getAllocator().template getItemPtr< double >( 4 );
return std::vector< double >( ptr, ptr + 125 );
}
void DoubleTable::setDoublearray( double value[ 125 ] )
{
::memcpy( getAllocator().template getItemPtr< double >( 4 ), value, 125 * sizeof( double ));
notifyChanged();
}
void DoubleTable::setDoublearray( const std::vector< double >& value )
{
if( 125 < value.size( ))
return;
::memcpy( getAllocator().template getItemPtr< double >( 4 ), value.data(), value.size() * sizeof( double ));
notifyChanged();
}
size_t DoubleTable::getDoublearraySize() const
{
return 125;
}
DoubleTable::DoubleTable()
: DoubleTable( ::zerobuf::AllocatorPtr( new ::zerobuf::NonMovingAllocator( 1004, 0 )))
{}
DoubleTable::DoubleTable( const std::vector< double >& doublearrayValue )
: DoubleTable( ::zerobuf::AllocatorPtr( new ::zerobuf::NonMovingAllocator( 1004, 0 )))
{
setDoublearray( doublearrayValue );
}
DoubleTable::DoubleTable( const DoubleTable& rhs )
: DoubleTable( ::zerobuf::AllocatorPtr( new ::zerobuf::NonMovingAllocator( 1004, 0 )))
{
*this = rhs;
}
DoubleTable::DoubleTable( DoubleTable&& rhs ) noexcept
: ::zerobuf::Zerobuf( std::move( rhs ))
{
}
DoubleTable::DoubleTable( const ::zerobuf::Zerobuf& rhs )
: DoubleTable( ::zerobuf::AllocatorPtr( new ::zerobuf::NonMovingAllocator( 1004, 0 )))
{
::zerobuf::Zerobuf::operator = ( rhs );
}
DoubleTable::DoubleTable( ::zerobuf::AllocatorPtr allocator )
: ::zerobuf::Zerobuf( std::move( allocator ))
{
}
DoubleTable::~DoubleTable()
{}
DoubleTable& DoubleTable::operator = ( DoubleTable&& rhs )
{
::zerobuf::Zerobuf::operator = ( std::move( rhs ));
return *this;
}
std::string DoubleTable::getSchema() const
{
return ZEROBUF_SCHEMA();
}
std::string DoubleTable::ZEROBUF_SCHEMA()
{
return R"({
"$schema": "http://json-schema.org/schema#",
"title": "DoubleTable",
"description": "Class DoubleTable of namespace []",
"type": "object",
"additionalProperties": false,
"properties": {
"doublearray": {
"type": "array",
"minItems": 125,
"maxItems": 125,
"items": {
"type": "number"
}
}
}
})";
}
void DoubleTable::_parseJSON( const Json::Value& json )
{
if( ::zerobuf::hasJSONField( json, "doublearray" ))
{
const Json::Value& field = ::zerobuf::getJSONField( json, "doublearray" );
double* array = (double*)getDoublearray();
array[0] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 0 ));
array[1] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 1 ));
array[2] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 2 ));
array[3] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 3 ));
array[4] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 4 ));
array[5] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 5 ));
array[6] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 6 ));
array[7] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 7 ));
array[8] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 8 ));
array[9] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 9 ));
array[10] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 10 ));
array[11] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 11 ));
array[12] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 12 ));
array[13] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 13 ));
array[14] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 14 ));
array[15] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 15 ));
array[16] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 16 ));
array[17] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 17 ));
array[18] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 18 ));
array[19] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 19 ));
array[20] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 20 ));
array[21] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 21 ));
array[22] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 22 ));
array[23] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 23 ));
array[24] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 24 ));
array[25] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 25 ));
array[26] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 26 ));
array[27] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 27 ));
array[28] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 28 ));
array[29] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 29 ));
array[30] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 30 ));
array[31] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 31 ));
array[32] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 32 ));
array[33] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 33 ));
array[34] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 34 ));
array[35] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 35 ));
array[36] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 36 ));
array[37] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 37 ));
array[38] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 38 ));
array[39] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 39 ));
array[40] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 40 ));
array[41] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 41 ));
array[42] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 42 ));
array[43] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 43 ));
array[44] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 44 ));
array[45] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 45 ));
array[46] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 46 ));
array[47] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 47 ));
array[48] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 48 ));
array[49] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 49 ));
array[50] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 50 ));
array[51] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 51 ));
array[52] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 52 ));
array[53] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 53 ));
array[54] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 54 ));
array[55] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 55 ));
array[56] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 56 ));
array[57] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 57 ));
array[58] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 58 ));
array[59] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 59 ));
array[60] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 60 ));
array[61] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 61 ));
array[62] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 62 ));
array[63] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 63 ));
array[64] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 64 ));
array[65] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 65 ));
array[66] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 66 ));
array[67] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 67 ));
array[68] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 68 ));
array[69] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 69 ));
array[70] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 70 ));
array[71] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 71 ));
array[72] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 72 ));
array[73] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 73 ));
array[74] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 74 ));
array[75] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 75 ));
array[76] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 76 ));
array[77] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 77 ));
array[78] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 78 ));
array[79] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 79 ));
array[80] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 80 ));
array[81] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 81 ));
array[82] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 82 ));
array[83] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 83 ));
array[84] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 84 ));
array[85] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 85 ));
array[86] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 86 ));
array[87] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 87 ));
array[88] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 88 ));
array[89] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 89 ));
array[90] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 90 ));
array[91] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 91 ));
array[92] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 92 ));
array[93] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 93 ));
array[94] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 94 ));
array[95] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 95 ));
array[96] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 96 ));
array[97] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 97 ));
array[98] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 98 ));
array[99] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 99 ));
array[100] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 100 ));
array[101] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 101 ));
array[102] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 102 ));
array[103] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 103 ));
array[104] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 104 ));
array[105] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 105 ));
array[106] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 106 ));
array[107] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 107 ));
array[108] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 108 ));
array[109] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 109 ));
array[110] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 110 ));
array[111] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 111 ));
array[112] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 112 ));
array[113] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 113 ));
array[114] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 114 ));
array[115] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 115 ));
array[116] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 116 ));
array[117] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 117 ));
array[118] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 118 ));
array[119] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 119 ));
array[120] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 120 ));
array[121] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 121 ));
array[122] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 122 ));
array[123] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 123 ));
array[124] = ::zerobuf::fromJSON< double >( ::zerobuf::getJSONField( field, 124 ));
}
}
void DoubleTable::_createJSON( Json::Value& json ) const
{
{
Json::Value& field = ::zerobuf::getJSONField( json, "doublearray" );
const double* array = (const double*)getDoublearray();
::zerobuf::toJSON( array[0], ::zerobuf::getJSONField( field, 0 ));
::zerobuf::toJSON( array[1], ::zerobuf::getJSONField( field, 1 ));
::zerobuf::toJSON( array[2], ::zerobuf::getJSONField( field, 2 ));
::zerobuf::toJSON( array[3], ::zerobuf::getJSONField( field, 3 ));
::zerobuf::toJSON( array[4], ::zerobuf::getJSONField( field, 4 ));
::zerobuf::toJSON( array[5], ::zerobuf::getJSONField( field, 5 ));
::zerobuf::toJSON( array[6], ::zerobuf::getJSONField( field, 6 ));
::zerobuf::toJSON( array[7], ::zerobuf::getJSONField( field, 7 ));
::zerobuf::toJSON( array[8], ::zerobuf::getJSONField( field, 8 ));
::zerobuf::toJSON( array[9], ::zerobuf::getJSONField( field, 9 ));
::zerobuf::toJSON( array[10], ::zerobuf::getJSONField( field, 10 ));
::zerobuf::toJSON( array[11], ::zerobuf::getJSONField( field, 11 ));
::zerobuf::toJSON( array[12], ::zerobuf::getJSONField( field, 12 ));
::zerobuf::toJSON( array[13], ::zerobuf::getJSONField( field, 13 ));
::zerobuf::toJSON( array[14], ::zerobuf::getJSONField( field, 14 ));
::zerobuf::toJSON( array[15], ::zerobuf::getJSONField( field, 15 ));
::zerobuf::toJSON( array[16], ::zerobuf::getJSONField( field, 16 ));
::zerobuf::toJSON( array[17], ::zerobuf::getJSONField( field, 17 ));
::zerobuf::toJSON( array[18], ::zerobuf::getJSONField( field, 18 ));
::zerobuf::toJSON( array[19], ::zerobuf::getJSONField( field, 19 ));
::zerobuf::toJSON( array[20], ::zerobuf::getJSONField( field, 20 ));
::zerobuf::toJSON( array[21], ::zerobuf::getJSONField( field, 21 ));
::zerobuf::toJSON( array[22], ::zerobuf::getJSONField( field, 22 ));
::zerobuf::toJSON( array[23], ::zerobuf::getJSONField( field, 23 ));
::zerobuf::toJSON( array[24], ::zerobuf::getJSONField( field, 24 ));
::zerobuf::toJSON( array[25], ::zerobuf::getJSONField( field, 25 ));
::zerobuf::toJSON( array[26], ::zerobuf::getJSONField( field, 26 ));
::zerobuf::toJSON( array[27], ::zerobuf::getJSONField( field, 27 ));
::zerobuf::toJSON( array[28], ::zerobuf::getJSONField( field, 28 ));
::zerobuf::toJSON( array[29], ::zerobuf::getJSONField( field, 29 ));
::zerobuf::toJSON( array[30], ::zerobuf::getJSONField( field, 30 ));
::zerobuf::toJSON( array[31], ::zerobuf::getJSONField( field, 31 ));
::zerobuf::toJSON( array[32], ::zerobuf::getJSONField( field, 32 ));
::zerobuf::toJSON( array[33], ::zerobuf::getJSONField( field, 33 ));
::zerobuf::toJSON( array[34], ::zerobuf::getJSONField( field, 34 ));
::zerobuf::toJSON( array[35], ::zerobuf::getJSONField( field, 35 ));
::zerobuf::toJSON( array[36], ::zerobuf::getJSONField( field, 36 ));
::zerobuf::toJSON( array[37], ::zerobuf::getJSONField( field, 37 ));
::zerobuf::toJSON( array[38], ::zerobuf::getJSONField( field, 38 ));
::zerobuf::toJSON( array[39], ::zerobuf::getJSONField( field, 39 ));
::zerobuf::toJSON( array[40], ::zerobuf::getJSONField( field, 40 ));
::zerobuf::toJSON( array[41], ::zerobuf::getJSONField( field, 41 ));
::zerobuf::toJSON( array[42], ::zerobuf::getJSONField( field, 42 ));
::zerobuf::toJSON( array[43], ::zerobuf::getJSONField( field, 43 ));
::zerobuf::toJSON( array[44], ::zerobuf::getJSONField( field, 44 ));
::zerobuf::toJSON( array[45], ::zerobuf::getJSONField( field, 45 ));
::zerobuf::toJSON( array[46], ::zerobuf::getJSONField( field, 46 ));
::zerobuf::toJSON( array[47], ::zerobuf::getJSONField( field, 47 ));
::zerobuf::toJSON( array[48], ::zerobuf::getJSONField( field, 48 ));
::zerobuf::toJSON( array[49], ::zerobuf::getJSONField( field, 49 ));
::zerobuf::toJSON( array[50], ::zerobuf::getJSONField( field, 50 ));
::zerobuf::toJSON( array[51], ::zerobuf::getJSONField( field, 51 ));
::zerobuf::toJSON( array[52], ::zerobuf::getJSONField( field, 52 ));
::zerobuf::toJSON( array[53], ::zerobuf::getJSONField( field, 53 ));
::zerobuf::toJSON( array[54], ::zerobuf::getJSONField( field, 54 ));
::zerobuf::toJSON( array[55], ::zerobuf::getJSONField( field, 55 ));
::zerobuf::toJSON( array[56], ::zerobuf::getJSONField( field, 56 ));
::zerobuf::toJSON( array[57], ::zerobuf::getJSONField( field, 57 ));
::zerobuf::toJSON( array[58], ::zerobuf::getJSONField( field, 58 ));
::zerobuf::toJSON( array[59], ::zerobuf::getJSONField( field, 59 ));
::zerobuf::toJSON( array[60], ::zerobuf::getJSONField( field, 60 ));
::zerobuf::toJSON( array[61], ::zerobuf::getJSONField( field, 61 ));
::zerobuf::toJSON( array[62], ::zerobuf::getJSONField( field, 62 ));
::zerobuf::toJSON( array[63], ::zerobuf::getJSONField( field, 63 ));
::zerobuf::toJSON( array[64], ::zerobuf::getJSONField( field, 64 ));
::zerobuf::toJSON( array[65], ::zerobuf::getJSONField( field, 65 ));
::zerobuf::toJSON( array[66], ::zerobuf::getJSONField( field, 66 ));
::zerobuf::toJSON( array[67], ::zerobuf::getJSONField( field, 67 ));
::zerobuf::toJSON( array[68], ::zerobuf::getJSONField( field, 68 ));
::zerobuf::toJSON( array[69], ::zerobuf::getJSONField( field, 69 ));
::zerobuf::toJSON( array[70], ::zerobuf::getJSONField( field, 70 ));
::zerobuf::toJSON( array[71], ::zerobuf::getJSONField( field, 71 ));
::zerobuf::toJSON( array[72], ::zerobuf::getJSONField( field, 72 ));
::zerobuf::toJSON( array[73], ::zerobuf::getJSONField( field, 73 ));
::zerobuf::toJSON( array[74], ::zerobuf::getJSONField( field, 74 ));
::zerobuf::toJSON( array[75], ::zerobuf::getJSONField( field, 75 ));
::zerobuf::toJSON( array[76], ::zerobuf::getJSONField( field, 76 ));
::zerobuf::toJSON( array[77], ::zerobuf::getJSONField( field, 77 ));
::zerobuf::toJSON( array[78], ::zerobuf::getJSONField( field, 78 ));
::zerobuf::toJSON( array[79], ::zerobuf::getJSONField( field, 79 ));
::zerobuf::toJSON( array[80], ::zerobuf::getJSONField( field, 80 ));
::zerobuf::toJSON( array[81], ::zerobuf::getJSONField( field, 81 ));
::zerobuf::toJSON( array[82], ::zerobuf::getJSONField( field, 82 ));
::zerobuf::toJSON( array[83], ::zerobuf::getJSONField( field, 83 ));
::zerobuf::toJSON( array[84], ::zerobuf::getJSONField( field, 84 ));
::zerobuf::toJSON( array[85], ::zerobuf::getJSONField( field, 85 ));
::zerobuf::toJSON( array[86], ::zerobuf::getJSONField( field, 86 ));
::zerobuf::toJSON( array[87], ::zerobuf::getJSONField( field, 87 ));
::zerobuf::toJSON( array[88], ::zerobuf::getJSONField( field, 88 ));
::zerobuf::toJSON( array[89], ::zerobuf::getJSONField( field, 89 ));
::zerobuf::toJSON( array[90], ::zerobuf::getJSONField( field, 90 ));
::zerobuf::toJSON( array[91], ::zerobuf::getJSONField( field, 91 ));
::zerobuf::toJSON( array[92], ::zerobuf::getJSONField( field, 92 ));
::zerobuf::toJSON( array[93], ::zerobuf::getJSONField( field, 93 ));
::zerobuf::toJSON( array[94], ::zerobuf::getJSONField( field, 94 ));
::zerobuf::toJSON( array[95], ::zerobuf::getJSONField( field, 95 ));
::zerobuf::toJSON( array[96], ::zerobuf::getJSONField( field, 96 ));
::zerobuf::toJSON( array[97], ::zerobuf::getJSONField( field, 97 ));
::zerobuf::toJSON( array[98], ::zerobuf::getJSONField( field, 98 ));
::zerobuf::toJSON( array[99], ::zerobuf::getJSONField( field, 99 ));
::zerobuf::toJSON( array[100], ::zerobuf::getJSONField( field, 100 ));
::zerobuf::toJSON( array[101], ::zerobuf::getJSONField( field, 101 ));
::zerobuf::toJSON( array[102], ::zerobuf::getJSONField( field, 102 ));
::zerobuf::toJSON( array[103], ::zerobuf::getJSONField( field, 103 ));
::zerobuf::toJSON( array[104], ::zerobuf::getJSONField( field, 104 ));
::zerobuf::toJSON( array[105], ::zerobuf::getJSONField( field, 105 ));
::zerobuf::toJSON( array[106], ::zerobuf::getJSONField( field, 106 ));
::zerobuf::toJSON( array[107], ::zerobuf::getJSONField( field, 107 ));
::zerobuf::toJSON( array[108], ::zerobuf::getJSONField( field, 108 ));
::zerobuf::toJSON( array[109], ::zerobuf::getJSONField( field, 109 ));
::zerobuf::toJSON( array[110], ::zerobuf::getJSONField( field, 110 ));
::zerobuf::toJSON( array[111], ::zerobuf::getJSONField( field, 111 ));
::zerobuf::toJSON( array[112], ::zerobuf::getJSONField( field, 112 ));
::zerobuf::toJSON( array[113], ::zerobuf::getJSONField( field, 113 ));
::zerobuf::toJSON( array[114], ::zerobuf::getJSONField( field, 114 ));
::zerobuf::toJSON( array[115], ::zerobuf::getJSONField( field, 115 ));
::zerobuf::toJSON( array[116], ::zerobuf::getJSONField( field, 116 ));
::zerobuf::toJSON( array[117], ::zerobuf::getJSONField( field, 117 ));
::zerobuf::toJSON( array[118], ::zerobuf::getJSONField( field, 118 ));
::zerobuf::toJSON( array[119], ::zerobuf::getJSONField( field, 119 ));
::zerobuf::toJSON( array[120], ::zerobuf::getJSONField( field, 120 ));
::zerobuf::toJSON( array[121], ::zerobuf::getJSONField( field, 121 ));
::zerobuf::toJSON( array[122], ::zerobuf::getJSONField( field, 122 ));
::zerobuf::toJSON( array[123], ::zerobuf::getJSONField( field, 123 ));
::zerobuf::toJSON( array[124], ::zerobuf::getJSONField( field, 124 ));
}
}
namespace zerobuf
{
}
| 62.862338 | 112 | 0.6059 | [
"object",
"vector"
] |
f2d5d880b3969916f565fcbdce17f756c754c95e | 3,040 | cpp | C++ | 217CR -Project-Ivan Alexandru/Rigidbody2D.cpp | Pixanu/Physics-Project | 75462d84b2c37dee19cb4a6bdca72a34c7e1faa3 | [
"MIT"
] | null | null | null | 217CR -Project-Ivan Alexandru/Rigidbody2D.cpp | Pixanu/Physics-Project | 75462d84b2c37dee19cb4a6bdca72a34c7e1faa3 | [
"MIT"
] | null | null | null | 217CR -Project-Ivan Alexandru/Rigidbody2D.cpp | Pixanu/Physics-Project | 75462d84b2c37dee19cb4a6bdca72a34c7e1faa3 | [
"MIT"
] | null | null | null | #include "Rigidbody2D.h"
#include <iostream>
#include <glm/gtx/string_cast.hpp>
void Rigidbody2D::Draw()
{
glPushMatrix(); //dont affect other objects, only this one so take a copy of the matrix and put it on the stack
glTranslatef(position.x, position.y, position.z); //then this happens
glRotatef(glm::degrees(orientation), 0, 0, 1); //this really happens first
glColor3f(1.f, 1.f, 1.f);
glBegin(GL_QUADS);
glVertex3f(-length, width, 0); //top left
glVertex3f(length, width, 0); //top right
glVertex3f(length, -width, 0); //bottom right
glVertex3f(-length, -width, 0); //bottom left
glEnd();
glPointSize(5.0f); // so we can see the point better
glColor3f(0.f, 0.f, 0.f);
glBegin(GL_POINTS);
//at the middle of object
glVertex3f(0, 0, 0);
glEnd();
glPopMatrix(); //forget about what we've done to this object so push off the stack - we are back to before the glPushMatrix() happened
//sphere collider draw
sphereCol.Draw();
}
void Rigidbody2D::Update(float deltatime)
{
sphereCol.position = position;
CalculateForces();
CheckForInput();
//linear
acceleration = totalForce / mass;
velocity = velocity + (acceleration * deltatime);
//Dampen
velocity *= pow(0.4f, deltatime);
position = position+(velocity * deltatime);
//sp->position = position;
//Angular
angularAcceleration = rotationalForce / inertia;
angularVelocity = angularVelocity + angularAcceleration * deltatime;
angularVelocity *= pow(0.4f, deltatime);
orientation = orientation + angularVelocity.z * deltatime;
//debub angular velocity
//std::cout << glm::to_string(angularVelocity) << std::endl;
}
void Rigidbody2D::CalculateForces()
{
totalForce = glm::vec3(0, 0, 0);
totalForce += force1;
rotationalForce = glm::vec3(0, 0, 0);
//cross prod havs been moved to a key input
//rotationalForce += glm::cross(glm::vec3(1, 1, 0), glm::vec3(1, 0, 0));
//debug rotation
//std::cout << rotationalForce.x << " " << rotationalForce.y << " " << rotationalForce.z << std::endl;
}
void Rigidbody2D::CheckForInput()
{
if (GameObject::specialKeys[GLUT_KEY_UP])
{
totalForce += glm::vec3(0, 0, 5);
}
if (GameObject::specialKeys[GLUT_KEY_DOWN])
{
totalForce += glm::vec3(0, 0, -5);
}
if (GameObject::specialKeys[GLUT_KEY_LEFT])
{
totalForce += glm::vec3(5, 0, 0);
}
if (GameObject::specialKeys[GLUT_KEY_RIGHT])
{
totalForce += glm::vec3(-5, 0, 0);
}
if(GameObject::keys['p'])
rotationalForce += glm::cross(glm::vec3(1, 1, 0), glm::vec3(1, 0, 0));
}
Rigidbody2D::Rigidbody2D(float m, glm::vec3 pos, float length, float width) : GameObject(pos)
{
this->length = length;
this->width = width;
force1 = glm::vec3(0, 0, 0);
//force2 = glm::vec3(2, 0, 0);
mass = m;
/*
velocity = glm::vec3(0, 0, 0);
acceleration = glm::vec3(0, 0, 0);
totalForce = glm::vec3(0, 0, 0);*/
inertia = 1.0f / 6.0f;
std::cout << "Inertia= " << inertia << std::endl;
angularAcceleration = glm::vec3(0, 0, 0);
angularVelocity = glm::vec3(0, 0, 0);
orientation = 0.0f;
}
Rigidbody2D::~Rigidbody2D()
{
}
| 22.686567 | 135 | 0.670066 | [
"object"
] |
f2db63383e480e1555b1292857abeb2b0da3af3d | 3,217 | cpp | C++ | src/scheduler/processor.cpp | Jacques-Florence/SchedSim | cd5f356ec1d177963d401b69996a19a68646d7af | [
"BSD-3-Clause"
] | 1 | 2019-12-24T19:07:19.000Z | 2019-12-24T19:07:19.000Z | src/scheduler/processor.cpp | Jacques-Florence/SchedSim | cd5f356ec1d177963d401b69996a19a68646d7af | [
"BSD-3-Clause"
] | null | null | null | src/scheduler/processor.cpp | Jacques-Florence/SchedSim | cd5f356ec1d177963d401b69996a19a68646d7af | [
"BSD-3-Clause"
] | null | null | null | /**
* Copyright 2017 Jacques Florence
* All rights reserved.
* See License.txt file
*
*/
#include "processor.h"
#include <iomanip>
#include <iostream>
#include <fstream>
#include <utils/log.h>
#include "time.h"
#include "process.h"
#include "temperatureModel/temperatureModel.h"
using namespace Scheduler;
//TODO: make the Utils::Record use a shared_ptr so we don't need get()
Processor::Processor(std::shared_ptr<Utils::Configuration> c) : conf(c), usageHistory(Utils::Record(c, "usage")), freqHistory(Utils::Record(c, "frequency"))
{
}
Processor::~Processor()
{
delete temperatureModel;
}
double Processor::getMaxFreq() const
{
return maxFreq;
}
double Processor::getMinFreq() const
{
return minFreq;
}
double Processor::getUsage() const
{
return usage;
}
void Processor::updateUsage()
{
long long int deltaIdle = totalIdleTicks - previousIdleTicks;
long long int deltaBusy = totalBusyTicks - previousBusyTicks;
previousIdleTicks = totalIdleTicks;
previousBusyTicks = totalBusyTicks;
long long int sumDelta = deltaIdle + deltaBusy;
if (sumDelta == 0)
{
usage = 0.0;
}
else
{
usage = (double)deltaBusy/(double)sumDelta;
}
usageHistory.add(Time::getTime(), usage);
}
void Processor::reinitTicks()
{
totalBusyTicks = totalIdleTicks = 0;
}
bool Processor::isBusy() const
{
return (runningTask != nullptr);
}
bool Processor::isRunning(std::shared_ptr<Process> p) const
{
return (runningTask == p);
}
void Processor::setRunning(std::shared_ptr<Process> p)
{
runningTask = p;
}
std::shared_ptr<Process> Processor::getRunningTask()
{
return runningTask;
}
void Processor::updateTemperature(double timeInterval)
{
/*FIXME where should the powerCoeff of an idle processor be defined?*/
double powerCoeff = (runningTask==nullptr) ? 0.0: runningTask->powerCoeff;
temperatureModel->updateTemperature(timeInterval, &powerParams, powerCoeff, freq);
}
void Processor::setTemperatureModel(TemperatureModel *model)
{
temperatureModel = model;
}
TemperatureModel *Processor::getTemperatureModel()
{
return temperatureModel;
}
void Processor::setFreq(double f)
{
double epsilon = 0.0000001;
if (f < (freq - epsilon) || (f > freq + epsilon))
freqHistory.add(Time::getTime(), f);
freq = f;
}
double Processor::getFreq() const
{
return freq;
}
void Processor::printTemperatureReport(std::string folder) const
{
temperatureModel->printTemperatureHistory(folder);
}
void Processor::printEnergyReport(std::string folder) const
{
temperatureModel->printEnergyHistory(folder);
}
void Processor::printUsageReport(std::string folder) const
{
usageHistory.printToFile(folder);
}
void Processor::printFreqReport(std::string folder) const
{
freqHistory.printToFile(folder);
}
void Processor::printReports(std::string folder) const
{
printTemperatureReport(folder);
printEnergyReport(folder);
printUsageReport(folder);
printFreqReport(folder);
}
void Processor::updateTicks()
{
busy ? (totalBusyTicks++) : (totalIdleTicks++);
}
void Processor::power(bool b)
{
powerParams.powered = b;
}
bool Processor::powered() const
{
return powerParams.powered;
}
double Processor::getTemperature() const
{
return temperatureModel->getTemperature();
}
| 16.668394 | 156 | 0.735779 | [
"model"
] |
f2dd66e7afc34e6ed1b14149e13358fcd986dbff | 36,910 | hpp | C++ | include/Firebase/Auth/FirebaseAuth.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | include/Firebase/Auth/FirebaseAuth.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | include/Firebase/Auth/FirebaseAuth.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: System.IDisposable
#include "System/IDisposable.hpp"
// Including type: System.Runtime.InteropServices.HandleRef
#include "System/Runtime/InteropServices/HandleRef.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
#include "beatsaber-hook/shared/utils/typedefs-string.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: Firebase::Auth
namespace Firebase::Auth {
// Forward declaring type: FirebaseUser
class FirebaseUser;
}
// Forward declaring namespace: Firebase
namespace Firebase {
// Forward declaring type: FirebaseApp
class FirebaseApp;
// Forward declaring type: InitResult
struct InitResult;
}
// Forward declaring namespace: System
namespace System {
// Forward declaring type: EventHandler
class EventHandler;
// Forward declaring type: Action`1<T>
template<typename T>
class Action_1;
// Forward declaring type: EventArgs
class EventArgs;
}
// Forward declaring namespace: System::Collections::Generic
namespace System::Collections::Generic {
// Forward declaring type: Dictionary`2<TKey, TValue>
template<typename TKey, typename TValue>
class Dictionary_2;
}
// Forward declaring namespace: System::Threading::Tasks
namespace System::Threading::Tasks {
// Forward declaring type: Task`1<TResult>
template<typename TResult>
class Task_1;
// Forward declaring type: TaskCompletionSource`1<TResult>
template<typename TResult>
class TaskCompletionSource_1;
// Forward declaring type: Task
class Task;
}
// Completed forward declares
// Type namespace: Firebase.Auth
namespace Firebase::Auth {
// Forward declaring type: FirebaseAuth
class FirebaseAuth;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::Firebase::Auth::FirebaseAuth);
DEFINE_IL2CPP_ARG_TYPE(::Firebase::Auth::FirebaseAuth*, "Firebase.Auth", "FirebaseAuth");
// Type namespace: Firebase.Auth
namespace Firebase::Auth {
// Size: 0x61
#pragma pack(push, 1)
// Autogenerated type: Firebase.Auth.FirebaseAuth
// [TokenAttribute] Offset: FFFFFFFF
class FirebaseAuth : public ::Il2CppObject/*, public ::System::IDisposable*/ {
public:
// Nested type: ::Firebase::Auth::FirebaseAuth::StateChangedDelegate
class StateChangedDelegate;
// Nested type: ::Firebase::Auth::FirebaseAuth::$GetAuth$c__AnonStorey1
class $GetAuth$c__AnonStorey1;
// Nested type: ::Firebase::Auth::FirebaseAuth::$GetAuth$c__AnonStorey2
class $GetAuth$c__AnonStorey2;
// Nested type: ::Firebase::Auth::FirebaseAuth::$ForwardStateChange$c__AnonStorey3
class $ForwardStateChange$c__AnonStorey3;
// Nested type: ::Firebase::Auth::FirebaseAuth::$ForwardStateChange$c__AnonStorey4
class $ForwardStateChange$c__AnonStorey4;
// Nested type: ::Firebase::Auth::FirebaseAuth::$SignInWithEmailAndPasswordAsync$c__AnonStoreyA
class $SignInWithEmailAndPasswordAsync$c__AnonStoreyA;
// Nested type: ::Firebase::Auth::FirebaseAuth::$CreateUserWithEmailAndPasswordAsync$c__AnonStoreyB
class $CreateUserWithEmailAndPasswordAsync$c__AnonStoreyB;
#ifdef USE_CODEGEN_FIELDS
public:
#else
#ifdef CODEGEN_FIELD_ACCESSIBILITY
CODEGEN_FIELD_ACCESSIBILITY:
#else
protected:
#endif
#endif
// private System.Runtime.InteropServices.HandleRef swigCPtr
// Size: 0x10
// Offset: 0x10
::System::Runtime::InteropServices::HandleRef swigCPtr;
// Field size check
static_assert(sizeof(::System::Runtime::InteropServices::HandleRef) == 0x10);
// private System.Boolean swigCMemOwn
// Size: 0x1
// Offset: 0x20
bool swigCMemOwn;
// Field size check
static_assert(sizeof(bool) == 0x1);
// Padding between fields: swigCMemOwn and: appProxy
char __padding1[0x7] = {};
// private Firebase.FirebaseApp appProxy
// Size: 0x8
// Offset: 0x28
::Firebase::FirebaseApp* appProxy;
// Field size check
static_assert(sizeof(::Firebase::FirebaseApp*) == 0x8);
// private System.IntPtr appCPtr
// Size: 0x8
// Offset: 0x30
::System::IntPtr appCPtr;
// Field size check
static_assert(sizeof(::System::IntPtr) == 0x8);
// private System.IntPtr authStateListener
// Size: 0x8
// Offset: 0x38
::System::IntPtr authStateListener;
// Field size check
static_assert(sizeof(::System::IntPtr) == 0x8);
// private System.IntPtr idTokenListener
// Size: 0x8
// Offset: 0x40
::System::IntPtr idTokenListener;
// Field size check
static_assert(sizeof(::System::IntPtr) == 0x8);
// private Firebase.Auth.FirebaseUser currentUser
// Size: 0x8
// Offset: 0x48
::Firebase::Auth::FirebaseUser* currentUser;
// Field size check
static_assert(sizeof(::Firebase::Auth::FirebaseUser*) == 0x8);
// private System.EventHandler stateChangedImpl
// Size: 0x8
// Offset: 0x50
::System::EventHandler* stateChangedImpl;
// Field size check
static_assert(sizeof(::System::EventHandler*) == 0x8);
// private System.EventHandler idTokenChangedImpl
// Size: 0x8
// Offset: 0x58
::System::EventHandler* idTokenChangedImpl;
// Field size check
static_assert(sizeof(::System::EventHandler*) == 0x8);
// private System.Boolean persistentLoaded
// Size: 0x1
// Offset: 0x60
bool persistentLoaded;
// Field size check
static_assert(sizeof(bool) == 0x1);
public:
// Creating interface conversion operator: operator ::System::IDisposable
operator ::System::IDisposable() noexcept {
return *reinterpret_cast<::System::IDisposable*>(this);
}
// Get static field: static private System.Collections.Generic.Dictionary`2<System.IntPtr,Firebase.Auth.FirebaseAuth> appCPtrToAuth
static ::System::Collections::Generic::Dictionary_2<::System::IntPtr, ::Firebase::Auth::FirebaseAuth*>* _get_appCPtrToAuth();
// Set static field: static private System.Collections.Generic.Dictionary`2<System.IntPtr,Firebase.Auth.FirebaseAuth> appCPtrToAuth
static void _set_appCPtrToAuth(::System::Collections::Generic::Dictionary_2<::System::IntPtr, ::Firebase::Auth::FirebaseAuth*>* value);
// Get static field: static private Firebase.Auth.FirebaseAuth/Firebase.Auth.StateChangedDelegate <>f__mg$cache0
static ::Firebase::Auth::FirebaseAuth::StateChangedDelegate* _get_$$f__mg$cache0();
// Set static field: static private Firebase.Auth.FirebaseAuth/Firebase.Auth.StateChangedDelegate <>f__mg$cache0
static void _set_$$f__mg$cache0(::Firebase::Auth::FirebaseAuth::StateChangedDelegate* value);
// Get static field: static private Firebase.Auth.FirebaseAuth/Firebase.Auth.StateChangedDelegate <>f__mg$cache1
static ::Firebase::Auth::FirebaseAuth::StateChangedDelegate* _get_$$f__mg$cache1();
// Set static field: static private Firebase.Auth.FirebaseAuth/Firebase.Auth.StateChangedDelegate <>f__mg$cache1
static void _set_$$f__mg$cache1(::Firebase::Auth::FirebaseAuth::StateChangedDelegate* value);
// Get static field: static private System.Action`1<Firebase.Auth.FirebaseAuth> <>f__am$cache0
static ::System::Action_1<::Firebase::Auth::FirebaseAuth*>* _get_$$f__am$cache0();
// Set static field: static private System.Action`1<Firebase.Auth.FirebaseAuth> <>f__am$cache0
static void _set_$$f__am$cache0(::System::Action_1<::Firebase::Auth::FirebaseAuth*>* value);
// Get static field: static private System.Action`1<Firebase.Auth.FirebaseAuth> <>f__am$cache1
static ::System::Action_1<::Firebase::Auth::FirebaseAuth*>* _get_$$f__am$cache1();
// Set static field: static private System.Action`1<Firebase.Auth.FirebaseAuth> <>f__am$cache1
static void _set_$$f__am$cache1(::System::Action_1<::Firebase::Auth::FirebaseAuth*>* value);
// Get instance field reference: private System.Runtime.InteropServices.HandleRef swigCPtr
::System::Runtime::InteropServices::HandleRef& dyn_swigCPtr();
// Get instance field reference: private System.Boolean swigCMemOwn
bool& dyn_swigCMemOwn();
// Get instance field reference: private Firebase.FirebaseApp appProxy
::Firebase::FirebaseApp*& dyn_appProxy();
// Get instance field reference: private System.IntPtr appCPtr
::System::IntPtr& dyn_appCPtr();
// Get instance field reference: private System.IntPtr authStateListener
::System::IntPtr& dyn_authStateListener();
// Get instance field reference: private System.IntPtr idTokenListener
::System::IntPtr& dyn_idTokenListener();
// Get instance field reference: private Firebase.Auth.FirebaseUser currentUser
::Firebase::Auth::FirebaseUser*& dyn_currentUser();
// Get instance field reference: private System.EventHandler stateChangedImpl
::System::EventHandler*& dyn_stateChangedImpl();
// Get instance field reference: private System.EventHandler idTokenChangedImpl
::System::EventHandler*& dyn_idTokenChangedImpl();
// Get instance field reference: private System.Boolean persistentLoaded
bool& dyn_persistentLoaded();
// static public Firebase.Auth.FirebaseAuth get_DefaultInstance()
// Offset: 0x12B0C98
static ::Firebase::Auth::FirebaseAuth* get_DefaultInstance();
// public Firebase.Auth.FirebaseUser get_CurrentUser()
// Offset: 0x12B10B8
::Firebase::Auth::FirebaseUser* get_CurrentUser();
// Firebase.Auth.FirebaseUser get_CurrentUserInternal()
// Offset: 0x12B111C
::Firebase::Auth::FirebaseUser* get_CurrentUserInternal();
// public System.Void add_StateChanged(System.EventHandler value)
// Offset: 0x12B0D30
void add_StateChanged(::System::EventHandler* value);
// public System.Void remove_StateChanged(System.EventHandler value)
// Offset: 0x12B0E7C
void remove_StateChanged(::System::EventHandler* value);
// private System.Void add_stateChangedImpl(System.EventHandler value)
// Offset: 0x12B0DDC
void add_stateChangedImpl(::System::EventHandler* value);
// private System.Void remove_stateChangedImpl(System.EventHandler value)
// Offset: 0x12B0E80
void remove_stateChangedImpl(::System::EventHandler* value);
// System.Void .ctor(System.IntPtr cPtr, System.Boolean cMemoryOwn)
// Offset: 0x12AFD78
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static FirebaseAuth* New_ctor(::System::IntPtr cPtr, bool cMemoryOwn) {
static auto ___internal__logger = ::Logger::get().WithContext("::Firebase::Auth::FirebaseAuth::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<FirebaseAuth*, creationType>(cPtr, cMemoryOwn)));
}
// static private System.Void .cctor()
// Offset: 0x12B1E08
static void _cctor();
// static System.Runtime.InteropServices.HandleRef getCPtr(Firebase.Auth.FirebaseAuth obj)
// Offset: 0x12AE9A8
static ::System::Runtime::InteropServices::HandleRef getCPtr(::Firebase::Auth::FirebaseAuth* obj);
// public System.Void Dispose()
// Offset: 0x12AFE44
void Dispose();
// static private Firebase.Auth.FirebaseAuth ProxyFromAppCPtr(System.IntPtr appCPtr)
// Offset: 0x12B01FC
static ::Firebase::Auth::FirebaseAuth* ProxyFromAppCPtr(::System::IntPtr appCPtr);
// private System.Void ThrowIfNull()
// Offset: 0x12B0328
void ThrowIfNull();
// static public Firebase.Auth.FirebaseAuth GetAuth(Firebase.FirebaseApp app)
// Offset: 0x12B03AC
static ::Firebase::Auth::FirebaseAuth* GetAuth(::Firebase::FirebaseApp* app);
// private System.Void OnAppDisposed(System.Object sender, System.EventArgs eventArgs)
// Offset: 0x12B0858
void OnAppDisposed(::Il2CppObject* sender, ::System::EventArgs* eventArgs);
// private System.Void DisposeInternal()
// Offset: 0x12AFE48
void DisposeInternal();
// static private System.Void ForwardStateChange(System.IntPtr appCPtr, System.Action`1<Firebase.Auth.FirebaseAuth> stateChangeClosure)
// Offset: 0x12B0AC0
static void ForwardStateChange(::System::IntPtr appCPtr, ::System::Action_1<::Firebase::Auth::FirebaseAuth*>* stateChangeClosure);
// static System.Void StateChangedFunction(System.IntPtr appCPtr)
// Offset: 0x12AFB50
static void StateChangedFunction(::System::IntPtr appCPtr);
// static System.Void IdTokenChangedFunction(System.IntPtr appCPtr)
// Offset: 0x12AFC64
static void IdTokenChangedFunction(::System::IntPtr appCPtr);
// private Firebase.Auth.FirebaseUser UpdateCurrentUser(Firebase.Auth.FirebaseUser proxy)
// Offset: 0x12B0F20
::Firebase::Auth::FirebaseUser* UpdateCurrentUser(::Firebase::Auth::FirebaseUser* proxy);
// public System.Threading.Tasks.Task`1<Firebase.Auth.FirebaseUser> SignInWithEmailAndPasswordAsync(System.String email, System.String password)
// Offset: 0x12B1230
::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* SignInWithEmailAndPasswordAsync(::StringW email, ::StringW password);
// public System.Threading.Tasks.Task`1<Firebase.Auth.FirebaseUser> CreateUserWithEmailAndPasswordAsync(System.String email, System.String password)
// Offset: 0x12B14AC
::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* CreateUserWithEmailAndPasswordAsync(::StringW email, ::StringW password);
// private System.Void CompleteFirebaseUserTask(System.Threading.Tasks.Task`1<Firebase.Auth.FirebaseUser> task, System.Threading.Tasks.TaskCompletionSource`1<Firebase.Auth.FirebaseUser> taskCompletionSource)
// Offset: 0x12B1728
void CompleteFirebaseUserTask(::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* task, ::System::Threading::Tasks::TaskCompletionSource_1<::Firebase::Auth::FirebaseUser*>* taskCompletionSource);
// System.Threading.Tasks.Task`1<Firebase.Auth.FirebaseUser> SignInWithEmailAndPasswordInternalAsync(System.String email, System.String password)
// Offset: 0x12B13AC
::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* SignInWithEmailAndPasswordInternalAsync(::StringW email, ::StringW password);
// System.Threading.Tasks.Task`1<Firebase.Auth.FirebaseUser> CreateUserWithEmailAndPasswordInternalAsync(System.String email, System.String password)
// Offset: 0x12B1628
::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* CreateUserWithEmailAndPasswordInternalAsync(::StringW email, ::StringW password);
// public System.Void SignOut()
// Offset: 0x12B1AB0
void SignOut();
// public System.Threading.Tasks.Task SendPasswordResetEmailAsync(System.String email)
// Offset: 0x12B1B4C
::System::Threading::Tasks::Task* SendPasswordResetEmailAsync(::StringW email);
// static Firebase.Auth.FirebaseAuth GetAuthInternal(Firebase.FirebaseApp app, out Firebase.InitResult init_result_out)
// Offset: 0x12B1C20
static ::Firebase::Auth::FirebaseAuth* GetAuthInternal(::Firebase::FirebaseApp* app, ByRef<::Firebase::InitResult> init_result_out);
// static System.Void ReleaseReferenceInternal(Firebase.Auth.FirebaseAuth instance)
// Offset: 0x12B09EC
static void ReleaseReferenceInternal(::Firebase::Auth::FirebaseAuth* instance);
// static private System.Void <StateChangedFunction>m__0(Firebase.Auth.FirebaseAuth auth)
// Offset: 0x12B1E90
static void $StateChangedFunction$m__0(::Firebase::Auth::FirebaseAuth* auth);
// static private System.Void <IdTokenChangedFunction>m__1(Firebase.Auth.FirebaseAuth auth)
// Offset: 0x12B1FCC
static void $IdTokenChangedFunction$m__1(::Firebase::Auth::FirebaseAuth* auth);
// protected override System.Void Finalize()
// Offset: 0x12AFDDC
// Implemented from: System.Object
// Base method: System.Void Object::Finalize()
void Finalize();
}; // Firebase.Auth.FirebaseAuth
#pragma pack(pop)
static check_size<sizeof(FirebaseAuth), 96 + sizeof(bool)> __Firebase_Auth_FirebaseAuthSizeCheck;
static_assert(sizeof(FirebaseAuth) == 0x61);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::get_DefaultInstance
// Il2CppName: get_DefaultInstance
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseAuth* (*)()>(&Firebase::Auth::FirebaseAuth::get_DefaultInstance)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "get_DefaultInstance", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::get_CurrentUser
// Il2CppName: get_CurrentUser
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseUser* (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::get_CurrentUser)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "get_CurrentUser", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::get_CurrentUserInternal
// Il2CppName: get_CurrentUserInternal
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseUser* (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::get_CurrentUserInternal)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "get_CurrentUserInternal", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::add_StateChanged
// Il2CppName: add_StateChanged
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::System::EventHandler*)>(&Firebase::Auth::FirebaseAuth::add_StateChanged)> {
static const MethodInfo* get() {
static auto* value = &::il2cpp_utils::GetClassFromName("System", "EventHandler")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "add_StateChanged", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::remove_StateChanged
// Il2CppName: remove_StateChanged
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::System::EventHandler*)>(&Firebase::Auth::FirebaseAuth::remove_StateChanged)> {
static const MethodInfo* get() {
static auto* value = &::il2cpp_utils::GetClassFromName("System", "EventHandler")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "remove_StateChanged", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::add_stateChangedImpl
// Il2CppName: add_stateChangedImpl
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::System::EventHandler*)>(&Firebase::Auth::FirebaseAuth::add_stateChangedImpl)> {
static const MethodInfo* get() {
static auto* value = &::il2cpp_utils::GetClassFromName("System", "EventHandler")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "add_stateChangedImpl", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::remove_stateChangedImpl
// Il2CppName: remove_stateChangedImpl
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::System::EventHandler*)>(&Firebase::Auth::FirebaseAuth::remove_stateChangedImpl)> {
static const MethodInfo* get() {
static auto* value = &::il2cpp_utils::GetClassFromName("System", "EventHandler")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "remove_stateChangedImpl", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{value});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::_cctor
// Il2CppName: .cctor
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)()>(&Firebase::Auth::FirebaseAuth::_cctor)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), ".cctor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::getCPtr
// Il2CppName: getCPtr
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Runtime::InteropServices::HandleRef (*)(::Firebase::Auth::FirebaseAuth*)>(&Firebase::Auth::FirebaseAuth::getCPtr)> {
static const MethodInfo* get() {
static auto* obj = &::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseAuth")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "getCPtr", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{obj});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::Dispose
// Il2CppName: Dispose
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::Dispose)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "Dispose", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::ProxyFromAppCPtr
// Il2CppName: ProxyFromAppCPtr
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseAuth* (*)(::System::IntPtr)>(&Firebase::Auth::FirebaseAuth::ProxyFromAppCPtr)> {
static const MethodInfo* get() {
static auto* appCPtr = &::il2cpp_utils::GetClassFromName("System", "IntPtr")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "ProxyFromAppCPtr", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{appCPtr});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::ThrowIfNull
// Il2CppName: ThrowIfNull
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::ThrowIfNull)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "ThrowIfNull", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::GetAuth
// Il2CppName: GetAuth
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseAuth* (*)(::Firebase::FirebaseApp*)>(&Firebase::Auth::FirebaseAuth::GetAuth)> {
static const MethodInfo* get() {
static auto* app = &::il2cpp_utils::GetClassFromName("Firebase", "FirebaseApp")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "GetAuth", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{app});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::OnAppDisposed
// Il2CppName: OnAppDisposed
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::Il2CppObject*, ::System::EventArgs*)>(&Firebase::Auth::FirebaseAuth::OnAppDisposed)> {
static const MethodInfo* get() {
static auto* sender = &::il2cpp_utils::GetClassFromName("System", "Object")->byval_arg;
static auto* eventArgs = &::il2cpp_utils::GetClassFromName("System", "EventArgs")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "OnAppDisposed", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{sender, eventArgs});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::DisposeInternal
// Il2CppName: DisposeInternal
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::DisposeInternal)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "DisposeInternal", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::ForwardStateChange
// Il2CppName: ForwardStateChange
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::System::IntPtr, ::System::Action_1<::Firebase::Auth::FirebaseAuth*>*)>(&Firebase::Auth::FirebaseAuth::ForwardStateChange)> {
static const MethodInfo* get() {
static auto* appCPtr = &::il2cpp_utils::GetClassFromName("System", "IntPtr")->byval_arg;
static auto* stateChangeClosure = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Action`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseAuth")})->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "ForwardStateChange", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{appCPtr, stateChangeClosure});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::StateChangedFunction
// Il2CppName: StateChangedFunction
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::System::IntPtr)>(&Firebase::Auth::FirebaseAuth::StateChangedFunction)> {
static const MethodInfo* get() {
static auto* appCPtr = &::il2cpp_utils::GetClassFromName("System", "IntPtr")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "StateChangedFunction", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{appCPtr});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::IdTokenChangedFunction
// Il2CppName: IdTokenChangedFunction
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::System::IntPtr)>(&Firebase::Auth::FirebaseAuth::IdTokenChangedFunction)> {
static const MethodInfo* get() {
static auto* appCPtr = &::il2cpp_utils::GetClassFromName("System", "IntPtr")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "IdTokenChangedFunction", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{appCPtr});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::UpdateCurrentUser
// Il2CppName: UpdateCurrentUser
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseUser* (Firebase::Auth::FirebaseAuth::*)(::Firebase::Auth::FirebaseUser*)>(&Firebase::Auth::FirebaseAuth::UpdateCurrentUser)> {
static const MethodInfo* get() {
static auto* proxy = &::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseUser")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "UpdateCurrentUser", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{proxy});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::SignInWithEmailAndPasswordAsync
// Il2CppName: SignInWithEmailAndPasswordAsync
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* (Firebase::Auth::FirebaseAuth::*)(::StringW, ::StringW)>(&Firebase::Auth::FirebaseAuth::SignInWithEmailAndPasswordAsync)> {
static const MethodInfo* get() {
static auto* email = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
static auto* password = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "SignInWithEmailAndPasswordAsync", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{email, password});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::CreateUserWithEmailAndPasswordAsync
// Il2CppName: CreateUserWithEmailAndPasswordAsync
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* (Firebase::Auth::FirebaseAuth::*)(::StringW, ::StringW)>(&Firebase::Auth::FirebaseAuth::CreateUserWithEmailAndPasswordAsync)> {
static const MethodInfo* get() {
static auto* email = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
static auto* password = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "CreateUserWithEmailAndPasswordAsync", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{email, password});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::CompleteFirebaseUserTask
// Il2CppName: CompleteFirebaseUserTask
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)(::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>*, ::System::Threading::Tasks::TaskCompletionSource_1<::Firebase::Auth::FirebaseUser*>*)>(&Firebase::Auth::FirebaseAuth::CompleteFirebaseUserTask)> {
static const MethodInfo* get() {
static auto* task = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System.Threading.Tasks", "Task`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseUser")})->byval_arg;
static auto* taskCompletionSource = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System.Threading.Tasks", "TaskCompletionSource`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseUser")})->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "CompleteFirebaseUserTask", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{task, taskCompletionSource});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::SignInWithEmailAndPasswordInternalAsync
// Il2CppName: SignInWithEmailAndPasswordInternalAsync
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* (Firebase::Auth::FirebaseAuth::*)(::StringW, ::StringW)>(&Firebase::Auth::FirebaseAuth::SignInWithEmailAndPasswordInternalAsync)> {
static const MethodInfo* get() {
static auto* email = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
static auto* password = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "SignInWithEmailAndPasswordInternalAsync", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{email, password});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::CreateUserWithEmailAndPasswordInternalAsync
// Il2CppName: CreateUserWithEmailAndPasswordInternalAsync
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Threading::Tasks::Task_1<::Firebase::Auth::FirebaseUser*>* (Firebase::Auth::FirebaseAuth::*)(::StringW, ::StringW)>(&Firebase::Auth::FirebaseAuth::CreateUserWithEmailAndPasswordInternalAsync)> {
static const MethodInfo* get() {
static auto* email = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
static auto* password = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "CreateUserWithEmailAndPasswordInternalAsync", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{email, password});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::SignOut
// Il2CppName: SignOut
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::SignOut)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "SignOut", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::SendPasswordResetEmailAsync
// Il2CppName: SendPasswordResetEmailAsync
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::System::Threading::Tasks::Task* (Firebase::Auth::FirebaseAuth::*)(::StringW)>(&Firebase::Auth::FirebaseAuth::SendPasswordResetEmailAsync)> {
static const MethodInfo* get() {
static auto* email = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "SendPasswordResetEmailAsync", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{email});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::GetAuthInternal
// Il2CppName: GetAuthInternal
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<::Firebase::Auth::FirebaseAuth* (*)(::Firebase::FirebaseApp*, ByRef<::Firebase::InitResult>)>(&Firebase::Auth::FirebaseAuth::GetAuthInternal)> {
static const MethodInfo* get() {
static auto* app = &::il2cpp_utils::GetClassFromName("Firebase", "FirebaseApp")->byval_arg;
static auto* init_result_out = &::il2cpp_utils::GetClassFromName("Firebase", "InitResult")->this_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "GetAuthInternal", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{app, init_result_out});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::ReleaseReferenceInternal
// Il2CppName: ReleaseReferenceInternal
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::Firebase::Auth::FirebaseAuth*)>(&Firebase::Auth::FirebaseAuth::ReleaseReferenceInternal)> {
static const MethodInfo* get() {
static auto* instance = &::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseAuth")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "ReleaseReferenceInternal", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{instance});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::$StateChangedFunction$m__0
// Il2CppName: <StateChangedFunction>m__0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::Firebase::Auth::FirebaseAuth*)>(&Firebase::Auth::FirebaseAuth::$StateChangedFunction$m__0)> {
static const MethodInfo* get() {
static auto* auth = &::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseAuth")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "<StateChangedFunction>m__0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{auth});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::$IdTokenChangedFunction$m__1
// Il2CppName: <IdTokenChangedFunction>m__1
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)(::Firebase::Auth::FirebaseAuth*)>(&Firebase::Auth::FirebaseAuth::$IdTokenChangedFunction$m__1)> {
static const MethodInfo* get() {
static auto* auth = &::il2cpp_utils::GetClassFromName("Firebase.Auth", "FirebaseAuth")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "<IdTokenChangedFunction>m__1", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{auth});
}
};
// Writing MetadataGetter for method: Firebase::Auth::FirebaseAuth::Finalize
// Il2CppName: Finalize
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (Firebase::Auth::FirebaseAuth::*)()>(&Firebase::Auth::FirebaseAuth::Finalize)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(Firebase::Auth::FirebaseAuth*), "Finalize", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
| 62.033613 | 324 | 0.748361 | [
"object",
"vector"
] |
f2e22cee1b237bc307d8513895be91417001414d | 6,976 | cpp | C++ | src/hdNuke/environmentLightAdapter.cpp | TheFoundryVisionmongers/NukeHydraPlugins | 3ffaf6fae9ad3b988edcdb3198dd3109fbcda12a | [
"Apache-2.0"
] | 3 | 2022-03-03T17:40:54.000Z | 2022-03-21T22:14:43.000Z | src/hdNuke/environmentLightAdapter.cpp | TheFoundryVisionmongers/NukeHydraPlugins | 3ffaf6fae9ad3b988edcdb3198dd3109fbcda12a | [
"Apache-2.0"
] | null | null | null | src/hdNuke/environmentLightAdapter.cpp | TheFoundryVisionmongers/NukeHydraPlugins | 3ffaf6fae9ad3b988edcdb3198dd3109fbcda12a | [
"Apache-2.0"
] | 3 | 2021-12-06T06:48:54.000Z | 2022-02-08T23:58:30.000Z | #include "environmentLightAdapter.h"
#include "sceneDelegate.h"
#include "adapterManager.h"
#include "utils.h"
#include "adapterFactory.h"
#include "nukeTexturePlugin.h"
#include <DDImage/Iop.h>
#include <DDImage/LightOp.h>
#include <pxr/imaging/hd/light.h>
#include <pxr/imaging/hd/renderIndex.h>
#include <pxr/base/gf/matrix4d.h>
#if PXR_METAL_SUPPORT_ENABLED
#include <pxr/imaging/garch/texture.h>
#include <pxr/imaging/garch/textureRegistry.h>
#if PXR_VERSION >= 2105
#include <pxr/imaging/hio/image.h>
#else
#include <pxr/imaging/garch/image.h>
#endif
#include <pxr/imaging/hdSt/resourceFactory.h>
#else
#include <pxr/imaging/glf/texture.h>
#include <pxr/imaging/glf/textureHandle.h>
#include <pxr/imaging/glf/textureRegistry.h>
#endif
#include <pxr/imaging/hdSt/textureResource.h>
PXR_NAMESPACE_OPEN_SCOPE
HdNukeEnvironmentLightAdapter::HdNukeEnvironmentLightAdapter(AdapterSharedState* statePtr)
: HdNukeAdapter(statePtr)
{
}
HdNukeEnvironmentLightAdapter::~HdNukeEnvironmentLightAdapter()
{
}
bool HdNukeEnvironmentLightAdapter::SetUp(HdNukeAdapterManager* manager, const VtValue& nukeData)
{
if (!TF_VERIFY(nukeData.IsHolding<DD::Image::LightOp*>(),
"HdNukeEnvironmentLightAdapter expects a LightOp")) {
return false;
}
_lightOp = nukeData.UncheckedGet<DD::Image::LightOp*>();
_hash = _lightOp->hash();
HdNukeSceneDelegate* sceneDelegate = manager->GetSceneDelegate();
HdRenderIndex& renderIndex = sceneDelegate->GetRenderIndex();
_envMapIop = static_cast<DD::Image::Iop*>(_lightOp->input_op(1));
bool envMapUsable = true;
if (_envMapIop != nullptr) {
envMapUsable = uploadTexture(renderIndex);
}
renderIndex.InsertSprim(HdPrimTypeTokens->domeLight, sceneDelegate, GetPath());
return envMapUsable;
}
bool HdNukeEnvironmentLightAdapter::Update(HdNukeAdapterManager* manager, const VtValue& nukeData)
{
if (!TF_VERIFY(nukeData.IsHolding<DD::Image::LightOp*>(),
"HdNukeEnvironmentLightAdapter expects a LightOp")) {
return false;
}
_lightOp = nukeData.UncheckedGet<DD::Image::LightOp*>();
if (_hash == _lightOp->hash()) {
return true;
}
_hash = _lightOp->hash();
HdNukeSceneDelegate* sceneDelegate = manager->GetSceneDelegate();
HdRenderIndex& renderIndex = sceneDelegate->GetRenderIndex();
HdChangeTracker& changeTracker = renderIndex.GetChangeTracker();
_envMapIop = static_cast<DD::Image::Iop*>(_lightOp->input_op(1));
bool envMapUsable = true;
if (_envMapIop != nullptr) {
envMapUsable = uploadTexture(renderIndex);
}
else {
NukeTexturePlugin::Instance().RemoveFile(_assetPath.GetAssetPath());
_assetPath = SdfAssetPath();
_textureResource = nullptr;
}
changeTracker.MarkSprimDirty(GetPath(), DefaultDirtyBits);
return envMapUsable;
}
void HdNukeEnvironmentLightAdapter::TearDown(HdNukeAdapterManager* manager)
{
HdNukeSceneDelegate* sceneDelegate = manager->GetSceneDelegate();
HdRenderIndex& renderIndex = sceneDelegate->GetRenderIndex();
renderIndex.RemoveSprim(HdPrimTypeTokens->domeLight, GetPath());
NukeTexturePlugin::Instance().RemoveFile(_assetPath.GetAssetPath());
_assetPath = SdfAssetPath();
_textureResource = nullptr;
}
VtValue HdNukeEnvironmentLightAdapter::Get(const TfToken& key) const
{
if (key == HdLightTokens->textureFile) {
return VtValue{_assetPath};
}
if (key == HdLightTokens->textureResource && _textureResource != nullptr) {
return VtValue{_textureResource};
}
if (key == HdTokens->transform) {
// Dome lights seem to need its transform flipped on the x and y axis.
static const GfMatrix4d flipMatrix(GfVec4d(-1.0, -1.0, 1.0, 1.0));
return VtValue{flipMatrix * DDToGfMatrix4d(_lightOp->matrix())};
}
return HdNukeAdapter::Get(key);
}
namespace
{
static HdTextureResourceSharedPtr GetFileTextureResource(const TfToken& filePath, int maxTextureMemory = 4 * 1024 * 1024)
{
#if PXR_METAL_SUPPORT_ENABLED
GarchTextureHandleRefPtr texture =
GarchTextureRegistry::GetInstance().GetTextureHandle(
filePath,
#if PXR_VERSION >= 2105
HioImage::ImageOriginLocation::OriginUpperLeft);
#else
GarchImage::ImageOriginLocation::OriginUpperLeft);
#endif
return HdTextureResourceSharedPtr(
HdStResourceFactory::GetInstance()->NewSimpleTextureResource(texture, HdTextureType::Uv,
HdWrap::HdWrapRepeat, HdWrap::HdWrapRepeat,
HdWrap::HdWrapRepeat, HdMinFilter::HdMinFilterLinear,
HdMagFilter::HdMagFilterLinear,
0));
#else
GlfTextureHandleRefPtr texture =
GlfTextureRegistry::GetInstance().GetTextureHandle(
filePath,
GlfImage::ImageOriginLocation::OriginUpperLeft);
return HdTextureResourceSharedPtr(
new HdStSimpleTextureResource(texture, HdTextureType::Uv,
HdWrap::HdWrapRepeat, HdWrap::HdWrapRepeat,
HdWrap::HdWrapRepeat, HdMinFilter::HdMinFilterLinear,
HdMagFilter::HdMagFilterLinear,
0));
#endif
}
}
bool HdNukeEnvironmentLightAdapter::uploadTexture(HdRenderIndex& renderIndex)
{
HdResourceRegistrySharedPtr registry = renderIndex.GetResourceRegistry();
_envMapIop->set_texturemap(GetSharedState()->_viewerContext, true);
auto textureMap = _envMapIop->get_texturemap(GetSharedState()->_viewerContext);
_envMapIop->unset_texturemap(GetSharedState()->_viewerContext);
if (textureMap.buffer == nullptr) {
return false;
}
std::string filename = _envMapIop->node_name() + ".nuke";
auto file = NukeTexturePlugin::Instance().GetFile(filename);
if (file == nullptr) {
NukeTexturePlugin::Instance().AddFile(filename, textureMap);
}
TfToken filenameToken{filename};
_textureResource = GetFileTextureResource(filenameToken);
_assetPath = SdfAssetPath(filenameToken, filenameToken);
registry->ReloadResource(HdResourceTypeTokens->texture, _assetPath.GetAssetPath());
return true;
}
const TfToken& HdNukeEnvironmentLightAdapter::GetPrimType() const
{
return HdPrimTypeTokens->domeLight;
}
const HdDirtyBits HdNukeEnvironmentLightAdapter::DefaultDirtyBits =
HdLight::DirtyTransform | HdLight::DirtyParams | HdLight::DirtyShadowParams;
class EnvironmentLightCreator : public HdNukeAdapterFactory::AdapterCreator { public:
HdNukeAdapterPtr Create(AdapterSharedState *sharedState) override
{
return std::make_shared<HdNukeEnvironmentLightAdapter>(sharedState);
}
};
static const AdapterRegister<EnvironmentLightCreator> sRegisterEnvironmentCreator(HdNukeAdapterManagerPrimTypes->Environment);
PXR_NAMESPACE_CLOSE_SCOPE
| 33.864078 | 126 | 0.707856 | [
"transform"
] |
f2e5b03a23572e07417ae66f3935d946d8b12e03 | 5,375 | cpp | C++ | command/src/CommandPool.cpp | fuchstraumer/VulpesRender | 44ea76d68ae90c7eab754690a60e8361165698cd | [
"MIT"
] | 35 | 2017-10-18T19:01:49.000Z | 2022-03-07T00:11:01.000Z | command/src/CommandPool.cpp | fuchstraumer/VulpesRender | 44ea76d68ae90c7eab754690a60e8361165698cd | [
"MIT"
] | 13 | 2018-01-09T20:05:00.000Z | 2019-09-23T22:55:30.000Z | command/src/CommandPool.cpp | fuchstraumer/VulpesRender | 44ea76d68ae90c7eab754690a60e8361165698cd | [
"MIT"
] | 3 | 2018-01-14T00:35:45.000Z | 2019-08-24T01:30:36.000Z | #include "vpr_stdafx.h"
#include "CommandPool.hpp"
#include "vkAssert.hpp"
#include "CreateInfoBase.hpp"
#include "easylogging++.h"
#if !defined(VPR_BUILD_STATIC)
INITIALIZE_EASYLOGGINGPP
#endif
#include <vector>
namespace vpr
{
void SetLoggingRepository_VprCommand(void* repo) {
el::Helpers::setStorage(*(el::base::type::StoragePointer*)repo);
LOG(INFO) << "Updating easyloggingpp storage pointer in vpr_command module...";
}
struct CommandBuffers {
std::vector<VkCommandBuffer> Data;
};
CommandPool::CommandPool(const VkDevice _parent, const VkCommandPoolCreateInfo & create_info) : parent(_parent), handle(VK_NULL_HANDLE), cmdBuffers(std::make_unique<CommandBuffers>()) {
vkCreateCommandPool(parent, &create_info, nullptr, &handle);
}
void CommandPool::ResetCmdPool(const VkCommandPoolResetFlagBits command_pool_reset_flags)
{
vkResetCommandPool(parent, handle, command_pool_reset_flags);
}
CommandPool::CommandPool(CommandPool && other) noexcept
{
handle = std::move(other.handle);
cmdBuffers = std::move(other.cmdBuffers);
parent = std::move(other.parent);
other.handle = VK_NULL_HANDLE;
}
CommandPool & CommandPool::operator=(CommandPool && other) noexcept
{
handle = std::move(other.handle);
cmdBuffers = std::move(other.cmdBuffers);
parent = std::move(other.parent);
other.handle = VK_NULL_HANDLE;
return *this;
}
CommandPool::~CommandPool()
{
destroy();
}
void CommandPool::destroy()
{
if (!cmdBuffers->Data.empty())
{
FreeCommandBuffers();
}
if (handle != VK_NULL_HANDLE)
{
vkDestroyCommandPool(parent, handle, nullptr);
LOG_IF(VERBOSE_LOGGING, INFO) << "Command Pool " << handle << " destroyed.";
handle = VK_NULL_HANDLE;
}
}
void CommandPool::AllocateCmdBuffers(const uint32_t num_buffers, const VkCommandBufferLevel cmd_buffer_level)
{
if (!cmdBuffers->Data.empty())
{
return;
}
cmdBuffers->Data.resize(num_buffers);
VkCommandBufferAllocateInfo alloc_info = vk_command_buffer_allocate_info_base;
alloc_info.commandPool = handle;
alloc_info.commandBufferCount = num_buffers;
alloc_info.level = cmd_buffer_level;
VkResult result = vkAllocateCommandBuffers(parent, &alloc_info, cmdBuffers->Data.data());
LOG_IF(VERBOSE_LOGGING, INFO) << std::to_string(num_buffers) << " command buffers allocated for command pool " << handle;
VkAssert(result);
}
void CommandPool::FreeCommandBuffers()
{
vkFreeCommandBuffers(parent, handle, static_cast<uint32_t>(cmdBuffers->Data.size()), cmdBuffers->Data.data());
LOG_IF(VERBOSE_LOGGING, INFO) << std::to_string(cmdBuffers->Data.size()) << " command buffers freed.";
cmdBuffers->Data.clear();
cmdBuffers->Data.shrink_to_fit();
}
void CommandPool::ResetCmdBuffer(const size_t idx, const VkCommandBufferResetFlagBits command_buffer_reset_flag_bits)
{
vkResetCommandBuffer(cmdBuffers->Data[idx], command_buffer_reset_flag_bits);
}
const VkCommandPool& CommandPool::vkHandle() const noexcept
{
return handle;
}
const VkCommandBuffer* CommandPool::GetCommandBuffers(const size_t offset) const
{
return &cmdBuffers->Data[offset];
}
VkCommandBuffer& CommandPool::operator[](const size_t idx)
{
return cmdBuffers->Data[idx];
}
VkCommandBuffer& CommandPool::GetCmdBuffer(const size_t idx)
{
return cmdBuffers->Data[idx];
}
VkCommandBuffer CommandPool::StartSingleCmdBuffer()
{
VkCommandBufferAllocateInfo allocInfo = {};
allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
allocInfo.commandPool = handle;
allocInfo.commandBufferCount = 1;
VkCommandBuffer commandBuffer;
vkAllocateCommandBuffers(parent, &allocInfo, &commandBuffer);
VkCommandBufferBeginInfo beginInfo = {};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
beginInfo.pInheritanceInfo = nullptr;
vkBeginCommandBuffer(commandBuffer, &beginInfo);
return commandBuffer;
}
void CommandPool::EndSingleCmdBuffer(VkCommandBuffer& cmd_buffer, const VkQueue& queue)
{
VkResult result = vkEndCommandBuffer(cmd_buffer);
VkAssert(result);
VkSubmitInfo submitInfo = {};
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &cmd_buffer;
result = vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE);
VkAssert(result);
vkQueueWaitIdle(queue);
result = vkResetCommandBuffer(cmd_buffer, VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT);
VkAssert(result);
}
const size_t CommandPool::size() const noexcept
{
return cmdBuffers->Data.size();
}
const VkCommandBuffer* CommandPool::Data() const noexcept
{
return cmdBuffers->Data.data();
}
}
| 31.804734 | 189 | 0.672 | [
"vector"
] |
f2ed406a36f704dcd61a0ce3778334f33e1812dd | 39,167 | cc | C++ | Controllers/Flatground/utils/funcs/kin/mex/J_LeftToeBottomFront_mex.cc | EngineeringIV/CASSIE_MPC | fcbf5559bfd11dbdbb241565585fa22ccdaa5499 | [
"BSD-3-Clause"
] | 61 | 2019-02-21T09:32:55.000Z | 2022-03-29T02:30:18.000Z | Controllers/Flatground/utils/funcs/kin/mex/J_LeftToeBottomFront_mex.cc | EngineeringIV/CASSIE_MPC | fcbf5559bfd11dbdbb241565585fa22ccdaa5499 | [
"BSD-3-Clause"
] | 3 | 2019-02-22T08:01:40.000Z | 2022-01-20T09:16:40.000Z | Controllers/Flatground/utils/funcs/kin/mex/J_LeftToeBottomFront_mex.cc | EngineeringIV/CASSIE_MPC | fcbf5559bfd11dbdbb241565585fa22ccdaa5499 | [
"BSD-3-Clause"
] | 28 | 2019-02-04T19:47:35.000Z | 2022-02-23T08:28:23.000Z | /*
* Automatically Generated from Mathematica.
* Mon 25 Jun 2018 14:53:40 GMT-04:00
*/
#ifdef MATLAB_MEX_FILE
#include <stdexcept>
#include <cmath>
/**
* Copied from Wolfram Mathematica C Definitions file mdefs.hpp
* Changed marcos to inline functions (Eric Cousineau)
*/
inline double Power(double x, double y) { return pow(x, y); }
inline double Sqrt(double x) { return sqrt(x); }
inline double Abs(double x) { return fabs(x); }
inline double Exp(double x) { return exp(x); }
inline double Log(double x) { return log(x); }
inline double Sin(double x) { return sin(x); }
inline double Cos(double x) { return cos(x); }
inline double Tan(double x) { return tan(x); }
inline double ArcSin(double x) { return asin(x); }
inline double ArcCos(double x) { return acos(x); }
inline double ArcTan(double x) { return atan(x); }
/* update ArcTan function to use atan2 instead. */
inline double ArcTan(double x, double y) { return atan2(y,x); }
inline double Sinh(double x) { return sinh(x); }
inline double Cosh(double x) { return cosh(x); }
inline double Tanh(double x) { return tanh(x); }
const double E = 2.71828182845904523536029;
const double Pi = 3.14159265358979323846264;
const double Degree = 0.01745329251994329576924;
#endif
/*
* Sub functions
*/
static void output1(double *p_output1,const double *var1)
{
double t835;
double t911;
double t917;
double t809;
double t1022;
double t469;
double t883;
double t1153;
double t1292;
double t1300;
double t1336;
double t1456;
double t1489;
double t1957;
double t2065;
double t2154;
double t2206;
double t1557;
double t1717;
double t1846;
double t2326;
double t2707;
double t2725;
double t2789;
double t2819;
double t2620;
double t2630;
double t2632;
double t2974;
double t2992;
double t3033;
double t3182;
double t3297;
double t3329;
double t3368;
double t3481;
double t3486;
double t3577;
double t3667;
double t3718;
double t3731;
double t3802;
double t4174;
double t4357;
double t4450;
double t4739;
double t4767;
double t4833;
double t5520;
double t5524;
double t5566;
double t5736;
double t5826;
double t5903;
double t5980;
double t6291;
double t6301;
double t6352;
double t6457;
double t6472;
double t6500;
double t6522;
double t6531;
double t6546;
double t6608;
double t6647;
double t6650;
double t6664;
double t6730;
double t6737;
double t6762;
double t476;
double t650;
double t769;
double t803;
double t1493;
double t1494;
double t6920;
double t6932;
double t6942;
double t6955;
double t6958;
double t6970;
double t2193;
double t2290;
double t2291;
double t2333;
double t2336;
double t2388;
double t6988;
double t7002;
double t7006;
double t2814;
double t2821;
double t2872;
double t3041;
double t3047;
double t3074;
double t3350;
double t3395;
double t3435;
double t7098;
double t7109;
double t7110;
double t7138;
double t7155;
double t7179;
double t3606;
double t3625;
double t3644;
double t4437;
double t4454;
double t4685;
double t7217;
double t7224;
double t7226;
double t7261;
double t7269;
double t7277;
double t4971;
double t5025;
double t5443;
double t5965;
double t6083;
double t6167;
double t7286;
double t7291;
double t7294;
double t7308;
double t7311;
double t7336;
double t6368;
double t6396;
double t6438;
double t6574;
double t6621;
double t6636;
double t7345;
double t7355;
double t7368;
double t7383;
double t7397;
double t7418;
double t6682;
double t6701;
double t6715;
double t7434;
double t7443;
double t7453;
double t7464;
double t7468;
double t7470;
double t7557;
double t7564;
double t7569;
double t7638;
double t7642;
double t7646;
double t7654;
double t7657;
double t7660;
double t7662;
double t7666;
double t7673;
double t7679;
double t7682;
double t7687;
double t7691;
double t7693;
double t7696;
double t7708;
double t7709;
double t7713;
double t7718;
double t7719;
double t7721;
double t7726;
double t7727;
double t7738;
double t7745;
double t7747;
double t7751;
double t7756;
double t7759;
double t7760;
double t7799;
double t7801;
double t7804;
double t7827;
double t7829;
double t7830;
double t7839;
double t7849;
double t7850;
double t7856;
double t7858;
double t7860;
double t7868;
double t7870;
double t7871;
double t7877;
double t7878;
double t7881;
double t7885;
double t7886;
double t7887;
double t7889;
double t7893;
double t7896;
double t7900;
double t7901;
double t7903;
double t7910;
double t7913;
double t7916;
double t7921;
double t7932;
double t7933;
double t7965;
double t7968;
double t7972;
double t7981;
double t7982;
double t7985;
double t7994;
double t7996;
double t7998;
double t8001;
double t8002;
double t8004;
double t8011;
double t8014;
double t8015;
double t8021;
double t8023;
double t8027;
double t8032;
double t8035;
double t8037;
double t8041;
double t8043;
double t8047;
double t8051;
double t8052;
double t8055;
double t8057;
double t8059;
double t8060;
double t8064;
double t8066;
double t8068;
double t8099;
double t8100;
double t8104;
double t8108;
double t8111;
double t8118;
double t8120;
double t8121;
double t8127;
double t8129;
double t8130;
double t8134;
double t8137;
double t8138;
double t8140;
double t8143;
double t8144;
double t8150;
double t8152;
double t8156;
double t8158;
double t8161;
double t8162;
double t8164;
double t8166;
double t8167;
double t8173;
double t8177;
double t8179;
double t8181;
double t8182;
double t8185;
double t8203;
double t8204;
double t8205;
double t8211;
double t8213;
double t8216;
double t8226;
double t8227;
double t8232;
double t8233;
double t8235;
double t8238;
double t8239;
double t8240;
double t8242;
double t8244;
double t8245;
double t8249;
double t8250;
double t8254;
double t8258;
double t8259;
double t8260;
double t8262;
double t8263;
double t8264;
double t8266;
double t8268;
double t8271;
double t8278;
double t8279;
double t8285;
double t8306;
double t8307;
double t8310;
double t8318;
double t8319;
double t8320;
double t8322;
double t8323;
double t8324;
double t8326;
double t8327;
double t8328;
double t8330;
double t8332;
double t8333;
double t8337;
double t8338;
double t8340;
double t8342;
double t8343;
double t8346;
double t8351;
double t8354;
double t8355;
double t8360;
double t8361;
double t8362;
double t8365;
double t8366;
double t8369;
double t8394;
double t8395;
double t8399;
double t8402;
double t8403;
double t8405;
double t8406;
double t8407;
double t8410;
double t8411;
double t8412;
double t8414;
double t8416;
double t8417;
double t8422;
double t8423;
double t8425;
double t8427;
double t8428;
double t8429;
double t8432;
double t8433;
double t8435;
double t8439;
double t8440;
double t8441;
double t8453;
double t8454;
double t8455;
double t8458;
double t8459;
double t8466;
double t8467;
double t8469;
double t8470;
double t8471;
double t8473;
double t8474;
double t8475;
double t8477;
double t8478;
double t8480;
double t8483;
double t8486;
double t8487;
double t8490;
double t8491;
double t8494;
double t8496;
double t8497;
double t8498;
double t8500;
double t8501;
double t8502;
double t8504;
double t8505;
double t8506;
double t8313;
double t8316;
double t8317;
double t8321;
double t8325;
double t8329;
double t8335;
double t8341;
double t8349;
double t8359;
double t8363;
double t8371;
double t8372;
double t8374;
double t8375;
double t8378;
double t8379;
double t8382;
double t8384;
double t8385;
double t7074;
double t7080;
double t7092;
double t8542;
double t8544;
double t8545;
double t8547;
double t8548;
double t8549;
double t8551;
double t8552;
double t8554;
double t8558;
double t8560;
double t8561;
double t8564;
double t8565;
double t8567;
double t8569;
double t8570;
double t8571;
double t8527;
double t8528;
double t8529;
double t8531;
double t8532;
double t8589;
double t8590;
double t8591;
double t8593;
double t8594;
double t8595;
double t8602;
double t8603;
double t8604;
double t8607;
double t8608;
double t8609;
double t8611;
double t8612;
double t8613;
double t8615;
double t8616;
double t8617;
double t8620;
double t8621;
double t8622;
double t8624;
double t8625;
double t8626;
double t8638;
double t8639;
double t8640;
double t8642;
double t8643;
double t8644;
double t8652;
double t8653;
double t8654;
double t8656;
double t8657;
double t8658;
double t8660;
double t8661;
double t8662;
double t8664;
double t8665;
double t8666;
double t8668;
double t8669;
double t8670;
double t8672;
double t8673;
double t8674;
double t8692;
double t8693;
double t8694;
double t8697;
double t8698;
double t8700;
double t8701;
double t8702;
double t8704;
double t8705;
double t8706;
double t8708;
double t8709;
double t8710;
double t8712;
double t8713;
double t8714;
double t8716;
double t8717;
double t8718;
double t8685;
double t8686;
double t8688;
double t8689;
double t8690;
double t8730;
double t8731;
double t8732;
double t8734;
double t8735;
double t8736;
double t8738;
double t8739;
double t8740;
double t8742;
double t8743;
double t8744;
double t8746;
double t8747;
double t8748;
double t8750;
double t8751;
double t8752;
double t8754;
double t8755;
double t8756;
double t8758;
double t8759;
double t8760;
double t8762;
double t8763;
double t8764;
double t8776;
double t8777;
double t8778;
double t8780;
double t8781;
double t8782;
double t8784;
double t8785;
double t8786;
double t8788;
double t8789;
double t8790;
double t8792;
double t8793;
double t8794;
double t8796;
double t8797;
double t8798;
double t8800;
double t8801;
double t8802;
double t8804;
double t8805;
double t8806;
double t8808;
double t8809;
double t8810;
double t8829;
double t8830;
double t8832;
double t8833;
double t8834;
double t8836;
double t8837;
double t8839;
double t8840;
double t8841;
double t8843;
double t8844;
double t8845;
double t8821;
double t8822;
double t8823;
double t8825;
double t8826;
double t8856;
double t8857;
double t8858;
double t8861;
double t8862;
double t8864;
double t8865;
double t8867;
double t8868;
double t8869;
double t8871;
double t8872;
double t8873;
double t8875;
double t8876;
double t8877;
double t8879;
double t8880;
double t8881;
double t8892;
double t8893;
double t8894;
double t8897;
double t8898;
double t8900;
double t8901;
double t8903;
double t8904;
double t8905;
double t8907;
double t8908;
double t8909;
double t8911;
double t8912;
double t8913;
double t8915;
double t8916;
double t8917;
double t8935;
double t8936;
double t8939;
double t8940;
double t8942;
double t8943;
double t8944;
double t8928;
double t8929;
double t8931;
double t8932;
double t8933;
double t8956;
double t8957;
double t8958;
double t8960;
double t8961;
double t8963;
double t8964;
double t8966;
double t8967;
double t8968;
double t8970;
double t8971;
double t8972;
double t8984;
double t8985;
double t8986;
double t8988;
double t8989;
double t8991;
double t8992;
double t8994;
double t8995;
double t8996;
double t8998;
double t8999;
double t9000;
double t9019;
double t9020;
double t7500;
double t9011;
double t9012;
double t9013;
double t9015;
double t9016;
double t9030;
double t9031;
double t9032;
double t9035;
double t9036;
double t9038;
double t9039;
double t9050;
double t9051;
double t9052;
double t9055;
double t9056;
double t9058;
double t9059;
double t9022;
double t7516;
double t7519;
double t9070;
double t9071;
double t9073;
double t9074;
double t9075;
double t9041;
double t9083;
double t9084;
double t9085;
double t9045;
double t9061;
double t9095;
double t9096;
double t9097;
double t9065;
t835 = Cos(var1[5]);
t911 = Sin(var1[3]);
t917 = Sin(var1[4]);
t809 = Cos(var1[3]);
t1022 = Sin(var1[5]);
t469 = Cos(var1[6]);
t883 = -1.*t809*t835;
t1153 = -1.*t911*t917*t1022;
t1292 = t883 + t1153;
t1300 = -1.*t835*t911*t917;
t1336 = t809*t1022;
t1456 = t1300 + t1336;
t1489 = Sin(var1[6]);
t1957 = Cos(var1[7]);
t2065 = -1.*t1957;
t2154 = 1. + t2065;
t2206 = Sin(var1[7]);
t1557 = t469*t1292;
t1717 = t1456*t1489;
t1846 = t1557 + t1717;
t2326 = Cos(var1[4]);
t2707 = Cos(var1[8]);
t2725 = -1.*t2707;
t2789 = 1. + t2725;
t2819 = Sin(var1[8]);
t2620 = -1.*t2326*t1957*t911;
t2630 = t1846*t2206;
t2632 = t2620 + t2630;
t2974 = t469*t1456;
t2992 = -1.*t1292*t1489;
t3033 = t2974 + t2992;
t3182 = Cos(var1[9]);
t3297 = -1.*t3182;
t3329 = 1. + t3297;
t3368 = Sin(var1[9]);
t3481 = t2707*t2632;
t3486 = t3033*t2819;
t3577 = t3481 + t3486;
t3667 = t2707*t3033;
t3718 = -1.*t2632*t2819;
t3731 = t3667 + t3718;
t3802 = Cos(var1[10]);
t4174 = -1.*t3802;
t4357 = 1. + t4174;
t4450 = Sin(var1[10]);
t4739 = -1.*t3368*t3577;
t4767 = t3182*t3731;
t4833 = t4739 + t4767;
t5520 = t3182*t3577;
t5524 = t3368*t3731;
t5566 = t5520 + t5524;
t5736 = Cos(var1[11]);
t5826 = -1.*t5736;
t5903 = 1. + t5826;
t5980 = Sin(var1[11]);
t6291 = t4450*t4833;
t6301 = t3802*t5566;
t6352 = t6291 + t6301;
t6457 = t3802*t4833;
t6472 = -1.*t4450*t5566;
t6500 = t6457 + t6472;
t6522 = Cos(var1[12]);
t6531 = -1.*t6522;
t6546 = 1. + t6531;
t6608 = Sin(var1[12]);
t6647 = -1.*t5980*t6352;
t6650 = t5736*t6500;
t6664 = t6647 + t6650;
t6730 = t5736*t6352;
t6737 = t5980*t6500;
t6762 = t6730 + t6737;
t476 = -1.*t469;
t650 = 1. + t476;
t769 = 0.135*t650;
t803 = 0. + t769;
t1493 = -0.135*t1489;
t1494 = 0. + t1493;
t6920 = -1.*t835*t911;
t6932 = t809*t917*t1022;
t6942 = t6920 + t6932;
t6955 = t809*t835*t917;
t6958 = t911*t1022;
t6970 = t6955 + t6958;
t2193 = 0.135*t2154;
t2290 = 0.049*t2206;
t2291 = 0. + t2193 + t2290;
t2333 = -0.049*t2154;
t2336 = 0.135*t2206;
t2388 = 0. + t2333 + t2336;
t6988 = t469*t6942;
t7002 = t6970*t1489;
t7006 = t6988 + t7002;
t2814 = -0.049*t2789;
t2821 = -0.09*t2819;
t2872 = 0. + t2814 + t2821;
t3041 = -0.09*t2789;
t3047 = 0.049*t2819;
t3074 = 0. + t3041 + t3047;
t3350 = -0.049*t3329;
t3395 = -0.21*t3368;
t3435 = 0. + t3350 + t3395;
t7098 = t809*t2326*t1957;
t7109 = t7006*t2206;
t7110 = t7098 + t7109;
t7138 = t469*t6970;
t7155 = -1.*t6942*t1489;
t7179 = t7138 + t7155;
t3606 = -0.21*t3329;
t3625 = 0.049*t3368;
t3644 = 0. + t3606 + t3625;
t4437 = -0.2707*t4357;
t4454 = 0.0016*t4450;
t4685 = 0. + t4437 + t4454;
t7217 = t2707*t7110;
t7224 = t7179*t2819;
t7226 = t7217 + t7224;
t7261 = t2707*t7179;
t7269 = -1.*t7110*t2819;
t7277 = t7261 + t7269;
t4971 = -0.0016*t4357;
t5025 = -0.2707*t4450;
t5443 = 0. + t4971 + t5025;
t5965 = 0.0184*t5903;
t6083 = -0.7055*t5980;
t6167 = 0. + t5965 + t6083;
t7286 = -1.*t3368*t7226;
t7291 = t3182*t7277;
t7294 = t7286 + t7291;
t7308 = t3182*t7226;
t7311 = t3368*t7277;
t7336 = t7308 + t7311;
t6368 = -0.7055*t5903;
t6396 = -0.0184*t5980;
t6438 = 0. + t6368 + t6396;
t6574 = -1.1135*t6546;
t6621 = 0.0216*t6608;
t6636 = 0. + t6574 + t6621;
t7345 = t4450*t7294;
t7355 = t3802*t7336;
t7368 = t7345 + t7355;
t7383 = t3802*t7294;
t7397 = -1.*t4450*t7336;
t7418 = t7383 + t7397;
t6682 = -0.0216*t6546;
t6701 = -1.1135*t6608;
t6715 = 0. + t6682 + t6701;
t7434 = -1.*t5980*t7368;
t7443 = t5736*t7418;
t7453 = t7434 + t7443;
t7464 = t5736*t7368;
t7468 = t5980*t7418;
t7470 = t7464 + t7468;
t7557 = t809*t2326*t469*t1022;
t7564 = t809*t2326*t835*t1489;
t7569 = t7557 + t7564;
t7638 = -1.*t809*t1957*t917;
t7642 = t7569*t2206;
t7646 = t7638 + t7642;
t7654 = t809*t2326*t835*t469;
t7657 = -1.*t809*t2326*t1022*t1489;
t7660 = t7654 + t7657;
t7662 = t2707*t7646;
t7666 = t7660*t2819;
t7673 = t7662 + t7666;
t7679 = t2707*t7660;
t7682 = -1.*t7646*t2819;
t7687 = t7679 + t7682;
t7691 = -1.*t3368*t7673;
t7693 = t3182*t7687;
t7696 = t7691 + t7693;
t7708 = t3182*t7673;
t7709 = t3368*t7687;
t7713 = t7708 + t7709;
t7718 = t4450*t7696;
t7719 = t3802*t7713;
t7721 = t7718 + t7719;
t7726 = t3802*t7696;
t7727 = -1.*t4450*t7713;
t7738 = t7726 + t7727;
t7745 = -1.*t5980*t7721;
t7747 = t5736*t7738;
t7751 = t7745 + t7747;
t7756 = t5736*t7721;
t7759 = t5980*t7738;
t7760 = t7756 + t7759;
t7799 = t2326*t469*t911*t1022;
t7801 = t2326*t835*t911*t1489;
t7804 = t7799 + t7801;
t7827 = -1.*t1957*t911*t917;
t7829 = t7804*t2206;
t7830 = t7827 + t7829;
t7839 = t2326*t835*t469*t911;
t7849 = -1.*t2326*t911*t1022*t1489;
t7850 = t7839 + t7849;
t7856 = t2707*t7830;
t7858 = t7850*t2819;
t7860 = t7856 + t7858;
t7868 = t2707*t7850;
t7870 = -1.*t7830*t2819;
t7871 = t7868 + t7870;
t7877 = -1.*t3368*t7860;
t7878 = t3182*t7871;
t7881 = t7877 + t7878;
t7885 = t3182*t7860;
t7886 = t3368*t7871;
t7887 = t7885 + t7886;
t7889 = t4450*t7881;
t7893 = t3802*t7887;
t7896 = t7889 + t7893;
t7900 = t3802*t7881;
t7901 = -1.*t4450*t7887;
t7903 = t7900 + t7901;
t7910 = -1.*t5980*t7896;
t7913 = t5736*t7903;
t7916 = t7910 + t7913;
t7921 = t5736*t7896;
t7932 = t5980*t7903;
t7933 = t7921 + t7932;
t7965 = -1.*t469*t917*t1022;
t7968 = -1.*t835*t917*t1489;
t7972 = t7965 + t7968;
t7981 = -1.*t2326*t1957;
t7982 = t7972*t2206;
t7985 = t7981 + t7982;
t7994 = -1.*t835*t469*t917;
t7996 = t917*t1022*t1489;
t7998 = t7994 + t7996;
t8001 = t2707*t7985;
t8002 = t7998*t2819;
t8004 = t8001 + t8002;
t8011 = t2707*t7998;
t8014 = -1.*t7985*t2819;
t8015 = t8011 + t8014;
t8021 = -1.*t3368*t8004;
t8023 = t3182*t8015;
t8027 = t8021 + t8023;
t8032 = t3182*t8004;
t8035 = t3368*t8015;
t8037 = t8032 + t8035;
t8041 = t4450*t8027;
t8043 = t3802*t8037;
t8047 = t8041 + t8043;
t8051 = t3802*t8027;
t8052 = -1.*t4450*t8037;
t8055 = t8051 + t8052;
t8057 = -1.*t5980*t8047;
t8059 = t5736*t8055;
t8060 = t8057 + t8059;
t8064 = t5736*t8047;
t8066 = t5980*t8055;
t8068 = t8064 + t8066;
t8099 = t835*t911;
t8100 = -1.*t809*t917*t1022;
t8104 = t8099 + t8100;
t8108 = t8104*t1489;
t8111 = t7138 + t8108;
t8118 = t469*t8104;
t8120 = -1.*t6970*t1489;
t8121 = t8118 + t8120;
t8127 = t2707*t8111*t2206;
t8129 = t8121*t2819;
t8130 = t8127 + t8129;
t8134 = t2707*t8121;
t8137 = -1.*t8111*t2206*t2819;
t8138 = t8134 + t8137;
t8140 = -1.*t3368*t8130;
t8143 = t3182*t8138;
t8144 = t8140 + t8143;
t8150 = t3182*t8130;
t8152 = t3368*t8138;
t8156 = t8150 + t8152;
t8158 = t4450*t8144;
t8161 = t3802*t8156;
t8162 = t8158 + t8161;
t8164 = t3802*t8144;
t8166 = -1.*t4450*t8156;
t8167 = t8164 + t8166;
t8173 = -1.*t5980*t8162;
t8177 = t5736*t8167;
t8179 = t8173 + t8177;
t8181 = t5736*t8162;
t8182 = t5980*t8167;
t8185 = t8181 + t8182;
t8203 = t835*t911*t917;
t8204 = -1.*t809*t1022;
t8205 = t8203 + t8204;
t8211 = t469*t8205;
t8213 = t1292*t1489;
t8216 = t8211 + t8213;
t8226 = -1.*t8205*t1489;
t8227 = t1557 + t8226;
t8232 = t2707*t8216*t2206;
t8233 = t8227*t2819;
t8235 = t8232 + t8233;
t8238 = t2707*t8227;
t8239 = -1.*t8216*t2206*t2819;
t8240 = t8238 + t8239;
t8242 = -1.*t3368*t8235;
t8244 = t3182*t8240;
t8245 = t8242 + t8244;
t8249 = t3182*t8235;
t8250 = t3368*t8240;
t8254 = t8249 + t8250;
t8258 = t4450*t8245;
t8259 = t3802*t8254;
t8260 = t8258 + t8259;
t8262 = t3802*t8245;
t8263 = -1.*t4450*t8254;
t8264 = t8262 + t8263;
t8266 = -1.*t5980*t8260;
t8268 = t5736*t8264;
t8271 = t8266 + t8268;
t8278 = t5736*t8260;
t8279 = t5980*t8264;
t8285 = t8278 + t8279;
t8306 = t2326*t835*t469;
t8307 = -1.*t2326*t1022*t1489;
t8310 = t8306 + t8307;
t8318 = -1.*t2326*t469*t1022;
t8319 = -1.*t2326*t835*t1489;
t8320 = t8318 + t8319;
t8322 = t2707*t8310*t2206;
t8323 = t8320*t2819;
t8324 = t8322 + t8323;
t8326 = t2707*t8320;
t8327 = -1.*t8310*t2206*t2819;
t8328 = t8326 + t8327;
t8330 = -1.*t3368*t8324;
t8332 = t3182*t8328;
t8333 = t8330 + t8332;
t8337 = t3182*t8324;
t8338 = t3368*t8328;
t8340 = t8337 + t8338;
t8342 = t4450*t8333;
t8343 = t3802*t8340;
t8346 = t8342 + t8343;
t8351 = t3802*t8333;
t8354 = -1.*t4450*t8340;
t8355 = t8351 + t8354;
t8360 = -1.*t5980*t8346;
t8361 = t5736*t8355;
t8362 = t8360 + t8361;
t8365 = t5736*t8346;
t8366 = t5980*t8355;
t8369 = t8365 + t8366;
t8394 = -1.*t469*t6942;
t8395 = t8394 + t8120;
t8399 = t2707*t7179*t2206;
t8402 = t8395*t2819;
t8403 = t8399 + t8402;
t8405 = t2707*t8395;
t8406 = -1.*t7179*t2206*t2819;
t8407 = t8405 + t8406;
t8410 = -1.*t3368*t8403;
t8411 = t3182*t8407;
t8412 = t8410 + t8411;
t8414 = t3182*t8403;
t8416 = t3368*t8407;
t8417 = t8414 + t8416;
t8422 = t4450*t8412;
t8423 = t3802*t8417;
t8425 = t8422 + t8423;
t8427 = t3802*t8412;
t8428 = -1.*t4450*t8417;
t8429 = t8427 + t8428;
t8432 = -1.*t5980*t8425;
t8433 = t5736*t8429;
t8435 = t8432 + t8433;
t8439 = t5736*t8425;
t8440 = t5980*t8429;
t8441 = t8439 + t8440;
t8453 = t809*t835;
t8454 = t911*t917*t1022;
t8455 = t8453 + t8454;
t8458 = -1.*t8455*t1489;
t8459 = t8211 + t8458;
t8466 = -1.*t469*t8455;
t8467 = t8466 + t8226;
t8469 = t2707*t8459*t2206;
t8470 = t8467*t2819;
t8471 = t8469 + t8470;
t8473 = t2707*t8467;
t8474 = -1.*t8459*t2206*t2819;
t8475 = t8473 + t8474;
t8477 = -1.*t3368*t8471;
t8478 = t3182*t8475;
t8480 = t8477 + t8478;
t8483 = t3182*t8471;
t8486 = t3368*t8475;
t8487 = t8483 + t8486;
t8490 = t4450*t8480;
t8491 = t3802*t8487;
t8494 = t8490 + t8491;
t8496 = t3802*t8480;
t8497 = -1.*t4450*t8487;
t8498 = t8496 + t8497;
t8500 = -1.*t5980*t8494;
t8501 = t5736*t8498;
t8502 = t8500 + t8501;
t8504 = t5736*t8494;
t8505 = t5980*t8498;
t8506 = t8504 + t8505;
t8313 = 0.1305*t1957*t8310;
t8316 = t8310*t2291;
t8317 = t8310*t2206*t2872;
t8321 = t8320*t3074;
t8325 = t3435*t8324;
t8329 = t3644*t8328;
t8335 = t4685*t8333;
t8341 = t5443*t8340;
t8349 = t6167*t8346;
t8359 = t6438*t8355;
t8363 = t6636*t8362;
t8371 = t6715*t8369;
t8372 = t6608*t8362;
t8374 = t6522*t8369;
t8375 = t8372 + t8374;
t8378 = 0.077577*t8375;
t8379 = t6522*t8362;
t8382 = -1.*t6608*t8369;
t8384 = t8379 + t8382;
t8385 = -1.059658*t8384;
t7074 = t1957*t7006;
t7080 = -1.*t809*t2326*t2206;
t7092 = t7074 + t7080;
t8542 = -1.*t2707*t3368*t7092;
t8544 = -1.*t3182*t7092*t2819;
t8545 = t8542 + t8544;
t8547 = t3182*t2707*t7092;
t8548 = -1.*t3368*t7092*t2819;
t8549 = t8547 + t8548;
t8551 = t4450*t8545;
t8552 = t3802*t8549;
t8554 = t8551 + t8552;
t8558 = t3802*t8545;
t8560 = -1.*t4450*t8549;
t8561 = t8558 + t8560;
t8564 = -1.*t5980*t8554;
t8565 = t5736*t8561;
t8567 = t8564 + t8565;
t8569 = t5736*t8554;
t8570 = t5980*t8561;
t8571 = t8569 + t8570;
t8527 = 0.135*t1957;
t8528 = -0.049*t2206;
t8529 = t8527 + t8528;
t8531 = 0.049*t1957;
t8532 = t8531 + t2336;
t8589 = t469*t8455;
t8590 = t8205*t1489;
t8591 = t8589 + t8590;
t8593 = t1957*t8591;
t8594 = -1.*t2326*t911*t2206;
t8595 = t8593 + t8594;
t8602 = -1.*t2707*t3368*t8595;
t8603 = -1.*t3182*t8595*t2819;
t8604 = t8602 + t8603;
t8607 = t3182*t2707*t8595;
t8608 = -1.*t3368*t8595*t2819;
t8609 = t8607 + t8608;
t8611 = t4450*t8604;
t8612 = t3802*t8609;
t8613 = t8611 + t8612;
t8615 = t3802*t8604;
t8616 = -1.*t4450*t8609;
t8617 = t8615 + t8616;
t8620 = -1.*t5980*t8613;
t8621 = t5736*t8617;
t8622 = t8620 + t8621;
t8624 = t5736*t8613;
t8625 = t5980*t8617;
t8626 = t8624 + t8625;
t8638 = t2326*t469*t1022;
t8639 = t2326*t835*t1489;
t8640 = t8638 + t8639;
t8642 = t1957*t8640;
t8643 = t917*t2206;
t8644 = t8642 + t8643;
t8652 = -1.*t2707*t3368*t8644;
t8653 = -1.*t3182*t8644*t2819;
t8654 = t8652 + t8653;
t8656 = t3182*t2707*t8644;
t8657 = -1.*t3368*t8644*t2819;
t8658 = t8656 + t8657;
t8660 = t4450*t8654;
t8661 = t3802*t8658;
t8662 = t8660 + t8661;
t8664 = t3802*t8654;
t8665 = -1.*t4450*t8658;
t8666 = t8664 + t8665;
t8668 = -1.*t5980*t8662;
t8669 = t5736*t8666;
t8670 = t8668 + t8669;
t8672 = t5736*t8662;
t8673 = t5980*t8666;
t8674 = t8672 + t8673;
t8692 = -1.*t2707*t7110;
t8693 = -1.*t7179*t2819;
t8694 = t8692 + t8693;
t8697 = t3368*t8694;
t8698 = t8697 + t7291;
t8700 = t3182*t8694;
t8701 = -1.*t3368*t7277;
t8702 = t8700 + t8701;
t8704 = -1.*t4450*t8698;
t8705 = t3802*t8702;
t8706 = t8704 + t8705;
t8708 = t3802*t8698;
t8709 = t4450*t8702;
t8710 = t8708 + t8709;
t8712 = t5980*t8706;
t8713 = t5736*t8710;
t8714 = t8712 + t8713;
t8716 = t5736*t8706;
t8717 = -1.*t5980*t8710;
t8718 = t8716 + t8717;
t8685 = 0.049*t2707;
t8686 = t8685 + t2821;
t8688 = -0.09*t2707;
t8689 = -0.049*t2819;
t8690 = t8688 + t8689;
t8730 = t2326*t1957*t911;
t8731 = t8591*t2206;
t8732 = t8730 + t8731;
t8734 = -1.*t2707*t8732;
t8735 = -1.*t8459*t2819;
t8736 = t8734 + t8735;
t8738 = t2707*t8459;
t8739 = -1.*t8732*t2819;
t8740 = t8738 + t8739;
t8742 = t3368*t8736;
t8743 = t3182*t8740;
t8744 = t8742 + t8743;
t8746 = t3182*t8736;
t8747 = -1.*t3368*t8740;
t8748 = t8746 + t8747;
t8750 = -1.*t4450*t8744;
t8751 = t3802*t8748;
t8752 = t8750 + t8751;
t8754 = t3802*t8744;
t8755 = t4450*t8748;
t8756 = t8754 + t8755;
t8758 = t5980*t8752;
t8759 = t5736*t8756;
t8760 = t8758 + t8759;
t8762 = t5736*t8752;
t8763 = -1.*t5980*t8756;
t8764 = t8762 + t8763;
t8776 = -1.*t1957*t917;
t8777 = t8640*t2206;
t8778 = t8776 + t8777;
t8780 = -1.*t2707*t8778;
t8781 = -1.*t8310*t2819;
t8782 = t8780 + t8781;
t8784 = t2707*t8310;
t8785 = -1.*t8778*t2819;
t8786 = t8784 + t8785;
t8788 = t3368*t8782;
t8789 = t3182*t8786;
t8790 = t8788 + t8789;
t8792 = t3182*t8782;
t8793 = -1.*t3368*t8786;
t8794 = t8792 + t8793;
t8796 = -1.*t4450*t8790;
t8797 = t3802*t8794;
t8798 = t8796 + t8797;
t8800 = t3802*t8790;
t8801 = t4450*t8794;
t8802 = t8800 + t8801;
t8804 = t5980*t8798;
t8805 = t5736*t8802;
t8806 = t8804 + t8805;
t8808 = t5736*t8798;
t8809 = -1.*t5980*t8802;
t8810 = t8808 + t8809;
t8829 = -1.*t3182*t7226;
t8830 = t8829 + t8701;
t8832 = -1.*t4450*t7294;
t8833 = t3802*t8830;
t8834 = t8832 + t8833;
t8836 = t4450*t8830;
t8837 = t7383 + t8836;
t8839 = t5980*t8834;
t8840 = t5736*t8837;
t8841 = t8839 + t8840;
t8843 = t5736*t8834;
t8844 = -1.*t5980*t8837;
t8845 = t8843 + t8844;
t8821 = -0.21*t3182;
t8822 = -0.049*t3368;
t8823 = t8821 + t8822;
t8825 = 0.049*t3182;
t8826 = t8825 + t3395;
t8856 = t2707*t8732;
t8857 = t8459*t2819;
t8858 = t8856 + t8857;
t8861 = -1.*t3368*t8858;
t8862 = t8861 + t8743;
t8864 = -1.*t3182*t8858;
t8865 = t8864 + t8747;
t8867 = -1.*t4450*t8862;
t8868 = t3802*t8865;
t8869 = t8867 + t8868;
t8871 = t3802*t8862;
t8872 = t4450*t8865;
t8873 = t8871 + t8872;
t8875 = t5980*t8869;
t8876 = t5736*t8873;
t8877 = t8875 + t8876;
t8879 = t5736*t8869;
t8880 = -1.*t5980*t8873;
t8881 = t8879 + t8880;
t8892 = t2707*t8778;
t8893 = t8310*t2819;
t8894 = t8892 + t8893;
t8897 = -1.*t3368*t8894;
t8898 = t8897 + t8789;
t8900 = -1.*t3182*t8894;
t8901 = t8900 + t8793;
t8903 = -1.*t4450*t8898;
t8904 = t3802*t8901;
t8905 = t8903 + t8904;
t8907 = t3802*t8898;
t8908 = t4450*t8901;
t8909 = t8907 + t8908;
t8911 = t5980*t8905;
t8912 = t5736*t8909;
t8913 = t8911 + t8912;
t8915 = t5736*t8905;
t8916 = -1.*t5980*t8909;
t8917 = t8915 + t8916;
t8935 = -1.*t3802*t7336;
t8936 = t8832 + t8935;
t8939 = t5980*t8936;
t8940 = t8939 + t7443;
t8942 = t5736*t8936;
t8943 = -1.*t5980*t7418;
t8944 = t8942 + t8943;
t8928 = 0.0016*t3802;
t8929 = t8928 + t5025;
t8931 = -0.2707*t3802;
t8932 = -0.0016*t4450;
t8933 = t8931 + t8932;
t8956 = t3182*t8858;
t8957 = t3368*t8740;
t8958 = t8956 + t8957;
t8960 = -1.*t3802*t8958;
t8961 = t8867 + t8960;
t8963 = -1.*t4450*t8958;
t8964 = t8871 + t8963;
t8966 = t5980*t8961;
t8967 = t5736*t8964;
t8968 = t8966 + t8967;
t8970 = t5736*t8961;
t8971 = -1.*t5980*t8964;
t8972 = t8970 + t8971;
t8984 = t3182*t8894;
t8985 = t3368*t8786;
t8986 = t8984 + t8985;
t8988 = -1.*t3802*t8986;
t8989 = t8903 + t8988;
t8991 = -1.*t4450*t8986;
t8992 = t8907 + t8991;
t8994 = t5980*t8989;
t8995 = t5736*t8992;
t8996 = t8994 + t8995;
t8998 = t5736*t8989;
t8999 = -1.*t5980*t8992;
t9000 = t8998 + t8999;
t9019 = -1.*t5736*t7368;
t9020 = t9019 + t8943;
t7500 = t6522*t7453;
t9011 = -0.7055*t5736;
t9012 = 0.0184*t5980;
t9013 = t9011 + t9012;
t9015 = -0.0184*t5736;
t9016 = t9015 + t6083;
t9030 = t4450*t8862;
t9031 = t3802*t8958;
t9032 = t9030 + t9031;
t9035 = -1.*t5980*t9032;
t9036 = t9035 + t8967;
t9038 = -1.*t5736*t9032;
t9039 = t9038 + t8971;
t9050 = t4450*t8898;
t9051 = t3802*t8986;
t9052 = t9050 + t9051;
t9055 = -1.*t5980*t9052;
t9056 = t9055 + t8995;
t9058 = -1.*t5736*t9052;
t9059 = t9058 + t8999;
t9022 = -1.*t6608*t7453;
t7516 = -1.*t6608*t7470;
t7519 = t7500 + t7516;
t9070 = 0.0216*t6522;
t9071 = t9070 + t6701;
t9073 = -1.1135*t6522;
t9074 = -0.0216*t6608;
t9075 = t9073 + t9074;
t9041 = -1.*t6608*t9036;
t9083 = t5736*t9032;
t9084 = t5980*t8964;
t9085 = t9083 + t9084;
t9045 = t6522*t9036;
t9061 = -1.*t6608*t9056;
t9095 = t5736*t9052;
t9096 = t5980*t8992;
t9097 = t9095 + t9096;
t9065 = t6522*t9056;
p_output1[0]=1.;
p_output1[1]=0;
p_output1[2]=0;
p_output1[3]=0;
p_output1[4]=1.;
p_output1[5]=0;
p_output1[6]=0;
p_output1[7]=0;
p_output1[8]=1.;
p_output1[9]=t1456*t1494 + t1846*t2291 + t2632*t2872 + t3033*t3074 + t3435*t3577 + t3644*t3731 + t4685*t4833 + t5443*t5566 + t6167*t6352 + t6438*t6500 + t6636*t6664 + t6715*t6762 + 0.077577*(t6608*t6664 + t6522*t6762) - 1.059658*(t6522*t6664 - 1.*t6608*t6762) + t1292*t803 - 1.*t2326*t2388*t911 + 0.1305*(t1846*t1957 + t2206*t2326*t911);
p_output1[10]=t1494*t6970 + t2291*t7006 + 0.1305*t7092 + t2872*t7110 + t3074*t7179 + t3435*t7226 + t3644*t7277 + t4685*t7294 + t5443*t7336 + t6167*t7368 + t6438*t7418 + t6636*t7453 + t6715*t7470 + 0.077577*(t6608*t7453 + t6522*t7470) - 1.059658*t7519 + t6942*t803 + t2326*t2388*t809;
p_output1[11]=0;
p_output1[12]=t2291*t7569 + t2872*t7646 + t3074*t7660 + t3435*t7673 + t3644*t7687 + t4685*t7696 + t5443*t7713 + t6167*t7721 + t6438*t7738 + t6636*t7751 + t6715*t7760 + 0.077577*(t6608*t7751 + t6522*t7760) - 1.059658*(t6522*t7751 - 1.*t6608*t7760) + t1022*t2326*t803*t809 + t1494*t2326*t809*t835 - 1.*t2388*t809*t917 + 0.1305*(t1957*t7569 + t2206*t809*t917);
p_output1[13]=t2291*t7804 + t2872*t7830 + t3074*t7850 + t3435*t7860 + t3644*t7871 + t4685*t7881 + t5443*t7887 + t6167*t7896 + t6438*t7903 + t6636*t7916 + t6715*t7933 + 0.077577*(t6608*t7916 + t6522*t7933) - 1.059658*(t6522*t7916 - 1.*t6608*t7933) + t1022*t2326*t803*t911 + t1494*t2326*t835*t911 - 1.*t2388*t911*t917 + 0.1305*(t1957*t7804 + t2206*t911*t917);
p_output1[14]=-1.*t2326*t2388 + t2291*t7972 + 0.1305*(t2206*t2326 + t1957*t7972) + t2872*t7985 + t3074*t7998 + t3435*t8004 + t3644*t8015 + t4685*t8027 + t5443*t8037 + t6167*t8047 + t6438*t8055 + t6636*t8060 + t6715*t8068 + 0.077577*(t6608*t8060 + t6522*t8068) - 1.059658*(t6522*t8060 - 1.*t6608*t8068) - 1.*t1022*t803*t917 - 1.*t1494*t835*t917;
p_output1[15]=t6970*t803 + t1494*t8104 + 0.1305*t1957*t8111 + t2291*t8111 + t2206*t2872*t8111 + t3074*t8121 + t3435*t8130 + t3644*t8138 + t4685*t8144 + t5443*t8156 + t6167*t8162 + t6438*t8167 + t6636*t8179 + t6715*t8185 + 0.077577*(t6608*t8179 + t6522*t8185) - 1.059658*(t6522*t8179 - 1.*t6608*t8185);
p_output1[16]=t1292*t1494 + t803*t8205 + 0.1305*t1957*t8216 + t2291*t8216 + t2206*t2872*t8216 + t3074*t8227 + t3435*t8235 + t3644*t8240 + t4685*t8245 + t5443*t8254 + t6167*t8260 + t6438*t8264 + t6636*t8271 + t6715*t8285 + 0.077577*(t6608*t8271 + t6522*t8285) - 1.059658*(t6522*t8271 - 1.*t6608*t8285);
p_output1[17]=-1.*t1022*t1494*t2326 + t8313 + t8316 + t8317 + t8321 + t8325 + t8329 + t8335 + t8341 + t8349 + t2326*t803*t835 + t8359 + t8363 + t8371 + t8378 + t8385;
p_output1[18]=0.135*t1489*t6942 - 0.135*t469*t6970 + 0.1305*t1957*t7179 + t2291*t7179 + t2206*t2872*t7179 + t3074*t8395 + t3435*t8403 + t3644*t8407 + t4685*t8412 + t5443*t8417 + t6167*t8425 + t6438*t8429 + t6636*t8435 + t6715*t8441 + 0.077577*(t6608*t8435 + t6522*t8441) - 1.059658*(t6522*t8435 - 1.*t6608*t8441);
p_output1[19]=-0.135*t469*t8205 + 0.135*t1489*t8455 + 0.1305*t1957*t8459 + t2291*t8459 + t2206*t2872*t8459 + t3074*t8467 + t3435*t8471 + t3644*t8475 + t4685*t8480 + t5443*t8487 + t6167*t8494 + t6438*t8498 + t6636*t8502 + t6715*t8506 + 0.077577*(t6608*t8502 + t6522*t8506) - 1.059658*(t6522*t8502 - 1.*t6608*t8506);
p_output1[20]=0.135*t1022*t1489*t2326 + t8313 + t8316 + t8317 + t8321 + t8325 + t8329 + t8335 + t8341 + t8349 - 0.135*t2326*t469*t835 + t8359 + t8363 + t8371 + t8378 + t8385;
p_output1[21]=t2872*t7092 + t2707*t3435*t7092 - 1.*t2819*t3644*t7092 + 0.1305*(-1.*t2206*t7006 - 1.*t1957*t2326*t809) + t2326*t809*t8529 + t7006*t8532 + t4685*t8545 + t5443*t8549 + t6167*t8554 + t6438*t8561 + t6636*t8567 + t6715*t8571 + 0.077577*(t6608*t8567 + t6522*t8571) - 1.059658*(t6522*t8567 - 1.*t6608*t8571);
p_output1[22]=t8532*t8591 + 0.1305*(t2620 - 1.*t2206*t8591) + t2872*t8595 + t2707*t3435*t8595 - 1.*t2819*t3644*t8595 + t4685*t8604 + t5443*t8609 + t6167*t8613 + t6438*t8617 + t6636*t8622 + t6715*t8626 + 0.077577*(t6608*t8622 + t6522*t8626) - 1.059658*(t6522*t8622 - 1.*t6608*t8626) + t2326*t8529*t911;
p_output1[23]=t8532*t8640 + t2872*t8644 + t2707*t3435*t8644 - 1.*t2819*t3644*t8644 + t4685*t8654 + t5443*t8658 + t6167*t8662 + t6438*t8666 + t6636*t8670 + t6715*t8674 + 0.077577*(t6608*t8670 + t6522*t8674) - 1.059658*(t6522*t8670 - 1.*t6608*t8674) - 1.*t8529*t917 + 0.1305*(-1.*t2206*t8640 + t1957*t917);
p_output1[24]=t3435*t7277 + t7179*t8686 + t7110*t8690 + t3644*t8694 + t5443*t8698 + t4685*t8702 + t6438*t8706 + t6167*t8710 + t6715*t8714 + t6636*t8718 - 1.059658*(-1.*t6608*t8714 + t6522*t8718) + 0.077577*(t6522*t8714 + t6608*t8718);
p_output1[25]=t8459*t8686 + t8690*t8732 + t3644*t8736 + t3435*t8740 + t5443*t8744 + t4685*t8748 + t6438*t8752 + t6167*t8756 + t6715*t8760 + t6636*t8764 - 1.059658*(-1.*t6608*t8760 + t6522*t8764) + 0.077577*(t6522*t8760 + t6608*t8764);
p_output1[26]=t8310*t8686 + t8690*t8778 + t3644*t8782 + t3435*t8786 + t5443*t8790 + t4685*t8794 + t6438*t8798 + t6167*t8802 + t6715*t8806 + t6636*t8810 - 1.059658*(-1.*t6608*t8806 + t6522*t8810) + 0.077577*(t6522*t8806 + t6608*t8810);
p_output1[27]=t5443*t7294 + t7226*t8823 + t7277*t8826 + t4685*t8830 + t6438*t8834 + t6167*t8837 + t6715*t8841 + t6636*t8845 - 1.059658*(-1.*t6608*t8841 + t6522*t8845) + 0.077577*(t6522*t8841 + t6608*t8845);
p_output1[28]=t8740*t8826 + t8823*t8858 + t5443*t8862 + t4685*t8865 + t6438*t8869 + t6167*t8873 + t6715*t8877 + t6636*t8881 - 1.059658*(-1.*t6608*t8877 + t6522*t8881) + 0.077577*(t6522*t8877 + t6608*t8881);
p_output1[29]=t8786*t8826 + t8823*t8894 + t5443*t8898 + t4685*t8901 + t6438*t8905 + t6167*t8909 + t6715*t8913 + t6636*t8917 - 1.059658*(-1.*t6608*t8913 + t6522*t8917) + 0.077577*(t6522*t8913 + t6608*t8917);
p_output1[30]=t6167*t7418 + t7294*t8929 + t7336*t8933 + t6438*t8936 + t6715*t8940 + t6636*t8944 - 1.059658*(-1.*t6608*t8940 + t6522*t8944) + 0.077577*(t6522*t8940 + t6608*t8944);
p_output1[31]=t8862*t8929 + t8933*t8958 + t6438*t8961 + t6167*t8964 + t6715*t8968 + t6636*t8972 - 1.059658*(-1.*t6608*t8968 + t6522*t8972) + 0.077577*(t6522*t8968 + t6608*t8972);
p_output1[32]=t8898*t8929 + t8933*t8986 + t6438*t8989 + t6167*t8992 + t6715*t8996 + t6636*t9000 - 1.059658*(-1.*t6608*t8996 + t6522*t9000) + 0.077577*(t6522*t8996 + t6608*t9000);
p_output1[33]=t6715*t7453 + t7368*t9013 + t7418*t9016 + t6636*t9020 + 0.077577*(t7500 + t6608*t9020) - 1.059658*(t6522*t9020 + t9022);
p_output1[34]=t8964*t9016 + t9013*t9032 + t6715*t9036 + t6636*t9039 - 1.059658*(t6522*t9039 + t9041) + 0.077577*(t6608*t9039 + t9045);
p_output1[35]=t8992*t9016 + t9013*t9052 + t6715*t9056 + t6636*t9059 - 1.059658*(t6522*t9059 + t9061) + 0.077577*(t6608*t9059 + t9065);
p_output1[36]=0.077577*t7519 - 1.059658*(-1.*t6522*t7470 + t9022) + t7453*t9071 + t7470*t9075;
p_output1[37]=t9036*t9071 + t9075*t9085 - 1.059658*(t9041 - 1.*t6522*t9085) + 0.077577*(t9045 - 1.*t6608*t9085);
p_output1[38]=t9056*t9071 + t9075*t9097 - 1.059658*(t9061 - 1.*t6522*t9097) + 0.077577*(t9065 - 1.*t6608*t9097);
p_output1[39]=0;
p_output1[40]=0;
p_output1[41]=0;
p_output1[42]=0;
p_output1[43]=0;
p_output1[44]=0;
p_output1[45]=0;
p_output1[46]=0;
p_output1[47]=0;
p_output1[48]=0;
p_output1[49]=0;
p_output1[50]=0;
p_output1[51]=0;
p_output1[52]=0;
p_output1[53]=0;
p_output1[54]=0;
p_output1[55]=0;
p_output1[56]=0;
p_output1[57]=0;
p_output1[58]=0;
p_output1[59]=0;
}
#ifdef MATLAB_MEX_FILE
#include "mex.h"
/*
* Main function
*/
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
size_t mrows, ncols;
double *var1;
double *p_output1;
/* Check for proper number of arguments. */
if( nrhs != 1)
{
mexErrMsgIdAndTxt("MATLAB:MShaped:invalidNumInputs", "One input(s) required (var1).");
}
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 == 20 && ncols == 1) &&
!(mrows == 1 && ncols == 20)))
{
mexErrMsgIdAndTxt( "MATLAB:MShaped:inputNotRealVector", "var1 is wrong.");
}
/* Assign pointers to each input. */
var1 = mxGetPr(prhs[0]);
/* Create matrices for return arguments. */
plhs[0] = mxCreateDoubleMatrix((mwSize) 3, (mwSize) 20, mxREAL);
p_output1 = mxGetPr(plhs[0]);
/* Call the calculation subroutine. */
output1(p_output1,var1);
}
#else // MATLAB_MEX_FILE
#include "J_LeftToeBottomFront_mex.hh"
namespace SymExpression
{
void J_LeftToeBottomFront_mex_raw(double *p_output1, const double *var1)
{
// Call Subroutines
output1(p_output1, var1);
}
}
#endif // MATLAB_MEX_FILE
| 24.510013 | 359 | 0.654148 | [
"vector"
] |
f2edd2ecff8c0a9bb84455954d189dc1e7d1d575 | 1,694 | cc | C++ | src/tests/source/Test8.cc | venkate5hgunda/CSE598-Spring22-Group22-NetsDB | 6c2dabd1a3b3f5901a97c788423fdd93cc0015d4 | [
"Apache-2.0"
] | 13 | 2022-01-17T16:14:26.000Z | 2022-03-30T02:06:04.000Z | src/tests/source/Test8.cc | venkate5hgunda/CSE598-Spring22-Group22-NetsDB | 6c2dabd1a3b3f5901a97c788423fdd93cc0015d4 | [
"Apache-2.0"
] | 1 | 2022-01-28T23:17:14.000Z | 2022-01-28T23:17:14.000Z | src/tests/source/Test8.cc | venkate5hgunda/CSE598-Spring22-Group22-NetsDB | 6c2dabd1a3b3f5901a97c788423fdd93cc0015d4 | [
"Apache-2.0"
] | 3 | 2022-01-18T02:13:53.000Z | 2022-03-06T19:28:19.000Z |
#include <cstddef>
#include <sstream>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstring>
#include <ctime>
#include <chrono>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string>
#include "InterfaceFunctions.h"
#include "Employee.h"
using namespace pdb;
int main() {
// for timing
auto begin = std::chrono::high_resolution_clock::now();
// load up the allocator with RAM
makeObjectAllocatorBlock(1024 * 1024 * 24, false);
Handle<Vector<Vector<Employee>>> data = makeObject<Vector<Vector<Employee>>>();
for (int i = 0; i < 100; i++) {
Vector<Employee> temp;
for (int j = 0; j < 100; j++) {
std::stringstream ss;
ss << "myEmployee " << i << ", " << j;
Employee temp2(ss.str(), j);
temp.push_back(temp2);
}
data->push_back(temp);
}
auto end = std::chrono::high_resolution_clock::now();
std::cout << "Duration to create all of the objects: "
<< std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count() << " ns."
<< std::endl;
std::cout << "Are " << getBytesAvailableInCurrentAllocatorBlock()
<< " bytes left in the current allocation block.\n";
Record<Vector<Vector<Employee>>>* myBytes = getRecord<Vector<Vector<Employee>>>(data);
int filedesc = open("testfile6", O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
size_t sizeWritten = write(filedesc, myBytes, myBytes->numBytes());
if (sizeWritten == 0) {
std::cout << "Write failed" << std::endl;
}
close(filedesc);
}
| 26.888889 | 100 | 0.609799 | [
"vector"
] |
f2f4f074cfe57b417ef1f7dab4acbcc9e1432e5b | 3,426 | cpp | C++ | src/Featurizers/Components/UnitTests/MinMaxEstimator_UnitTest.cpp | Bhaskers-Blu-Org2/FeaturizersLibrary | 229ae38ea233bfb02a6ff92ec3a67c1751c58005 | [
"MIT"
] | 15 | 2019-12-14T07:54:18.000Z | 2021-03-14T14:53:28.000Z | src/Featurizers/Components/UnitTests/MinMaxEstimator_UnitTest.cpp | Lisiczka27/FeaturizersLibrary | dc7b42abd39589af0668c896666affb4abe8a622 | [
"MIT"
] | 30 | 2019-12-03T20:58:56.000Z | 2020-04-21T23:34:39.000Z | src/Featurizers/Components/UnitTests/MinMaxEstimator_UnitTest.cpp | Lisiczka27/FeaturizersLibrary | dc7b42abd39589af0668c896666affb4abe8a622 | [
"MIT"
] | 13 | 2020-01-23T00:18:47.000Z | 2021-10-04T17:46:45.000Z | // ----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License
// ----------------------------------------------------------------------
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "../../../3rdParty/optional.h"
#include "../../TestHelpers.h"
#include "../MinMaxEstimator.h"
namespace NS = Microsoft::Featurizer;
template <typename InputT>
std::tuple<InputT, InputT> FindMinMax(std::vector<std::vector<InputT>> const &inputBatches) {
NS::AnnotationMapsPtr pAllColumnAnnotations(NS::CreateTestAnnotationMapsPtr(1));
NS::Featurizers::Components::MinMaxEstimator<InputT> estimator(pAllColumnAnnotations, 0);
NS::TestHelpers::Train(estimator, inputBatches);
NS::Featurizers::Components::MinMaxAnnotationData<InputT> const & annotation(estimator.get_annotation_data());
return std::make_tuple(annotation.Min, annotation.Max);
}
TEST_CASE("Invalid Annotation") {
CHECK_THROWS_WITH(NS::Featurizers::Components::MinMaxAnnotationData<int>(100, -2), "min is > max");
}
TEST_CASE("int") {
using InputType = int;
std::vector<std::vector<InputType>> const list({{10,
20,
8,
10,
30}});
std::tuple<InputType, InputType> const toCheck(FindMinMax(list));
CHECK(toCheck == std::make_tuple(8, 30));
}
TEST_CASE("float") {
using InputType = std::float_t;
std::vector<std::vector<InputType>> const list({{
static_cast<InputType>(10.3),
static_cast<InputType>(20.1),
static_cast<InputType>(8.4),
static_cast<InputType>(8.2),
static_cast<InputType>(10.3),
static_cast<InputType>(30.1),
static_cast<InputType>(30.4)}});
std::tuple<InputType, InputType> const toCheck(FindMinMax(list));
CHECK(toCheck == std::tuple<InputType, InputType>(8.2f, 30.4f));
}
TEST_CASE("double") {
using InputType = std::double_t;
std::vector<std::vector<InputType>> const list({{
static_cast<InputType>(-1),
static_cast<InputType>(-0.5),
static_cast<InputType>(1),
static_cast<InputType>(0)}});
std::tuple<InputType, InputType> const toCheck(FindMinMax(list));
CHECK(toCheck == std::tuple<InputType, InputType>(-1, 1));
}
| 47.583333 | 135 | 0.425861 | [
"vector"
] |
f2f9727d7fe8499b7405effa7b8bd479c884ef0d | 16,337 | cpp | C++ | src/ngraph/runtime/cpu/pass/cpu_mat_fusion.cpp | srinivasputta/ngraph | 7506133fff4a8e5c25914a8370a567c4da5b53be | [
"Apache-2.0"
] | null | null | null | src/ngraph/runtime/cpu/pass/cpu_mat_fusion.cpp | srinivasputta/ngraph | 7506133fff4a8e5c25914a8370a567c4da5b53be | [
"Apache-2.0"
] | null | null | null | src/ngraph/runtime/cpu/pass/cpu_mat_fusion.cpp | srinivasputta/ngraph | 7506133fff4a8e5c25914a8370a567c4da5b53be | [
"Apache-2.0"
] | null | null | null | //*****************************************************************************
// Copyright 2017-2018 Intel Corporation
//
// 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 <array>
#include <map>
#include <memory>
#include <numeric>
#include <stack>
#include <typeindex>
#include <unordered_map>
#include "cpu_mat_fusion.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/dot.hpp"
#include "ngraph/op/reshape.hpp"
#include "ngraph/op/slice.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/runtime/cpu/op/batch_dot.hpp"
#include "ngraph/runtime/cpu/op/group_conv.hpp"
#include "ngraph/util.hpp"
using namespace ngraph;
struct Type
{
enum
{
DATA = 0,
WEIGHTS,
BIAS,
};
};
static std::shared_ptr<Node> construct_data_pattern(std::shared_ptr<pattern::op::Label> data_slice)
{
auto reshape_slice =
std::make_shared<op::Reshape>(data_slice, AxisVector{0, 1, 2}, Shape{2, 4});
auto W = std::make_shared<pattern::op::Label>(element::f32, Shape{4, 1});
auto dot = std::make_shared<op::Dot>(reshape_slice, W);
auto broadcast = std::make_shared<pattern::op::Label>(element::f32, dot->get_shape());
return dot + broadcast;
}
static std::shared_ptr<Node>
construct_weights_pattern(std::shared_ptr<pattern::op::Label> weights_reshape)
{
auto X = std::make_shared<pattern::op::Label>(element::f32, Shape{2, 4});
auto dot = std::make_shared<op::Dot>(X, weights_reshape);
auto broadcast = std::make_shared<pattern::op::Label>(element::f32, dot->get_shape());
return dot + broadcast;
}
static std::shared_ptr<Node>
construct_bias_pattern(std::shared_ptr<pattern::op::Label> bias_broadcast)
{
auto dot_label = std::make_shared<pattern::op::Label>(element::f32, Shape{2, 1});
return dot_label + bias_broadcast;
}
bool runtime::cpu::pass::CPURnnMatFusion::run_on_function(std::shared_ptr<Function> function)
{
bool modified = false;
auto data_pred = [](std::shared_ptr<Node> n) {
return std::dynamic_pointer_cast<op::Slice>(n) != nullptr;
};
auto data_slice = std::make_shared<pattern::op::Label>(element::f32, Shape{1, 2, 4}, data_pred);
auto data_pattern = construct_data_pattern(data_slice);
auto weights_pred = [](std::shared_ptr<Node> n) {
return std::dynamic_pointer_cast<op::Reshape>(n) != nullptr;
};
auto weights_reshape =
std::make_shared<pattern::op::Label>(element::f32, Shape{4, 1}, weights_pred);
auto weights_pattern = construct_weights_pattern(weights_reshape);
// we don't really need a broadcast node but
// labelling a Broadcast allows us to extract
// params from all 3 labels in the same fashion
//(i.e. via get_argument(0))
auto broadcast_pred = [](std::shared_ptr<Node> n) {
return std::dynamic_pointer_cast<op::Broadcast>(n) != nullptr;
};
auto bias_broadcast =
std::make_shared<pattern::op::Label>(element::f32, Shape{2, 1}, broadcast_pred);
auto bias_pattern = construct_bias_pattern(bias_broadcast);
const size_t NUM_MMB_ARGS = 3;
std::shared_ptr<pattern::op::Label> labels[] = {data_slice, weights_reshape, bias_broadcast};
// Matchers' ordering is important! Don't change!
std::shared_ptr<pattern::Matcher> matchers[] = {
std::make_shared<pattern::Matcher>(data_pattern),
std::make_shared<pattern::Matcher>(weights_pattern),
std::make_shared<pattern::Matcher>(bias_pattern)};
std::map<std::shared_ptr<Node>, NodeVector> op_seg_map; // add to list of params
std::map<NodeVector, NodeVector> param_list;
for (auto n : function->get_ordered_ops())
{
NodeVector params;
NodeVector matched_nodes;
for (size_t i = 0; i < NUM_MMB_ARGS; i++)
{
auto matcher = matchers[i];
if (matcher->match(n))
{
// if we get all 3 matches they will all fall
// in the right spots (e.g. DATA, WEIGHTS, BIAS) since matchers are ordered
// if we have less than 3 matches we skip this node anyways
auto matched = matcher->get_pattern_map()[labels[i]];
params.push_back(matched->get_argument(0));
matched_nodes.push_back(matched);
}
if (params.size() != NUM_MMB_ARGS)
{
continue;
}
// we have a full set for the current Add (n) i.e. data, weights, bias
op_seg_map.insert(std::make_pair(n, matched_nodes));
param_list[params].push_back(n);
}
}
// remove params with single combo op (meaning no need to combine slicing)
for (auto it = param_list.cbegin(); it != param_list.cend();)
{
if (it->second.size() < 2)
{
it = param_list.erase(it);
}
else
{
++it;
}
}
// Expecting input data shape D=[x, y, z], weights W=[u, v], bias B = [w]
// where y is the time step. We are computing R=dot(D,W)=[x,y,v]. We can reshape D to D'=[x*y, z], then we have dot(D',W), result
// in R=[x*y, v], then add(R,B). We need to slice the result by strided by time steps.
// iterate each unique set of parameters, replace original operations
for (auto& p : param_list)
{
NodeVector params = p.first;
NodeVector& op_nodes = p.second;
auto data_node = params.at(Type::DATA);
auto weights_node = params.at(Type::WEIGHTS);
auto bias_node = params.at(Type::BIAS);
const auto& data_shape = data_node->get_shape();
// construct new op nodes
auto data_order = ngraph::get_default_order(data_node->get_shape());
auto data_reshape_node = std::make_shared<op::Reshape>(
data_node, data_order, Shape{data_shape[0] * data_shape[1], data_shape[2]});
auto old_weights_reshape_node = op_seg_map.at(op_nodes.at(0)).at(Type::WEIGHTS);
auto weights_reshape_node = old_weights_reshape_node->copy_with_new_args({weights_node});
auto dot_node = std::make_shared<op::Dot>(data_reshape_node, weights_reshape_node);
const auto& dot_shape = dot_node->get_shape();
auto bias_broadcast_node =
std::make_shared<op::Broadcast>(bias_node, dot_shape, AxisSet{0});
auto add_node = std::make_shared<op::Add>(dot_node, bias_broadcast_node);
const auto& add_shape = add_node->get_shape();
// create a slice for each user of the dot op matching the original dot op's output
for (auto op : op_nodes)
{
const auto old_slice =
std::dynamic_pointer_cast<op::Slice>(op_seg_map[op].at(Type::DATA));
const auto& old_lower_bounds = old_slice->get_lower_bounds();
// lower bound matching the current time step
const Coordinate lower_bounds{old_lower_bounds[1], 0};
// striding by the number of data
const Strides strides{data_shape[1], 1};
auto slice_node =
std::make_shared<op::Slice>(add_node, lower_bounds, add_shape, strides);
// replace old nodes
function->replace_node(op, slice_node);
}
modified = true;
}
return modified;
}
#define TI(x) std::type_index(typeid(x))
std::shared_ptr<Node> set_or_check_if_same(std::shared_ptr<Node> oldn, std::shared_ptr<Node> newn)
{
if (!oldn)
{
return newn;
}
else
{
if (oldn != newn)
{
NGRAPH_DEBUG << " different data nodes";
return nullptr;
}
return oldn;
}
}
static bool is_trivial_convolution(std::shared_ptr<op::Convolution> conv)
{
Strides stride_1{1, 1};
CoordinateDiff pad_0{0, 0};
return conv->get_window_dilation_strides() == stride_1 ||
conv->get_data_dilation_strides() == stride_1 || conv->get_padding_above() == pad_0 ||
conv->get_padding_below() == pad_0;
}
std::shared_ptr<Node> fuse_group_convolution(const std::shared_ptr<Node>& n)
{
Shape win_size_1{1, 1, 1, 1};
auto data_label = std::make_shared<pattern::op::Label>(element::f32, Shape{1, 4, 9});
auto weights_label = std::make_shared<pattern::op::Label>(element::f32, Shape{4, 2, 3});
auto slice_data = std::make_shared<op::Slice>(
data_label, Coordinate{0, 0, 0}, Coordinate{1, 2, 9}, Strides{1, 1, 1});
auto slice_weights = std::make_shared<op::Slice>(
weights_label, Coordinate{0, 0, 0}, Coordinate{2, 2, 3}, Strides{1, 1, 1});
auto slice_weights_label =
std::make_shared<pattern::op::Label>(slice_weights, nullptr, NodeVector{slice_weights});
auto conv = std::make_shared<op::Convolution>(slice_data, slice_weights_label);
auto matcher = std::make_shared<pattern::Matcher>(conv, nullptr);
NGRAPH_DEBUG << "In simplify_concat (group convolution) for " << n->get_name();
std::shared_ptr<Node> data;
std::shared_ptr<Node> weights;
auto concat = std::dynamic_pointer_cast<op::Concat>(n);
std::shared_ptr<op::Convolution> sconv;
NodeVector slices;
const size_t CHANNEL = 1;
if (concat->get_concatenation_axis() != CHANNEL)
{
NGRAPH_DEBUG << "concatenating on an axis different from channel";
return {nullptr};
}
for (auto arg : n->get_arguments())
{
if (!matcher->match(arg))
{
NGRAPH_DEBUG << arg->get_name() << " doesn't match";
return {nullptr};
}
sconv = std::dynamic_pointer_cast<op::Convolution>(arg);
if (arg->get_input_shape(0).size() != 4)
{
NGRAPH_DEBUG << "convolution data's rank isn't equal to 4";
return {nullptr};
}
if (!is_trivial_convolution(std::dynamic_pointer_cast<op::Convolution>(arg)))
{
NGRAPH_DEBUG << arg->get_name() << " isn't trivial convolution";
return {nullptr};
}
auto pattern_map = matcher->get_pattern_map();
data = set_or_check_if_same(data, pattern_map[data_label]);
weights = set_or_check_if_same(weights, pattern_map[weights_label]);
if (!data || !weights)
{
NGRAPH_DEBUG << "data or weights nodes are different among slices";
return {nullptr};
}
const size_t IC = 1;
auto slice = pattern_map[slice_weights_label];
if (weights->get_shape().at(IC) != slice->get_shape().at(IC))
{
slices.push_back(slice);
}
}
// TF-flavoured group convolution needs channels re-arranged
// MKLDNN requires group slicing to be done on OC
// MKLDNN [4,2,-]
// ordering w00 w01 w10 w11 w20 w21 w30 w31 produces g00 g01 g10 g11
// whereas
// TF [2,4,-]
// ordering w00 w01 w02 w03 w10 w11 w12 w13 produces g00 g10 g01 g11
const size_t CONCAT_AXIS_OC = 0;
if (!slices.empty())
{
weights = std::make_shared<op::Concat>(slices, CONCAT_AXIS_OC);
}
auto new_conv = std::make_shared<op::GroupConvolution>(data,
weights,
sconv->get_window_movement_strides(),
sconv->get_window_dilation_strides(),
sconv->get_padding_below(),
sconv->get_padding_above(),
sconv->get_data_dilation_strides(),
n->get_arguments().size(),
n->get_shape());
return new_conv;
}
std::shared_ptr<Node> fuse_batch_dot(const std::shared_ptr<Node>& n)
{
const int num_op_branches = 2;
std::shared_ptr<pattern::op::Label> input[num_op_branches];
std::shared_ptr<op::Reshape> reshape[num_op_branches];
for (int i = 0; i < num_op_branches; ++i)
{
input[i] = std::make_shared<pattern::op::Label>(element::f32, Shape{3, 2, 2});
auto slice =
std::make_shared<op::Slice>(input[i], Coordinate{0, 0, 0}, Coordinate{1, 2, 2});
auto skip = std::make_shared<pattern::op::Skip>(slice, pattern::has_class<op::Reshape>());
reshape[i] = std::make_shared<op::Reshape>(skip, AxisVector{0, 1, 2}, Shape{2, 2});
}
auto dot = std::make_shared<op::Dot>(reshape[0], reshape[1]);
auto final_reshape = std::make_shared<op::Reshape>(dot, AxisVector{0, 1}, Shape{1, 2, 2});
auto matcher = std::make_shared<pattern::Matcher>(final_reshape);
std::shared_ptr<Node> fuse_input[num_op_branches];
bool transpose[num_op_branches] = {false, false};
const int num_expected_reshape_with_trans = 3;
// check each input arg matches the pattern
for (auto arg : n->get_arguments())
{
if (matcher->match(arg))
{
auto pattern_map = matcher->get_pattern_map();
int reshape_count[num_op_branches] = {0, 0};
// we found a match, determine whether we have to transpose for each input by
// counting the number of reshapes in each branch, if transpose is applied, there
// should be 3 reshapes.
for (int i = 0; i < num_op_branches; ++i)
{
auto iter = matcher->get_match_root();
auto& input_node = pattern_map[input[i]];
do
{
if (std::dynamic_pointer_cast<op::Reshape>(iter) != nullptr)
{
++reshape_count[i];
if (reshape_count[i] == num_expected_reshape_with_trans)
{
transpose[i] = true;
break;
}
}
// branch to either input 0 or 1 depending on which one we are traversing
iter =
iter->get_input_size() > 1 ? iter->get_argument(i) : iter->get_argument(0);
} while (iter != input_node);
}
// keep track of the input data, make sure they all match
for (int i = 0; i < num_op_branches; ++i)
{
auto& input_node = pattern_map[input[i]];
if (fuse_input[i] == nullptr)
{
fuse_input[i] = input_node;
}
// found different input nodes between different args, can't fuse.
else if (fuse_input[i] != input_node)
{
return {nullptr};
}
}
}
}
if (fuse_input[0] && fuse_input[1])
{
return std::make_shared<op::BatchDot>(
fuse_input[0], fuse_input[1], transpose[0], transpose[1]);
}
return {nullptr};
}
bool runtime::cpu::pass::CPUBatchFusion::run_on_function(std::shared_ptr<Function> func)
{
bool modified = false;
for (auto n : func->get_ordered_ops())
{
const Node& node = *n;
if (TI(node) == TI(op::Concat))
{
auto fused_node = fuse_batch_dot(n);
if (fused_node)
{
func->replace_node(n, fused_node);
modified = true;
}
else if (auto fused_conv = fuse_group_convolution(n))
{
func->replace_node(n, fused_conv);
modified = true;
}
}
}
return modified;
}
| 37.993023 | 133 | 0.58646 | [
"shape"
] |
84087a0c2e5626c9adc649fc2476303804a4e6bc | 5,187 | cpp | C++ | src/rviz_sim/MAV.cpp | elikos/elikos_sim | a139d321c7ae239b445b4ff09ae2ca9833a9f6ee | [
"MIT"
] | 1 | 2019-02-24T08:29:06.000Z | 2019-02-24T08:29:06.000Z | src/rviz_sim/MAV.cpp | elikos/elikos_sim | a139d321c7ae239b445b4ff09ae2ca9833a9f6ee | [
"MIT"
] | null | null | null | src/rviz_sim/MAV.cpp | elikos/elikos_sim | a139d321c7ae239b445b4ff09ae2ca9833a9f6ee | [
"MIT"
] | 1 | 2019-02-12T23:06:13.000Z | 2019-02-12T23:06:13.000Z | #include <ros/ros.h>
#include <tf/tf.h>
#include "MAV.h"
namespace elikos_sim {
MAV::MAV(double simulationSpeed, ros::Duration cycleTime):
simSpeed(simulationSpeed), Name("MAV"), cycleTime(cycleTime) {
x = 0;
y = 0;
z = 5;
yaw = 0;
vel_x_pid = new Pid<double>(0.0, 0.0, 0.0, // PID
Pid<double>::PID_DIRECT, // Controller direction
Pid<double>::ACCUMULATE_OUTPUT, // Output mode
33.3 / simSpeed, // Sample period
-5.0, 5.0, 0.0); // Min output, Max output, Setpoint
vel_y_pid = new Pid<double>(0.0, 0.0, 0.0,
Pid<double>::PID_DIRECT,
Pid<double>::ACCUMULATE_OUTPUT,
33.3 / simSpeed,
-5.0, 5.0, 0.0);
vel_z_pid = new Pid<double>(0.0, 0.0, 0.0,
Pid<double>::PID_DIRECT,
Pid<double>::ACCUMULATE_OUTPUT,
33.3 / simSpeed,
-5.0, 5.0, 0.0);
xy_sp.setX(0);
xy_sp.setY(0);
z_sp = 0;
refreshTransform();
};
MAV::~MAV(){
delete vel_x_pid;
delete vel_y_pid;
delete vel_z_pid;
vel_x_pid = NULL;
vel_y_pid = NULL;
vel_z_pid = NULL;
}
void MAV::setVelXYPID(double kp, double ki, double kd){
vel_x_pid->SetTunings(kp, ki, kd);
vel_x_pid->SetSamplePeriod((cycleTime.toSec() / simSpeed) * 1000);
vel_y_pid->SetTunings(kp, ki, kd);
vel_y_pid->SetSamplePeriod((cycleTime.toSec() / simSpeed) * 1000);
}
void MAV::setVelZPID(double kp, double ki, double kd){
vel_z_pid->SetTunings(kp, ki, kd);
vel_z_pid->SetSamplePeriod((cycleTime.toSec() / simSpeed) * 1000);
}
void MAV::setVelXYMax(double vel){
vel_xy_max = vel;
vel_x_pid->SetOutputLimits(-vel, vel);
vel_y_pid->SetOutputLimits(-vel, vel);
}
void MAV::setVelZMax(double vel){
vel_z_pid->SetOutputLimits(-vel, vel);
}
std::string MAV::getName(){
return Name;
}
tf::Transform MAV::getTransform(){
return transform_;
}
void MAV::move(){
// Generate XY velocity setpoints
vel_xy_sp.setX(x - xy_sp.getX());
vel_xy_sp.setY(y - xy_sp.getY());
if (vel_xy_sp.length() > vel_xy_max) {
vel_xy_sp.normalize();
vel_xy_sp *= vel_xy_max;
}
// Generate Z velocity setpoint
vel_z_sp = z - z_sp;
// Compute new XY velocities
vel_x_pid->Run(vel_xy_sp.getX());
vel_y_pid->Run(vel_xy_sp.getY());
vel_xy.setX(vel_x_pid->output);
vel_xy.setY(vel_y_pid->output);
// Compute new Z velocity
vel_z_pid->Run(vel_z_sp);
vel_z = vel_z_pid->output;
// Set new position
x += vel_xy.getX() * cycleTime.toSec() * simSpeed;
y += vel_xy.getY() * cycleTime.toSec() * simSpeed;
z += vel_z * cycleTime.toSec() * simSpeed;
// TODO: Yaw
refreshTransform();
}
void MAV::collide(){
// TODO: MAV::collide()
}
void MAV::poseCallback(const geometry_msgs::PoseStamped::ConstPtr& msg){
xy_sp.setX(msg->pose.position.x);
xy_sp.setY(msg->pose.position.y);
z_sp = msg->pose.position.z;
// TODO: Yaw
}
void MAV::refreshTransform(){
v.setX(x);
v.setY(y);
v.setZ(z);
q.setRPY(0, 0, yaw);
transform_.setOrigin(v);
transform_.setRotation(q);
}
visualization_msgs::Marker MAV::getVizMarker() {
visualization_msgs::Marker marker;
marker.header.frame_id = "world";
marker.header.stamp = ros::Time();
marker.ns = Name;
marker.id = 1;
marker.type = visualization_msgs::Marker::CUBE;
marker.action = visualization_msgs::Marker::ADD;
marker.scale.x = 0.5;
marker.scale.y = 0.5;
marker.scale.z = 0.1;
marker.pose.position.x = transform_.getOrigin().getX();
marker.pose.position.y = transform_.getOrigin().getY();
marker.pose.position.z = transform_.getOrigin().getZ() + marker.scale.z / 2;
marker.pose.orientation.x = transform_.getRotation().getX();
marker.pose.orientation.y = transform_.getRotation().getY();
marker.pose.orientation.z = transform_.getRotation().getZ();
marker.pose.orientation.w = transform_.getRotation().getW();
marker.color.a = 1.0;
marker.color.r = 0.0;
marker.color.g = 0.0;
marker.color.b = 1.0;
return marker;
}
visualization_msgs::Marker MAV::getSetpointMarker() {
visualization_msgs::Marker marker;
marker.header.frame_id = "world";
marker.header.stamp = ros::Time();
marker.ns = Name;
marker.id = 2;
marker.type = visualization_msgs::Marker::CUBE;
marker.action = visualization_msgs::Marker::ADD;
marker.scale.x = 0.5;
marker.scale.y = 0.5;
marker.scale.z = 0.1;
marker.pose.position.x = xy_sp.getX();
marker.pose.position.y = xy_sp.getY();
marker.pose.position.z = z_sp + marker.scale.z / 2;
marker.pose.orientation.x = 0;
marker.pose.orientation.y = 0;
marker.pose.orientation.z = 0;
marker.pose.orientation.w = 0;
marker.color.a = 0.5;
marker.color.r = 0.5;
marker.color.g = 0.5;
marker.color.b = 1.0;
return marker;
}
} // namespace elikos_sim
| 29.471591 | 84 | 0.59919 | [
"transform"
] |
8408f9c402190b817c24a98b0c3121acd4bc27ca | 31,359 | cpp | C++ | src/MathExpression.cpp | comacros/Math-Expression-Parser | 0aaa58ff3433aa9cf3055073ddf54b607626304c | [
"MIT"
] | null | null | null | src/MathExpression.cpp | comacros/Math-Expression-Parser | 0aaa58ff3433aa9cf3055073ddf54b607626304c | [
"MIT"
] | null | null | null | src/MathExpression.cpp | comacros/Math-Expression-Parser | 0aaa58ff3433aa9cf3055073ddf54b607626304c | [
"MIT"
] | null | null | null | #define _USE_MATH_DEFINES
#include <cmath>
#ifdef _MSC_VER
#include <omp.h>
#endif
#include <vector>
#include <string>
#include <set>
#include <map>
#include <limits>
//#include <algorithm>
//#include <functional>
#include <cstdarg>
//#define NDEBUG
#include <cassert>
#include "MathExpression.h"
using namespace std;
typedef struct MathExpressionOperator
{
string repr;
size_t precedence;
friend bool operator>(const MathExpressionOperator& l, const MathExpressionOperator& r)
{
return l.precedence > r.precedence;
}
} MathExpressionOperator;
static MathExpressionOperator __MathExpression_operators__[] = {
{"+", 1},
{"-", 1},
{"*", 2},
{"/", 2},
{"^", 3}
};
template <typename T>
inline bool is_in_array(const T* ts, size_t n, const T t)
{
bool bFound = false;
for(size_t i = 0; i < n; i++)
{
if(ts[i] == t)
{
bFound = true;
break;
}
}
return bFound;
}
inline bool EvalMathFunction_1(MathFunction_1& f, double* inout, size_t n)
{
for(size_t i = 0; i < n; i++)
inout[i] = f(inout[i]);
return true;
}
template<typename op> inline bool EvalMathFunction_2(std::vector<double>& values_1, std::vector<double>& values_2, size_t& nResultPosition, op f)
{
if(values_1.size() == values_2.size())
{
nResultPosition = 0;
for(size_t i = 0; i < values_1.size(); i++)
values_1[i] = f(values_1[i], values_2[i]);
}
else if(values_1.size() == 1)
{
nResultPosition = 1;
double value_1 = values_1[0];
for(size_t i = 0; i < values_2.size(); i++)
values_2[i] = f(value_1, values_2[i]);
}
else if(values_2.size() == 1)
{
nResultPosition = 0;
double value_2 = values_2[0];
for(size_t i = 0; i < values_1.size(); i++)
values_1[i] = f(values_1[i], value_2);
}
else
return false;
return true;
}
MathExpression::MathExpression(const char* lpcszExpr)
{
if(!IsBalanced(lpcszExpr))
{
m_error = "Parentheses Not Balanced";
return;
}
m_expr.assign(lpcszExpr);
m_nodes.resize(0);
if(!GetTokens(lpcszExpr, m_nodes, m_error))
return;
if(!Validate(m_nodes))
{
m_error = "Tokens Order Invalid.";
return;
}
initialize_f1();
initialize_f2();
vector<MathExpressionNode> results;
ShuntingYard(results, m_nodes, m_error);
m_nodes = results;
return;
}
void MathExpression::Symbols(set<string>& symbols)
{
symbols.clear();
for(size_t i = 0; i < m_nodes.size(); i++)
{
if(m_nodes[i].type == MathExprNodeType_Symbol)
symbols.insert(m_nodes[i].repr);
}
}
void MathExpression::Functions(set<string>& functions)
{
functions.clear();
for(size_t i = 0; i < m_nodes.size(); i++)
{
if(m_nodes[i].type == MathExprNodeType_Function)
functions.insert(m_nodes[i].repr);
}
}
void MathExpression::BindSymbols(const map<string, double>& symbols)
{
if(!symbols.size())
return;
for(size_t i = 0; i < m_nodes.size(); i++)
{
if(m_nodes[i].type == MathExprNodeType_Symbol)
{
map<string, double>::const_iterator it = symbols.find(m_nodes[i].repr);
if(it != symbols.end())
{
m_nodes[i].values.resize(1);
m_nodes[i].values[0] = it->second;
}
}
}
}
bool MathExpression::Evaluate(vector<double>& results, const map<string, vector<double> >& symbols)
{
results.resize(0);
// nMaxLength is 1 in case expression has no symbol.
size_t nMaxLength = symbols.size() ? 0 : 1;
for(map<string, vector<double> >::const_iterator it = symbols.begin(); it != symbols.end(); it++)
{
if(nMaxLength < it->second.size())
nMaxLength = it->second.size();
}
size_t nSegmentSize = GetSegmentSize();
size_t nTasks = nMaxLength / nSegmentSize;
if((numeric_limits<unsigned long long>::max)() < nTasks)
{
m_error = "Not Enough Memory.";
return false;
}
if(nMaxLength > nTasks * nSegmentSize)
nTasks++;
if(!nTasks)
return false;
typedef struct {
vector<double> _results;
map<string, vector<double> > _symbols;
map<string, MathExprNodeEvalTaskBuffer> _symbols2;
} MathExprNodeEvalTask;
vector<MathExprNodeEvalTask> tasks(nTasks);
for(size_t i = 0; i < nTasks; i++)
{
for(map<string, vector<double> >::const_iterator it = symbols.begin(); it != symbols.end(); it++)
{
size_t N = (it->second.size() >= i * nSegmentSize + nSegmentSize ? nSegmentSize : it->second.size() - i * nSegmentSize);
if(it->second.size() == 0)
return false;
else
{
MathExprNodeEvalTaskBuffer buffer;
buffer.n = N;
buffer.p = const_cast<double*>(it->second.data() + i * nSegmentSize);
tasks[i]._symbols2[it->first] = buffer;
}
}
}
signed long long N = static_cast<signed long long>(nTasks);
size_t nEvalError = 0;
#pragma omp parallel for reduction(+: nEvalError)
for(signed long long i = 0; i < N; i++)
{
if(!EvaluateEx(tasks[i]._results, tasks[i]._symbols2, m_nodes))
nEvalError = 1;
else
nEvalError = 0;
}
if(nEvalError)
return false;
size_t nResultSize = 0;
for(size_t i = 0; i < tasks.size(); i++)
nResultSize += tasks[i]._results.size();
results.reserve(nResultSize);
for(size_t i = 0; i < tasks.size(); i++)
results.insert(results.end(), tasks[i]._results.begin(), tasks[i]._results.end());
return true;
}
bool MathExpression::IsBalanced(const char* lpcszExpr)
{
size_t N = 0;
size_t nExprLength = strlen(lpcszExpr);
for(size_t i = 0; i < nExprLength; i++)
{
if(lpcszExpr[i] == '(')
{
N++;
}
else if(lpcszExpr[i] == ')')
{
if(N == 0)
return false;
N--;
}
}
return N == 0;
}
bool MathExpression::IsValidForNumberBeginning(char chr)
{
return (chr >= '0' && chr <= '9') || chr == '.';
}
bool MathExpression::IsValidForName(char chr, bool bFirst)
{
if(bFirst)
return (chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || chr == '_';
else
return IsValidForName(chr, 1) || (chr >= '0' && chr <= '9');
}
bool MathExpression::IsValidOperator(char chr)
{
for(size_t i = 0; i < sizeof(__MathExpression_operators__)/sizeof(MathExpressionOperator); i++)
{
if(__MathExpression_operators__[i].repr[0] == chr)
return true;
}
return false;
}
bool MathExpression::IsValidWhiteSpace(char chr)
{
return chr == ' ' || chr == '\n' || chr == '\r' || chr == '\t' || chr == '\f' || chr == '\v';
}
bool MathExpression::IsOperatorWithGreaterPrecedence(const string& A, const string& B)
{
// assumes that A and b are valid operators.
size_t offsetOpA = 0, offsetOpB = 0;
for(size_t i = 0; i < sizeof(__MathExpression_operators__)/sizeof(MathExpressionOperator); i++)
{
if(__MathExpression_operators__[i].repr == A)
offsetOpA = i;
else if(__MathExpression_operators__[i].repr == B)
offsetOpB = i;
}
return __MathExpression_operators__[offsetOpA] > __MathExpression_operators__[offsetOpB];
}
bool MathExpression::GetSubExpressionLength(const char* lpcszExpr, size_t& nExprSubLength) // leading '(' and ending ')' included
{
size_t nExprLength = strlen(lpcszExpr);
if(!nExprLength || lpcszExpr[0] != '(')
return false;
size_t N = 0;
for(size_t i = 0; i < nExprLength; i++)
{
if(lpcszExpr[i] == '(')
{
N++;
}
else if(lpcszExpr[i] == ')')
{
if(N == 0)
{
return false;
}
N--;
if(N == 0)
{
nExprSubLength = i + 1;
return true;
}
}
}
return false;
}
bool MathExpression::GetTokens(const char* lpcszExpr, vector<MathExpressionNode>& nodes, string& error)
{
size_t nExprLength = strlen(lpcszExpr);
for(size_t i = 0; i < nExprLength;)
{
char chr = lpcszExpr[i];
MathExpressionNode node;
node.values.resize(0);
node.children.resize(0);
if(chr == '(')
{
node.type = MathExprNodeType_Expression;
size_t nSubSize = 0;
if(!GetSubExpressionLength(lpcszExpr + i, nSubSize))
{
error = "Parentheses Unbalanced.";
return false;
}
node.repr.assign(lpcszExpr + i + 1, nSubSize - 2);
vector<MathExpressionNode> children;
if(!GetTokens(node.repr.c_str(), children, error))
return false;
node.children.assign(children.begin(), children.end());
if(nodes.size() && nodes.back().type == MathExprNodeType_Symbol)
nodes.back().type = MathExprNodeType_Function;
nodes.push_back(node);
i += nSubSize;
continue;
}
else if(IsValidForName(chr, true))
{
size_t j = 0;
for(j = i + 1; j < nExprLength; j++)
{
char chr = lpcszExpr[j];
if(!IsValidForName(chr, false))
break;
}
node.type = MathExprNodeType_Symbol;
node.repr.assign(lpcszExpr + i, j - i);
nodes.push_back(node);
i = j;
continue;
}
else if(IsValidOperator(chr))
{
node.type = MathExprNodeType_Operator;
node.repr = chr;
bool SignMerged = false;
if(nodes.size() == 0 || \
nodes.back().type == MathExprNodeType_Separator || \
nodes.back().type == MathExprNodeType_Operator || nodes.back().type == MathExprNodeType_Sign)
{
node.type = MathExprNodeType_Sign;
if(node.repr != "+" && node.repr != "-")
{
error = "Invalid Operator.";
return false;
}
if(nodes.size())
{
if(nodes.back().type == MathExprNodeType_Sign)
{
SignMerged = true;
nodes.back().repr = (nodes.back().repr == node.repr ? "+" : "-");
}
else if(nodes.back().type == MathExprNodeType_Operator)
{
if(nodes.back().repr == "+")
{
SignMerged = true;
nodes.back().repr = node.repr;
}
else if(nodes.back().repr == "-")
{
nodes.back().repr = (node.repr == "+" ? "-" : "+");
}
}
}
}
if(!SignMerged)
nodes.push_back(node);
if(nodes.size() && nodes.back().type == MathExprNodeType_Sign && nodes.back().repr == "+")
nodes.pop_back();
i++;
continue;
}
else if(IsValidForNumberBeginning(chr))
{
char* pEnd;
double f = strtod(lpcszExpr + i, &pEnd);
size_t nNumberLength = pEnd - (lpcszExpr + i);
node.type = MathExprNodeType_Number;
node.repr.assign(lpcszExpr + i, nNumberLength);
node.values.push_back(f);
if(nodes.size() && nodes.back().type == MathExprNodeType_Sign && nodes.back().repr == "+")
nodes.pop_back();
nodes.push_back(node);
i = pEnd - lpcszExpr;
continue;
}
else if(chr == ',')
{
node.type = MathExprNodeType_Separator;
node.repr = chr;
nodes.push_back(node);
i++;
continue;
}
else if(IsValidWhiteSpace(chr))
{
i++;
continue;
}
else
{
error = "Invalid Character Found.";
return false;
}
}
return true;
}
bool MathExpression::ValidatePreviousNext(const vector<MathExpressionNode>& nodes, size_t offset, const MathExprNodeType* pValidPrevious, size_t nValidPrevious, const MathExprNodeType* pValidNext, size_t nValidNext)
{
if(offset >= nodes.size())
return false;
if(offset > 0)
{
MathExprNodeType prevtype = nodes[offset - 1].type;
if(!is_in_array(pValidPrevious, nValidPrevious, prevtype))
return false;
}
if(offset + 1 < nodes.size())
{
MathExprNodeType nexttype = nodes[offset + 1].type;
if(!is_in_array(pValidNext, nValidNext, nexttype))
return false;
}
return true;
}
bool MathExpression::Validate(const vector<MathExpressionNode>& nodes) {
/***********************************************************************************************************************
* MathExprNodeType_Number, MathExprNodeType_Operator, MathExprNodeType_Symbol, MathExprNodeType_Function, *
* MathExprNodeType_Expression, MathExprNodeType_Sign, MathExprNodeType_Separator *
***********************************************************************************************************************/
// there must be at least one number / symbol / expression
bool hasOperand = false;
for(size_t i = 0; i < nodes.size(); i++)
{
if(nodes[i].type == MathExprNodeType_Number || nodes[i].type == MathExprNodeType_Symbol || nodes[i].type == MathExprNodeType_Expression)
{
hasOperand = true;
break;
}
}
if(!hasOperand)
return false;
for(size_t i = 0; i < nodes.size(); i++)
{
MathExpressionNode node = nodes[i];
// MathExprNodeType_Sign should not show here
// in that it should be merged in GetToken()
switch(node.type)
{
case MathExprNodeType_Number:
{
// number can be the first or the last token
// only operator and separator are allowed before and after a number
static MathExprNodeType prev[] = {MathExprNodeType_Operator, MathExprNodeType_Sign, MathExprNodeType_Separator};
static MathExprNodeType next[] = {MathExprNodeType_Operator, MathExprNodeType_Separator};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
break;
}
case MathExprNodeType_Operator:
{
// operator can not be the first or the last token
// leading PLUS/MINUS should have been handled by CheckUnm()
// only number, symbol, expression and function are allowed before and after operator
static MathExprNodeType prev[] = {MathExprNodeType_Number, MathExprNodeType_Symbol, MathExprNodeType_Expression};
static MathExprNodeType next[] = {MathExprNodeType_Number, MathExprNodeType_Symbol, MathExprNodeType_Function, MathExprNodeType_Expression, MathExprNodeType_Sign};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
if(i == 0 || i == nodes.size() - 1)
return false;
break;
}
case MathExprNodeType_Symbol:
{
// symbol can not be before or after number, symbol, expression and function
static MathExprNodeType prev[] = {MathExprNodeType_Operator, MathExprNodeType_Separator, MathExprNodeType_Sign};
static MathExprNodeType next[] = {MathExprNodeType_Operator, MathExprNodeType_Separator};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
break;
}
case MathExprNodeType_Function:
{
// function can not be after number, symbol, expression and function
// must be before expression
static MathExprNodeType prev[] = {MathExprNodeType_Operator, MathExprNodeType_Separator, MathExprNodeType_Sign};
static MathExprNodeType next[] = {MathExprNodeType_Expression};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
if(i == nodes.size() - 1)
return false;
break;
}
case MathExprNodeType_Expression:
{
// expression cannot be before/after number, symbol, expression
// expression cannot be before function
// expression can be after function
// expression must have at least one child
static MathExprNodeType prev[] = {MathExprNodeType_Operator, MathExprNodeType_Function, MathExprNodeType_Separator, MathExprNodeType_Sign};
static MathExprNodeType next[] = {MathExprNodeType_Operator, MathExprNodeType_Separator};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
if(!node.children.size() || !Validate(node.children))
return false;
break;
}
case MathExprNodeType_Separator:
{
// separator must be between number, symbol, expression and function
static MathExprNodeType prev[] = {MathExprNodeType_Number, MathExprNodeType_Symbol, MathExprNodeType_Expression};
static MathExprNodeType next[] = {MathExprNodeType_Number, MathExprNodeType_Symbol, MathExprNodeType_Function, MathExprNodeType_Expression, MathExprNodeType_Sign};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
if(i == 0 || i == nodes.size() - 1)
return false;
break;
}
case MathExprNodeType_Sign:
{
static MathExprNodeType prev[] = {MathExprNodeType_Operator, MathExprNodeType_Separator};
static MathExprNodeType next[] = {MathExprNodeType_Number, MathExprNodeType_Symbol, MathExprNodeType_Function, MathExprNodeType_Expression};
if(!ValidatePreviousNext(nodes, i, prev, sizeof(prev)/sizeof(MathExprNodeType), next, sizeof(next)/sizeof(MathExprNodeType)))
return false;
if(i == nodes.size() - 1)
return false;
break;
}
default: return false;
}
}
return true;
}
bool MathExpression::ShuntingYard(vector<MathExpressionNode>& results, const vector<MathExpressionNode>& nodes, string& error)
{
// Shunting Yard Algorighm: https://en.wikipedia.org/wiki/Shunting-yard_algorithm
if(nodes.size() == 0)
return false;
vector<MathExpressionNode> OutputQueue;
vector<MathExpressionNode> OperatorStack;
for(size_t i = 0; i < nodes.size(); i++)
{
if(nodes[i].type == MathExprNodeType_Number || nodes[i].type == MathExprNodeType_Symbol)
OutputQueue.push_back(nodes[i]);
else if(nodes[i].type == MathExprNodeType_Expression)
{
vector<MathExpressionNode> _results;
if(!ShuntingYard(_results, nodes[i].children, error))
return false;
OutputQueue.insert(OutputQueue.end(), _results.begin(), _results.end());
}
else if(nodes[i].type == MathExprNodeType_Function)
OperatorStack.push_back(nodes[i]);
else if(nodes[i].type == MathExprNodeType_Sign)
{
vector<MathExpressionNode> _results, _nodes;
for(size_t j = i + 1; j < nodes.size(); j++)
{
if(nodes[j].type == MathExprNodeType_Number || \
nodes[j].type == MathExprNodeType_Symbol || \
nodes[j].type == MathExprNodeType_Function || \
nodes[j].type == MathExprNodeType_Expression || \
nodes[j].type == MathExprNodeType_Sign || \
(nodes[j].type == MathExprNodeType_Operator && nodes[j].repr != "+" && nodes[j].repr != "-"))
{
_nodes.push_back(nodes[j]);
}
else
break;
}
if(!ShuntingYard(_results, _nodes, error))
return false;
OutputQueue.insert(OutputQueue.end(), _results.begin(), _results.end());
OutputQueue.push_back(nodes[i]);
i += _nodes.size();
}
else if(nodes[i].type == MathExprNodeType_Separator)
{
OutputQueue.insert(OutputQueue.end(), OperatorStack.begin(), OperatorStack.end());
OperatorStack.resize(0);
// unnecessary to push back separator
//OutputQueue.push_back(nodes[i]);
}
else if(nodes[i].type == MathExprNodeType_Operator && nodes[i].repr == "^")
{
vector<MathExpressionNode> _results, _nodes;
for(size_t j = i + 1; j < nodes.size(); j++)
{
if(nodes[j].type == MathExprNodeType_Number || \
nodes[j].type == MathExprNodeType_Symbol || \
nodes[j].type == MathExprNodeType_Function || \
nodes[j].type == MathExprNodeType_Expression || \
nodes[j].type == MathExprNodeType_Sign || \
(nodes[j].type == MathExprNodeType_Operator && nodes[j].repr == "^"))
{
_nodes.push_back(nodes[j]);
}
else
break;
}
if(!ShuntingYard(_results, _nodes, error))
return false;
OutputQueue.insert(OutputQueue.end(), _results.begin(), _results.end());
OutputQueue.push_back(nodes[i]);
i += _nodes.size();
}
else if(nodes[i].type == MathExprNodeType_Operator && nodes[i].repr != "^")
{
if(OperatorStack.size())
{
for(size_t j = OperatorStack.size(); j >= 1; j--)
{
MathExprNodeType toptype = OperatorStack.back().type;
string toprepr = OperatorStack.back().repr;
if(toptype == MathExprNodeType_Function || !IsOperatorWithGreaterPrecedence(nodes[i].repr, toprepr))
{
OutputQueue.push_back(OperatorStack.back());
OperatorStack.pop_back();
}
else
break;
}
}
OperatorStack.push_back(nodes[i]);
}
}
for(size_t i = OperatorStack.size(); i >= 1; i--)
OutputQueue.push_back(OperatorStack[i - 1]);
results.resize(0);
results.insert(results.end(), OutputQueue.begin(), OutputQueue.end());
return true;
}
size_t MathExpression::GetSegmentSize()
{
// to-do: calculate segment size according to available memory.
return 128 * 1024 * 1; // 1MB for 131,072 doubles
}
bool MathExpression::EvaluateEx(vector<double>& results, map<string, MathExprNodeEvalTaskBuffer>& bindings, const vector<MathExpressionNode>& nodes)
{
results.resize(0);
vector<vector<double> > OutputQueue;
OutputQueue.reserve(nodes.size());
for(size_t i = 0; i < nodes.size(); i++)
{
MathExprNodeType nodetype = nodes[i].type;
if(nodetype == MathExprNodeType_Number)
OutputQueue.push_back(nodes[i].values);
else if(nodetype == MathExprNodeType_Symbol)
{
map<string, MathExprNodeEvalTaskBuffer>::iterator it = bindings.find(string(nodes[i].repr));
if(it == bindings.end())
return false;
OutputQueue.push_back(vector<double>(it->second.p, it->second.p + it->second.n));
}
else if(nodetype == MathExprNodeType_Separator)
{
// should not be pushed to nodes previously, just ignore it here without error checking
continue;
}
else if(nodetype == MathExprNodeType_Function)
{
size_t nOutputQueues = OutputQueue.size();
if(!nOutputQueues)
return false;
std::map<std::string, MathFunction_1>::iterator it1 = m_f1.find(std::string(nodes[i].repr));
std::map<std::string, MathFunction_2>::iterator it2 = m_f2.find(std::string(nodes[i].repr));
if(it1 != m_f1.end())
{
if(nOutputQueues < 1)
return false;
EvalMathFunction_1(it1->second, OutputQueue.back().data(), OutputQueue.back().size());
}
else if(it2 != m_f2.end())
{
if(nOutputQueues < 2)
return false;
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, it2->second);
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
else if(nResultPosition != 0)
return false;
OutputQueue.pop_back();
}
else
return false;
}
else if(nodetype == MathExprNodeType_Operator)
{
size_t nOutputQueues = OutputQueue.size();
if(nodes[i].repr == "+" || nodes[i].repr == "-" || nodes[i].repr == "*" || nodes[i].repr == "/" || nodes[i].repr == "^")
{
if(nOutputQueues < 2)
return false;
size_t nOperand1Size = OutputQueue[nOutputQueues - 2].size();
size_t nOperand2Size = OutputQueue[nOutputQueues - 1].size();
if(!nOperand1Size || !nOperand2Size)
return false;
if(nodes[i].repr == "+")
{
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, std::plus<double>());
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
}
else if(nodes[i].repr == "-")
{
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, std::minus<double>());
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
}
else if(nodes[i].repr == "*")
{
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, std::multiplies<double>());
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
}
else if(nodes[i].repr == "/")
{
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, std::divides<double>());
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
}
else if(nodes[i].repr == "^")
{
size_t nResultPosition;
EvalMathFunction_2(OutputQueue[nOutputQueues - 2], OutputQueue[nOutputQueues - 1], nResultPosition, [](double A, double B){return pow(A, B);});
if(nResultPosition == 1)
OutputQueue[nOutputQueues - 2] = std::move(OutputQueue[nOutputQueues - 1]);
}
OutputQueue.pop_back();
}
else
return false;
}
else if(nodetype == MathExprNodeType_Sign)
{
if(!OutputQueue.size())
return false;
if(nodes[i].repr == "-")
{
vector<double>& values = OutputQueue.back();
for(size_t j = 0; j < values.size(); j++)
values[j] = -values[j];
}
else if(nodes[i].repr != "+")
return false;
}
}
if(OutputQueue.size() != 1)
return false;
results = OutputQueue[0];
return true;
}
void MathExpression::initialize_f1()
{
m_f1["acos"] = acos;
m_f1["asin"] = asin;
m_f1["atan"] = atan;
m_f1["cos"] = cos;
m_f1["cosh"] = cosh;
m_f1["exp"] = exp;
m_f1["abs"] = abs;
m_f1["log"] = log;
m_f1["log10"] = log10;
m_f1["ln"] = [](double _){ return log(_)/log(exp(1)); };
m_f1["sin"] = sin;
m_f1["sinh"] = sinh;
m_f1["tan"] = tan;
m_f1["tanh"] = tanh;
m_f1["sqrt"] = sqrt;
#ifdef _MSC_VER
m_f1["j0"] = _j0;
m_f1["j1"] = _j1;
m_f1["y0"] = _y0;
m_f1["y1"] = _y1;
#elif defined __GNUC__
m_f1["j0"] = j0;
m_f1["j1"] = j1;
m_f1["y0"] = y0;
m_f1["y1"] = y1;
#endif
}
void MathExpression::initialize_f2()
{
m_f2["atan2"] = atan2;
}
void MathExpression::initialize_constants()
{
map<string, double> constants;
constants["pi"] = M_PI;
constants["PI"] = M_PI;
BindSymbols(constants);
return;
}
| 35.554422 | 215 | 0.52642 | [
"vector"
] |
840a971874674dfc39ba5486e9d5ab8da93f71a8 | 11,464 | cpp | C++ | SDK/Examples/FilamentViewer/FilamentViewer/Quesa Utilities/SynthesizeTriMeshUVs.cpp | h-haris/Quesa | a438ab824291ce6936a88dfae4fd0482dcba1247 | [
"BSD-3-Clause"
] | 24 | 2019-10-28T07:01:48.000Z | 2022-03-04T16:10:39.000Z | SDK/Examples/FilamentViewer/FilamentViewer/Quesa Utilities/SynthesizeTriMeshUVs.cpp | h-haris/Quesa | a438ab824291ce6936a88dfae4fd0482dcba1247 | [
"BSD-3-Clause"
] | 8 | 2020-04-22T19:42:45.000Z | 2021-04-30T16:28:32.000Z | SDK/Examples/FilamentViewer/FilamentViewer/Quesa Utilities/SynthesizeTriMeshUVs.cpp | h-haris/Quesa | a438ab824291ce6936a88dfae4fd0482dcba1247 | [
"BSD-3-Clause"
] | 6 | 2019-09-22T14:44:15.000Z | 2021-04-01T20:04:29.000Z | //
// SynthesizeTriMeshUVs.cpp
// FilamentViewer
//
// Created by James Walker on 6/3/21.
//
/* ___________________________________________________________________________
COPYRIGHT:
Copyright (c) 2021, Quesa Developers. All rights reserved.
For the current release of Quesa, please see:
<https://github.com/jwwalker/Quesa>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
o Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
o 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.
o Neither the name of Quesa nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
___________________________________________________________________________
*/
#include "SynthesizeTriMeshUVs.h"
#include "FindTriMeshVertexData.h"
#include <Quesa/QuesaGeometry.h>
#include <Quesa/QuesaMathOperators.hpp>
#include <algorithm>
#include <vector>
#include <assert.h>
namespace
{
enum EBoxSide
{
kBoxSide_Undefined = 0,
kBoxSide_Front = 1,
kBoxSide_Right,
kBoxSide_Back,
kBoxSide_Left,
kBoxSide_Top,
kBoxSide_Bottom,
kBoxSide_NumValues
};
}
/*!
@function SelectBoxSide
@abstract Find out which side of the bounding box a ray
points to.
@param inInternalPt A location inside a mesh.
@param inDirection A direction vector.
@param inBox The bounding box.
*/
static EBoxSide SelectBoxSide( const TQ3Point3D& inInternalPt,
const TQ3Vector3D& inDirection,
const TQ3BoundingBox& inBox )
{
EBoxSide theSide = kBoxSide_Undefined;
float t;
TQ3Point3D testPt;
// check front (z > 0)
if (inDirection.z > kQ3RealZero)
{
t = (inBox.max.z - inInternalPt.z) / inDirection.z;
testPt = inInternalPt + t * inDirection;
if ( (testPt.x > inBox.min.x) and (testPt.x < inBox.max.x) and
(testPt.y > inBox.min.y) and (testPt.y < inBox.max.y) )
{
theSide = kBoxSide_Front;
}
}
// check rear (z < 0)
if (inDirection.z < -kQ3RealZero)
{
t = (inBox.min.z - inInternalPt.z) / inDirection.z;
testPt = inInternalPt + t * inDirection;
if ( (testPt.x > inBox.min.x) and (testPt.x < inBox.max.x) and
(testPt.y > inBox.min.y) and (testPt.y < inBox.max.y) )
{
theSide = kBoxSide_Back;
}
}
// check top (y > 0)
if (inDirection.y > kQ3RealZero)
{
t = (inBox.max.y - inInternalPt.y) / inDirection.y;
testPt = inInternalPt + t * inDirection;
if ( (testPt.x > inBox.min.x) and (testPt.x < inBox.max.x) and
(testPt.z > inBox.min.z) and (testPt.z < inBox.max.z) )
{
theSide = kBoxSide_Top;
}
}
// check bottom (y < 0)
if (inDirection.y < -kQ3RealZero)
{
t = (inBox.min.y - inInternalPt.y) / inDirection.y;
testPt = inInternalPt + t * inDirection;
if ( (testPt.x > inBox.min.x) and (testPt.x < inBox.max.x) and
(testPt.z > inBox.min.z) and (testPt.z < inBox.max.z) )
{
theSide = kBoxSide_Bottom;
}
}
// check right (x > 0)
if (inDirection.x > kQ3RealZero)
{
t = (inBox.max.x - inInternalPt.x) / inDirection.x;
testPt = inInternalPt + t * inDirection;
if ( (testPt.z > inBox.min.z) and (testPt.z < inBox.max.z) and
(testPt.y > inBox.min.y) and (testPt.y < inBox.max.y) )
{
theSide = kBoxSide_Right;
}
}
// check left (x < 0)
if (inDirection.x < -kQ3RealZero)
{
t = (inBox.min.x - inInternalPt.x) / inDirection.x;
testPt = inInternalPt + t * inDirection;
if ( (testPt.z > inBox.min.z) and (testPt.z < inBox.max.z) and
(testPt.y > inBox.min.y) and (testPt.y < inBox.max.y) )
{
theSide = kBoxSide_Left;
}
}
return theSide;
}
/*!
@function FindMainSide
@abstract Find which side of the bounding box is pointed to by
the most face normals.
@param inData TriMesh data.
@param inOutsetBox A slightly expanded bounding box.
*/
static EBoxSide FindMainSide( const TQ3TriMeshData& inData,
const TQ3BoundingBox& inOutsetBox )
{
float sideWeights[ kBoxSide_NumValues ];
std::fill( &sideWeights[0], &sideWeights[ kBoxSide_NumValues ], 0.0f );
for (long tri = inData.numTriangles - 1; tri >= 0; --tri)
{
const TQ3TriMeshTriangleData& triData( inData.triangles[tri] );
const TQ3Point3D& pt0( inData.points[ triData.pointIndices[0] ] );
const TQ3Point3D& pt1( inData.points[ triData.pointIndices[1] ] );
const TQ3Point3D& pt2( inData.points[ triData.pointIndices[2] ] );
TQ3Vector3D normalVec;
Q3Point3D_CrossProductTri( &pt0, &pt1, &pt2, &normalVec );
TQ3Point3D baryCenter = (1.0f / 3.0f) * (pt0 + pt1 + pt2);
EBoxSide theSide = SelectBoxSide( baryCenter, normalVec, inOutsetBox );
sideWeights[ theSide ] += Q3Vector3D_Length( &normalVec );
}
// Find the majority side
float* majIter = std::max_element( &sideWeights[0],
&sideWeights[ kBoxSide_NumValues ] );
EBoxSide mainSide = static_cast<EBoxSide>( majIter - &sideWeights[0] );
return mainSide;
}
/*!
@function ProjectBoxUVFull
@abstract Compute UV coordinates for a point with the full-range style.
*/
static void ProjectBoxUVFull( const TQ3Point3D& inPt, EBoxSide inSide,
const TQ3BoundingBox& inBox, TQ3Param2D& outUV )
{
TQ3Vector3D dimens = inBox.max - inBox.min;
switch (inSide)
{
default:
break;
case kBoxSide_Top:
outUV.u = (inPt.x - inBox.min.x) / dimens.x;
outUV.v = (inBox.max.z - inPt.z) / dimens.z;
break;
case kBoxSide_Bottom:
outUV.u = (inPt.x - inBox.min.x) / dimens.x;
outUV.v = (inPt.z - inBox.min.z) / dimens.z;
break;
case kBoxSide_Front:
outUV.u = (inPt.x - inBox.min.x) / dimens.x;
outUV.v = (inPt.y - inBox.min.y) / dimens.y;
break;
case kBoxSide_Back:
outUV.u = (inBox.max.x - inPt.x) / dimens.x;
outUV.v = (inPt.y - inBox.min.y) / dimens.y;
break;
case kBoxSide_Right:
outUV.u = (inBox.max.z - inPt.z) / dimens.z;
outUV.v = (inPt.y - inBox.min.y) / dimens.y;
break;
case kBoxSide_Left:
outUV.u = (inPt.z - inBox.min.z) / dimens.z;
outUV.v = (inPt.y - inBox.min.y) / dimens.y;
break;
}
}
/*!
@function ProjectBoxUVProportional
@abstract Compute UV coordinates for a point with the proportional-range style.
*/
static void ProjectBoxUVProportional( const TQ3Point3D& inPt,
EBoxSide inSide,
const TQ3BoundingBox& inBox, TQ3Param2D& outUV )
{
TQ3Vector3D dimens = inBox.max - inBox.min;
float theDim;
switch (inSide)
{
default:
break;
case kBoxSide_Top:
theDim = std::max( dimens.x, dimens.z );
outUV.u = (inPt.x - inBox.min.x) / theDim;
outUV.v = (inBox.max.z - inPt.z) / theDim;
break;
case kBoxSide_Bottom:
theDim = std::max( dimens.x, dimens.z );
outUV.u = (inPt.x - inBox.min.x) / theDim;
outUV.v = (inPt.z - inBox.min.z) / theDim;
break;
case kBoxSide_Front:
theDim = std::max( dimens.x, dimens.y );
outUV.u = (inPt.x - inBox.min.x) / theDim;
outUV.v = (inPt.y - inBox.min.y) / theDim;
break;
case kBoxSide_Back:
theDim = std::max( dimens.x, dimens.y );
outUV.u = (inBox.max.x - inPt.x) / theDim;
outUV.v = (inPt.y - inBox.min.y) / theDim;
break;
case kBoxSide_Right:
theDim = std::max( dimens.y, dimens.z );
outUV.u = (inBox.max.z - inPt.z) / theDim;
outUV.v = (inPt.y - inBox.min.y) / theDim;
break;
case kBoxSide_Left:
theDim = std::max( dimens.y, dimens.z );
outUV.u = (inPt.z - inBox.min.z) / theDim;
outUV.v = (inPt.y - inBox.min.y) / theDim;
break;
}
}
///MARK:-
/*!
@function SynthesizeTriMeshUVs
@abstract Synthesize texture coordinates in a way that works well for flat parts.
@discussion For each vertex, find the vertex normal and see which side of the
local bounding box it points to. Pick the side that the most face
normals point to. Then assign UVs by projecting to that box side.
In the full range case, both u and v vary over the full range of 0 to 1.
In the proportional case, the ranges of u and v are proportional to the
dimensions of the part. For example, suppose the part has an aspect
ratio of 3. Then while u would have the full 0 to 1 range, v would
range between 0 and 1/3.
@param inTMData The TriMesh data.
@param inProportional Whether to use the proportional style,
see discussion.
@param outUVs Receives synthesized UVs.
*/
void SynthesizeTriMeshUVs( const TQ3TriMeshData& inTMData,
bool inProportional,
std::vector<TQ3Param2D>& outUVs )
{
// I need there to be some distance between the point and the box,
// which there won't be if the TriMesh is perfectly flat.
// So expand the box.
TQ3BoundingBox expandedBox = inTMData.bBox;
TQ3Vector3D change = 0.01f * (expandedBox.max - expandedBox.min);
expandedBox.min -= change;
expandedBox.max += change;
// Find the majority side
EBoxSide mainSide = FindMainSide( inTMData, expandedBox );
assert( mainSide != kBoxSide_Undefined );
// Compute UVs
outUVs.resize( inTMData.numPoints );
TQ3Uns32 i;
if (inProportional)
{
for (i = 0; i < inTMData.numPoints; ++i)
{
ProjectBoxUVProportional( inTMData.points[i], mainSide,
inTMData.bBox, outUVs[i] );
}
}
else // full-range
{
for (i = 0; i < inTMData.numPoints; ++i)
{
ProjectBoxUVFull( inTMData.points[i], mainSide,
inTMData.bBox, outUVs[i] );
}
}
}
/*!
@function CopyOrSynthesizeUVs
@abstract If TriMesh data contains vertex UV attributes, copy them to a vector, otherwise
synthesize them in a simple way.
@param inTMData The TriMesh data.
@param outUVs Receives synthesized UVs.
*/
void CopyOrSynthesizeUVs( const TQ3TriMeshData& inTMData,
std::unique_ptr< std::vector<TQ3Param2D> >& outUVs )
{
// Look for existing UVs
const TQ3Param2D* uvs = reinterpret_cast<const TQ3Param2D*>(
FindTriMeshVertexData( &inTMData, kQ3AttributeTypeSurfaceUV ) );
if (uvs == nullptr)
{
uvs = reinterpret_cast<const TQ3Param2D*>(
FindTriMeshVertexData( &inTMData, kQ3AttributeTypeShadingUV ) );
}
// If we found them, copy them.
if (uvs != nullptr)
{
outUVs.reset( new std::vector<TQ3Param2D>( uvs, &uvs[inTMData.numPoints] ) );
}
else
{
outUVs.reset( new std::vector<TQ3Param2D> );
SynthesizeTriMeshUVs( inTMData, false, *outUVs );
}
}
| 29.776623 | 90 | 0.675506 | [
"mesh",
"vector"
] |
840f011825767c0c3cbfe66df3ae5c1c8dae5ff0 | 7,140 | cpp | C++ | Ejercicios/Tarea2-biblioteca/biblioteca.cpp | olvin24/cpp | 2336bb668f0838d996009d647719e70aa3a4cfdb | [
"MIT"
] | null | null | null | Ejercicios/Tarea2-biblioteca/biblioteca.cpp | olvin24/cpp | 2336bb668f0838d996009d647719e70aa3a4cfdb | [
"MIT"
] | null | null | null | Ejercicios/Tarea2-biblioteca/biblioteca.cpp | olvin24/cpp | 2336bb668f0838d996009d647719e70aa3a4cfdb | [
"MIT"
] | null | null | null | #include <iostream>
#include <algorithm>
#include <time.h>
using namespace std;
string libros[39][3];
void cargarLibros() {
// Arreglo con categoria, descripcion y autor.
libros[0][0] = "Algoritmos"; libros[0][1] = "Algoritmos y Programacion (Guia para docentes)"; libros[2][0] = "Gines Garcia Mateo";
libros[1][0] = "Algoritmos"; libros[1][1] = "Apuntes de Algoritmos y Estructuras de Datos"; libros[2][1] = "Luis Joyanes Aguilar";
libros[2][0] = "Algoritmos"; libros[2][1] = "Breves Notas sobre Analisis de Algoritmos"; libros[2][2] = "Sebastien Putir";
libros[3][0] = "Algoritmos"; libros[3][1] = "Fundamentos de Informatica y Programacion"; libros[2][3] = "Yolanda Blanco Fernandez";
libros[4][0] = "Algoritmos"; libros[4][1] = "Temas selectos de estructuras de datos"; libros[2][4] = "Gines Garcia Mateo";
libros[5][0] = "Algoritmos"; libros[5][1] = "Teoria sintactico-gramatical de objetos"; libros[2][5] = "Juan Carlos Moreno";
libros[6][0] = "Base de Datos"; libros[6][1] = "Apuntes de Base de Datos 1"; libros[2][6] = "Mark Allen Weis";
libros[7][0] = "Base de Datos"; libros[7][1] = "Base de Datos (2005)"; libros[2][7] = "Francisco Cruz Teruel";
libros[8][0] = "Base de Datos"; libros[8][1] = "Base de Datos (2011)"; libros[2][8] = "David Kolling Barnes";
libros[9][0] = "Base de Datos"; libros[9][1] = "Base de Datos Avanzadas (2013)"; libros[2][9] = "Elizabeth George";
libros[10][0] = "Base de Datos"; libros[10][1] = "Diseno Conceptual de Bases de Datos"; libros[2][10] = "Mario Macias Lloret";
libros[11][0] = "Ciencia Computacional"; libros[11][1] = "Breves Notas sobre Automatas y Lenguajes"; libros[2][11] = "Fatos Xhafa";
libros[12][0] = "Ciencia Computacional"; libros[12][1] = "Breves Notas sobre Teoria de la Computacion"; libros[2][12] = "Robert C. Martin";
libros[13][0] = "Metodologias de desarrollo de software"; libros[13][1] = "Compendio de Ingenieria del Software"; libros[2][13] = "Francisco Blasco";
libros[14][0] = "Metodologias de desarrollo de software"; libros[14][1] = "Diseno agil con TDD"; libros[2][14] = "Francisco Grande";
libros[15][0] = "Metodologias de desarrollo de software"; libros[15][1] = "Ingenieria de Software: Una Guia para Crear Sistemas de Informacion"; libros[2][15] = "Michael Gernaey";
libros[16][0] = "Metodologias de desarrollo de software"; libros[16][1] = "Scrum & Extreme Programming (para programadores)"; libros[2][16] = "Virginia Andersen";
libros[17][0] = "Metodologias de desarrollo de software"; libros[17][1] = "Scrum y XP desde las trincheras";libros[2][17] = "Miguel Angel Acera Garcia";
libros[18][0] = "Miscelaneos"; libros[18][1] = "97 cosas que todo programador deberia saber"; libros[2][18] = "Olvin Romero";
libros[19][0] = "Miscelaneos"; libros[19][1] = "Docker"; libros[2][19] = "Olvin Romero";
libros[20][0] = "Miscelaneos"; libros[20][1] = "El camino a un mejor programador"; libros[2][20] = "Tomas Dominguez";
libros[21][0] = "Miscelaneos"; libros[21][1] = "Introduccion a Docker"; libros[2][21] = "Bruce Eckel";
libros[22][0] = "Miscelaneos"; libros[22][1] = "Programacion de videojuegos SDL"; libros[2][22] = "David Stuar";
libros[23][0] = "PHP"; libros[23][1] = "Manual de estudio introductorio al lenguaje PHP procedural"; libros[2][23] = "Danny Goodman";
libros[24][0] = "PHP"; libros[24][1] = "PHP y Programacion orientada a objetos"; libros[2][24] = "Yolanda Blanca Fernandez";
libros[25][0] = "PHP"; libros[25][1] = "POO y MVC en PHP"; libros[2][25] = "Bruce Eckel";
libros[26][0] = "PHP"; libros[26][1] = "Silex, el manual oficial"; libros[2][26] = "Hans Berger";
libros[27][0] = "PHP"; libros[27][1] = "Symfony 1.4, la guia definitiva"; libros[2][27] = "Scot Hillier";
libros[28][0] = "PHP"; libros[28][1] = "Symfony 2.4, el libro oficial"; libros[2][28] = "Tom Fischer";
libros[29][0] = "Python"; libros[29][1] = "Aprenda a pensar como un programador (con Python)"; libros[2][29] = "Helen Feddeman";
libros[30][0] = "Python"; libros[30][1] = "Doma de Serpientes para Ninos: Aprendiendo a Programar con Python"; libros[2][30] = "John Barnes";
libros[31][0] = "Python"; libros[31][1] = "Inmersion en Python"; libros[2][31] = "Arturo Montejo Raez";
libros[32][0] = "Python"; libros[32][1] = "Inmersion en Python 3"; libros[32][2] = "Alberto Cuevas Alvarez";
libros[33][0] = "Python"; libros[33][1] = "Introduccion a la programacion con Python"; libros[21][33] = "Paul Dubois";
libros[34][0] = "Python"; libros[34][1] = "Introduccion a Programando con Python"; libros[2][34] = "Rod Stephens";
libros[35][0] = "Python"; libros[35][1] = "Python instantaneo (1999)"; libros[2][35] = "Thierry Boulanger";
libros[36][0] = "Python"; libros[36][1] = "Python para ciencia e ingenieria"; libros[2][36] = "Octavio Hernandez Leal";
libros[37][0] = "Python"; libros[37][1] = "Python para principiantes"; libros[2][37] = "Alberto Cuevas Alvarez";
libros[38][0] = "Python"; libros[38][1] = "Python para todos";libros[2][38] = "Arturo Montejo Raez";
}
int main(int argc, char const *argv[])
{
cargarLibros();
srand (time(NULL));
bool salir = false;
while (salir == false)
{
string buscar = "";
system("cls");
cout << "Ingrese la descripcion del libro o Autor que busca: ";
cin >> buscar;
// busqueda
for (int i = 0; i < 39; i++)
{
string libro = libros[i][1];
string autor = libros[i][2];
string libroEnminuscula = libro;
string autorEnminuscula = libro;
// transformamos a minuscula los string buscar y libro
transform(libroEnminuscula.begin(), libroEnminuscula.end(), libroEnminuscula.begin(), ::tolower);
transform(autorEnminuscula.begin(), autorEnminuscula.end(), autorEnminuscula.begin(), ::tolower);
transform(buscar.begin(), buscar.end(), buscar.begin(), ::tolower);
if (libroEnminuscula.find(buscar) != string::npos || autorEnminuscula.find(buscar) != string::npos) {
cout << "Libro encontrado: " << libro << endl;
cout << "Tambien te sugerimos estos libros: " << endl;
int sugerencia1 = rand() % 38 + 1;
int sugerencia2 = rand() % 38 + 1;
int sugerencia3 = rand() % 38 + 1;
cout << " Sugerencia 1: " << libros[sugerencia1][1] << endl;
cout << " Sugerencia 2: " << libros[sugerencia2][1] << endl;
cout << " Sugerencia 3: " << libros[sugerencia3][1] << endl;
salir = true;
break;
}
}
if (salir == false) {
char continuar = 'n';
while(true) {
system("cls");
cout << "No se encontro el libro o autor que busca. Desea continuar? s/n ";
cin >> continuar;
if (continuar == 's' || continuar == 'S') {
break;
} else if (continuar == 'n' || continuar == 'N') {
salir = true;
break;
}
}
}
}
return 0;
} | 60 | 180 | 0.607843 | [
"transform"
] |
8418389722f35c1a23f65ef8ac7305fadadf4e75 | 2,847 | cxx | C++ | test/TestProbeCatalogue.cxx | greydongilmore/tactics | e57008ded07eb798368ccb161d9bf06d9a16f52c | [
"BSD-3-Clause"
] | 5 | 2015-06-02T22:10:36.000Z | 2022-01-02T09:26:47.000Z | test/TestProbeCatalogue.cxx | greydongilmore/tactics | e57008ded07eb798368ccb161d9bf06d9a16f52c | [
"BSD-3-Clause"
] | 2 | 2015-06-04T14:52:09.000Z | 2015-06-04T18:58:50.000Z | test/TestProbeCatalogue.cxx | greydongilmore/tactics | e57008ded07eb798368ccb161d9bf06d9a16f52c | [
"BSD-3-Clause"
] | 3 | 2015-06-04T15:02:25.000Z | 2021-02-02T01:47:56.000Z | #include "UnitTest++.h"
#include "TestData.h"
#include "cbProbeCatalogue.h"
#include "cbProbeSpecification.h"
#include <iostream>
#include <string>
SUITE (TestProbeCatalogue) {
struct CatalogueFixture {
CatalogueFixture() : directory_path_(APPLICATION_DATA_PATH), catalogue_(directory_path_) {};
~CatalogueFixture() {};
std::string directory_path_;
cbProbeCatalogue catalogue_;
};
TEST_FIXTURE(CatalogueFixture, TestShouldImportCatalogue) {
std::vector<std::string> list = catalogue_.list_as_strings();
std::vector<std::string> expected;
#ifdef TACTICS_PRIVATE_PROBES
expected.push_back(std::string("3387S-40"));
expected.push_back(std::string("3389S-40"));
expected.push_back(std::string("3391S-40"));
expected.push_back(std::string("6142"));
expected.push_back(std::string("6146"));
expected.push_back(std::string("AD04R-SP10X-000"));
expected.push_back(std::string("AD08R-SP05X-000"));
expected.push_back(std::string("CIPAC"));
expected.push_back(std::string("MD01R-SP00X-000"));
expected.push_back(std::string("PiscesQuad-3487A"));
expected.push_back(std::string("RD05R-SP35X-000"));
expected.push_back(std::string("RD06R-SP05X-000"));
expected.push_back(std::string("RD08R-SP04X-000"));
expected.push_back(std::string("RD08R-SP05X-000"));
expected.push_back(std::string("RD10R-SP04X-000"));
expected.push_back(std::string("RD10R-SP05X-000"));
expected.push_back(std::string("RD10R-SP06X-000"));
expected.push_back(std::string("RD10R-SP07X-000"));
expected.push_back(std::string("RD10R-SP08X-000"));
expected.push_back(std::string("RD10R-SP35X-000"));
expected.push_back(std::string("RD12R-SP05X-000"));
expected.push_back(std::string("RD12R-SP08X-000"));
expected.push_back(std::string("RD14R-SP03X-000"));
expected.push_back(std::string("RD14R-SP04X-000"));
expected.push_back(std::string("RD14R-SP05X-000"));
expected.push_back(std::string("RD14R-SP06X-000"));
expected.push_back(std::string("RD14R-SP07X-000"));
expected.push_back(std::string("RD14R-SP08X-000"));
expected.push_back(std::string("RD14R-SP09X-000"));
expected.push_back(std::string("RD14R-SP10X-000"));
expected.push_back(std::string("RD14R-SP35X-000"));
expected.push_back(std::string("SD10R-SP05X-000"));
expected.push_back(std::string("SD12R-SP05X-000"));
#else
expected.push_back(std::string("CIPAC"));
#endif
CHECK_EQUAL(expected.size(), list.size());
for (size_t i = 0; i < list.size(); i++) {
CHECK_EQUAL(0, expected.at(i).compare(list.at(i)));
}
}
TEST_FIXTURE(CatalogueFixture, TestShouldQueryCatalogue) {
std::string type("CIPAC");
cbProbeSpecification spec = catalogue_.specification(type);
CHECK_EQUAL(0, type.compare(spec.catalogue_number()));
}
}
| 37.460526 | 96 | 0.699333 | [
"vector"
] |
84211316c356e79504bf6c453c11fe159d6b2bc1 | 7,068 | cpp | C++ | src/modules/processes/Geometry/DynamicCropPreferencesDialog.cpp | GeorgViehoever/PCL | c4a4390185db3ccb04471f845d92917cc1bc1113 | [
"JasPer-2.0"
] | null | null | null | src/modules/processes/Geometry/DynamicCropPreferencesDialog.cpp | GeorgViehoever/PCL | c4a4390185db3ccb04471f845d92917cc1bc1113 | [
"JasPer-2.0"
] | null | null | null | src/modules/processes/Geometry/DynamicCropPreferencesDialog.cpp | GeorgViehoever/PCL | c4a4390185db3ccb04471f845d92917cc1bc1113 | [
"JasPer-2.0"
] | null | null | null | // ____ ______ __
// / __ \ / ____// /
// / /_/ // / / /
// / ____// /___ / /___ PixInsight Class Library
// /_/ \____//_____/ PCL 02.01.01.0784
// ----------------------------------------------------------------------------
// Standard Geometry Process Module Version 01.01.00.0314
// ----------------------------------------------------------------------------
// DynamicCropPreferencesDialog.cpp - Released 2016/02/21 20:22:42 UTC
// ----------------------------------------------------------------------------
// This file is part of the standard Geometry PixInsight module.
//
// Copyright (c) 2003-2016 Pleiades Astrophoto S.L. All Rights Reserved.
//
// Redistribution and use in both source and binary forms, with or without
// modification, is permitted provided that the following conditions are met:
//
// 1. All redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. All redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
// of their contributors, may be used to endorse or promote products derived
// from this software without specific prior written permission. For written
// permission, please contact info@pixinsight.com.
//
// 4. All products derived from this software, in any form whatsoever, must
// reproduce the following acknowledgment in the end-user documentation
// and/or other materials provided with the product:
//
// "This product is based on software from the PixInsight project, developed
// by Pleiades Astrophoto and its contributors (http://pixinsight.com/)."
//
// Alternatively, if that is where third-party acknowledgments normally
// appear, this acknowledgment must be reproduced in the product itself.
//
// THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS 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 PLEIADES ASTROPHOTO OR ITS
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
// INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
// DATA OR PROFITS) 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 "DynamicCropPreferencesDialog.h"
#include "DynamicCropInterface.h"
namespace pcl
{
#define fillColor TheDynamicCropInterface->fillColor
// ----------------------------------------------------------------------------
DynamicCropPreferencesDialog::DynamicCropPreferencesDialog() : Dialog()
{
savedColor = fillColor;
pcl::Font fnt = Font();
int buttonWidth = fnt.Width( String( "Cancel" ) + String( 'M', 4 ) );
Black_RadioButton.SetText( "Black" );
Black_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );
White_RadioButton.SetText( "White" );
White_RadioButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );
Alpha_Label.SetText( "Alpha Blend:" );
Alpha_Label.SetTextAlignment( TextAlign::Right|TextAlign::VertCenter );
Alpha_Slider.SetRange( 0, 255 );
Alpha_Slider.SetStepSize( 10 );
Alpha_Slider.SetTickFrequency( 10 );
Alpha_Slider.SetTickStyle( TickStyle::NoTicks );
Alpha_Slider.SetScaledMinWidth( 265 );
Alpha_Slider.OnValueUpdated( (Slider::value_event_handler)&DynamicCropPreferencesDialog::Slider_ValueUpdated, *this );
FillColor_Sizer.SetMargin( 8 );
FillColor_Sizer.SetSpacing( 6 );
FillColor_Sizer.Add( Black_RadioButton );
FillColor_Sizer.Add( White_RadioButton );
FillColor_Sizer.AddSpacing( 10 );
FillColor_Sizer.Add( Alpha_Label );
FillColor_Sizer.Add( Alpha_Slider );
FillColor_GroupBox.SetTitle( "Fill Color" );
FillColor_GroupBox.SetSizer( FillColor_Sizer );
OK_PushButton.SetText( "OK" );
OK_PushButton.SetMinWidth( buttonWidth );
OK_PushButton.SetDefault();
OK_PushButton.SetCursor( StdCursor::Checkmark );
OK_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );
Cancel_PushButton.SetText( "Cancel" );
Cancel_PushButton.SetMinWidth( buttonWidth );
Cancel_PushButton.SetCursor( StdCursor::Crossmark );
Cancel_PushButton.OnClick( (pcl::Button::click_event_handler)&DynamicCropPreferencesDialog::Button_Click, *this );
Buttons_Sizer.SetSpacing( 8 );
Buttons_Sizer.AddStretch();
Buttons_Sizer.Add( OK_PushButton );
Buttons_Sizer.Add( Cancel_PushButton );
Global_Sizer.SetMargin( 8 );
Global_Sizer.SetSpacing( 6 );
Global_Sizer.Add( FillColor_GroupBox );
Global_Sizer.AddSpacing( 4 );
Global_Sizer.Add( Buttons_Sizer );
SetSizer( Global_Sizer );
AdjustToContents();
SetFixedSize();
SetWindowTitle( "DynamicCrop Interface Preferences" );
OnReturn( (pcl::Dialog::return_event_handler)&DynamicCropPreferencesDialog::Dialog_Return, *this );
Black_RadioButton.SetChecked( Red( fillColor ) == 0 );
White_RadioButton.SetChecked( Red( fillColor ) != 0 );
Alpha_Slider.SetValue( Alpha( fillColor ) );
Update();
}
void DynamicCropPreferencesDialog::Update()
{
int alpha = Alpha_Slider.Value();
Alpha_Slider.SetToolTip( (alpha == 0) ? "Transparent" :
((alpha == 255) ? "Opaque" : String( Alpha_Slider.Value() )) );
uint8 base = White_RadioButton.IsChecked() ? 0xFF : 0x00;
fillColor = RGBAColor( base, base, base, alpha );
if ( TheDynamicCropInterface->view != 0 )
TheDynamicCropInterface->UpdateView();
}
void DynamicCropPreferencesDialog::Slider_ValueUpdated( Slider& /*sender*/, int /*value*/ )
{
Update();
}
void DynamicCropPreferencesDialog::Button_Click( Button& sender, bool /*checked*/ )
{
if ( sender == Black_RadioButton || sender == White_RadioButton )
Update();
else if ( sender == OK_PushButton )
Ok();
else
Cancel();
}
void DynamicCropPreferencesDialog::Dialog_Return( Dialog& sender, int retVal )
{
if ( retVal != StdDialogCode::Ok )
{
fillColor = savedColor;
if ( TheDynamicCropInterface->view != 0 )
TheDynamicCropInterface->UpdateView();
}
}
// ----------------------------------------------------------------------------
} // pcl
// ----------------------------------------------------------------------------
// EOF DynamicCropPreferencesDialog.cpp - Released 2016/02/21 20:22:42 UTC
| 38.835165 | 121 | 0.673316 | [
"geometry"
] |
8425471c9b1cdd382732ad0f64847e500375eb30 | 1,119 | cpp | C++ | SPOJ/DistractedJudges2.cpp | MartinAparicioPons/Competitive-Programming | 58151df0ed08a5e4e605abefdd69fef1ecc10fa0 | [
"Apache-2.0"
] | 1 | 2019-09-29T03:58:35.000Z | 2019-09-29T03:58:35.000Z | SPOJ/DistractedJudges2.cpp | MartinAparicioPons/Competitive-Programming | 58151df0ed08a5e4e605abefdd69fef1ecc10fa0 | [
"Apache-2.0"
] | null | null | null | SPOJ/DistractedJudges2.cpp | MartinAparicioPons/Competitive-Programming | 58151df0ed08a5e4e605abefdd69fef1ecc10fa0 | [
"Apache-2.0"
] | null | null | null | #include <bits/stdc++.h>
#define EPS 1e-11
#define EL cerr << endl;
#define DB(x) cerr << "#" << (#x) << ": " << (x) << " ";
#define DBL(x) cerr << "#" << (#x) << ": " << (x) << endl;
#define PR(x) cout << (x) << endl
#define X first
#define Y second
#define PB push_back
#define SQ(x) ((x)*(x))
#define GB(m, x) ((m) & (1<<(x)))
#define SB(m, x) ((m) |= (1<<(x)))
#define CB(m, x) ((m) &= ~(1<<(x)))
#define TB(m, x) ((m) ^= (1<<(x)))
using namespace std; typedef string string;
typedef unsigned long long ull; typedef long double ld;
typedef long long ll; typedef pair<ll, ll> ii;
typedef pair<int, ii> iii; typedef vector<int> vi;
typedef vector<ii> vii; typedef vector<vi> vvi;
typedef vector<ll> vll; typedef pair<string, string> ss;
const static ll MX = 1000100;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int A[MX], n, i, j;
bool V[MX];
while(cin >> n){
memset(V, false, sizeof V);
for(i = 0; i < n; i++) cin >> A[i];
V[n] = true;
for(i = n-1; i >= 0; i--){
if(V[A[i] + i + 1]) V[i] = true;
}
for(i = 1; i <= n; i++) if(V[i]) cout << i << endl;
}
}
| 26.642857 | 62 | 0.536193 | [
"vector"
] |
842eca30aba1c59a036cfdf8022a0ab38454a34f | 8,193 | cc | C++ | 0403_Frog_Jump/0403.cc | LuciusKyle/LeetCode | 66c9090e5244b10eca0be50398764da2b4b48a6c | [
"Apache-2.0"
] | null | null | null | 0403_Frog_Jump/0403.cc | LuciusKyle/LeetCode | 66c9090e5244b10eca0be50398764da2b4b48a6c | [
"Apache-2.0"
] | null | null | null | 0403_Frog_Jump/0403.cc | LuciusKyle/LeetCode | 66c9090e5244b10eca0be50398764da2b4b48a6c | [
"Apache-2.0"
] | null | null | null |
#include <assert.h>
#include <algorithm>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using std::array;
using std::map;
using std::unordered_map;
using std::unordered_set;
using std::vector;
class Solution_V3 {
public:
bool canCross(const vector<int>& stones) {
const unordered_set<size_t> stone_set(stones.cbegin(), stones.cend());
unordered_map<size_t, unordered_map<size_t, bool>> result;
return canCross(stone_set, 0, 0, result, stones.back());
}
private:
bool canCross(const unordered_set<size_t> stone_set, const size_t cur_pos, const size_t k, unordered_map<size_t,unordered_map<size_t, bool>> &result, const size_t final_stone) {
if (cur_pos == final_stone) return true;
if (result[cur_pos].find(k) != result[cur_pos].end()) return result[cur_pos].at(k);
array<size_t, 3> next_step_arr{k - 1, k, k + 1};
bool cur_result = false;
for (size_t i = (k == 0 ? 2 : (k == 1 ? 1 : 0)); i < next_step_arr.size(); ++i)
if (stone_set.count(cur_pos + next_step_arr[i]) != 0 && canCross(stone_set, cur_pos + next_step_arr[i], next_step_arr[i], result, final_stone)) {
cur_result = true;
break;
}
result[cur_pos].insert({k, cur_result});
return cur_result;
}
};
class Solution {
public:
bool canCross(const vector<int>& stones) {
unordered_map<size_t,unordered_map<size_t, bool>> result;
return canCross(stones, 0, 0, result);
}
private:
bool canCross(const vector<int>& stones, const size_t cur_pos, const size_t k, unordered_map<size_t,unordered_map<size_t, bool>> &result) {
if (cur_pos == size_t(stones.back())) return true;
if (result[cur_pos].find(k) != result[cur_pos].end()) return result[cur_pos].at(k);
array<size_t, 3> next_step_arr{k - 1, k, k + 1};
bool cur_result = false;
for (size_t i = (k == 0 ? 2 : (k == 1 ? 1 : 0)); i < next_step_arr.size(); ++i)
if (std::binary_search(stones.cbegin(), stones.cend(), cur_pos + next_step_arr[i]) && canCross(stones, cur_pos + next_step_arr[i], next_step_arr[i], result)) {
cur_result = true;
break;
}
result[cur_pos].insert({k, cur_result});
return cur_result;
}
};
int main(void) {
Solution sln;
assert(sln.canCross({0, 1, 3, 5, 6, 8, 12, 17}));
assert(!sln.canCross({0, 1, 2, 3, 4, 8, 9, 11}));
assert(!sln.canCross(
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293,
294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307,
308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321,
322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335,
336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349,
350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377,
378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391,
392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405,
406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419,
420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433,
434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447,
448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461,
462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475,
476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489,
490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503,
504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517,
518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531,
532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559,
560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573,
574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587,
588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601,
602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615,
616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629,
630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643,
644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657,
658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671,
672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685,
686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699,
700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713,
714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727,
728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741,
742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755,
756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769,
770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783,
784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797,
798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811,
812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839,
840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853,
854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867,
868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881,
882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895,
896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909,
910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937,
938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951,
952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965,
966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979,
980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993,
994, 995, 996, 997, 998, 99999999}));
return 0;
}
| 57.697183 | 179 | 0.546442 | [
"vector"
] |
843515f308e55047d0c34c2130e226a491919a57 | 1,599 | cpp | C++ | Vector2D.cpp | Shashank9830/SDL-Game-Project | 4e7418f54df917ee831be7710091f4dfb76b5fdd | [
"MIT"
] | 23 | 2017-09-16T06:25:52.000Z | 2022-02-21T10:15:16.000Z | Vector2D.cpp | Shashank9830/SDL-Game-Project | 4e7418f54df917ee831be7710091f4dfb76b5fdd | [
"MIT"
] | 1 | 2019-06-05T14:27:49.000Z | 2019-06-05T14:36:19.000Z | Vector2D.cpp | Shashank9830/SDL-Game-Project | 4e7418f54df917ee831be7710091f4dfb76b5fdd | [
"MIT"
] | 11 | 2018-01-23T11:44:25.000Z | 2021-07-30T04:47:30.000Z | #include "Vector2D.h"
#include <math.h>
//function to calculate the length of a vector
float Vector2D::length()
{
return (float)sqrt((m_x * m_x) + (m_y * m_y));
}
//addition of two vectors using + operator
Vector2D Vector2D::operator + (const Vector2D& v2) const
{
return Vector2D(m_x + v2.m_x, m_y + v2.m_y);
}
//addition of two vectors using += operator
Vector2D& operator += (Vector2D& v1, const Vector2D& v2)
{
v1.m_x += v2.m_x;
v1.m_y += v2.m_y;
return v1;
}
//multiplication of a vector with a scalar number using * operator
Vector2D Vector2D::operator * (float scalar)
{
return Vector2D(m_x * scalar, m_y * scalar);
}
//multiplication of a vector with a scalar number using *= operator
Vector2D& Vector2D::operator *= (float scalar)
{
m_x *= scalar;
m_y *= scalar;
return *this;
}
//subtraction of two vectors using - operator
Vector2D Vector2D::operator - (const Vector2D& v2) const
{
return Vector2D(m_x - v2.m_x, m_y - v2.m_y);
}
//subtraction of two vectors using -= operator
Vector2D& operator -= (Vector2D& v1, const Vector2D& v2)
{
v1.m_x -= v2.m_x;
v1.m_y -= v2.m_y;
return v1;
}
//division of a vector by a scalar number using / operator
Vector2D Vector2D::operator / (float scalar)
{
return Vector2D(m_x / scalar, m_y / scalar);
}
//division of a vector by a scalar number using /= operator
Vector2D& Vector2D::operator /= (float scalar)
{
m_x /= scalar;
m_y /= scalar;
return *this;
}
//function to normalize a vector
void Vector2D::normalize()
{
float l = length();
if (l > 0) //we never want to attempt to divide by 0
{
(*this) *= 1 / l;
}
} | 20.5 | 67 | 0.682301 | [
"vector"
] |
843ae93d832a4374b85575d72cf25e5a726a7e4d | 530 | hpp | C++ | wjson/specialization/property.hpp | mambaru/wjson | 48de30f1247564ab16c93fc824a14b182145ff90 | [
"MIT"
] | 21 | 2016-09-29T10:25:12.000Z | 2020-07-07T23:19:51.000Z | wjson/specialization/property.hpp | mambaru/wjson | 48de30f1247564ab16c93fc824a14b182145ff90 | [
"MIT"
] | 10 | 2016-11-17T09:09:35.000Z | 2021-10-03T11:47:18.000Z | wjson/specialization/property.hpp | mambaru/wjson | 48de30f1247564ab16c93fc824a14b182145ff90 | [
"MIT"
] | 6 | 2016-09-29T12:05:06.000Z | 2022-02-17T13:05:18.000Z | //
// Author: Vladimir Migashko <migashko@gmail.com>, (C) 2008-2016
//
// Copyright: See COPYING file that comes with this distribution
//
#pragma once
#include <wjson/predef.hpp>
#include <wjson/serializer/object.hpp>
#include <wjson/serializer/member_value.hpp>
#include <fas/type_list/normalize.hpp>
namespace wjson{
template<typename T, typename M, M T::* m>
struct property
{
void operator()(T& t, const M& value ) const
{
t.*m = value;
}
const M& operator()(const T& t) const
{
return t.*m;
}
};
}
| 17.096774 | 64 | 0.673585 | [
"object"
] |
8449d866335fe9ce6db844021936ecf3cc1e82b2 | 41,101 | cc | C++ | src/nodes/backgroundCell/BackgroundCellChannelModel.cc | aferaudo/Simu5G | 301888f86d97a291f6dc8386590c8f7ba817a42d | [
"Intel"
] | null | null | null | src/nodes/backgroundCell/BackgroundCellChannelModel.cc | aferaudo/Simu5G | 301888f86d97a291f6dc8386590c8f7ba817a42d | [
"Intel"
] | null | null | null | src/nodes/backgroundCell/BackgroundCellChannelModel.cc | aferaudo/Simu5G | 301888f86d97a291f6dc8386590c8f7ba817a42d | [
"Intel"
] | 1 | 2021-12-15T14:50:34.000Z | 2021-12-15T14:50:34.000Z | //
// Simu5G
//
// Authors: Giovanni Nardini, Giovanni Stea, Antonio Virdis (University of Pisa)
//
// This file is part of a software released under the license included in file
// "license.pdf". Please read LICENSE and README files before using it.
// The above files and the present reference are part of the software itself,
// and cannot be removed from it.
//
#include "nodes/backgroundCell/BackgroundCellChannelModel.h"
#include "nodes/backgroundCell/BackgroundScheduler.h"
#include "stack/phy/layer/LtePhyBase.h"
#include "stack/phy/layer/LtePhyUe.h"
#include "stack/phy/ChannelModel/LteRealisticChannelModel.h"
Define_Module(BackgroundCellChannelModel);
void BackgroundCellChannelModel::initialize(int stage)
{
cSimpleModule::initialize(stage);
if (stage == inet::INITSTAGE_LOCAL)
{
scenario_ = aToDeploymentScenario(par("scenario").stringValue());
hNodeB_ = par("nodeb_height");
hBuilding_ = par("building_height");
inside_building_ = par("inside_building");
if (inside_building_)
inside_distance_ = uniform(0.0,25.0);
tolerateMaxDistViolation_ = par("tolerateMaxDistViolation");
hUe_ = par("ue_height");
wStreet_ = par("street_wide");
antennaGainUe_ = par("antennaGainUe");
antennaGainEnB_ = par("antennGainEnB");
antennaGainMicro_ = par("antennGainMicro");
thermalNoise_ = par("thermalNoise");
cableLoss_ = par("cable_loss");
ueNoiseFigure_ = par("ue_noise_figure");
bsNoiseFigure_ = par("bs_noise_figure");
shadowing_ = par("shadowing");
correlationDistance_ = par("correlation_distance");
dynamicLos_ = par("dynamic_los");
fixedLos_ = par("fixed_los");
fading_ = par("fading");
std::string fType = par("fading_type");
if (fType.compare("JAKES") == 0)
fadingType_ = JAKES;
else if (fType.compare("RAYLEIGH") == 0)
fadingType_ = RAYLEIGH;
else
fadingType_ = JAKES;
fadingPaths_ = par("fading_paths");
delayRMS_ = par("delay_rms");
enableBackgroundCellInterference_ = par("bgCell_interference");
enableDownlinkInterference_ = par("downlink_interference");
enableUplinkInterference_ = par("uplink_interference");
//get binder
binder_ = getBinder();
}
}
std::vector<double> BackgroundCellChannelModel::getSINR(MacNodeId bgUeId, inet::Coord bgUePos, TrafficGeneratorBase* bgUe, BackgroundScheduler* bgScheduler, Direction dir)
{
unsigned int numBands = bgScheduler->getNumBands();
inet::Coord bgBsPos = bgScheduler->getPosition();
int bgBsId = bgScheduler->getId();
//get tx power
double recvPower = (dir == DL) ? bgScheduler->getTxPower() : bgUe->getTxPwr(); // dBm
double antennaGainTx = 0.0;
double antennaGainRx = 0.0;
double noiseFigure = 0.0;
if (dir == DL)
{
//set noise Figure
noiseFigure = ueNoiseFigure_; //dB
//set antenna gain Figure
antennaGainTx = antennaGainEnB_; //dB
antennaGainRx = antennaGainUe_; //dB
}
else // if( dir == UL )
{
// TODO check if antennaGainEnB should be added in UL direction too
antennaGainTx = antennaGainUe_;
antennaGainRx = antennaGainEnB_;
noiseFigure = bsNoiseFigure_;
}
double attenuation = getAttenuation(bgUeId, dir, bgBsPos, bgUePos);
//compute attenuation (PATHLOSS + SHADOWING)
recvPower -= attenuation; // (dBm-dB)=dBm
//add antenna gain
recvPower += antennaGainTx; // (dBm+dB)=dBm
recvPower += antennaGainRx; // (dBm+dB)=dBm
//sub cable loss
recvPower -= cableLoss_; // (dBm-dB)=dBm
// std::cout << "BackgroundCellChannelModel::getSinr - attenuation " << attenuation << " antennaGainTx-Rx " << antennaGainTx << " " << antennaGainRx << " cableLoss " << cableLoss_ << endl;
//=============== ANGOLAR ATTENUATION =================
if (dir == DL && bgScheduler->getTxDirection() == ANISOTROPIC)
{
// get tx angle
double txAngle = bgScheduler->getTxAngle();
// compute the angle between uePosition and reference axis, considering the Bs as center
double ueAngle = computeAngle(bgBsPos, bgUePos);
// compute the reception angle between ue and eNb
double recvAngle = fabs(txAngle - ueAngle);
if (recvAngle > 180)
recvAngle = 360 - recvAngle;
double verticalAngle = computeVerticalAngle(bgBsPos, bgUePos);
// compute attenuation due to sectorial tx
double angolarAtt = computeAngolarAttenuation(recvAngle,verticalAngle);
recvPower -= angolarAtt;
}
//=============== END ANGOLAR ATTENUATION =================
//===================== SINR COMPUTATION ========================
std::vector<double> snrVector;
snrVector.resize(numBands, recvPower);
double speed = computeSpeed(bgUeId, bgUePos);
// compute and add interference due to fading
// Apply fading for each band
double fadingAttenuation = 0;
// for each logical band
// FIXME compute fading only for used RBs
for (unsigned int i = 0; i < numBands; i++)
{
fadingAttenuation = 0;
//if fading is enabled
if (fading_)
{
//Appling fading
if (fadingType_ == RAYLEIGH)
fadingAttenuation = rayleighFading(bgUeId, i);
else if (fadingType_ == JAKES)
fadingAttenuation = jakesFading(bgUeId, speed, i, numBands);
}
// add fading contribution to the received pwr
double finalRecvPower = recvPower + fadingAttenuation; // (dBm+dB)=dBm
snrVector[i] = finalRecvPower;
}
//============ MULTI CELL INTERFERENCE COMPUTATION =================
// for background UEs, we only compute CQI
RbMap rbmap;
//vector containing the sum of multicell interference for each band
std::vector<double> multiCellInterference; // Linear value (mW)
// prepare data structure
multiCellInterference.resize(numBands, 0);
if (enableDownlinkInterference_ && dir == DL)
{
computeDownlinkInterference(bgUeId, bgUePos, carrierFrequency_, rbmap, numBands, &multiCellInterference);
}
else if (enableUplinkInterference_ && dir == UL)
{
computeUplinkInterference(bgUeId, bgBsPos, carrierFrequency_, rbmap, numBands, &multiCellInterference);
}
//============ BACKGROUND CELLS INTERFERENCE COMPUTATION =================
//vector containing the sum of bg-cell interference for each band
std::vector<double> bgCellInterference; // Linear value (mW)
// prepare data structure
bgCellInterference.resize(numBands, 0);
if (enableBackgroundCellInterference_)
{
computeBackgroundCellInterference(bgUeId, bgUePos, bgBsId, bgBsPos, carrierFrequency_, rbmap, dir, numBands, &bgCellInterference); // dBm
}
// compute and linearize total noise
double totN = dBmToLinear(thermalNoise_ + noiseFigure);
for (unsigned int i = 0; i < numBands; i++)
{
// denominator expressed in dBm as (N+extCell+multiCell)
// ( mW + mW + mW )
double den = linearToDBm(multiCellInterference[i] + bgCellInterference[i] + totN );
// compute final SINR
snrVector[i] -= den;
}
return snrVector;
}
double BackgroundCellChannelModel::getAttenuation(MacNodeId nodeId, Direction dir, inet::Coord bgBsCoord, inet::Coord bgUeCoord)
{
//COMPUTE DISTANCE between ue and bs
double sqrDistance = bgBsCoord.distance(bgUeCoord);
double speed = computeSpeed(nodeId, bgUeCoord);
double correlationDist = computeCorrelationDistance(nodeId, bgUeCoord);
// If euclidean distance since last Los probabilty computation is greater than
// correlation distance UE could have changed its state and
// its visibility from eNodeb, hence it is correct to recompute the los probability
if (correlationDist > correlationDistance_
|| losMap_.find(nodeId) == losMap_.end())
{
computeLosProbability(sqrDistance, nodeId);
}
//compute attenuation based on selected scenario and based on LOS or NLOS
bool los = losMap_[nodeId];
double dbp = 0;
double attenuation = computePathLoss(sqrDistance, dbp, los);
// TODO compute shadowing based on speed
// Applying shadowing only if it is enabled by configuration
// log-normal shadowing
if (shadowing_)
attenuation += computeShadowing(sqrDistance, nodeId, speed);
EV << "BackgroundCellChannelModel::getAttenuation - computed attenuation at distance " << sqrDistance << " is " << attenuation << endl;
return attenuation;
}
void BackgroundCellChannelModel::updatePositionHistory(const MacNodeId nodeId, const inet::Coord coord)
{
if (positionHistory_.find(nodeId) != positionHistory_.end())
{
// position already updated for this TTI.
if (positionHistory_[nodeId].back().first == NOW)
return;
}
// FIXME: possible memory leak
positionHistory_[nodeId].push(Position(NOW, coord));
if (positionHistory_[nodeId].size() > 2) // if we have more than a past and a current element
// drop the oldest one
positionHistory_[nodeId].pop();
}
void BackgroundCellChannelModel::updateCorrelationDistance(const MacNodeId nodeId, const inet::Coord coord)
{
if (lastCorrelationPoint_.find(nodeId) == lastCorrelationPoint_.end()){
// no lastCorrelationPoint set current point.
lastCorrelationPoint_[nodeId] = Position(NOW, coord);
} else if ((lastCorrelationPoint_[nodeId].first != NOW) &&
lastCorrelationPoint_[nodeId].second.distance(coord) > correlationDistance_) {
// check simtime_t first
lastCorrelationPoint_[nodeId] = Position(NOW, coord);
}
}
double BackgroundCellChannelModel::computeCorrelationDistance(const MacNodeId nodeId, const inet::Coord coord)
{
double dist = 0.0;
if (lastCorrelationPoint_.find(nodeId) == lastCorrelationPoint_.end()){
// no lastCorrelationPoint found. Add current position and return dist = 0.0
lastCorrelationPoint_[nodeId] = Position(NOW, coord);
} else {
dist = lastCorrelationPoint_[nodeId].second.distance(coord);
}
return dist;
}
double BackgroundCellChannelModel::computeSpeed(const MacNodeId nodeId, const inet::Coord coord)
{
double speed = 0.0;
if (positionHistory_.find(nodeId) == positionHistory_.end())
{
// no entries
return speed;
}
else
{
//compute distance traveled from last update by UE (eNodeB position is fixed)
if (positionHistory_[nodeId].size() == 1)
{
// the only element refers to present , return 0
return speed;
}
double movement = positionHistory_[nodeId].front().second.distance(coord);
if (movement <= 0.0)
return speed;
else
{
double time = (NOW.dbl()) - (positionHistory_[nodeId].front().first.dbl());
if (time <= 0.0) // time not updated since last speed call
throw cRuntimeError("Multiple entries detected in position history referring to same time");
// compute speed
speed = (movement) / (time);
}
}
return speed;
}
void BackgroundCellChannelModel::computeLosProbability(double d, MacNodeId nodeId)
{
double p = 0;
if (!dynamicLos_)
{
losMap_[nodeId] = fixedLos_;
return;
}
switch (scenario_)
{
case INDOOR_HOTSPOT:
if (d < 18)
p = 1;
else if (d >= 37)
p = 0.5;
else
p = exp((-1) * ((d - 18) / 27));
break;
case URBAN_MICROCELL:
p = (((18 / d) > 1) ? 1 : 18 / d) * (1 - exp(-1 * d / 36))
+ exp(-1 * d / 36);
break;
case URBAN_MACROCELL:
p = (((18 / d) > 1) ? 1 : 18 / d) * (1 - exp(-1 * d / 36))
+ exp(-1 * d / 36);
break;
case RURAL_MACROCELL:
if (d <= 10)
p = 1;
else
p = exp(-1 * (d - 10) / 200);
break;
case SUBURBAN_MACROCELL:
if (d <= 10)
p = 1;
else
p = exp(-1 * (d - 10) / 1000);
break;
default:
throw cRuntimeError("Wrong path-loss scenario value %d", scenario_);
}
double random = uniform(0.0, 1.0);
if (random <= p)
losMap_[nodeId] = true;
else
losMap_[nodeId] = false;
}
double BackgroundCellChannelModel::computePathLoss(double distance, double dbp, bool los)
{
//compute attenuation based on selected scenario and based on LOS or NLOS
double pathLoss = 0;
switch (scenario_)
{
case INDOOR_HOTSPOT:
pathLoss = computeIndoor(distance, los);
break;
case URBAN_MICROCELL:
pathLoss = computeUrbanMicro(distance, los);
break;
case URBAN_MACROCELL:
pathLoss = computeUrbanMacro(distance, los);
break;
case RURAL_MACROCELL:
pathLoss = computeRuralMacro(distance, dbp, los);
break;
case SUBURBAN_MACROCELL:
pathLoss = computeSubUrbanMacro(distance, dbp, los);
break;
default:
throw cRuntimeError("Wrong value %d for path-loss scenario", scenario_);
}
return pathLoss;
}
double BackgroundCellChannelModel::computeIndoor(double d, bool los)
{
double a, b;
if (los)
{
if (d > 150 || d < 3)
throw cRuntimeError("Error LOS indoor path loss model is valid for 3<d<150");
a = 16.9;
b = 32.8;
}
else
{
if (d > 250 || d < 6)
throw cRuntimeError("Error NLOS indoor path loss model is valid for 6<d<250");
a = 43.3;
b = 11.5;
}
return a * log10(d) + b + 20 * log10(carrierFrequency_);
}
double BackgroundCellChannelModel::computeUrbanMicro(double d, bool los)
{
if (d < 10)
d = 10;
double dbp = 4 * (hNodeB_ - 1) * (hUe_ - 1)
* ((carrierFrequency_ * 1000000000) / SPEED_OF_LIGHT);
if (los)
{
// LOS situation
if (d > 5000){
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error LOS urban microcell path loss model is valid for d<5000 m");
}
if (d < dbp)
return 22 * log10(d) + 28 + 20 * log10(carrierFrequency_);
else
return 40 * log10(d) + 7.8 - 18 * log10(hNodeB_ - 1)
- 18 * log10(hUe_ - 1) + 2 * log10(carrierFrequency_);
}
// NLOS situation
if (d < 10)
throw cRuntimeError("Error NLOS urban microcell path loss model is valid for 10m < d ");
if (d > 5000){
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error NLOS urban microcell path loss model is valid for d <2000 m");
}
return 36.7 * log10(d) + 22.7 + 26 * log10(carrierFrequency_);
}
double BackgroundCellChannelModel::computeUrbanMacro(double d, bool los)
{
if (d < 10)
d = 10;
double dbp = 4 * (hNodeB_ - 1) * (hUe_ - 1)
* ((carrierFrequency_ * 1000000000) / SPEED_OF_LIGHT);
if (los)
{
if (d > 5000){
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error LOS urban macrocell path loss model is valid for d<5000 m");
}
if (d < dbp)
return 22 * log10(d) + 28 + 20 * log10(carrierFrequency_);
else
return 40 * log10(d) + 7.8 - 18 * log10(hNodeB_ - 1)
- 18 * log10(hUe_ - 1) + 2 * log10(carrierFrequency_);
}
if (d < 10)
throw cRuntimeError("Error NLOS urban macrocell path loss model is valid for 10m < d ");
if (d > 5000){
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error NLOS urban macrocell path loss model is valid for d <5000 m");
}
double att = 161.04 - 7.1 * log10(wStreet_) + 7.5 * log10(hBuilding_)
- (24.37 - 3.7 * pow(hBuilding_ / hNodeB_, 2)) * log10(hNodeB_)
+ (43.42 - 3.1 * log10(hNodeB_)) * (log10(d) - 3)
+ 20 * log10(carrierFrequency_)
- (3.2 * (pow(log10(11.75 * hUe_), 2)) - 4.97);
return att;
}
double BackgroundCellChannelModel::computeSubUrbanMacro(double d, double& dbp, bool los)
{
if (d < 10)
d = 10;
dbp = 4 * (hNodeB_ - 1) * (hUe_ - 1)
* ((carrierFrequency_ * 1000000000) / SPEED_OF_LIGHT);
if (los)
{
if (d > 5000) {
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error LOS suburban macrocell path loss model is valid for d<5000 m");
}
double a1 = (0.03 * pow(hBuilding_, 1.72));
double b1 = 0.044 * pow(hBuilding_, 1.72);
double a = (a1 < 10) ? a1 : 10;
double b = (b1 < 14.72) ? b1 : 14.72;
if (d < dbp)
{
double primo = 20 * log10((40 * M_PI * d * carrierFrequency_) / 3);
double secondo = a * log10(d);
double quarto = 0.002 * log10(hBuilding_) * d;
return primo + secondo - b + quarto;
}
else
return 20 * log10((40 * M_PI * dbp * carrierFrequency_) / 3)
+ a * log10(dbp) - b + 0.002 * log10(hBuilding_) * dbp
+ 40 * log10(d / dbp);
}
if (d > 5000) {
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error NLOS suburban macrocell path loss model is valid for 10 < d < 5000 m");
}
double att = 161.04 - 7.1 * log10(wStreet_) + 7.5 * log10(hBuilding_)
- (24.37 - 3.7 * pow(hBuilding_ / hNodeB_, 2)) * log10(hNodeB_)
+ (43.42 - 3.1 * log10(hNodeB_)) * (log10(d) - 3)
+ 20 * log10(carrierFrequency_)
- (3.2 * (pow(log10(11.75 * hUe_), 2)) - 4.97);
return att;
}
double BackgroundCellChannelModel::computeRuralMacro(double d, double& dbp, bool los)
{
if (d < 10)
d = 10;
dbp = 4 * (hNodeB_ - 1) * (hUe_ - 1)
* ((carrierFrequency_ * 1000000000) / SPEED_OF_LIGHT);
if (los)
{
// LOS situation
if (d > 10000) {
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error LOS rural macrocell path loss model is valid for d < 10000 m");
}
double a1 = (0.03 * pow(hBuilding_, 1.72));
double b1 = 0.044 * pow(hBuilding_, 1.72);
double a = (a1 < 10) ? a1 : 10;
double b = (b1 < 14.72) ? b1 : 14.72;
if (d < dbp)
return 20 * log10((40 * M_PI * d * carrierFrequency_) / 3)
+ a * log10(d) - b + 0.002 * log10(hBuilding_) * d;
else
return 20 * log10((40 * M_PI * dbp * carrierFrequency_) / 3)
+ a * log10(dbp) - b + 0.002 * log10(hBuilding_) * dbp
+ 40 * log10(d / dbp);
}
// NLOS situation
if (d > 5000) {
if(tolerateMaxDistViolation_)
return ATT_MAXDISTVIOLATED;
else
throw cRuntimeError("Error NLOS rural macrocell path loss model is valid for d<5000 m");
}
double att = 161.04 - 7.1 * log10(wStreet_) + 7.5 * log10(hBuilding_)
- (24.37 - 3.7 * pow(hBuilding_ / hNodeB_, 2)) * log10(hNodeB_)
+ (43.42 - 3.1 * log10(hNodeB_)) * (log10(d) - 3)
+ 20 * log10(carrierFrequency_)
- (3.2 * (pow(log10(11.75 * hUe_), 2)) - 4.97);
return att;
}
double BackgroundCellChannelModel::computeShadowing(double sqrDistance, MacNodeId nodeId, double speed)
{
double mean = 0;
double dbp = 0.0;
//Get std deviation according to los/nlos and selected scenario
double stdDev = getStdDev(sqrDistance < dbp, nodeId);
double time = 0;
double space = 0;
double att;
// if direction is DOWNLINK it means that this module is located in UE stack than
// the Move object associated to the UE is myMove_ varible
// if direction is UPLINK it means that this module is located in UE stack than
// the Move object associated to the UE is move varible
// if shadowing for current user has never been computed
if (lastComputedSF_.find(nodeId) == lastComputedSF_.end())
{
//Get the log normal shadowing with std deviation stdDev
att = normal(mean, stdDev);
//store the shadowing attenuation for this user and the temporal mark
std::pair<simtime_t, double> tmp(NOW, att);
lastComputedSF_[nodeId] = tmp;
//If the shadowing attenuation has been computed at least one time for this user
// and the distance traveled by the UE is greated than correlation distance
}
else if ((NOW - lastComputedSF_.at(nodeId).first).dbl() * speed
> correlationDistance_)
{
//get the temporal mark of the last computed shadowing attenuation
time = (NOW - lastComputedSF_.at(nodeId).first).dbl();
//compute the traveled distance
space = time * speed;
//Compute shadowing with a EAW (Exponential Average Window) (step1)
double a = exp(-0.5 * (space / correlationDistance_));
//Get last shadowing attenuation computed
double old = lastComputedSF_.at(nodeId).second;
//Compute shadowing with a EAW (Exponential Average Window) (step2)
att = a * old + sqrt(1 - pow(a, 2)) * normal(mean, stdDev);
// Store the new computed shadowing
std::pair<simtime_t, double> tmp(NOW, att);
lastComputedSF_[nodeId] = tmp;
// if the distance traveled by the UE is smaller than correlation distance shadowing attenuation remain the same
}
else
{
att = lastComputedSF_.at(nodeId).second;
}
return att;
}
double BackgroundCellChannelModel::getStdDev(bool dist, MacNodeId nodeId)
{
switch (scenario_)
{
case URBAN_MICROCELL:
case INDOOR_HOTSPOT:
if (losMap_[nodeId])
return 3.;
else
return 4.;
break;
case URBAN_MACROCELL:
if (losMap_[nodeId])
return 4.;
else
return 6.;
break;
case RURAL_MACROCELL:
case SUBURBAN_MACROCELL:
if (losMap_[nodeId])
{
if (dist)
return 4.;
else
return 6.;
}
else
return 8.;
break;
default:
throw cRuntimeError("Wrong path-loss scenario value %d", scenario_);
}
return 0.0;
}
double BackgroundCellChannelModel::computeAngle(inet::Coord center, inet::Coord point) {
double relx, rely, arcoSen, angle, dist;
// compute distance between points
dist = point.distance(center);
// compute distance along the axis
relx = point.x - center.x;
rely = point.y - center.y;
// compute the arc sine
arcoSen = asin(rely / dist) * 180.0 / M_PI;
// adjust the angle depending on the quadrants
if (relx < 0 && rely > 0) // quadrant II
angle = 180.0 - arcoSen;
else if (relx < 0 && rely <= 0) // quadrant III
angle = 180.0 - arcoSen;
else if (relx > 0 && rely < 0) // quadrant IV
angle = 360.0 + arcoSen;
else
// quadrant I
angle = arcoSen;
return angle;
}
double BackgroundCellChannelModel::computeVerticalAngle(inet::Coord center, inet::Coord point)
{
double threeDimDistance = center.distance(point);
double twoDimDistance = getTwoDimDistance(center, point);
double arccos = acos(twoDimDistance/threeDimDistance) * 180.0 / M_PI;
return 90 + arccos;
}
double BackgroundCellChannelModel::getTwoDimDistance(inet::Coord a, inet::Coord b)
{
a.z = 0.0;
b.z = 0.0;
return a.distance(b);
}
double BackgroundCellChannelModel::computeAngolarAttenuation(double hAngle, double vAngle)
{
// in this implementation, vertical angle is not considered
double angolarAtt;
double angolarAttMin = 25;
// compute attenuation due to angolar position
// see TR 36.814 V9.0.0 for more details
angolarAtt = 12 * pow(hAngle / 70.0, 2);
// EV << "\t angolarAtt[" << angolarAtt << "]" << endl;
// max value for angolar attenuation is 25 dB
if (angolarAtt > angolarAttMin)
angolarAtt = angolarAttMin;
return angolarAtt;
}
double BackgroundCellChannelModel::rayleighFading(MacNodeId id, unsigned int band)
{
//get raylegh variable from trace file
double temp1 = binder_->phyPisaData.getChannel(getCellInfo(id)->getLambda(id)->channelIndex + band);
return linearToDb(temp1);
}
double BackgroundCellChannelModel::jakesFading(MacNodeId nodeId, double speed, unsigned int band, unsigned int numBands)
{
JakesFadingMap* actualJakesMap = &jakesFadingMap_;
//if this is the first time that we compute fading for current user
if (actualJakesMap->find(nodeId) == actualJakesMap->end())
{
//clear the map
// FIXME: possible memory leak
(*actualJakesMap)[nodeId].clear();
//for each band we are going to create a jakes fading
for (unsigned int j = 0; j < numBands; j++)
{
//clear some structure
JakesFadingData temp;
temp.angleOfArrival.clear();
temp.delaySpread.clear();
//for each fading path
for (int i = 0; i < fadingPaths_; i++)
{
//get angle of arrivals
temp.angleOfArrival.push_back(cos(uniform(0, M_PI)));
//get delay spread
temp.delaySpread.push_back(exponential(delayRMS_));
}
//store the jakes fadint for this user
(*actualJakesMap)[nodeId].push_back(temp);
}
}
// convert carrier frequency from GHz to Hz
double f = carrierFrequency_ * 1000000000;
//get transmission time start (TTI =1ms)
simtime_t t = simTime().dbl() - 0.001;
double re_h = 0;
double im_h = 0;
const JakesFadingData& actualJakesData = actualJakesMap->at(nodeId).at(band);
// Compute Doppler shift.
double doppler_shift = (speed * f) / SPEED_OF_LIGHT;
for (int i = 0; i < fadingPaths_; i++)
{
// Phase shift due to Doppler => t-selectivity.
double phi_d = actualJakesData.angleOfArrival[i] * doppler_shift;
// Phase shift due to delay spread => f-selectivity.
double phi_i = actualJakesData.delaySpread[i].dbl() * f;
// Calculate resulting phase due to t-selective and f-selective fading.
double phi = 2.00 * M_PI * (phi_d * t.dbl() - phi_i);
// One ring model/Clarke's model plus f-selectivity according to Cavers:
// Due to isotropic antenna gain pattern on all paths only a^2 can be received on all paths.
// Since we are interested in attenuation a:=1, attenuation per path is then:
double attenuation = (1.00 / sqrt(static_cast<double>(fadingPaths_)));
// Convert to cartesian form and aggregate {Re, Im} over all fading paths.
re_h = re_h + attenuation * cos(phi);
im_h = im_h - attenuation * sin(phi);
// EV << "ID=" << nodeId << " - t[" << t << "] - dopplerShift[" << doppler_shift << "] - phiD[" <<
// phi_d << "] - phiI[" << phi_i << "] - phi[" << phi << "] - attenuation[" << attenuation << "] - f["
// << f << "] - Band[" << band << "] - cos(phi)["
// << cos(phi) << "]" << endl;
}
// Output: |H_f|^2 = absolute channel impulse response due to fading.
// Note that this may be >1 due to constructive interference.
return linearToDb(re_h * re_h + im_h * im_h);
}
double BackgroundCellChannelModel::getReceivedPower_bgUe(double txPower, inet::Coord txPos, inet::Coord rxPos, Direction dir, bool losStatus, const BackgroundScheduler* bgScheduler)
{
double antennaGainTx = 0.0;
double antennaGainRx = 0.0;
double noiseFigure = 0.0;
EV << NOW << " BackgroundCellChannelModel::getReceivedPower_bgUe" << endl;
//===================== PARAMETERS SETUP ============================
if (dir == DL)
{
noiseFigure = ueNoiseFigure_; //dB
antennaGainTx = antennaGainEnB_; //dB
antennaGainRx = antennaGainUe_; //dB
}
else // if( dir == UL )
{
antennaGainTx = antennaGainUe_;
antennaGainRx = antennaGainEnB_;
noiseFigure = bsNoiseFigure_;
}
EV << "BackgroundCellChannelModel::getReceivedPower_bgUe - DIR=" << (( dir==DL )?"DL" : "UL")
<< " - txPwr " << txPower << " - txPos[" << txPos << "] - rxPos[" << rxPos << "] " << endl;
//=================== END PARAMETERS SETUP =======================
//=============== PATH LOSS =================
// Note that shadowing and fading effects are not applied here and left FFW
//compute attenuation based on selected scenario and based on LOS or NLOS
double sqrDistance = txPos.distance(rxPos);
double dbp = 0;
double attenuation = computePathLoss(sqrDistance, dbp, losStatus);
//compute recvPower
double recvPower = txPower - attenuation; // (dBm-dB)=dBm
//add antenna gain
recvPower += antennaGainTx; // (dBm+dB)=dBm
recvPower += antennaGainRx; // (dBm+dB)=dBm
//sub cable loss
recvPower -= cableLoss_; // (dBm-dB)=dBm
//=============== ANGOLAR ATTENUATION =================
if (dir == DL && bgScheduler->getTxDirection() == ANISOTROPIC)
{
// get tx angle
double txAngle = bgScheduler->getTxAngle();
// compute the angle between uePosition and reference axis, considering the Bs as center
double ueAngle = computeAngle(txPos, rxPos);
// compute the reception angle between ue and eNb
double recvAngle = fabs(txAngle - ueAngle);
if (recvAngle > 180)
recvAngle = 360 - recvAngle;
double verticalAngle = computeVerticalAngle(txPos, rxPos);
// compute attenuation due to sectorial tx
double angolarAtt = computeAngolarAttenuation(recvAngle,verticalAngle);
recvPower -= angolarAtt;
}
//=============== END ANGOLAR ATTENUATION =================
//============ END PATH LOSS + ANGOLAR ATTENUATION ===============
return recvPower;
}
bool BackgroundCellChannelModel::computeDownlinkInterference(MacNodeId bgUeId, inet::Coord bgUePos, double carrierFrequency, const RbMap& rbmap, unsigned int numBands,
std::vector<double> * interference)
{
EV << "**** Downlink Interference ****" << endl;
// reference to the mac/phy/channel of each cell
int temp;
double att;
double txPwr;
std::vector<EnbInfo*> * enbList = binder_->getEnbList();
std::vector<EnbInfo*>::iterator it = enbList->begin(), et = enbList->end();
while(it!=et)
{
MacNodeId id = (*it)->id;
// initialize eNb data structures
if(!(*it)->init)
{
// obtain a reference to enb phy and obtain tx power
(*it)->phy = check_and_cast<LtePhyBase*>(getSimulation()->getModule(binder_->getOmnetId(id))->getSubmodule("cellularNic")->getSubmodule("phy"));
(*it)->txPwr = (*it)->phy->getTxPwr();//dBm
// get tx direction
(*it)->txDirection = (*it)->phy->getTxDirection();
// get tx angle
(*it)->txAngle = (*it)->phy->getTxAngle();
//get reference to mac layer
(*it)->mac = check_and_cast<LteMacEnb*>(getMacByMacNodeId(id));
(*it)->init = true;
}
Coord bsPos = (*it)->phy->getCoord();
LteRealisticChannelModel* interfChanModel = dynamic_cast<LteRealisticChannelModel *>((*it)->phy->getChannelModel(carrierFrequency));
// if the interfering BS does not use the selected carrier frequency, skip it
if (interfChanModel == NULL)
{
++it;
continue;
}
att = getAttenuation(bgUeId, DL, bsPos, bgUePos);
EV << "BsId [" << id << "] - attenuation [" << att << "]";
//=============== ANGOLAR ATTENUATION =================
double angolarAtt = 0;
if ((*it)->txDirection == ANISOTROPIC)
{
//get tx angle
double txAngle = (*it)->txAngle;
// compute the angle between uePosition and reference axis, considering the eNb as center
double ueAngle = computeAngle(bsPos, bgUePos);
// compute the reception angle between ue and eNb
double recvAngle = fabs(txAngle - ueAngle);
if (recvAngle > 180)
recvAngle = 360 - recvAngle;
double verticalAngle = computeVerticalAngle(bsPos, bgUePos);
// compute attenuation due to sectorial tx
angolarAtt = computeAngolarAttenuation(recvAngle,verticalAngle);
EV << "angolar attenuation [" << angolarAtt << "]";
}
// else, antenna is omni-directional
//=============== END ANGOLAR ATTENUATION =================
txPwr = (*it)->txPwr - angolarAtt - cableLoss_ + antennaGainEnB_ + antennaGainUe_;
numBands = std::min(numBands, interfChanModel->getNumBands());
for(unsigned int i=0;i<numBands;i++)
{
// compute the number of occupied slot (unnecessary)
temp = (*it)->mac->getDlBandStatus(i);
if(temp!=0)
(*interference)[i] += dBmToLinear(txPwr-att);//(dBm-dB)=dBm
EV << "\t band " << i << " occupied " << temp << "/pwr[" << txPwr << "]-int[" << (*interference)[i] << "]" << endl;
}
++it;
}
return true;
}
bool BackgroundCellChannelModel::computeUplinkInterference(MacNodeId bgUeId, inet::Coord bgBsPos, double carrierFrequency, const RbMap& rbmap, unsigned int numBands,
std::vector<double> * interference)
{
EV << "**** Uplink Interference ****" << endl;
const std::vector<std::vector<UeAllocationInfo> >* ulTransmissionMap;
const std::vector<UeAllocationInfo>* allocatedUes;
std::vector<UeAllocationInfo>::const_iterator ue_it, ue_et;
ulTransmissionMap = binder_->getUlTransmissionMap(carrierFrequency, CURR_TTI);
if (ulTransmissionMap != nullptr && !ulTransmissionMap->empty())
{
for(unsigned int i=0;i<numBands;i++)
{
// get the set of UEs transmitting on the same band
allocatedUes = &(ulTransmissionMap->at(i));
ue_it = allocatedUes->begin(), ue_et = allocatedUes->end();
for (; ue_it != ue_et; ++ue_it)
{
MacNodeId ueId = ue_it->nodeId;
// MacCellId cellId = ue_it->cellId;
Direction dir = ue_it->dir;
double txPwr;
inet::Coord ueCoord;
LtePhyUe* uePhy = nullptr;
TrafficGeneratorBase* trafficGen = nullptr;
if (ue_it->phy != nullptr)
{
uePhy = check_and_cast<LtePhyUe*>(ue_it->phy);
txPwr = uePhy->getTxPwr(dir);
ueCoord = uePhy->getCoord();
}
else // this is a backgroundUe
{
trafficGen = check_and_cast<TrafficGeneratorBase*>(ue_it->trafficGen);
txPwr = trafficGen->getTxPwr();
ueCoord = trafficGen->getCoord();
}
EV<<NOW<<" BackgroundCellChannelModel::computeUplinkInterference - Interference from UE: "<< ueId << "(dir " << dirToA(dir) << ") on band[" << i << "]" << endl;
// get rx power and attenuation from this UE
double rxPwr = txPwr - cableLoss_ + antennaGainUe_ + antennaGainEnB_;
double att = getAttenuation(ueId, UL, bgBsPos, ueCoord);
(*interference)[i] += dBmToLinear(rxPwr-att);//(dBm-dB)=dBm
EV << "\t band " << i << "/pwr[" << rxPwr-att << "]-int[" << (*interference)[i] << "]" << endl;
}
}
}
// Debug Output
EV << NOW << " BackgroundCellChannelModel::computeUplinkInterference - Final Band Interference Status: "<<endl;
for(unsigned int i=0;i<numBands;i++)
EV << "\t band " << i << " int[" << (*interference)[i] << "]" << endl;
return true;
}
bool BackgroundCellChannelModel::computeBackgroundCellInterference(MacNodeId bgUeId, inet::Coord bgUeCoord, int bgBsId, inet::Coord bgBsCoord, double carrierFrequency, const RbMap& rbmap, Direction dir,
unsigned int numBands, std::vector<double>* interference)
{
EV << "**** Background Cell Interference **** " << endl;
// get external cell list
BackgroundSchedulerList* list = binder_->getBackgroundSchedulerList(carrierFrequency);
BackgroundSchedulerList::iterator it = list->begin();
Coord c;
double dist, // meters
txPwr, // dBm
recvPwr, // watt
recvPwrDBm, // dBm
att, // dBm
angolarAtt; // dBm
//compute distance for each cell
while (it != list->end())
{
// skip interference from serving Bg Bs
if ((*it)->getId() == bgBsId)
{
it++;
continue;
}
if (dir == DL)
{
// compute interference with respect to the background base station
// get external cell position
c = (*it)->getPosition();
// computer distance between UE and the ext cell
dist = bgUeCoord.distance(c);
EV << "\t distance between BgUe[" << bgUeCoord.x << "," << bgUeCoord.y <<
"] and backgroundCell[" << c.x << "," << c.y << "] is -> "
<< dist << "\t";
// compute attenuation according to some path loss model
bool los = false;
double dbp = 0;
att = computePathLoss(dist, dbp, los);
txPwr = (*it)->getTxPower();
//=============== ANGOLAR ATTENUATION =================
if ((*it)->getTxDirection() == OMNI)
{
angolarAtt = 0;
}
else
{
// compute the angle between uePosition and reference axis, considering the eNb as center
double ueAngle = computeAngle(c, bgUeCoord);
// compute the reception angle between ue and eNb
double recvAngle = fabs((*it)->getTxAngle() - ueAngle);
if (recvAngle > 180)
recvAngle = 360 - recvAngle;
double verticalAngle = computeVerticalAngle(c, bgUeCoord);
// compute attenuation due to sectorial tx
angolarAtt = computeAngolarAttenuation(recvAngle, verticalAngle);
}
//=============== END ANGOLAR ATTENUATION =================
// TODO do we need to use (- cableLoss_ + antennaGainEnB_) in ext cells too?
// compute and linearize received power
recvPwrDBm = txPwr - att - angolarAtt - cableLoss_ + antennaGainEnB_ + antennaGainUe_;
recvPwr = dBmToLinear(recvPwrDBm);
numBands = std::min(numBands, (*it)->getNumBands());
// add interference in those bands where the ext cell is active
for (unsigned int i = 0; i < numBands; i++)
{
int occ = 0;
occ = (*it)->getBandStatus(i, DL);
// if the ext cell is active, add interference
if (occ > 0)
{
(*interference)[i] += recvPwr;
}
}
}
else // dir == UL
{
// for each RB occupied in the background cell, compute interference with respect to the
// background UE that is using that RB
TrafficGeneratorBase* bgUe;
double antennaGainBgUe = antennaGainUe_; // TODO get this from the bgUe
angolarAtt = 0; // we assume OMNI directional UEs
numBands = std::min(numBands, (*it)->getNumBands());
// add interference in those bands where a UE in the background cell is active
for (unsigned int i = 0; i < numBands; i++)
{
int occ = 0;
occ = (*it)->getBandStatus(i, UL);
if ( occ )
bgUe = (*it)->getBandInterferingUe(i);
// if the ext cell is active, add interference
if (occ)
{
txPwr = bgUe->getTxPwr();
c = bgUe->getCoord();
dist = bgBsCoord.distance(c);
EV << "\t distance between BgBS[" << bgBsCoord.x << "," << bgBsCoord.y <<
"] and backgroundUE[" << c.x << "," << c.y << "] is -> "
<< dist << "\t";
// compute attenuation according to some path loss model
bool los = false;
double dbp = 0;
att = computePathLoss(dist, dbp, los);
recvPwrDBm = txPwr - att - angolarAtt - cableLoss_ + antennaGainEnB_ + antennaGainBgUe;
recvPwr = dBmToLinear(recvPwrDBm);
(*interference)[i] += recvPwr;
}
}
}
it++;
}
return true;
}
| 34.052196 | 202 | 0.592857 | [
"object",
"vector",
"model"
] |
844c1d7c9b40162cddba9fcefc501f258270b278 | 18,298 | cpp | C++ | Code/Tools/Animation/GraphEditor/AnimationGraphEditor_VariationEditor.cpp | JuanluMorales/KRG | f3a11de469586a4ef0db835af4bc4589e6b70779 | [
"MIT"
] | 419 | 2022-01-27T19:37:43.000Z | 2022-03-31T06:14:22.000Z | Code/Tools/Animation/GraphEditor/AnimationGraphEditor_VariationEditor.cpp | JuanluMorales/KRG | f3a11de469586a4ef0db835af4bc4589e6b70779 | [
"MIT"
] | 2 | 2022-01-28T20:35:33.000Z | 2022-03-13T17:42:52.000Z | Code/Tools/Animation/GraphEditor/AnimationGraphEditor_VariationEditor.cpp | JuanluMorales/KRG | f3a11de469586a4ef0db835af4bc4589e6b70779 | [
"MIT"
] | 20 | 2022-01-27T20:41:02.000Z | 2022-03-26T16:16:57.000Z | #include "AnimationGraphEditor_VariationEditor.h"
#include "EditorGraph/Animation_EditorGraph_Variations.h"
#include "EditorGraph/Animation_EditorGraph_Definition.h"
#include "Tools/Core/Resource/ResourceFilePicker.h"
#include "Engine/Animation/Graph/Animation_RuntimeGraph_Resources.h"
#include "System/Render/Imgui/ImguiX.h"
//-------------------------------------------------------------------------
namespace KRG::Animation
{
GraphVariationEditor::GraphVariationEditor( ToolsContext const& toolsContext, EditorGraphDefinition* pGraphDefinition )
: m_pGraphDefinition( pGraphDefinition )
, m_resourcePicker( toolsContext )
{
KRG_ASSERT( m_pGraphDefinition != nullptr );
}
void GraphVariationEditor::UpdateAndDraw( UpdateContext const& context, ImGuiWindowClass* pWindowClass, char const* pWindowName )
{
ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding, ImVec2( 4, 4 ) );
ImGui::SetNextWindowClass( pWindowClass );
if ( ImGui::Begin( pWindowName, nullptr, 0 ) )
{
if ( ImGui::BeginTable( "VariationMainSplitter", 2, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollX ) )
{
ImGui::TableSetupColumn( "VariationTree", ImGuiTableColumnFlags_WidthStretch, 0.2f );
ImGui::TableSetupColumn( "Data", ImGuiTableColumnFlags_WidthStretch );
ImGui::TableNextRow();
ImGui::TableNextColumn();
DrawVariationTree();
ImGui::TableNextColumn();
DrawOverridesTable();
ImGui::EndTable();
}
//-------------------------------------------------------------------------
if ( m_activeOperation != OperationType::None )
{
DrawActiveOperationUI();
}
}
ImGui::End();
ImGui::PopStyleVar();
}
void GraphVariationEditor::DrawVariationTreeNode( VariationHierarchy& variationHierarchy, StringID variationID )
{
ImGui::PushID( variationID.GetID() );
// Open Tree Node
//-------------------------------------------------------------------------
bool const isSelected = m_pGraphDefinition->GetSelectedVariationID() == variationID;
ImGuiX::PushFontAndColor( isSelected ? ImGuiX::Font::SmallBold : ImGuiX::Font::Small, isSelected ? ImGuiX::ConvertColor( Colors::LimeGreen ) : ImGuiX::Style::s_textColor );
bool const isTreeNodeOpen = ImGui::TreeNode( variationID.c_str() );
ImGui::PopFont();
ImGui::PopStyleColor();
// Click Handler
//-------------------------------------------------------------------------
if ( ImGui::IsMouseDoubleClicked( ImGuiMouseButton_Left ) )
{
m_pGraphDefinition->SetSelectedVariation( variationID );
}
// Context Menu
//-------------------------------------------------------------------------
if ( ImGui::BeginPopupContextItem( variationID.c_str() ) )
{
if ( ImGui::MenuItem( "Create Child" ) )
{
StartCreate( variationID );
}
if ( variationID != GraphVariation::DefaultVariationID )
{
ImGui::Separator();
if ( ImGui::MenuItem( "Rename" ) )
{
StartRename( variationID );
}
if ( ImGui::MenuItem( "Delete" ) )
{
StartDelete( variationID );
}
}
ImGui::EndPopup();
}
// Draw node contents
//-------------------------------------------------------------------------
if( isTreeNodeOpen )
{
auto const childVariations = variationHierarchy.GetChildVariations( variationID );
for ( StringID const& childVariationID : childVariations )
{
DrawVariationTreeNode( variationHierarchy, childVariationID );
}
ImGui::TreePop();
}
ImGui::PopID();
}
void GraphVariationEditor::DrawVariationTree()
{
DrawVariationTreeNode( m_pGraphDefinition->GetVariationHierarchy(), GraphVariation::DefaultVariationID );
}
void GraphVariationEditor::DrawOverridesTable()
{
auto dataSlotNodes = m_pGraphDefinition->GetAllDataSlotNodes();
bool isDefaultVariationSelected = m_pGraphDefinition->IsDefaultVariationSelected();
//-------------------------------------------------------------------------
auto c = ImGui::GetContentRegionAvail();
ImGui::AlignTextToFramePadding();
ImGui::Text( "Skeleton: " );
ImGui::SameLine( 0, 4 );
auto d = ImGui::GetContentRegionAvail();
auto pVariation = m_pGraphDefinition->GetVariation( m_pGraphDefinition->GetSelectedVariationID() );
ResourceID resourceID = pVariation->m_pSkeleton.GetResourceID();
if ( m_resourcePicker.DrawPicker( Skeleton::GetStaticResourceTypeID(), &resourceID ) )
{
VisualGraph::ScopedGraphModification sgm( m_pGraphDefinition->GetRootGraph() );
if ( m_resourcePicker.GetSelectedResourceID().IsValid() )
{
pVariation->m_pSkeleton = m_resourcePicker.GetSelectedResourceID();
}
else
{
pVariation->m_pSkeleton.Clear();
}
}
//-------------------------------------------------------------------------
if ( ImGui::BeginTable( "SourceTable", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_ScrollX ) )
{
ImGui::TableSetupColumn( "Name", ImGuiTableColumnFlags_WidthStretch );
ImGui::TableSetupColumn( "Path", ImGuiTableColumnFlags_WidthStretch );
ImGui::TableSetupColumn( "Source", ImGuiTableColumnFlags_WidthStretch );
ImGui::TableSetupColumn( "##Override", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, 20 );
ImGui::TableHeadersRow();
//-------------------------------------------------------------------------
StringID const currentVariationID = m_pGraphDefinition->GetSelectedVariationID();
for ( auto pDataSlotNode : dataSlotNodes )
{
bool const hasOverrideForVariation = pDataSlotNode->HasOverrideForVariation( currentVariationID );
ImGui::PushID( pDataSlotNode );
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
if ( !isDefaultVariationSelected && hasOverrideForVariation )
{
ImGui::TextColored( ImVec4( 0, 1, 0, 1 ), pDataSlotNode->GetDisplayName() );
}
else
{
ImGui::Text( pDataSlotNode->GetDisplayName() );
}
ImGui::TableNextColumn();
ImGui::Text( pDataSlotNode->GetPathFromRoot().c_str() );
ImGui::TableNextColumn();
// Default variations always have values created
if ( isDefaultVariationSelected )
{
ResourceID* pResourceID = pDataSlotNode->GetOverrideValueForVariation( currentVariationID );
if ( m_resourcePicker.DrawPicker( pDataSlotNode->GetSlotResourceTypeID(), pResourceID) )
{
VisualGraph::ScopedGraphModification sgm( m_pGraphDefinition->GetRootGraph() );
*pResourceID = m_resourcePicker.GetSelectedResourceID();
}
}
else // Variation
{
// If we have an override for this variation
if ( pDataSlotNode->HasOverrideForVariation( currentVariationID ) )
{
ResourceID* pResourceID = pDataSlotNode->GetOverrideValueForVariation( currentVariationID );
if ( m_resourcePicker.DrawPicker( AnimationClip::GetStaticResourceTypeID(), pResourceID ) )
{
VisualGraph::ScopedGraphModification sgm( m_pGraphDefinition->GetRootGraph() );
// If we've cleared the resource ID and it's not the default, remove the override
if ( !pResourceID->IsValid() && !m_pGraphDefinition->IsDefaultVariationSelected() )
{
pDataSlotNode->RemoveOverride( currentVariationID );
}
else
{
*pResourceID = m_resourcePicker.GetSelectedResourceID();
}
}
}
else // Show current value
{
ImGui::Text( pDataSlotNode->GetResourceID( m_pGraphDefinition->GetVariationHierarchy(), currentVariationID ).c_str() );
}
}
//-------------------------------------------------------------------------
ImGui::TableNextColumn();
if ( !isDefaultVariationSelected )
{
if ( pDataSlotNode->HasOverrideForVariation( currentVariationID ) )
{
if ( ImGuiX::ColoredButton( ImGuiX::ConvertColor( Colors::MediumRed ), ImGuiX::ConvertColor( Colors::White ), KRG_ICON_TIMES, ImVec2( 22, 22 ) ) )
{
pDataSlotNode->RemoveOverride( currentVariationID );
}
}
else // Create an override
{
if ( ImGuiX::ColoredButton( ImGuiX::ConvertColor( Colors::ForestGreen ), ImGuiX::ConvertColor( Colors::White ), KRG_ICON_PLUS, ImVec2( 22, 22 ) ) )
{
pDataSlotNode->CreateOverride( currentVariationID );
}
}
}
ImGui::PopID();
}
//-------------------------------------------------------------------------
ImGui::EndTable();
}
}
//-------------------------------------------------------------------------
void GraphVariationEditor::StartCreate( StringID variationID )
{
KRG_ASSERT( variationID.IsValid() );
m_activeOperationVariationID = variationID;
m_activeOperation = OperationType::Create;
strncpy_s( m_buffer, "New Child Variation", 255 );
}
void GraphVariationEditor::StartRename( StringID variationID )
{
KRG_ASSERT( variationID.IsValid() );
m_activeOperationVariationID = variationID;
m_activeOperation = OperationType::Rename;
strncpy_s( m_buffer, variationID.c_str(), 255 );
}
void GraphVariationEditor::StartDelete( StringID variationID )
{
KRG_ASSERT( variationID.IsValid() );
m_activeOperationVariationID = variationID;
m_activeOperation = OperationType::Delete;
}
void GraphVariationEditor::DrawActiveOperationUI()
{
bool isDialogOpen = m_activeOperation != OperationType::None;
if ( m_activeOperation == OperationType::Create )
{
ImGui::OpenPopup( "Create" );
if ( ImGui::BeginPopupModal( "Create", &isDialogOpen, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize ) )
{
bool nameChangeConfirmed = false;
ImGui::PushStyleColor( ImGuiCol_Text, m_pGraphDefinition->IsValidVariation( StringID( m_buffer ) ) ? ImGuiX::ConvertColor( Colors::Red ).Value : ImGuiX::Style::s_textColor );
if ( ImGui::InputText( "##VariationName", m_buffer, 255, ImGuiInputTextFlags_EnterReturnsTrue ) )
{
nameChangeConfirmed = true;
}
ImGui::PopStyleColor();
ImGui::NewLine();
float const dialogWidth = ( ImGui::GetWindowContentRegionMax() - ImGui::GetWindowContentRegionMin() ).x;
ImGui::SameLine( 0, dialogWidth - 104 );
if ( ImGui::Button( "Ok", ImVec2( 50, 0 ) ) || nameChangeConfirmed )
{
// Only allow creations of unique variation names
StringID newVariationID( m_buffer );
if ( !m_pGraphDefinition->IsValidVariation( newVariationID ) )
{
VisualGraph::ScopedGraphModification gm( m_pGraphDefinition->GetRootGraph() );
m_pGraphDefinition->GetVariationHierarchy().CreateVariation( newVariationID, m_activeOperationVariationID );
m_activeOperationVariationID = StringID();
m_activeOperation = OperationType::None;
}
}
ImGui::SameLine( 0, 4 );
if ( ImGui::Button( "Cancel", ImVec2( 50, 0 ) ) )
{
m_activeOperation = OperationType::None;
}
ImGui::EndPopup();
}
}
//-------------------------------------------------------------------------
if ( m_activeOperation == OperationType::Rename )
{
ImGui::OpenPopup( "Rename" );
if ( ImGui::BeginPopupModal( "Rename", &isDialogOpen, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize ) )
{
bool nameChangeConfirmed = false;
ImGui::PushStyleColor( ImGuiCol_Text, m_pGraphDefinition->IsValidVariation( StringID( m_buffer ) ) ? ImGuiX::ConvertColor( Colors::Red ).Value : ImGuiX::Style::s_textColor );
if ( ImGui::InputText( "##VariationName", m_buffer, 255, ImGuiInputTextFlags_EnterReturnsTrue ) )
{
nameChangeConfirmed = true;
}
ImGui::PopStyleColor();
ImGui::NewLine();
float const dialogWidth = ( ImGui::GetWindowContentRegionMax() - ImGui::GetWindowContentRegionMin() ).x;
ImGui::SameLine( 0, dialogWidth - 104 );
if ( ImGui::Button( "Ok", ImVec2( 50, 0 ) ) || nameChangeConfirmed )
{
// Only allow rename to unique variation names
StringID newVariationID( m_buffer );
if ( !m_pGraphDefinition->IsValidVariation( newVariationID ) )
{
VisualGraph::ScopedGraphModification gm( m_pGraphDefinition->GetRootGraph() );
// Rename actual variation
m_pGraphDefinition->GetVariationHierarchy().RenameVariation( m_activeOperationVariationID, newVariationID );
// Update all data slot nodes
auto dataSlotNodes = m_pGraphDefinition->GetAllDataSlotNodes();
for ( auto pDataSlotNode : dataSlotNodes )
{
pDataSlotNode->RenameOverride( m_activeOperationVariationID, newVariationID );
}
m_activeOperationVariationID = StringID();
m_activeOperation = OperationType::None;
}
}
ImGui::SameLine( 0, 4 );
if ( ImGui::Button( "Cancel", ImVec2( 50, 0 ) ) )
{
m_activeOperation = OperationType::None;
}
ImGui::EndPopup();
}
}
//-------------------------------------------------------------------------
if ( m_activeOperation == OperationType::Delete )
{
ImGui::OpenPopup( "Delete" );
if ( ImGui::BeginPopupModal( "Delete", &isDialogOpen, ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize ) )
{
ImGui::Text( "Are you sure you want to delete this variation?" );
ImGui::NewLine();
float const dialogWidth = ( ImGui::GetWindowContentRegionMax() - ImGui::GetWindowContentRegionMin() ).x;
ImGui::SameLine( 0, dialogWidth - 64 );
if ( ImGui::Button( "Yes", ImVec2( 30, 0 ) ) )
{
KRG_ASSERT( m_activeOperationVariationID != GraphVariation::DefaultVariationID );
// Update selection
auto const pVariation = m_pGraphDefinition->GetVariation( m_activeOperationVariationID );
m_pGraphDefinition->SetSelectedVariation( pVariation->m_parentID );
// Destroy variation
VisualGraph::ScopedGraphModification gm( m_pGraphDefinition->GetRootGraph() );
m_pGraphDefinition->GetVariationHierarchy().DestroyVariation( m_activeOperationVariationID );
m_activeOperationVariationID = StringID();
m_activeOperation = OperationType::None;
}
ImGui::SameLine( 0, 4 );
if ( ImGui::Button( "No", ImVec2( 30, 0 ) ) )
{
m_activeOperation = OperationType::None;
}
ImGui::EndPopup();
}
}
//-------------------------------------------------------------------------
if ( !isDialogOpen )
{
m_activeOperation = OperationType::None;
}
}
} | 42.454756 | 191 | 0.50541 | [
"render"
] |
4608eb2a206c4f88593d93826b3c3fac6e77c2a9 | 1,496 | hh | C++ | src/util/SphericalDistributions.hh | JonathanIlk/Tropical-Island-Laser-Battle | 1dd7d2ce95a7b003f8cc87b2bf4bac27e026a9ed | [
"MIT"
] | 1 | 2022-03-25T11:18:41.000Z | 2022-03-25T11:18:41.000Z | src/util/SphericalDistributions.hh | JonathanIlk/Tropical-Island-Laser-Battle | 1dd7d2ce95a7b003f8cc87b2bf4bac27e026a9ed | [
"MIT"
] | null | null | null | src/util/SphericalDistributions.hh | JonathanIlk/Tropical-Island-Laser-Battle | 1dd7d2ce95a7b003f8cc87b2bf4bac27e026a9ed | [
"MIT"
] | null | null | null | // SPDX-License-Identifier: MIT
#pragma once
#include <random>
#include <typed-geometry/tg-lean.hh>
#include <typed-geometry/functions/basic/scalar_math.hh>
namespace Util {
template<typename ScalarT>
const ScalarT afterOne = std::nextafter(ScalarT(1), std::numeric_limits<ScalarT>::max());
}
template<typename ScalarT = float>
class UnitCircleDistribution {
std::uniform_real_distribution<ScalarT> angle{0, 360_deg .radians()};
public:
template<typename Generator>
tg::dir<2, ScalarT> operator()(Generator &rng) {
auto [sin, cos] = tg::sin_cos(tg::angle_t<ScalarT>::from_radians(angle(rng)));
return {cos, sin};
}
};
template<typename ScalarT = float>
class UnitDiscDistribution {
std::uniform_real_distribution<ScalarT> reals {
0.f, Util::afterOne<ScalarT>
};
UnitCircleDistribution<ScalarT> circle;
public:
template<typename Generator>
tg::vec<2, ScalarT> operator()(Generator &rng) {
auto radius = std::sqrt(reals(rng));
return circle(rng) * radius;
}
};
template<typename ScalarT = float>
class UnitSphereDistribution {
std::uniform_real_distribution<ScalarT> reals {
-1, Util::afterOne<ScalarT>
};
UnitCircleDistribution<ScalarT> circle;
public:
template<typename Generator>
tg::dir<3, ScalarT> operator()(Generator &rng) {
auto z = reals(rng);
auto radius = std::sqrt(ScalarT(1) - z * z);
return tg::dir<3, ScalarT>(circle(rng) * radius, z);
}
};
| 28.226415 | 89 | 0.677807 | [
"geometry"
] |
460dc424e74adfc0f72940ba04523f6773b372c2 | 5,306 | cpp | C++ | Blackjack/src/Player.cpp | sabihoshi/Blackjack | c43f4fb63fe7ccb7fc5eaf1dccab0f0d4a98b194 | [
"MIT"
] | null | null | null | Blackjack/src/Player.cpp | sabihoshi/Blackjack | c43f4fb63fe7ccb7fc5eaf1dccab0f0d4a98b194 | [
"MIT"
] | null | null | null | Blackjack/src/Player.cpp | sabihoshi/Blackjack | c43f4fb63fe7ccb7fc5eaf1dccab0f0d4a98b194 | [
"MIT"
] | null | null | null | #include "Player.h"
#include <conio.h>
#include <iostream>
#include <utility>
#include "Table.h"
/**
* \brief Gets the current active collection useful for when the hand is split.
* \return The hand that should be used.
*/
Hand& Player::GetCurrentCollection()
{
if (!Split) return FirstHand;
return IsFirstHand ? FirstHand : SecondHand;
}
/**
* \brief Blanks the cards that is seen on the screen.
*/
void Player::ClearCards() const
{
XY(CardsXY);
for (int c = 0; c < MAX_CARDS; c++)
{
const auto p = XY();
for (int h = 0; h < Card::CARD_HEIGHT; h++)
{
WriteLine(Repeat(" ", Card::CARD_WIDTH));
}
XY(p);
MoveCursor(Direction, Card::CARD_WIDTH);
}
}
/**
* \brief Prints the cards of the user.
* \param hand The hand to print.
* \param maxWidth The max width that the cards can occupy.
* \param position The coordinates that the cards will start to print.
*/
void Player::PrintCards(const Hand& hand, const int maxWidth, const COORD position) const
{
auto& cards = hand.Cards;
const unsigned long long count = cards.size();
if (count == 0) return;
const unsigned long long cardWidth = count * Card::CARD_WIDTH;
const unsigned long long width = min(maxWidth, cardWidth);
unsigned long long jump = width / count;
if (jump * (count - 1) + Card::CARD_WIDTH > MAX_WIDTH)
jump--;
XY(position);
for (auto& card : cards)
{
const auto p = XY();
card.PrintCard();
XY(p);
MoveCursor(Direction, static_cast<short>(jump));
}
XY(position);
MoveCursor(CursorDirection::Down, Card::CARD_HEIGHT);
if (Direction == CursorDirection::Left)
MoveCursor(Direction, Card::CARD_WIDTH);
std::cout << "Total: " << hand.CountTotal()
<< " | " << "Bet: " << hand.Bet;
}
/**
* \brief Prints all of the active hands that the user has.
*/
void Player::PrintCards() const
{
ClearCards();
if (Split)
{
constexpr int width = MAX_WIDTH / 3;
const auto x = static_cast<short>(CardsXY.X + MAX_WIDTH / 2);
PrintCards(FirstHand, width, CardsXY);
PrintCards(SecondHand, width, {x, CardsXY.Y});
}
else
{
PrintCards(FirstHand, MAX_WIDTH, CardsXY);
}
}
/**
* \brief Prints the chips the user has.
*/
void Player::PrintChips() const
{
if (Chips == 0)
return;
XY(ChipsXY);
std::cout << Repeat(" ", 52);
XY(ChipsXY);
std::cout << "Chips: " << Chips;
if (Insured) std::cout << " | Insurance: " << Insurance;
}
/**
* \brief Creates a Player object.
* \param name The name of the player.
* \param direction The direction in which the cards will print.
*/
Player::Player(std::string name, const CursorDirection direction) : Direction(direction), Name(std::move(name))
{
CardsXY = {4, 6};
TotalXY = {4, 16};
PromptXY = {4, 18};
ChipsXY = {4, 21};
}
/**
* \brief Resets the state of the player.
*/
void Player::ResetState()
{
State = PlayerState::Normal;
IsFirstHand = true;
Split = false;
Insured = false;
Insurance = 0;
CanInsurance = false;
CanHit = true;
CanSplit = false;
CanDouble = false;
FirstHand.Reset();
SecondHand.Reset();
}
/**
* \brief Prompts the user for the amount of bet.
*/
void Player::PromptBet()
{
const int bet = Prompt<int>("How much do you want to bet?");
Chips -= bet;
FirstHand.Bet = bet;
}
/**
* \brief Prompts the user for the amount of insurance.
*/
void Player::PromptInsurance()
{
if (Chips == 0)
return;
while (true)
{
const int bet = Prompt<int>("How much do you want to insure?");
if (bet > 0 && bet <= FirstHand.Bet / 2)
{
Insured = true;
Insurance = bet;
Chips -= bet;
break;
}
}
}
/**
* \brief Prompts the user of the action to take.
* \param prompt The prompt message.
* \return A GameAction containing the action the user chose.
*/
GameAction Player::PromptAction(const std::string& prompt) const
{
while (true)
{
XY(PromptXY);
WriteLine(Repeat(" ", 52));
WriteLine(Repeat(" ", 52));
XY(PromptXY);
WriteLine(prompt);
std::cout << "~> ";
const char c = _getch();
const auto action = GetAction(c);
if (action != GameAction::None)
return action;
}
}
/**
* \brief A string representation of the action that is pluralized.
* \param action The action the user took.
* \return The string containing the action.
*/
std::string Player::ActionString(const GameAction action)
{
switch (action)
{
case GameAction::Hit: return "Hits";
case GameAction::Stand: return "Stands";
case GameAction::Double: return "Doubles";
case GameAction::Reveal: return "Reveals";
case GameAction::Split: return "Splits";
case GameAction::Insurance: return "Insures";
default: return {};
}
}
/**
* \brief Converts a character input into a GameAction.
* \param c The character input.
* \return A GameAction that the user has taken.
*/
GameAction Player::GetAction(const char c)
{
switch (c)
{
case 'h': return GameAction::Hit;
case 's': return GameAction::Stand;
case 'd': return GameAction::Double;
case 'p': return GameAction::Split;
case 'i': return GameAction::Insurance;
default: return GameAction::None;
}
}
/**
* \brief Prints the action that the user took on the console.
* \param action The GameAction that the user took.
*/
void Player::PrintAction(const GameAction action) const
{
XY(PromptXY);
std::cout << Repeat(" ", 52);
XY(PromptXY);
std::cout << Name << " " << ActionString(action);
}
| 20.889764 | 111 | 0.660573 | [
"object"
] |
4615f7465c750e8f232b05129934bad7c9ed8418 | 22,220 | cpp | C++ | src/libQtl/QtlFile.cpp | qtlmovie/qtlmovie | 082ad5ea6522a02d5ac0d86f23cdd6152edff613 | [
"BSD-2-Clause"
] | 8 | 2016-08-09T14:05:58.000Z | 2020-09-05T14:43:36.000Z | src/libQtl/QtlFile.cpp | qtlmovie/qtlmovie | 082ad5ea6522a02d5ac0d86f23cdd6152edff613 | [
"BSD-2-Clause"
] | 15 | 2016-08-09T14:11:21.000Z | 2022-01-15T23:39:07.000Z | src/libQtl/QtlFile.cpp | qtlmovie/qtlmovie | 082ad5ea6522a02d5ac0d86f23cdd6152edff613 | [
"BSD-2-Clause"
] | 1 | 2017-08-26T22:08:58.000Z | 2017-08-26T22:08:58.000Z | //----------------------------------------------------------------------------
//
// Copyright (c) 2013-2017, Thierry Lelegard
// 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.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
//----------------------------------------------------------------------------
//
// Qtl, Qt utility library.
// Define the class QtlFile.
//
//----------------------------------------------------------------------------
#include "QtlFile.h"
#include "QtlStringUtils.h"
#include <QProcessEnvironment>
#include <QFileInfo>
#include <QDir>
#if defined(Q_OS_WIN)
#include <windows.h>
#endif
//----------------------------------------------------------------------------
// Constructor.
//----------------------------------------------------------------------------
QtlFile::QtlFile(const QString& fileName, QObject *parent) :
QObject(parent),
_fileName(fileName == "" ? "" : absoluteNativeFilePath(fileName))
{
}
QtlFile::QtlFile(const QtlFile& other, QObject* parent) :
QObject(parent),
_fileName(other._fileName)
{
}
//----------------------------------------------------------------------------
// Get the directory name of the file.
//----------------------------------------------------------------------------
QString QtlFile::directoryName() const
{
if (_fileName.isEmpty()) {
return "";
}
else {
const QFileInfo info(_fileName);
return absoluteNativeFilePath(info.path());
}
}
//----------------------------------------------------------------------------
// Set the file name.
//----------------------------------------------------------------------------
bool QtlFile::setFileName(const QString& fileName)
{
const QString path(fileName.isEmpty() ? "" : absoluteNativeFilePath(fileName));
if (path != _fileName) {
// Set a new file name.
_fileName = path;
emit fileNameChanged(_fileName);
return true;
}
else {
// The absolute path remains unchanged.
return false;
}
}
//----------------------------------------------------------------------------
// Build an absolute file path with native directory separators.
//----------------------------------------------------------------------------
QString QtlFile::absoluteNativeFilePath(const QString& path, bool removeSymLinks)
{
// Qt conversion and clean path operates on '/' only.
// Make sure that the Windows separators are converted into slashes.
QString normPath(path);
normPath.replace('\\', '/');
// Build an absolute file path, remove redundant "." and "..", convert directory separators to "/".
const QFileInfo info(normPath);
QString clean;
if (removeSymLinks) {
// Remove symbolic links and redundant "." or "..".
// If the file does not exist, return an empty string.
clean = info.canonicalFilePath();
}
if (clean.isEmpty()) {
// Never return an ampty string but does not remove redundant "." or "..".
clean = info.absoluteFilePath();
}
// Always remove redundant "." or ".." but does not remove symbolic links.
clean = QDir::cleanPath(clean);
// Collapse multiple slashes. Note that "//" shall remain at the beginning of the string (Windows share).
#if defined(Q_OS_WIN)
const bool winShare = clean.startsWith("//");
#endif
clean.replace(QRegExp("/+"), "/");
#if defined(Q_OS_WIN)
if (winShare) {
clean.insert(0, '/');
}
#endif
// Remove trailing slashes (unless on "/").
if (clean.length() > 1) {
clean.replace(QRegExp("/*$"), "");
}
// Convert directory separators to native.
return QDir::toNativeSeparators(clean);
}
//----------------------------------------------------------------------------
// Return the list of directories in the system search path.
//----------------------------------------------------------------------------
QStringList QtlFile::commandSearchPath()
{
// Get the process environment.
const QProcessEnvironment env(QProcessEnvironment::systemEnvironment());
// Get and split the search path.
return env.value(QTL_PATH_VARIABLE_NAME).split(QTL_SEARCH_PATH_SEPARATOR, QString::SkipEmptyParts);
}
//----------------------------------------------------------------------------
// Search a file in a list of directories.
//----------------------------------------------------------------------------
QString QtlFile::search(const QString& baseName,
const QStringList& searchPath,
const QString& extension,
QFile::Permissions permissions)
{
// Filter out empty name.
if (baseName.isEmpty()) {
return "";
}
// Check if the file ends with the specified extension.
// On Windows, use non-case-sensitive search.
QString fileName(baseName);
if (!baseName.endsWith(extension, QTL_FILE_NAMES_CASE_SENSITIVE)) {
// Specified extension not present, add it.
fileName.append(extension);
}
// If fileName contains a directory separator, do not search in other directories.
if (fileName.contains(QChar('/')) || fileName.contains(QChar('\\'))) {
return absoluteNativeFilePath(fileName);
}
// Search file in all directories.
foreach (const QString& dir, searchPath) {
const QString path(dir + QDir::separator() + fileName);
const QFileInfo info(path);
if (info.exists() && info.permission(permissions) && !info.isDir()) {
// Found.
return path;
}
}
// File not found.
return "";
}
//----------------------------------------------------------------------------
// Expand a file path containing wildcards to all existing files matching
// the specification.
//----------------------------------------------------------------------------
namespace {
//!
//! Recursive helper function for qtlExpandFilePath.
//! @param [in,out] result The list of full file paths to return.
//! @param [in] baseDir Current directory to explore.
//! @param [in] currentPart Iterator to current component in the original wildcard specification.
//! @param [in] endPart Iterator to the end of this list of components.
//! @param [in] filter User-specified filter.
//!
void subExpandFilePath(QStringList& result,
const QString& baseDir,
const QStringList::const_iterator& currentPart,
const QStringList::const_iterator& endPart,
QtlFilePathFilterInterface* filter)
{
// If there is nothing to search in the base directory, there is nothing to find...
if (currentPart == endPart) {
return;
}
// Get the current component in the base directory (can be a wildcard).
QString localPart(*currentPart);
QStringList::const_iterator nextPart(currentPart + 1);
bool isLastPart = nextPart == endPart;
// Base options for filtering files in the directory.
QDir::Filters filterOptions (
#if defined (Q_OS_UNIX)
// Case sensitivity depends on the operating system.
QDir::CaseSensitive |
#endif
// Always filter directories.
QDir::Dirs |
// We always skip "." and "..".
QDir::NoDotAndDotDot);
// Special case: the local part is **, meaning all subdirectories.
if (localPart == "**") {
// Skip contiguous **.
while (nextPart != endPart && *nextPart == "**") {
++nextPart;
}
// First, apply _next_ part (without **) to the local subdirectory.
subExpandFilePath(result, baseDir, nextPart, endPart, filter);
// Then apply the local scheme (**) on all subdirectories.
localPart = "*"; // search all local subdirectories.
--nextPart; // back on **, applied on all local subdirectories.
isLastPart = false; // since we stepped back.
}
else if (nextPart == endPart) {
// Last component and not **. We also filter files.
filterOptions |= QDir::Files;
}
// Load files and directories in the base directories using localPart as name filter.
const QDir dir(baseDir, localPart, QDir::Name | QDir::IgnoreCase | QDir::DirsLast, filterOptions);
// Loop on all entries in the directory.
foreach (const QFileInfo& info, dir.entryInfoList()) {
// Build full path.
const QString fileName(info.fileName());
const QString filePath(baseDir + QDir::separator() + fileName);
// Check if this file path must be kept using the optional filter.
// We only add paths when we reached the last componement in the path.
if (isLastPart && (filter == 0 || filter->filePathFilter(info))) {
result.append(filePath);
}
// Check if we need to recurse in a subdirectory.
if (info.isDir() && !isLastPart && (filter == 0 || filter->recursionFilter(info))) {
subExpandFilePath(result, filePath, nextPart, endPart, filter);
}
}
}
}
QStringList QtlFile::expandFilePath(const QString& path, QtlFilePathFilterInterface* filter)
{
// Resolve absolute path.
QString absPath(absoluteNativeFilePath(path));
const QChar sep(QDir::separator());
// The object to return.
QStringList result;
// Locate first wildcard character in string.
int start = absPath.indexOf(QRegExp("[?\\*]"));
if (start < 0) {
// No wildcard, point after end of string.
start = absPath.length();
}
// Filter pathological case: a wildcard cannot be at beginning of absolute file path.
if (start <= 0) {
return result;
}
// Locate last directory separator before first wildcard (or end of string).
start = absPath.lastIndexOf(sep, start - 1);
// Longest directory path without wildcard.
// Use at least "/" when root is the first directory without wildcard.
QString baseDirectory(absPath.left(qMax(start, 1)));
// Split all remaining components.
QStringList parts(absPath.mid(start).split(sep, QString::SkipEmptyParts));
// Run the exploration
subExpandFilePath(result, baseDirectory, parts.begin(), parts.end(), filter);
// Cleanup the list.
result.sort(Qt::CaseInsensitive);
result.removeDuplicates();
return result;
}
//-----------------------------------------------------------------------------
// Get the absolute file path of the parent directory of a file.
//-----------------------------------------------------------------------------
QString QtlFile::parentPath(const QString& path, int upLevels)
{
QFileInfo info(path);
while (upLevels-- > 0) {
info.setFile(info.absolutePath());
}
return absoluteNativeFilePath(info.absoluteFilePath());
}
//-----------------------------------------------------------------------------
// Create a directory and all parent directories if necessary.
//-----------------------------------------------------------------------------
bool QtlFile::createDirectory(const QString& path, bool createOnly)
{
// Avoid looping forever.
int foolProof = 1024;
// Iterate over parents until one is found, keep path elements to create.
QFileInfo info(absoluteNativeFilePath(path));
QStringList subdirs;
while (!info.isDir()) {
// When too many levels of parents, this is suspect, abort.
// If something with that name exists, this is not a directory, abort.
// If we reached a root that is not a directory, abort.
if (--foolProof < 0 || info.exists() || info.isRoot()) {
return false;
}
// Push local name.
subdirs.prepend(info.fileName());
// Now examine parent.
info.setFile(info.path());
}
// If the directory already exists and createOnly is true, this is an error.
if (createOnly && subdirs.isEmpty()) {
return false;
}
// Now create all levels of directory.
QDir dir(info.filePath());
while (!subdirs.isEmpty()) {
const QString name(subdirs.takeFirst());
if (!dir.mkdir(name)) {
return false;
}
dir.setPath(dir.path() + QDir::separator() + name);
}
return true;
}
//-----------------------------------------------------------------------------
// Search a subdirectory in the parent path.
//-----------------------------------------------------------------------------
QString QtlFile::searchParentSubdirectory(const QString &dirName, const QString &subdirName, int maxLevels)
{
if (!dirName.isEmpty() && !subdirName.isEmpty()) {
QString dir(absoluteNativeFilePath(dirName));
QFileInfo info(dir);
do {
const QString subdir(dir + QDir::separator() + subdirName);
if (QDir(subdir).exists()) {
return subdir;
}
info.setFile(parentPath(dir));
dir = info.absoluteFilePath();
} while (maxLevels-- > 0 && !dir.isEmpty() && !info.isRoot());
}
return "";
}
//-----------------------------------------------------------------------------
// Get the "short path name" of a file path.
//-----------------------------------------------------------------------------
QString QtlFile::shortPath(const QString& path, bool keepOnError)
{
#if defined(Q_OS_WIN)
// Get the length of the corresponding short path.
// We specify an empty output buffer. Thus, the returned value is the required
// length to hold the path name, INCLUDING the terminating nul character.
const QVector<wchar_t> input(qtlToWCharVector(path));
int length = ::GetShortPathName(&input[0], NULL, 0);
if (length <= 0) {
// Error, typically non-existent file.
return keepOnError ? path : QString();
}
// Get the actual short path. This time, the returned value is the length
// of the returned path, EXCLUDING the terminating nul character.
QVector<wchar_t> output(length);
length = ::GetShortPathName(&input[0], &output[0], length);
if (length <= 0 || length >= output.size()) {
// Error, should not happen since the length was previously returned.
return keepOnError ? path : QString();
}
// Convert returned wide string as a QString.
return QString::fromWCharArray(&output[0], length);
#else
// On non-Windows platforms, return the input path, unchanged.
return path;
#endif
}
//-----------------------------------------------------------------------------
// Enforce a suffix in a file name.
//-----------------------------------------------------------------------------
QString QtlFile::enforceSuffix(const QString& path, const QString& suffix, Qt::CaseSensitivity cs)
{
return path.endsWith(suffix, cs) ? path : path + suffix;
}
//-----------------------------------------------------------------------------
// Format the content of an URL into a file path if the URL scheme is file:
//-----------------------------------------------------------------------------
QString QtlFile::toFileName(const QUrl& url)
{
// For non-file URL, return the full URL.
if (url.scheme() != "file") {
return url.url();
}
// Get the local file path.
QString path(url.url(QUrl::PreferLocalFile));
// On Windows, remove any leading slash.
#if defined(Q_OS_WIN)
path.replace(QRegExp("^/*"), "");
#endif
// Try to make the file path native.
return QDir::toNativeSeparators(path);
}
//-----------------------------------------------------------------------------
// Write the content of a binary file.
//-----------------------------------------------------------------------------
bool QtlFile::writeBinaryFile(const QString& fileName, const QtlByteBlock& content)
{
// Open the file. Note: the ~QFile() destructor will close it.
QFile file(fileName);
return file.open(QFile::WriteOnly) && writeBinary(file, content);
}
//-----------------------------------------------------------------------------
// Write binary data into an open file.
//-----------------------------------------------------------------------------
bool QtlFile::writeBinary(QIODevice& file, const void* data, int size, bool processEvents)
{
const char* current = reinterpret_cast<const char*>(data);
qint64 remain = size;
while (remain > 0) {
// Process pending events if required before entering a write operation.
if (processEvents) {
qApp->processEvents();
}
// Write as many bytes as possible.
const qint64 written = file.write(current, remain);
if (written <= 0) {
// Error occured.
return false;
}
// Next chunk.
current += written;
remain -= written;
}
return true;
}
//-----------------------------------------------------------------------------
// Read the content of a binary file.
//-----------------------------------------------------------------------------
QtlByteBlock QtlFile::readBinaryFile(const QString& fileName, int maxSize)
{
// Open the file. Note: the ~QFile() destructor will close it.
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
return QtlByteBlock();
}
// Read the file.
QtlByteBlock data;
readBinary(file, data, maxSize);
return data;
}
//-----------------------------------------------------------------------------
// Read the content of a text file.
//-----------------------------------------------------------------------------
QStringList QtlFile::readTextLinesFile(const QString& fileName, int maxSize)
{
// Open the file. Note: the ~QFile() destructor will close it.
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
return QStringList();
}
// Read the file line by line.
QTextStream text(&file);
QStringList lines;
int size = 0;
while (maxSize < 0 || size < maxSize) {
const QString line(text.readLine(maxSize < 0 ? 0 : qint64(maxSize - size)));
if (line.isNull()) { // end of file
break;
}
size += line.length();
lines << line;
}
return lines;
}
QString QtlFile::readTextFile(const QString& fileName)
{
// Open the file. Note: the ~QFile() destructor will close it.
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
return QString();
}
// Read the file line by line.
QTextStream text(&file);
return text.readAll();
}
//-----------------------------------------------------------------------------
// Write the content of a text file.
//-----------------------------------------------------------------------------
bool QtlFile::writeTextLinesFile(const QString& fileName, const QStringList& lines)
{
QFile file(fileName);
if (!file.open(QFile::WriteOnly)) {
return false;
}
else {
QTextStream stream(&file);
foreach (const QString& line, lines) {
stream << line << endl;
}
stream.flush();
file.close();
return true;
}
}
bool QtlFile::writeTextFile(const QString& fileName, const QString& text)
{
QFile file(fileName);
if (!file.open(QFile::WriteOnly)) {
return false;
}
else {
QTextStream stream(&file);
stream << text;
stream.flush();
file.close();
return true;
}
}
//-----------------------------------------------------------------------------
// Read a portion of a binary file at a given position.
//-----------------------------------------------------------------------------
bool QtlFile::readBinary(QIODevice& device, QtlByteBlock& data, int maxSize)
{
// Clear returned content.
data.clear();
// Chunk size for each read operation.
const int maxChunkSize = 2048;
const int chunkSize = maxSize < 0 ? maxChunkSize : qMin(maxSize, maxChunkSize);
// Actual read size.
int size = 0;
bool success = true;
// Read until maxSize or end of file.
while (maxSize < 0 || size < maxSize) {
// Resize buffer.
data.resize(data.size() + chunkSize);
// Read a chunk.
const qint64 thisMax = maxSize < 0 || size + chunkSize < maxSize ? chunkSize : maxSize - size;
const qint64 thisRead = device.read(reinterpret_cast<char*>(data.data() + size), thisMax);
success = thisRead >= 0;
if (!success) {
break;
}
size += thisRead;
if (thisRead < thisMax) {
break;
}
}
// Resize to actually read size.
data.resize(size);
// Do not report error now if some bytes were read.
return success || size > 0;
}
| 33.768997 | 109 | 0.538794 | [
"object"
] |
461eea8a849a61c8fe83235ceace28aff9304f92 | 7,160 | cpp | C++ | Pathfinding SFML/World.cpp | phoenixv5/Pathfinding-SFML | 8c88fe88e6e4907d5d01761331af8d875edb0a86 | [
"Apache-2.0"
] | 1 | 2019-05-17T09:05:30.000Z | 2019-05-17T09:05:30.000Z | Pathfinding SFML/World.cpp | phoenixv5/Pathfinding-SFML | 8c88fe88e6e4907d5d01761331af8d875edb0a86 | [
"Apache-2.0"
] | null | null | null | Pathfinding SFML/World.cpp | phoenixv5/Pathfinding-SFML | 8c88fe88e6e4907d5d01761331af8d875edb0a86 | [
"Apache-2.0"
] | null | null | null | #include "stdafx.h"
#include "SFML_System.h"
#include "AStarMain.h"
#include "Tile.h"
#include "FallenStar.h"
#include "StarChaser.h"
#include "Spaceship.h"
#include "TradingPost.h"
#include "StartButton.h"
#include "World.h"
#include <iostream>
World::World()
{
core = new SFML_System();
for (int i = 0;i < Config::GRID_WIDTH;i++)
{
for (int j = 0;j < Config::GRID_HEIGHT;j++)
{
grid[i][j] = new Tile(i, j, core->CreateSprite(Config::TILE_TEXTURE_RECT[0]), core->CreateSprite(Config::TILE_TEXTURE_RECT[1]));
}
}
std::srand(std::time(nullptr));
int x, y;
for (int i = 0;i < Config::BLOCKED_COUNT_START;)
{
x = std::rand() % Config::GRID_WIDTH;
y = std::rand() % Config::GRID_HEIGHT;
if (!grid[x][y]->getBlockedStatus())
{
grid[x][y]->setBlockedStatus(true);
i++;
}
}
while (grid[x][y]->getBlockedStatus())
{
x = std::rand() % Config::GRID_WIDTH;
y = std::rand() % Config::GRID_HEIGHT;
}
chaser = new StarChaser(this, x, y, core->CreateSprite(Config::STARCHASER_TEXTURE_RECT[0]), core->CreateSprite(Config::STARCHASER_TEXTURE_RECT[1]));
while (grid[x][y]->getBlockedStatus() || (x == chaser->GetIndex().first && y == chaser->GetIndex().second))
{
x = std::rand() % Config::GRID_WIDTH;
y = std::rand() % Config::GRID_HEIGHT;
}
star = new FallenStar(x, y, core->CreateSprite(Config::STAR_TEXTURE_RECT[0]), core->CreateSprite(Config::STAR_TEXTURE_RECT[1]));
while (grid[x][y]->getBlockedStatus() || (x == chaser->GetIndex().first && y == chaser->GetIndex().second)
|| (x == star->GetIndex().first && y == star->GetIndex().second))
{
x = std::rand() % Config::GRID_WIDTH;
y = std::rand() % Config::GRID_HEIGHT;
}
ship = new Spaceship(x, y, core->CreateSprite(Config::SHIP_TEXTURE_RECT[0]), core->CreateSprite(Config::SHIP_TEXTURE_RECT[1]));
while (grid[x][y]->getBlockedStatus() || (x == chaser->GetIndex().first && y == chaser->GetIndex().second)
|| (x == star->GetIndex().first && y == star->GetIndex().second)
|| (x == ship->GetIndex().first && y == ship->GetIndex().second)
)
{
x = std::rand() % Config::GRID_WIDTH;
y = std::rand() % Config::GRID_HEIGHT;
}
trader = new TradingPost(x, y, core->CreateSprite(Config::TRADEPOST_TEXTURE_RECT[0]), core->CreateSprite(Config::TRADEPOST_TEXTURE_RECT[1]));
wish = new AStarMain(
core->CreateSprite(Config::NODE_TEXTURE_RECT[0]),
core->CreateSprite(Config::NODE_TEXTURE_RECT[1]));
button = new StartButton(0, Config::GRID_HEIGHT, core->CreateSprite(Config::STARTBUTTON_TEXTURE_RECT[0]), core->CreateSprite(Config::STARTBUTTON_TEXTURE_RECT[1]));
pathfindingStarted = false;
}
World::~World()
{
}
void World::Update()
{
while (core->WindowStatus())
{
sf::Event event;
while (core->getWindow()->pollEvent(event))
{
if (event.type == sf::Event::Closed)
{
core->getWindow()->close();
}
if (event.type == sf::Event::MouseButtonPressed)
{
OnClick();
}
}
core->RenderClear();
for (int i = 0;i < Config::GRID_WIDTH;i++)
{
for (int j = 0;j < Config::GRID_HEIGHT;j++)
{
core->DrawEntity(grid[i][j]);
}
}
for (auto it : path)
{
core->DrawEntity(it);
}
core->DrawEntity(ship);
core->DrawEntity(trader);
core->DrawEntity(star);
core->DrawEntity(chaser);
core->DrawEntity(button);
core->Display();
}
}
Index World::GetObjectIndex(std::string objectType)
{
if (objectType == "StarChaser")
{
return chaser->GetIndex();
}
else if (objectType == "SpaceShip")
{
return ship->GetIndex();
}
else if (objectType == "TradingPost")
{
return trader->GetIndex();
}
else if (objectType == "FallenStar")
{
return star->GetIndex();
}
return Index(0, 0);
}
void World::OnClick()
{
Index mouseIndex;
if (sf::Mouse::isButtonPressed(sf::Mouse::Button::Left))
{
mouseIndex = core->GetMousePosIndex();
}
else
{
return;
}
if (pathfindingStarted)
{
path.clear();
chaser->UpdateState();
if (chaser->currentState == FSM::SeekShip)
{
path = wish->FindAStarPath(calculateBlocked(), chaser->GetIndex(), ship->GetIndex());
}
else if (chaser->currentState == FSM::SeekStar)
{
path = wish->FindAStarPath(calculateBlocked(), chaser->GetIndex(), star->GetIndex());
}
else if (chaser->currentState == FSM::SeekTrade)
{
path = wish->FindAStarPath(calculateBlocked(), chaser->GetIndex(), trader->GetIndex());
}
else if (chaser->currentState == FSM::Ended)
{
path.clear();
}
std::reverse(path.begin(), path.end());
if (chaser->GetStarStatus())
{
for (int i = 0; i < path.size(); i++)
{
if (path[i]->getFGH('g') > Config::STARCHASER_ENERGY)
{
path[i]->SetSprite(1);
}
else
{
chaser->SetDestination(path[i]->GetIndex());
}
}
star->SetPos(chaser->GetDestination().first, chaser->GetDestination().second);
chaser->SetFatigueStatus(true);
}
chaser->SetPos(chaser->GetDestination().first, chaser->GetDestination().second);
}
else
{
if (
core->GetMousePosVector().x >= button->GetSprite().getPosition().x
&& core->GetMousePosVector().y >= button->GetSprite().getPosition().y
&& core->GetMousePosVector().x <= button->GetSprite().getPosition().x + button->GetSprite().getGlobalBounds().width
&& core->GetMousePosVector().y <= button->GetSprite().getPosition().y + button->GetSprite().getGlobalBounds().height
)
{
pathfindingStarted = true;
button->SetSprite(1);
}
if (mouseIndex.first < 0 || mouseIndex.second < 0 || mouseIndex.first >= Config::GRID_WIDTH || mouseIndex.second >= Config::GRID_HEIGHT)
{
return;
}
if (!objectSelected)
{
if (mouseIndex.first == chaser->GetIndex().first && mouseIndex.second == chaser->GetIndex().second)
{
objectSelected = true;
selectedObject = chaser;
selectedObject->SetSprite(1);
}
else if (mouseIndex.first == trader->GetIndex().first && mouseIndex.second == trader->GetIndex().second)
{
objectSelected = true;
selectedObject = trader;
selectedObject->SetSprite(1);
}
else if (mouseIndex.first == ship->GetIndex().first && mouseIndex.second == ship->GetIndex().second)
{
objectSelected = true;
selectedObject = ship;
selectedObject->SetSprite(1);
}
else if (mouseIndex.first == star->GetIndex().first && mouseIndex.second == star->GetIndex().second)
{
objectSelected = true;
selectedObject = star;
selectedObject->SetSprite(1);
}
else
{
grid[mouseIndex.first][mouseIndex.second]->setBlockedStatus(!grid[mouseIndex.first][mouseIndex.second]->getBlockedStatus());
}
}
else
{
if (selectedObject != nullptr)
{
grid[mouseIndex.first][mouseIndex.second]->setBlockedStatus(false);
selectedObject->SetPos(mouseIndex.first, mouseIndex.second);
selectedObject->SetSprite(0);
}
objectSelected = false;
selectedObject = nullptr;
}
}
}
std::vector<Index> World::calculateBlocked()
{
std::vector<Index> blockedTiles;
for (int i = 0;i < Config::GRID_WIDTH;i++)
{
for (int j = 0;j < Config::GRID_HEIGHT;j++)
{
if (grid[i][j]->getBlockedStatus())
{
blockedTiles.push_back(grid[i][j]->GetIndex());
}
}
}
return blockedTiles;
}
| 24.43686 | 164 | 0.64567 | [
"vector"
] |
46234eb1b5dfe875170f4a6dd9cee4459bb7cc98 | 3,729 | cxx | C++ | src/larcv3/app/NextImageMod/ReSample.cxx | zhulcher/larcv3 | 26d1ad33f0c27ddf6bb2c56bc0238aeaddcb772b | [
"MIT"
] | 14 | 2017-10-19T15:08:29.000Z | 2021-03-31T21:21:07.000Z | src/larcv3/app/NextImageMod/ReSample.cxx | zhulcher/larcv3 | 26d1ad33f0c27ddf6bb2c56bc0238aeaddcb772b | [
"MIT"
] | 34 | 2019-05-15T13:33:10.000Z | 2022-03-22T17:54:49.000Z | src/larcv3/app/NextImageMod/ReSample.cxx | zhulcher/larcv3 | 26d1ad33f0c27ddf6bb2c56bc0238aeaddcb772b | [
"MIT"
] | 16 | 2017-12-07T12:04:40.000Z | 2021-11-15T00:53:31.000Z | #ifndef __RESAMPLE_CXX__
#define __RESAMPLE_CXX__
#include "ReSample.h"
#include "larcv/core/DataFormat/EventVoxel3D.h"
namespace larcv {
static ReSampleProcessFactory __global_ReSampleProcessFactory__;
ReSample::ReSample(const std::string name)
: ProcessBase(name)
{}
void ReSample::configure(const PSet& cfg)
{
_pmaps_producers = cfg.get<std::vector<std::string>>("PMAPSProducers");
_output_labels = cfg.get<std::vector<std::string>>("OutputLables");
_scale_x = cfg.get<double>("ScaleX");
_scale_y = cfg.get<double>("ScaleY");
_scale_z = cfg.get<double>("ScaleZ");
}
void ReSample::initialize()
{}
bool ReSample::process(IOManager& mgr)
{
for (size_t i_input = 0; i_input < _pmaps_producers.size(); i_input ++) {
auto ev_sparse3d_pmaps = mgr.get_data<larcv::EventSparseTensor3D>(_pmaps_producers.at(i_input));
if (ev_sparse3d_pmaps.as_vector().size() == 0) {
LARCV_CRITICAL() << "Input EventSparseTensor3D not found by producer name "
<< _pmaps_producers.at(i_input) << std::endl;
throw larbys();
}
auto & original_meta_pmaps = ev_sparse3d_pmaps.meta();
// get the x/y locations of the min/max row/col in the old meta:
float min_x = original_meta_pmaps.min_x();
float max_x = original_meta_pmaps.max_x();
float min_y = original_meta_pmaps.min_y();
float max_y = original_meta_pmaps.max_y();
float min_z = original_meta_pmaps.min_z();
float max_z = original_meta_pmaps.max_z();
int n_x = original_meta_pmaps.num_voxel_x();
int n_y = original_meta_pmaps.num_voxel_y();
int n_z = original_meta_pmaps.num_voxel_z();
n_x *= _scale_x;
n_y *= _scale_y;
n_z *= _scale_z;
// Create a new meta object for pmaps
larcv::Voxel3DMeta new_meta_pmaps;
new_meta_pmaps.set(min_x, min_y, min_z,
max_x, max_y, max_z,
n_x, n_y, n_z,
original_meta_pmaps.unit());
larcv::VoxelSet _output_voxel_set;
for (auto & voxel : ev_sparse3d_pmaps.as_vector() ){
if (voxel.id() > original_meta_pmaps.size() ){
std::cout << "Skipping voxel with id " << voxel.id() << std::endl;
continue;
}
// Get the old id and i_x, i_y, i_z of this voxel:
float old_pos_x = original_meta_pmaps.pos_x(voxel.id());
float old_pos_y = original_meta_pmaps.pos_y(voxel.id());
float old_pos_z = original_meta_pmaps.pos_z(voxel.id());
// LARCV_DEBUG() << "initial x " << old_pos_x << ", initial y " << old_pos_y << ", initial z " << old_pos_z << std::endl;
int spacing = 2;
for (int i = old_pos_x - (int)(_scale_x / 2) * spacing; i <= old_pos_x + (int)(_scale_x / 2) * spacing; i+= spacing) {
// old_pos_x += i * spacing;
for (int j = old_pos_y - (int)(_scale_y / 2) * spacing; j <= old_pos_y + (int)(_scale_y / 2) * spacing; j+= spacing) {
// old_pos_y += j * spacing;
for (int k = old_pos_z - (int)(_scale_z / 2) * spacing; k <= old_pos_z + (int)(_scale_z / 2) * spacing; k+= spacing) {
// LARCV_DEBUG() << "i " << i << ", j " << j << ", k " << k<< std::endl;
VoxelID_t new_index;
new_index = new_meta_pmaps.id(i, j, k);
_output_voxel_set.add(larcv::Voxel(new_index, voxel.value() /*/ (_scale_x * _scale_x * _scale_z)*/));
}
}
}
}
auto & ev_sparse3d_out = mgr.get_data<larcv::EventSparseTensor3D>(_output_labels.at(i_input));
ev_sparse3d_out.emplace(std::move(_output_voxel_set), new_meta_pmaps);
}
return true;
}
void ReSample::finalize()
{}
}
#endif
| 29.132813 | 130 | 0.61491 | [
"object",
"vector"
] |
462b49a3ae7174329a34f8c5e7a99bcdec27b3f1 | 1,090 | cpp | C++ | leetcode/1 - twosum/two_sum.cpp | robinsonvs/community-coding-challenges | 62b20f15b3a8c2e3bedc33a296d93832bebf3abc | [
"MIT"
] | 91 | 2021-08-06T10:26:43.000Z | 2022-03-18T11:18:59.000Z | leetcode/1 - twosum/two_sum.cpp | robinsonvs/community-coding-challenges | 62b20f15b3a8c2e3bedc33a296d93832bebf3abc | [
"MIT"
] | 6 | 2021-08-06T15:46:39.000Z | 2021-09-13T21:10:52.000Z | leetcode/1 - twosum/two_sum.cpp | robinsonvs/community-coding-challenges | 62b20f15b3a8c2e3bedc33a296d93832bebf3abc | [
"MIT"
] | 32 | 2021-08-06T06:13:34.000Z | 2021-11-14T03:01:04.000Z | // Time complexity: O(N) - linear (tamanho do vetor)
// A estrutura de dados map pode ser implementada de duas formas, utilizando o conceito de árvore rubro-negra
// ou Hash table. cada estrutura possui vatangens/desvantagens. No exercício em questão a implementação baseada
// em Hash table faz muito mais sentido, visto que o custo de busca de um item em uma Hash table é constante
// e em uma árvore rubro-negra é Log2(N), sendo N o número de elementos contidos no mapa.
// em C++ temos as duas implementações, onde estrutura map utliza árvore rubro-negra como implementação
// e a estrutura unordered_map utiliza o conceito de Hash table como implementação ;)
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int> storage;
for (int index = 0; index < nums.size(); index++) {
int diff = (target - nums[index]);
if (storage.find(diff) != storage.end()) {
return {index, storage[diff]};
}
storage[nums[index]] = index;
}
return {};
}
}; | 45.416667 | 111 | 0.666055 | [
"vector"
] |
462df82e16b224a2a4b7fede20ddcfeeb22c4ba2 | 3,387 | cpp | C++ | src/Analysis.cpp | aishkrish3/Scalar-Transport-Equation-Solver | f61d7a3fb2b674504c717ca94e165a89610fdcb5 | [
"MIT"
] | null | null | null | src/Analysis.cpp | aishkrish3/Scalar-Transport-Equation-Solver | f61d7a3fb2b674504c717ca94e165a89610fdcb5 | [
"MIT"
] | null | null | null | src/Analysis.cpp | aishkrish3/Scalar-Transport-Equation-Solver | f61d7a3fb2b674504c717ca94e165a89610fdcb5 | [
"MIT"
] | null | null | null | #include <Analysis.h>
std::vector<std::vector<Point3D> > Analysis::Analyze(double CFL)
{
std::vector<std::vector<Point3D> > final_result;
const int nx = get_nx(), ny = get_ny();
double dxi = mesh.get_dxi(); /*inverse of dx*/
double dyi = mesh.get_dyi(); /*inverse of dy*/
double dxi_2 = mesh.get_dxi_2(); /*inverse of dx^2*/
double dyi_2 = mesh.get_dyi_2(); /*inverse of dy^2*/
std::cout << "Calculating Convection and Diffusion terms...\n";
auto data = CreateCNConvDiff(CFL);
const double output_freq = Mesh::tf / 4.;
double otime = output_freq;
auto check_range = [](int &ii, int size)
{
if (ii < 0)
{ ii += size;}
if (ii >= size)
{ ii -= size;}
};
std::vector<Point3D> phi_result;
for (auto &x : mesh.getXm())
{
for (auto &y : mesh.getYm())
{
phi_result.push_back(Point3D(x, y, 0));
}
}
auto add_result = [&]()
{
int k = 0;
for (int i = 0; i < nx; ++i)
{
for (int j = 0; j < ny; ++j)
{
phi_result[k++].z = phi(i, j);
}
}
final_result.push_back(phi_result);
};
/*Looping through time*/
for (double t = 0; t <= Mesh::tf; t += data.dt)
{
std::cout << "Analyzing time step " << t << "s of " << Mesh::tf
<< "s...\n";
/*Looping through space*/
for (int i = 0; i < nx; i++)
{
for (int j = 0; j < ny; j++)
{
int ip1 = i + 1;
int ip2 = i + 2;
int im1 = i - 1;
int im2 = i - 2;
check_range(ip1, nx);
check_range(ip2, nx);
check_range(im1, nx);
check_range(im2, nx);
int jp1 = j + 1;
int jp2 = j + 2;
int jm1 = j - 1;
int jm2 = j - 2;
check_range(jp1, ny);
check_range(jp2, ny);
check_range(jm1, ny);
check_range(jm2, ny);
/*calculate diffusion*/
double diff = 0;
diff = Mesh::alpha * dxi_2
* (phi_old(im1, j) - 2. * phi_old(i, j)
+ phi_old(ip1, j));
diff += Mesh::alpha * dyi_2
* (phi_old(i, jm1) - 2. * phi_old(i, j)
+ phi_old(i, jp1));
/*Face velocities*/
double ue = data.u[i + 1][j];
double uw = data.u[i][j];
double un = data.v[i][j + 1];
double us = data.v[i][j];
double phi_e, phi_w, phi_n, phi_s;
if (ue > 0)
phi_e = (-phi_old(im1, j) + 5. * phi_old(i, j)
+ 2. * phi_old(ip1, j)) / 6.;
else
phi_e = (2. * phi_old(i, j) + 5. * phi_old(ip1, j)
- phi_old(ip2, j)) / 6.;
if (uw > 0)
phi_w = (-phi_old(im2, j) + 5. * phi_old(im1, j)
+ 2. * phi_old(i, j)) / 6.;
else
phi_w = (2. * phi_old(im1, j) + 5. * phi_old(i, j)
- phi_old(ip1, j)) / 6.;
if (un > 0)
phi_n = (-phi_old(i, jm1) + 5. * phi_old(i, j)
+ 2. * phi_old(i, jp1)) / 6.;
else
phi_n = (2. * phi_old(i, j) + 5. * phi_old(i, jp1)
- phi_old(i, jp2)) / 6.;
if (us > 0)
phi_s = (-phi_old(i, jm2) + 5. * phi_old(i, jm1)
+ 2. * phi_old(i, j)) / 6.;
else
phi_s = (2. * phi_old(i, jm1) + 5. * phi_old(i, j)
- phi_old(i, jp1)) / 6.;
/*calculate convection*/
double conv = -dxi * (ue * phi_e - uw * phi_w);
conv -= dyi * (un * phi_n - us * phi_s);
CalcPhi(i, j, conv, diff, data);
}
}
/*solve phi matrix using Armadillo*/
if (!SolvePhi())
{
std::cout << "\nFailed to solve for Phi!\n";
break;
}
phi_old = phi;
if (t > otime)
{
add_result();
otime += output_freq;
}
}
add_result();
std::cout << "\nDone!\n";
return final_result;
}
| 23.040816 | 65 | 0.517567 | [
"mesh",
"vector"
] |
462ecf58c2ade22baeaaa51b7f57dd8e845e4b2c | 2,803 | hpp | C++ | include/codegen/include/GlobalNamespace/ComboUIController.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 1 | 2021-11-12T09:29:31.000Z | 2021-11-12T09:29:31.000Z | include/codegen/include/GlobalNamespace/ComboUIController.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | null | null | null | include/codegen/include/GlobalNamespace/ComboUIController.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 2 | 2021-10-03T02:14:20.000Z | 2021-11-12T09:29:36.000Z | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: UnityEngine.MonoBehaviour
#include "UnityEngine/MonoBehaviour.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: TMPro
namespace TMPro {
// Forward declaring type: TextMeshProUGUI
class TextMeshProUGUI;
}
// Forward declaring namespace: UnityEngine
namespace UnityEngine {
// Forward declaring type: Animator
class Animator;
}
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: ScoreController
class ScoreController;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Autogenerated type: ComboUIController
class ComboUIController : public UnityEngine::MonoBehaviour {
public:
// private TMPro.TextMeshProUGUI _comboText
// Offset: 0x18
TMPro::TextMeshProUGUI* comboText;
// private UnityEngine.Animator _animator
// Offset: 0x20
UnityEngine::Animator* animator;
// private ScoreController _scoreController
// Offset: 0x28
GlobalNamespace::ScoreController* scoreController;
// private System.Int32 _comboLostID
// Offset: 0x30
int comboLostID;
// private System.Boolean _comboLost
// Offset: 0x34
bool comboLost;
// protected System.Void Start()
// Offset: 0xBE1B88
void Start();
// protected System.Void OnEnable()
// Offset: 0xBE1D98
void OnEnable();
// protected System.Void OnDisable()
// Offset: 0xBE1D9C
void OnDisable();
// private System.Void RegisterForEvents()
// Offset: 0xBE1C04
void RegisterForEvents();
// private System.Void UnregisterFromEvents()
// Offset: 0xBE1DA0
void UnregisterFromEvents();
// private System.Void HandleComboDidChange(System.Int32 combo)
// Offset: 0xBE1EC0
void HandleComboDidChange(int combo);
// private System.Void HandleComboBreakingEventHappened()
// Offset: 0xBE1F04
void HandleComboBreakingEventHappened();
// public System.Void .ctor()
// Offset: 0xBE1F3C
// Implemented from: UnityEngine.MonoBehaviour
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
static ComboUIController* New_ctor();
}; // ComboUIController
}
#include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::ComboUIController*, "", "ComboUIController");
#pragma pack(pop)
| 33.771084 | 85 | 0.704602 | [
"object"
] |
46361c962e9c226834031abd8707f061f8633db4 | 499 | cpp | C++ | promethee/functions/umbu/promethee_umbu_fun.cpp | FMota0/PrometheeOptimization | 6f6cd936e61d9d25e9bc0bb57d002506445a62cf | [
"MIT"
] | 9 | 2018-09-17T03:09:38.000Z | 2021-11-12T12:25:28.000Z | promethee/functions/umbu/promethee_umbu_fun.cpp | FMota0/PrometheeOptimization | 6f6cd936e61d9d25e9bc0bb57d002506445a62cf | [
"MIT"
] | 20 | 2018-08-16T11:53:12.000Z | 2020-04-09T21:08:06.000Z | promethee/functions/umbu/promethee_umbu_fun.cpp | FMota0/PrometheeOptimization | 6f6cd936e61d9d25e9bc0bb57d002506445a62cf | [
"MIT"
] | 3 | 2018-08-06T19:53:31.000Z | 2018-08-10T12:32:43.000Z | #include "promethee_umbu_fun.h"
PrometheeUmbuFunction::PrometheeUmbuFunction(vector<ldouble> params){
this->params = params;
}
ldouble PrometheeUmbuFunction::getPositiveDelta(vector<ldouble> &values, ldouble queryValue, vector<ldouble> &cummulative, ldouble weight, vector<unsigned int> &cnt){
return 0;
}
ldouble PrometheeUmbuFunction::getNegativeDelta(vector<ldouble> &values, ldouble queryValue, vector<ldouble> &cummulative, ldouble weight, vector<unsigned int> &cnt){
return 0;
} | 38.384615 | 166 | 0.783567 | [
"vector"
] |
46392fdbe8108fb952749dcd5d5d210a7f5e8d9e | 1,012,811 | hpp | C++ | Lattices/10_3_d_6x6x6_periodic_10flux_Jz_0.3333333333333333.hpp | timeschmann/Kitaev_QMC_KPM | 6dbeceadf93c6319a746fa69e6e780f7570f72d3 | [
"MIT"
] | null | null | null | Lattices/10_3_d_6x6x6_periodic_10flux_Jz_0.3333333333333333.hpp | timeschmann/Kitaev_QMC_KPM | 6dbeceadf93c6319a746fa69e6e780f7570f72d3 | [
"MIT"
] | null | null | null | Lattices/10_3_d_6x6x6_periodic_10flux_Jz_0.3333333333333333.hpp | timeschmann/Kitaev_QMC_KPM | 6dbeceadf93c6319a746fa69e6e780f7570f72d3 | [
"MIT"
] | null | null | null | #include <armadillo>
#include <complex>
using namespace arma;
sp_cx_mat def_matrix()
{
sp_cx_mat A(1728,1728);
A(0, 1) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1, 0) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(0, 5) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(5, 0) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(0, 11) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(11, 0) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1, 2) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(2, 1) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1, 1446) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1446, 1) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(2, 3) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(3, 2) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(2, 1495) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1495, 2) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(3, 40) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(40, 3) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(3, 52) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(52, 3) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(4, 5) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(5, 4) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(4, 7) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(7, 4) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(4, 243) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(243, 4) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(5, 6) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(6, 5) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(6, 15) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(15, 6) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(6, 289) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(289, 6) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(7, 46) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(46, 7) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(7, 530) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(530, 7) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(8, 9) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(9, 8) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(8, 13) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(13, 8) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(8, 19) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(19, 8) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(9, 10) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(10, 9) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(9, 1454) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1454, 9) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(10, 11) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(11, 10) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(10, 1503) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1503, 10) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(11, 60) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(60, 11) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(12, 13) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(13, 12) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(12, 15) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(15, 12) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(12, 251) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(251, 12) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(13, 14) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(14, 13) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(14, 23) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(23, 14) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(14, 297) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(297, 14) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(15, 538) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(538, 15) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(16, 17) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(17, 16) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(16, 21) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(21, 16) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(16, 27) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(27, 16) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(17, 18) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(18, 17) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(17, 1462) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1462, 17) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(18, 19) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(19, 18) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(18, 1511) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1511, 18) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(19, 68) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(68, 19) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(20, 21) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(21, 20) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(20, 23) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(23, 20) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(20, 259) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(259, 20) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(21, 22) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(22, 21) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(22, 31) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(31, 22) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(22, 305) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(305, 22) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(23, 546) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(546, 23) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(24, 25) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(25, 24) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(24, 29) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(29, 24) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(24, 35) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(35, 24) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(25, 26) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(26, 25) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(25, 1470) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1470, 25) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(26, 27) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(27, 26) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(26, 1519) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1519, 26) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(27, 76) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(76, 27) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(28, 29) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(29, 28) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(28, 31) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(31, 28) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(28, 267) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(267, 28) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(29, 30) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(30, 29) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(30, 39) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(39, 30) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(30, 313) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(313, 30) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(31, 554) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(554, 31) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(32, 33) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(33, 32) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(32, 37) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(37, 32) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(32, 43) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(43, 32) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(33, 34) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(34, 33) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(33, 1478) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1478, 33) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(34, 35) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(35, 34) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(34, 1527) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1527, 34) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(35, 84) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(84, 35) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(36, 37) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(37, 36) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(36, 39) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(39, 36) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(36, 275) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(275, 36) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(37, 38) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(38, 37) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(38, 47) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(47, 38) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(38, 321) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(321, 38) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(39, 562) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(562, 39) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(40, 41) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(41, 40) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(40, 45) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(45, 40) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(41, 42) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(42, 41) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(41, 1486) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1486, 41) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(42, 43) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(43, 42) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(42, 1535) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1535, 42) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(43, 92) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(92, 43) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(44, 45) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(45, 44) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(44, 47) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(47, 44) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(44, 283) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(283, 44) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(45, 46) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(46, 45) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(46, 329) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(329, 46) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(47, 570) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(570, 47) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(48, 49) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(49, 48) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(48, 53) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(53, 48) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(48, 59) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(59, 48) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(49, 50) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(50, 49) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(49, 1494) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1494, 49) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(50, 51) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(51, 50) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(50, 1543) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1543, 50) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(51, 88) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(88, 51) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(51, 100) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(100, 51) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(52, 53) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(53, 52) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(52, 55) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(55, 52) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(53, 54) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(54, 53) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(54, 63) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(63, 54) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(54, 337) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(337, 54) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(55, 94) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(94, 55) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(55, 290) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(290, 55) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(56, 57) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(57, 56) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(56, 61) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(61, 56) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(56, 67) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(67, 56) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(57, 58) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(58, 57) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(57, 1502) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1502, 57) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(58, 59) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(59, 58) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(58, 1551) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1551, 58) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(59, 108) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(108, 59) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(60, 61) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(61, 60) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(60, 63) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(63, 60) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(61, 62) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(62, 61) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(62, 71) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(71, 62) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(62, 345) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(345, 62) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(63, 298) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(298, 63) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(64, 65) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(65, 64) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(64, 69) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(69, 64) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(64, 75) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(75, 64) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(65, 66) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(66, 65) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(65, 1510) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1510, 65) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(66, 67) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(67, 66) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(66, 1559) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1559, 66) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(67, 116) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(116, 67) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(68, 69) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(69, 68) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(68, 71) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(71, 68) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(69, 70) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(70, 69) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(70, 79) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(79, 70) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(70, 353) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(353, 70) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(71, 306) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(306, 71) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(72, 73) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(73, 72) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(72, 77) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(77, 72) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(72, 83) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(83, 72) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(73, 74) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(74, 73) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(73, 1518) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1518, 73) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(74, 75) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(75, 74) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(74, 1567) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1567, 74) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(75, 124) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(124, 75) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(76, 77) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(77, 76) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(76, 79) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(79, 76) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(77, 78) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(78, 77) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(78, 87) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(87, 78) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(78, 361) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(361, 78) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(79, 314) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(314, 79) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(80, 81) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(81, 80) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(80, 85) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(85, 80) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(80, 91) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(91, 80) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(81, 82) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(82, 81) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(81, 1526) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1526, 81) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(82, 83) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(83, 82) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(82, 1575) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1575, 82) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(83, 132) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(132, 83) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(84, 85) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(85, 84) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(84, 87) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(87, 84) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(85, 86) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(86, 85) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(86, 95) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(95, 86) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(86, 369) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(369, 86) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(87, 322) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(322, 87) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(88, 89) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(89, 88) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(88, 93) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(93, 88) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(89, 90) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(90, 89) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(89, 1534) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1534, 89) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(90, 91) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(91, 90) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(90, 1583) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1583, 90) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(91, 140) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(140, 91) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(92, 93) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(93, 92) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(92, 95) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(95, 92) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(93, 94) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(94, 93) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(94, 377) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(377, 94) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(95, 330) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(330, 95) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(96, 97) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(97, 96) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(96, 101) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(101, 96) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(96, 107) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(107, 96) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(97, 98) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(98, 97) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(97, 1542) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1542, 97) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(98, 99) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(99, 98) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(98, 1591) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1591, 98) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(99, 136) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(136, 99) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(99, 148) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(148, 99) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(100, 101) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(101, 100) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(100, 103) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(103, 100) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(101, 102) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(102, 101) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(102, 111) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(111, 102) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(102, 385) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(385, 102) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(103, 142) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(142, 103) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(103, 338) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(338, 103) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(104, 105) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(105, 104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(104, 109) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(109, 104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(104, 115) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(115, 104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(105, 106) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(106, 105) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(105, 1550) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1550, 105) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(106, 107) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(107, 106) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(106, 1599) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1599, 106) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(107, 156) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(156, 107) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(108, 109) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(109, 108) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(108, 111) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(111, 108) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(109, 110) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(110, 109) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(110, 119) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(119, 110) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(110, 393) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(393, 110) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(111, 346) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(346, 111) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(112, 113) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(113, 112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(112, 117) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(117, 112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(112, 123) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(123, 112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(113, 114) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(114, 113) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(113, 1558) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1558, 113) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(114, 115) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(115, 114) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(114, 1607) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1607, 114) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(115, 164) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(164, 115) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(116, 117) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(117, 116) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(116, 119) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(119, 116) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(117, 118) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(118, 117) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(118, 127) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(127, 118) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(118, 401) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(401, 118) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(119, 354) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(354, 119) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(120, 121) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(121, 120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(120, 125) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(125, 120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(120, 131) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(131, 120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(121, 122) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(122, 121) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(121, 1566) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1566, 121) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(122, 123) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(123, 122) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(122, 1615) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1615, 122) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(123, 172) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(172, 123) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(124, 125) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(125, 124) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(124, 127) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(127, 124) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(125, 126) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(126, 125) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(126, 135) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(135, 126) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(126, 409) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(409, 126) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(127, 362) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(362, 127) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(128, 129) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(129, 128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(128, 133) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(133, 128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(128, 139) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(139, 128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(129, 130) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(130, 129) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(129, 1574) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1574, 129) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(130, 131) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(131, 130) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(130, 1623) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1623, 130) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(131, 180) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(180, 131) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(132, 133) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(133, 132) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(132, 135) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(135, 132) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(133, 134) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(134, 133) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(134, 143) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(143, 134) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(134, 417) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(417, 134) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(135, 370) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(370, 135) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(136, 137) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(137, 136) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(136, 141) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(141, 136) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(137, 138) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(138, 137) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(137, 1582) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1582, 137) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(138, 139) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(139, 138) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(138, 1631) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1631, 138) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(139, 188) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(188, 139) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(140, 141) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(141, 140) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(140, 143) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(143, 140) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(141, 142) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(142, 141) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(142, 425) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(425, 142) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(143, 378) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(378, 143) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(144, 145) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(145, 144) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(144, 149) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(149, 144) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(144, 155) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(155, 144) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(145, 146) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(146, 145) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(145, 1590) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1590, 145) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(146, 147) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(147, 146) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(146, 1639) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1639, 146) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(147, 184) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(184, 147) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(147, 196) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(196, 147) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(148, 149) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(149, 148) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(148, 151) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(151, 148) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(149, 150) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(150, 149) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(150, 159) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(159, 150) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(150, 433) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(433, 150) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(151, 190) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(190, 151) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(151, 386) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(386, 151) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(152, 153) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(153, 152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(152, 157) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(157, 152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(152, 163) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(163, 152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(153, 154) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(154, 153) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(153, 1598) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1598, 153) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(154, 155) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(155, 154) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(154, 1647) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1647, 154) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(155, 204) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(204, 155) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(156, 157) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(157, 156) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(156, 159) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(159, 156) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(157, 158) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(158, 157) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(158, 167) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(167, 158) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(158, 441) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(441, 158) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(159, 394) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(394, 159) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(160, 161) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(161, 160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(160, 165) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(165, 160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(160, 171) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(171, 160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(161, 162) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(162, 161) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(161, 1606) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1606, 161) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(162, 163) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(163, 162) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(162, 1655) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1655, 162) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(163, 212) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(212, 163) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(164, 165) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(165, 164) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(164, 167) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(167, 164) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(165, 166) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(166, 165) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(166, 175) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(175, 166) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(166, 449) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(449, 166) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(167, 402) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(402, 167) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(168, 169) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(169, 168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(168, 173) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(173, 168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(168, 179) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(179, 168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(169, 170) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(170, 169) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(169, 1614) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1614, 169) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(170, 171) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(171, 170) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(170, 1663) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1663, 170) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(171, 220) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(220, 171) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(172, 173) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(173, 172) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(172, 175) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(175, 172) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(173, 174) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(174, 173) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(174, 183) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(183, 174) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(174, 457) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(457, 174) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(175, 410) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(410, 175) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(176, 177) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(177, 176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(176, 181) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(181, 176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(176, 187) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(187, 176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(177, 178) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(178, 177) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(177, 1622) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1622, 177) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(178, 179) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(179, 178) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(178, 1671) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1671, 178) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(179, 228) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(228, 179) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(180, 181) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(181, 180) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(180, 183) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(183, 180) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(181, 182) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(182, 181) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(182, 191) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(191, 182) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(182, 465) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(465, 182) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(183, 418) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(418, 183) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(184, 185) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(185, 184) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(184, 189) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(189, 184) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(185, 186) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(186, 185) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(185, 1630) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1630, 185) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(186, 187) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(187, 186) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(186, 1679) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1679, 186) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(187, 236) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(236, 187) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(188, 189) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(189, 188) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(188, 191) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(191, 188) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(189, 190) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(190, 189) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(190, 473) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(473, 190) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(191, 426) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(426, 191) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(192, 193) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(193, 192) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(192, 197) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(197, 192) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(192, 203) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(203, 192) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(193, 194) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(194, 193) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(193, 1638) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1638, 193) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(194, 195) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(195, 194) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(194, 1687) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1687, 194) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(195, 232) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(232, 195) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(195, 244) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(244, 195) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(196, 197) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(197, 196) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(196, 199) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(199, 196) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(197, 198) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(198, 197) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(198, 207) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(207, 198) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(198, 481) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(481, 198) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(199, 238) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(238, 199) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(199, 434) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(434, 199) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(200, 201) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(201, 200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(200, 205) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(205, 200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(200, 211) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(211, 200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(201, 202) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(202, 201) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(201, 1646) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1646, 201) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(202, 203) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(203, 202) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(202, 1695) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1695, 202) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(203, 252) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(252, 203) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(204, 205) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(205, 204) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(204, 207) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(207, 204) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(205, 206) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(206, 205) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(206, 215) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(215, 206) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(206, 489) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(489, 206) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(207, 442) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(442, 207) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(208, 209) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(209, 208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(208, 213) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(213, 208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(208, 219) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(219, 208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(209, 210) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(210, 209) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(209, 1654) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1654, 209) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(210, 211) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(211, 210) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(210, 1703) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1703, 210) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(211, 260) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(260, 211) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(212, 213) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(213, 212) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(212, 215) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(215, 212) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(213, 214) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(214, 213) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(214, 223) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(223, 214) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(214, 497) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(497, 214) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(215, 450) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(450, 215) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(216, 217) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(217, 216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(216, 221) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(221, 216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(216, 227) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(227, 216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(217, 218) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(218, 217) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(217, 1662) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1662, 217) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(218, 219) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(219, 218) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(218, 1711) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1711, 218) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(219, 268) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(268, 219) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(220, 221) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(221, 220) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(220, 223) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(223, 220) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(221, 222) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(222, 221) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(222, 231) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(231, 222) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(222, 505) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(505, 222) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(223, 458) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(458, 223) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(224, 225) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(225, 224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(224, 229) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(229, 224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(224, 235) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(235, 224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(225, 226) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(226, 225) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(225, 1670) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1670, 225) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(226, 227) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(227, 226) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(226, 1719) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1719, 226) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(227, 276) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(276, 227) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(228, 229) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(229, 228) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(228, 231) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(231, 228) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(229, 230) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(230, 229) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(230, 239) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(239, 230) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(230, 513) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(513, 230) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(231, 466) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(466, 231) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(232, 233) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(233, 232) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(232, 237) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(237, 232) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(233, 234) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(234, 233) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(233, 1678) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1678, 233) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(234, 235) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(235, 234) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(234, 1727) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1727, 234) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(235, 284) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(284, 235) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(236, 237) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(237, 236) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(236, 239) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(239, 236) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(237, 238) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(238, 237) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(238, 521) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(521, 238) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(239, 474) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(474, 239) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(240, 241) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(241, 240) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(240, 245) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(245, 240) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(240, 251) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(251, 240) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(241, 242) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(242, 241) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(241, 1686) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1686, 241) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(242, 243) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(243, 242) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(242, 1447) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1447, 242) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(243, 280) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(280, 243) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(244, 245) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(245, 244) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(244, 247) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(247, 244) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(245, 246) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(246, 245) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(246, 255) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(255, 246) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(246, 529) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(529, 246) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(247, 286) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(286, 247) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(247, 482) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(482, 247) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(248, 249) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(249, 248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(248, 253) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(253, 248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(248, 259) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(259, 248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(249, 250) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(250, 249) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(249, 1694) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1694, 249) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(250, 251) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(251, 250) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(250, 1455) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1455, 250) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(252, 253) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(253, 252) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(252, 255) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(255, 252) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(253, 254) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(254, 253) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(254, 263) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(263, 254) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(254, 537) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(537, 254) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(255, 490) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(490, 255) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(256, 257) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(257, 256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(256, 261) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(261, 256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(256, 267) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(267, 256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(257, 258) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(258, 257) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(257, 1702) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1702, 257) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(258, 259) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(259, 258) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(258, 1463) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1463, 258) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(260, 261) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(261, 260) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(260, 263) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(263, 260) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(261, 262) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(262, 261) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(262, 271) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(271, 262) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(262, 545) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(545, 262) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(263, 498) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(498, 263) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(264, 265) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(265, 264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(264, 269) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(269, 264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(264, 275) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(275, 264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(265, 266) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(266, 265) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(265, 1710) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1710, 265) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(266, 267) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(267, 266) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(266, 1471) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1471, 266) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(268, 269) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(269, 268) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(268, 271) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(271, 268) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(269, 270) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(270, 269) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(270, 279) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(279, 270) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(270, 553) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(553, 270) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(271, 506) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(506, 271) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(272, 273) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(273, 272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(272, 277) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(277, 272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(272, 283) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(283, 272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(273, 274) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(274, 273) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(273, 1718) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1718, 273) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(274, 275) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(275, 274) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(274, 1479) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1479, 274) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(276, 277) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(277, 276) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(276, 279) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(279, 276) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(277, 278) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(278, 277) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(278, 287) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(287, 278) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(278, 561) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(561, 278) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(279, 514) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(514, 279) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(280, 281) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(281, 280) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(280, 285) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(285, 280) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(281, 282) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(282, 281) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(281, 1726) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1726, 281) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(282, 283) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(283, 282) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(282, 1487) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1487, 282) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(284, 285) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(285, 284) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(284, 287) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(287, 284) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(285, 286) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(286, 285) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(286, 569) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(569, 286) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(287, 522) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(522, 287) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(288, 289) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(289, 288) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(288, 293) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(293, 288) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(288, 299) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(299, 288) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(289, 290) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(290, 289) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(290, 291) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(291, 290) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(291, 328) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(328, 291) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(291, 340) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(340, 291) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(292, 293) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(293, 292) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(292, 295) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(295, 292) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(292, 531) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(531, 292) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(293, 294) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(294, 293) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(294, 303) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(303, 294) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(294, 577) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(577, 294) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(295, 334) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(334, 295) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(295, 818) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(818, 295) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(296, 297) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(297, 296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(296, 301) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(301, 296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(296, 307) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(307, 296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(297, 298) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(298, 297) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(298, 299) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(299, 298) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(299, 348) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(348, 299) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(300, 301) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(301, 300) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(300, 303) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(303, 300) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(300, 539) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(539, 300) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(301, 302) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(302, 301) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(302, 311) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(311, 302) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(302, 585) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(585, 302) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(303, 826) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(826, 303) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(304, 305) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(305, 304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(304, 309) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(309, 304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(304, 315) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(315, 304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(305, 306) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(306, 305) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(306, 307) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(307, 306) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(307, 356) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(356, 307) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(308, 309) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(309, 308) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(308, 311) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(311, 308) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(308, 547) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(547, 308) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(309, 310) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(310, 309) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(310, 319) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(319, 310) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(310, 593) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(593, 310) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(311, 834) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(834, 311) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(312, 313) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(313, 312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(312, 317) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(317, 312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(312, 323) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(323, 312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(313, 314) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(314, 313) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(314, 315) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(315, 314) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(315, 364) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(364, 315) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(316, 317) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(317, 316) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(316, 319) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(319, 316) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(316, 555) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(555, 316) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(317, 318) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(318, 317) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(318, 327) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(327, 318) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(318, 601) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(601, 318) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(319, 842) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(842, 319) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(320, 321) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(321, 320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(320, 325) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(325, 320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(320, 331) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(331, 320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(321, 322) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(322, 321) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(322, 323) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(323, 322) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(323, 372) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(372, 323) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(324, 325) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(325, 324) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(324, 327) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(327, 324) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(324, 563) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(563, 324) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(325, 326) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(326, 325) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(326, 335) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(335, 326) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(326, 609) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(609, 326) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(327, 850) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(850, 327) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(328, 329) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(329, 328) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(328, 333) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(333, 328) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(329, 330) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(330, 329) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(330, 331) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(331, 330) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(331, 380) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(380, 331) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(332, 333) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(333, 332) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(332, 335) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(335, 332) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(332, 571) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(571, 332) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(333, 334) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(334, 333) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(334, 617) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(617, 334) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(335, 858) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(858, 335) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(336, 337) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(337, 336) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(336, 341) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(341, 336) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(336, 347) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(347, 336) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(337, 338) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(338, 337) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(338, 339) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(339, 338) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(339, 376) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(376, 339) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(339, 388) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(388, 339) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(340, 341) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(341, 340) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(340, 343) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(343, 340) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(341, 342) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(342, 341) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(342, 351) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(351, 342) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(342, 625) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(625, 342) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(343, 382) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(382, 343) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(343, 578) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(578, 343) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(344, 345) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(345, 344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(344, 349) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(349, 344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(344, 355) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(355, 344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(345, 346) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(346, 345) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(346, 347) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(347, 346) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(347, 396) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(396, 347) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(348, 349) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(349, 348) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(348, 351) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(351, 348) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(349, 350) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(350, 349) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(350, 359) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(359, 350) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(350, 633) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(633, 350) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(351, 586) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(586, 351) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(352, 353) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(353, 352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(352, 357) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(357, 352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(352, 363) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(363, 352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(353, 354) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(354, 353) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(354, 355) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(355, 354) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(355, 404) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(404, 355) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(356, 357) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(357, 356) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(356, 359) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(359, 356) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(357, 358) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(358, 357) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(358, 367) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(367, 358) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(358, 641) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(641, 358) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(359, 594) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(594, 359) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(360, 361) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(361, 360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(360, 365) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(365, 360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(360, 371) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(371, 360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(361, 362) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(362, 361) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(362, 363) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(363, 362) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(363, 412) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(412, 363) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(364, 365) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(365, 364) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(364, 367) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(367, 364) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(365, 366) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(366, 365) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(366, 375) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(375, 366) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(366, 649) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(649, 366) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(367, 602) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(602, 367) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(368, 369) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(369, 368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(368, 373) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(373, 368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(368, 379) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(379, 368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(369, 370) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(370, 369) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(370, 371) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(371, 370) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(371, 420) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(420, 371) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(372, 373) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(373, 372) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(372, 375) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(375, 372) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(373, 374) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(374, 373) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(374, 383) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(383, 374) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(374, 657) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(657, 374) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(375, 610) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(610, 375) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(376, 377) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(377, 376) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(376, 381) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(381, 376) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(377, 378) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(378, 377) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(378, 379) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(379, 378) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(379, 428) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(428, 379) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(380, 381) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(381, 380) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(380, 383) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(383, 380) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(381, 382) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(382, 381) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(382, 665) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(665, 382) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(383, 618) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(618, 383) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(384, 385) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(385, 384) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(384, 389) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(389, 384) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(384, 395) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(395, 384) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(385, 386) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(386, 385) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(386, 387) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(387, 386) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(387, 424) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(424, 387) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(387, 436) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(436, 387) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(388, 389) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(389, 388) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(388, 391) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(391, 388) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(389, 390) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(390, 389) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(390, 399) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(399, 390) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(390, 673) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(673, 390) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(391, 430) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(430, 391) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(391, 626) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(626, 391) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(392, 393) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(393, 392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(392, 397) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(397, 392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(392, 403) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(403, 392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(393, 394) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(394, 393) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(394, 395) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(395, 394) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(395, 444) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(444, 395) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(396, 397) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(397, 396) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(396, 399) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(399, 396) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(397, 398) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(398, 397) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(398, 407) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(407, 398) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(398, 681) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(681, 398) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(399, 634) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(634, 399) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(400, 401) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(401, 400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(400, 405) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(405, 400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(400, 411) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(411, 400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(401, 402) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(402, 401) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(402, 403) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(403, 402) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(403, 452) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(452, 403) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(404, 405) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(405, 404) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(404, 407) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(407, 404) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(405, 406) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(406, 405) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(406, 415) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(415, 406) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(406, 689) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(689, 406) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(407, 642) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(642, 407) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(408, 409) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(409, 408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(408, 413) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(413, 408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(408, 419) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(419, 408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(409, 410) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(410, 409) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(410, 411) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(411, 410) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(411, 460) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(460, 411) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(412, 413) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(413, 412) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(412, 415) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(415, 412) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(413, 414) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(414, 413) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(414, 423) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(423, 414) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(414, 697) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(697, 414) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(415, 650) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(650, 415) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(416, 417) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(417, 416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(416, 421) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(421, 416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(416, 427) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(427, 416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(417, 418) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(418, 417) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(418, 419) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(419, 418) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(419, 468) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(468, 419) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(420, 421) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(421, 420) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(420, 423) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(423, 420) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(421, 422) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(422, 421) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(422, 431) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(431, 422) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(422, 705) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(705, 422) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(423, 658) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(658, 423) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(424, 425) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(425, 424) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(424, 429) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(429, 424) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(425, 426) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(426, 425) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(426, 427) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(427, 426) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(427, 476) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(476, 427) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(428, 429) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(429, 428) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(428, 431) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(431, 428) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(429, 430) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(430, 429) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(430, 713) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(713, 430) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(431, 666) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(666, 431) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(432, 433) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(433, 432) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(432, 437) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(437, 432) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(432, 443) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(443, 432) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(433, 434) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(434, 433) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(434, 435) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(435, 434) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(435, 472) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(472, 435) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(435, 484) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(484, 435) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(436, 437) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(437, 436) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(436, 439) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(439, 436) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(437, 438) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(438, 437) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(438, 447) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(447, 438) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(438, 721) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(721, 438) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(439, 478) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(478, 439) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(439, 674) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(674, 439) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(440, 441) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(441, 440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(440, 445) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(445, 440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(440, 451) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(451, 440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(441, 442) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(442, 441) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(442, 443) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(443, 442) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(443, 492) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(492, 443) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(444, 445) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(445, 444) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(444, 447) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(447, 444) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(445, 446) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(446, 445) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(446, 455) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(455, 446) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(446, 729) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(729, 446) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(447, 682) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(682, 447) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(448, 449) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(449, 448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(448, 453) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(453, 448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(448, 459) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(459, 448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(449, 450) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(450, 449) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(450, 451) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(451, 450) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(451, 500) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(500, 451) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(452, 453) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(453, 452) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(452, 455) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(455, 452) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(453, 454) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(454, 453) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(454, 463) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(463, 454) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(454, 737) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(737, 454) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(455, 690) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(690, 455) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(456, 457) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(457, 456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(456, 461) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(461, 456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(456, 467) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(467, 456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(457, 458) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(458, 457) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(458, 459) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(459, 458) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(459, 508) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(508, 459) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(460, 461) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(461, 460) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(460, 463) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(463, 460) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(461, 462) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(462, 461) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(462, 471) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(471, 462) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(462, 745) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(745, 462) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(463, 698) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(698, 463) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(464, 465) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(465, 464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(464, 469) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(469, 464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(464, 475) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(475, 464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(465, 466) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(466, 465) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(466, 467) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(467, 466) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(467, 516) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(516, 467) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(468, 469) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(469, 468) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(468, 471) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(471, 468) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(469, 470) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(470, 469) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(470, 479) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(479, 470) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(470, 753) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(753, 470) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(471, 706) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(706, 471) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(472, 473) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(473, 472) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(472, 477) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(477, 472) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(473, 474) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(474, 473) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(474, 475) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(475, 474) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(475, 524) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(524, 475) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(476, 477) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(477, 476) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(476, 479) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(479, 476) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(477, 478) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(478, 477) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(478, 761) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(761, 478) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(479, 714) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(714, 479) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(480, 481) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(481, 480) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(480, 485) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(485, 480) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(480, 491) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(491, 480) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(481, 482) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(482, 481) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(482, 483) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(483, 482) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(483, 520) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(520, 483) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(483, 532) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(532, 483) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(484, 485) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(485, 484) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(484, 487) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(487, 484) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(485, 486) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(486, 485) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(486, 495) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(495, 486) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(486, 769) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(769, 486) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(487, 526) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(526, 487) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(487, 722) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(722, 487) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(488, 489) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(489, 488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(488, 493) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(493, 488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(488, 499) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(499, 488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(489, 490) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(490, 489) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(490, 491) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(491, 490) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(491, 540) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(540, 491) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(492, 493) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(493, 492) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(492, 495) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(495, 492) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(493, 494) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(494, 493) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(494, 503) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(503, 494) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(494, 777) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(777, 494) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(495, 730) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(730, 495) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(496, 497) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(497, 496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(496, 501) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(501, 496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(496, 507) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(507, 496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(497, 498) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(498, 497) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(498, 499) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(499, 498) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(499, 548) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(548, 499) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(500, 501) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(501, 500) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(500, 503) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(503, 500) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(501, 502) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(502, 501) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(502, 511) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(511, 502) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(502, 785) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(785, 502) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(503, 738) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(738, 503) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(504, 505) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(505, 504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(504, 509) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(509, 504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(504, 515) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(515, 504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(505, 506) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(506, 505) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(506, 507) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(507, 506) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(507, 556) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(556, 507) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(508, 509) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(509, 508) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(508, 511) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(511, 508) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(509, 510) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(510, 509) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(510, 519) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(519, 510) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(510, 793) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(793, 510) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(511, 746) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(746, 511) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(512, 513) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(513, 512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(512, 517) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(517, 512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(512, 523) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(523, 512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(513, 514) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(514, 513) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(514, 515) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(515, 514) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(515, 564) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(564, 515) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(516, 517) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(517, 516) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(516, 519) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(519, 516) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(517, 518) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(518, 517) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(518, 527) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(527, 518) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(518, 801) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(801, 518) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(519, 754) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(754, 519) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(520, 521) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(521, 520) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(520, 525) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(525, 520) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(521, 522) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(522, 521) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(522, 523) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(523, 522) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(523, 572) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(572, 523) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(524, 525) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(525, 524) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(524, 527) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(527, 524) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(525, 526) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(526, 525) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(526, 809) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(809, 526) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(527, 762) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(762, 527) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(528, 529) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(529, 528) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(528, 533) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(533, 528) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(528, 539) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(539, 528) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(529, 530) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(530, 529) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(530, 531) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(531, 530) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(531, 568) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(568, 531) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(532, 533) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(533, 532) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(532, 535) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(535, 532) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(533, 534) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(534, 533) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(534, 543) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(543, 534) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(534, 817) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(817, 534) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(535, 574) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(574, 535) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(535, 770) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(770, 535) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(536, 537) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(537, 536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(536, 541) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(541, 536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(536, 547) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(547, 536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(537, 538) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(538, 537) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(538, 539) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(539, 538) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(540, 541) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(541, 540) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(540, 543) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(543, 540) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(541, 542) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(542, 541) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(542, 551) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(551, 542) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(542, 825) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(825, 542) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(543, 778) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(778, 543) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(544, 545) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(545, 544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(544, 549) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(549, 544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(544, 555) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(555, 544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(545, 546) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(546, 545) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(546, 547) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(547, 546) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(548, 549) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(549, 548) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(548, 551) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(551, 548) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(549, 550) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(550, 549) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(550, 559) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(559, 550) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(550, 833) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(833, 550) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(551, 786) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(786, 551) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(552, 553) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(553, 552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(552, 557) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(557, 552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(552, 563) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(563, 552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(553, 554) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(554, 553) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(554, 555) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(555, 554) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(556, 557) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(557, 556) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(556, 559) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(559, 556) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(557, 558) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(558, 557) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(558, 567) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(567, 558) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(558, 841) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(841, 558) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(559, 794) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(794, 559) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(560, 561) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(561, 560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(560, 565) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(565, 560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(560, 571) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(571, 560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(561, 562) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(562, 561) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(562, 563) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(563, 562) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(564, 565) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(565, 564) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(564, 567) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(567, 564) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(565, 566) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(566, 565) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(566, 575) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(575, 566) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(566, 849) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(849, 566) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(567, 802) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(802, 567) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(568, 569) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(569, 568) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(568, 573) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(573, 568) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(569, 570) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(570, 569) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(570, 571) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(571, 570) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(572, 573) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(573, 572) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(572, 575) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(575, 572) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(573, 574) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(574, 573) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(574, 857) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(857, 574) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(575, 810) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(810, 575) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(576, 577) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(577, 576) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(576, 581) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(581, 576) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(576, 587) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(587, 576) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(577, 578) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(578, 577) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(578, 579) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(579, 578) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(579, 616) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(616, 579) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(579, 628) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(628, 579) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(580, 581) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(581, 580) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(580, 583) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(583, 580) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(580, 819) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(819, 580) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(581, 582) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(582, 581) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(582, 591) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(591, 582) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(582, 865) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(865, 582) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(583, 622) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(622, 583) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(583, 1106) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1106, 583) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(584, 585) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(585, 584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(584, 589) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(589, 584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(584, 595) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(595, 584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(585, 586) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(586, 585) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(586, 587) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(587, 586) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(587, 636) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(636, 587) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(588, 589) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(589, 588) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(588, 591) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(591, 588) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(588, 827) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(827, 588) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(589, 590) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(590, 589) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(590, 599) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(599, 590) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(590, 873) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(873, 590) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(591, 1114) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1114, 591) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(592, 593) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(593, 592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(592, 597) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(597, 592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(592, 603) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(603, 592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(593, 594) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(594, 593) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(594, 595) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(595, 594) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(595, 644) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(644, 595) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(596, 597) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(597, 596) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(596, 599) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(599, 596) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(596, 835) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(835, 596) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(597, 598) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(598, 597) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(598, 607) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(607, 598) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(598, 881) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(881, 598) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(599, 1122) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1122, 599) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(600, 601) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(601, 600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(600, 605) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(605, 600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(600, 611) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(611, 600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(601, 602) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(602, 601) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(602, 603) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(603, 602) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(603, 652) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(652, 603) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(604, 605) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(605, 604) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(604, 607) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(607, 604) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(604, 843) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(843, 604) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(605, 606) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(606, 605) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(606, 615) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(615, 606) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(606, 889) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(889, 606) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(607, 1130) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1130, 607) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(608, 609) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(609, 608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(608, 613) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(613, 608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(608, 619) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(619, 608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(609, 610) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(610, 609) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(610, 611) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(611, 610) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(611, 660) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(660, 611) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(612, 613) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(613, 612) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(612, 615) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(615, 612) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(612, 851) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(851, 612) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(613, 614) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(614, 613) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(614, 623) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(623, 614) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(614, 897) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(897, 614) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(615, 1138) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1138, 615) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(616, 617) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(617, 616) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(616, 621) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(621, 616) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(617, 618) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(618, 617) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(618, 619) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(619, 618) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(619, 668) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(668, 619) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(620, 621) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(621, 620) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(620, 623) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(623, 620) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(620, 859) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(859, 620) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(621, 622) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(622, 621) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(622, 905) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(905, 622) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(623, 1146) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1146, 623) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(624, 625) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(625, 624) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(624, 629) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(629, 624) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(624, 635) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(635, 624) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(625, 626) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(626, 625) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(626, 627) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(627, 626) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(627, 664) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(664, 627) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(627, 676) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(676, 627) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(628, 629) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(629, 628) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(628, 631) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(631, 628) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(629, 630) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(630, 629) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(630, 639) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(639, 630) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(630, 913) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(913, 630) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(631, 670) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(670, 631) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(631, 866) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(866, 631) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(632, 633) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(633, 632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(632, 637) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(637, 632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(632, 643) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(643, 632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(633, 634) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(634, 633) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(634, 635) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(635, 634) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(635, 684) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(684, 635) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(636, 637) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(637, 636) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(636, 639) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(639, 636) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(637, 638) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(638, 637) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(638, 647) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(647, 638) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(638, 921) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(921, 638) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(639, 874) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(874, 639) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(640, 641) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(641, 640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(640, 645) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(645, 640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(640, 651) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(651, 640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(641, 642) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(642, 641) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(642, 643) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(643, 642) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(643, 692) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(692, 643) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(644, 645) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(645, 644) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(644, 647) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(647, 644) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(645, 646) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(646, 645) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(646, 655) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(655, 646) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(646, 929) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(929, 646) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(647, 882) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(882, 647) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(648, 649) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(649, 648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(648, 653) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(653, 648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(648, 659) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(659, 648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(649, 650) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(650, 649) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(650, 651) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(651, 650) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(651, 700) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(700, 651) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(652, 653) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(653, 652) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(652, 655) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(655, 652) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(653, 654) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(654, 653) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(654, 663) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(663, 654) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(654, 937) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(937, 654) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(655, 890) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(890, 655) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(656, 657) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(657, 656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(656, 661) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(661, 656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(656, 667) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(667, 656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(657, 658) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(658, 657) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(658, 659) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(659, 658) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(659, 708) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(708, 659) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(660, 661) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(661, 660) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(660, 663) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(663, 660) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(661, 662) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(662, 661) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(662, 671) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(671, 662) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(662, 945) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(945, 662) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(663, 898) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(898, 663) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(664, 665) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(665, 664) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(664, 669) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(669, 664) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(665, 666) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(666, 665) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(666, 667) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(667, 666) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(667, 716) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(716, 667) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(668, 669) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(669, 668) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(668, 671) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(671, 668) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(669, 670) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(670, 669) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(670, 953) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(953, 670) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(671, 906) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(906, 671) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(672, 673) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(673, 672) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(672, 677) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(677, 672) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(672, 683) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(683, 672) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(673, 674) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(674, 673) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(674, 675) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(675, 674) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(675, 712) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(712, 675) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(675, 724) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(724, 675) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(676, 677) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(677, 676) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(676, 679) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(679, 676) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(677, 678) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(678, 677) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(678, 687) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(687, 678) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(678, 961) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(961, 678) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(679, 718) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(718, 679) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(679, 914) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(914, 679) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(680, 681) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(681, 680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(680, 685) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(685, 680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(680, 691) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(691, 680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(681, 682) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(682, 681) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(682, 683) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(683, 682) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(683, 732) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(732, 683) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(684, 685) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(685, 684) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(684, 687) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(687, 684) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(685, 686) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(686, 685) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(686, 695) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(695, 686) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(686, 969) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(969, 686) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(687, 922) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(922, 687) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(688, 689) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(689, 688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(688, 693) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(693, 688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(688, 699) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(699, 688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(689, 690) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(690, 689) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(690, 691) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(691, 690) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(691, 740) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(740, 691) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(692, 693) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(693, 692) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(692, 695) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(695, 692) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(693, 694) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(694, 693) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(694, 703) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(703, 694) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(694, 977) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(977, 694) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(695, 930) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(930, 695) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(696, 697) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(697, 696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(696, 701) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(701, 696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(696, 707) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(707, 696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(697, 698) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(698, 697) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(698, 699) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(699, 698) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(699, 748) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(748, 699) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(700, 701) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(701, 700) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(700, 703) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(703, 700) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(701, 702) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(702, 701) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(702, 711) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(711, 702) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(702, 985) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(985, 702) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(703, 938) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(938, 703) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(704, 705) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(705, 704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(704, 709) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(709, 704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(704, 715) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(715, 704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(705, 706) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(706, 705) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(706, 707) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(707, 706) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(707, 756) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(756, 707) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(708, 709) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(709, 708) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(708, 711) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(711, 708) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(709, 710) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(710, 709) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(710, 719) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(719, 710) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(710, 993) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(993, 710) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(711, 946) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(946, 711) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(712, 713) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(713, 712) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(712, 717) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(717, 712) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(713, 714) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(714, 713) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(714, 715) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(715, 714) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(715, 764) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(764, 715) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(716, 717) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(717, 716) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(716, 719) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(719, 716) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(717, 718) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(718, 717) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(718, 1001) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1001, 718) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(719, 954) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(954, 719) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(720, 721) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(721, 720) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(720, 725) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(725, 720) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(720, 731) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(731, 720) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(721, 722) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(722, 721) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(722, 723) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(723, 722) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(723, 760) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(760, 723) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(723, 772) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(772, 723) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(724, 725) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(725, 724) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(724, 727) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(727, 724) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(725, 726) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(726, 725) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(726, 735) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(735, 726) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(726, 1009) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1009, 726) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(727, 766) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(766, 727) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(727, 962) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(962, 727) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(728, 729) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(729, 728) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(728, 733) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(733, 728) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(728, 739) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(739, 728) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(729, 730) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(730, 729) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(730, 731) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(731, 730) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(731, 780) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(780, 731) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(732, 733) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(733, 732) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(732, 735) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(735, 732) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(733, 734) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(734, 733) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(734, 743) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(743, 734) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(734, 1017) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1017, 734) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(735, 970) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(970, 735) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(736, 737) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(737, 736) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(736, 741) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(741, 736) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(736, 747) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(747, 736) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(737, 738) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(738, 737) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(738, 739) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(739, 738) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(739, 788) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(788, 739) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(740, 741) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(741, 740) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(740, 743) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(743, 740) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(741, 742) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(742, 741) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(742, 751) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(751, 742) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(742, 1025) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1025, 742) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(743, 978) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(978, 743) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(744, 745) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(745, 744) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(744, 749) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(749, 744) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(744, 755) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(755, 744) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(745, 746) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(746, 745) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(746, 747) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(747, 746) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(747, 796) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(796, 747) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(748, 749) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(749, 748) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(748, 751) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(751, 748) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(749, 750) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(750, 749) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(750, 759) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(759, 750) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(750, 1033) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1033, 750) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(751, 986) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(986, 751) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(752, 753) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(753, 752) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(752, 757) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(757, 752) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(752, 763) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(763, 752) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(753, 754) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(754, 753) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(754, 755) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(755, 754) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(755, 804) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(804, 755) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(756, 757) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(757, 756) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(756, 759) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(759, 756) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(757, 758) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(758, 757) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(758, 767) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(767, 758) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(758, 1041) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1041, 758) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(759, 994) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(994, 759) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(760, 761) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(761, 760) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(760, 765) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(765, 760) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(761, 762) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(762, 761) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(762, 763) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(763, 762) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(763, 812) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(812, 763) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(764, 765) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(765, 764) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(764, 767) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(767, 764) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(765, 766) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(766, 765) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(766, 1049) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1049, 766) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(767, 1002) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1002, 767) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(768, 769) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(769, 768) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(768, 773) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(773, 768) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(768, 779) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(779, 768) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(769, 770) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(770, 769) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(770, 771) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(771, 770) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(771, 808) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(808, 771) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(771, 820) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(820, 771) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(772, 773) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(773, 772) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(772, 775) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(775, 772) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(773, 774) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(774, 773) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(774, 783) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(783, 774) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(774, 1057) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1057, 774) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(775, 814) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(814, 775) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(775, 1010) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1010, 775) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(776, 777) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(777, 776) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(776, 781) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(781, 776) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(776, 787) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(787, 776) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(777, 778) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(778, 777) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(778, 779) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(779, 778) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(779, 828) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(828, 779) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(780, 781) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(781, 780) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(780, 783) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(783, 780) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(781, 782) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(782, 781) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(782, 791) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(791, 782) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(782, 1065) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1065, 782) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(783, 1018) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1018, 783) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(784, 785) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(785, 784) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(784, 789) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(789, 784) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(784, 795) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(795, 784) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(785, 786) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(786, 785) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(786, 787) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(787, 786) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(787, 836) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(836, 787) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(788, 789) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(789, 788) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(788, 791) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(791, 788) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(789, 790) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(790, 789) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(790, 799) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(799, 790) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(790, 1073) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1073, 790) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(791, 1026) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1026, 791) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(792, 793) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(793, 792) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(792, 797) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(797, 792) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(792, 803) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(803, 792) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(793, 794) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(794, 793) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(794, 795) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(795, 794) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(795, 844) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(844, 795) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(796, 797) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(797, 796) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(796, 799) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(799, 796) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(797, 798) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(798, 797) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(798, 807) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(807, 798) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(798, 1081) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1081, 798) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(799, 1034) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1034, 799) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(800, 801) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(801, 800) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(800, 805) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(805, 800) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(800, 811) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(811, 800) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(801, 802) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(802, 801) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(802, 803) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(803, 802) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(803, 852) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(852, 803) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(804, 805) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(805, 804) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(804, 807) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(807, 804) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(805, 806) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(806, 805) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(806, 815) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(815, 806) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(806, 1089) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1089, 806) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(807, 1042) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1042, 807) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(808, 809) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(809, 808) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(808, 813) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(813, 808) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(809, 810) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(810, 809) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(810, 811) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(811, 810) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(811, 860) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(860, 811) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(812, 813) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(813, 812) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(812, 815) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(815, 812) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(813, 814) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(814, 813) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(814, 1097) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1097, 814) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(815, 1050) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1050, 815) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(816, 817) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(817, 816) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(816, 821) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(821, 816) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(816, 827) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(827, 816) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(817, 818) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(818, 817) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(818, 819) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(819, 818) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(819, 856) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(856, 819) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(820, 821) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(821, 820) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(820, 823) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(823, 820) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(821, 822) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(822, 821) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(822, 831) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(831, 822) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(822, 1105) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1105, 822) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(823, 862) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(862, 823) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(823, 1058) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1058, 823) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(824, 825) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(825, 824) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(824, 829) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(829, 824) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(824, 835) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(835, 824) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(825, 826) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(826, 825) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(826, 827) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(827, 826) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(828, 829) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(829, 828) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(828, 831) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(831, 828) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(829, 830) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(830, 829) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(830, 839) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(839, 830) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(830, 1113) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1113, 830) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(831, 1066) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1066, 831) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(832, 833) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(833, 832) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(832, 837) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(837, 832) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(832, 843) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(843, 832) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(833, 834) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(834, 833) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(834, 835) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(835, 834) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(836, 837) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(837, 836) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(836, 839) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(839, 836) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(837, 838) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(838, 837) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(838, 847) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(847, 838) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(838, 1121) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1121, 838) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(839, 1074) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1074, 839) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(840, 841) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(841, 840) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(840, 845) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(845, 840) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(840, 851) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(851, 840) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(841, 842) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(842, 841) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(842, 843) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(843, 842) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(844, 845) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(845, 844) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(844, 847) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(847, 844) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(845, 846) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(846, 845) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(846, 855) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(855, 846) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(846, 1129) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1129, 846) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(847, 1082) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1082, 847) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(848, 849) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(849, 848) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(848, 853) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(853, 848) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(848, 859) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(859, 848) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(849, 850) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(850, 849) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(850, 851) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(851, 850) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(852, 853) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(853, 852) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(852, 855) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(855, 852) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(853, 854) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(854, 853) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(854, 863) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(863, 854) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(854, 1137) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1137, 854) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(855, 1090) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1090, 855) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(856, 857) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(857, 856) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(856, 861) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(861, 856) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(857, 858) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(858, 857) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(858, 859) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(859, 858) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(860, 861) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(861, 860) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(860, 863) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(863, 860) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(861, 862) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(862, 861) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(862, 1145) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1145, 862) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(863, 1098) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1098, 863) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(864, 865) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(865, 864) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(864, 869) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(869, 864) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(864, 875) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(875, 864) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(865, 866) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(866, 865) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(866, 867) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(867, 866) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(867, 904) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(904, 867) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(867, 916) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(916, 867) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(868, 869) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(869, 868) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(868, 871) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(871, 868) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(868, 1107) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1107, 868) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(869, 870) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(870, 869) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(870, 879) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(879, 870) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(870, 1153) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1153, 870) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(871, 910) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(910, 871) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(871, 1394) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1394, 871) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(872, 873) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(873, 872) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(872, 877) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(877, 872) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(872, 883) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(883, 872) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(873, 874) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(874, 873) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(874, 875) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(875, 874) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(875, 924) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(924, 875) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(876, 877) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(877, 876) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(876, 879) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(879, 876) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(876, 1115) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1115, 876) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(877, 878) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(878, 877) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(878, 887) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(887, 878) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(878, 1161) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1161, 878) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(879, 1402) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1402, 879) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(880, 881) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(881, 880) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(880, 885) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(885, 880) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(880, 891) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(891, 880) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(881, 882) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(882, 881) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(882, 883) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(883, 882) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(883, 932) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(932, 883) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(884, 885) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(885, 884) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(884, 887) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(887, 884) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(884, 1123) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1123, 884) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(885, 886) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(886, 885) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(886, 895) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(895, 886) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(886, 1169) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1169, 886) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(887, 1410) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1410, 887) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(888, 889) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(889, 888) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(888, 893) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(893, 888) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(888, 899) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(899, 888) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(889, 890) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(890, 889) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(890, 891) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(891, 890) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(891, 940) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(940, 891) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(892, 893) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(893, 892) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(892, 895) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(895, 892) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(892, 1131) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1131, 892) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(893, 894) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(894, 893) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(894, 903) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(903, 894) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(894, 1177) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1177, 894) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(895, 1418) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1418, 895) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(896, 897) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(897, 896) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(896, 901) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(901, 896) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(896, 907) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(907, 896) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(897, 898) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(898, 897) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(898, 899) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(899, 898) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(899, 948) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(948, 899) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(900, 901) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(901, 900) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(900, 903) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(903, 900) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(900, 1139) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1139, 900) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(901, 902) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(902, 901) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(902, 911) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(911, 902) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(902, 1185) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1185, 902) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(903, 1426) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1426, 903) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(904, 905) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(905, 904) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(904, 909) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(909, 904) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(905, 906) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(906, 905) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(906, 907) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(907, 906) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(907, 956) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(956, 907) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(908, 909) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(909, 908) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(908, 911) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(911, 908) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(908, 1147) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1147, 908) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(909, 910) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(910, 909) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(910, 1193) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1193, 910) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(911, 1434) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1434, 911) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(912, 913) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(913, 912) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(912, 917) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(917, 912) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(912, 923) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(923, 912) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(913, 914) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(914, 913) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(914, 915) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(915, 914) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(915, 952) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(952, 915) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(915, 964) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(964, 915) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(916, 917) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(917, 916) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(916, 919) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(919, 916) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(917, 918) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(918, 917) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(918, 927) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(927, 918) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(918, 1201) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1201, 918) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(919, 958) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(958, 919) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(919, 1154) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1154, 919) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(920, 921) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(921, 920) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(920, 925) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(925, 920) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(920, 931) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(931, 920) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(921, 922) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(922, 921) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(922, 923) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(923, 922) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(923, 972) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(972, 923) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(924, 925) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(925, 924) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(924, 927) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(927, 924) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(925, 926) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(926, 925) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(926, 935) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(935, 926) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(926, 1209) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1209, 926) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(927, 1162) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1162, 927) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(928, 929) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(929, 928) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(928, 933) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(933, 928) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(928, 939) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(939, 928) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(929, 930) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(930, 929) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(930, 931) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(931, 930) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(931, 980) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(980, 931) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(932, 933) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(933, 932) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(932, 935) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(935, 932) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(933, 934) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(934, 933) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(934, 943) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(943, 934) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(934, 1217) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1217, 934) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(935, 1170) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1170, 935) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(936, 937) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(937, 936) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(936, 941) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(941, 936) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(936, 947) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(947, 936) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(937, 938) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(938, 937) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(938, 939) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(939, 938) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(939, 988) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(988, 939) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(940, 941) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(941, 940) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(940, 943) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(943, 940) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(941, 942) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(942, 941) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(942, 951) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(951, 942) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(942, 1225) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1225, 942) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(943, 1178) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1178, 943) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(944, 945) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(945, 944) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(944, 949) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(949, 944) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(944, 955) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(955, 944) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(945, 946) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(946, 945) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(946, 947) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(947, 946) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(947, 996) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(996, 947) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(948, 949) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(949, 948) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(948, 951) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(951, 948) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(949, 950) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(950, 949) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(950, 959) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(959, 950) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(950, 1233) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1233, 950) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(951, 1186) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1186, 951) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(952, 953) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(953, 952) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(952, 957) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(957, 952) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(953, 954) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(954, 953) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(954, 955) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(955, 954) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(955, 1004) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1004, 955) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(956, 957) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(957, 956) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(956, 959) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(959, 956) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(957, 958) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(958, 957) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(958, 1241) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1241, 958) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(959, 1194) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1194, 959) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(960, 961) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(961, 960) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(960, 965) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(965, 960) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(960, 971) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(971, 960) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(961, 962) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(962, 961) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(962, 963) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(963, 962) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(963, 1000) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1000, 963) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(963, 1012) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1012, 963) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(964, 965) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(965, 964) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(964, 967) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(967, 964) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(965, 966) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(966, 965) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(966, 975) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(975, 966) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(966, 1249) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1249, 966) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(967, 1006) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1006, 967) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(967, 1202) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1202, 967) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(968, 969) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(969, 968) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(968, 973) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(973, 968) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(968, 979) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(979, 968) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(969, 970) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(970, 969) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(970, 971) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(971, 970) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(971, 1020) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1020, 971) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(972, 973) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(973, 972) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(972, 975) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(975, 972) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(973, 974) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(974, 973) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(974, 983) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(983, 974) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(974, 1257) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1257, 974) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(975, 1210) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1210, 975) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(976, 977) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(977, 976) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(976, 981) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(981, 976) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(976, 987) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(987, 976) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(977, 978) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(978, 977) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(978, 979) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(979, 978) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(979, 1028) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1028, 979) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(980, 981) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(981, 980) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(980, 983) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(983, 980) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(981, 982) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(982, 981) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(982, 991) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(991, 982) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(982, 1265) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1265, 982) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(983, 1218) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1218, 983) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(984, 985) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(985, 984) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(984, 989) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(989, 984) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(984, 995) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(995, 984) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(985, 986) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(986, 985) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(986, 987) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(987, 986) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(987, 1036) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1036, 987) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(988, 989) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(989, 988) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(988, 991) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(991, 988) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(989, 990) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(990, 989) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(990, 999) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(999, 990) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(990, 1273) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1273, 990) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(991, 1226) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1226, 991) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(992, 993) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(993, 992) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(992, 997) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(997, 992) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(992, 1003) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1003, 992) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(993, 994) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(994, 993) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(994, 995) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(995, 994) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(995, 1044) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1044, 995) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(996, 997) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(997, 996) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(996, 999) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(999, 996) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(997, 998) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(998, 997) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(998, 1007) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1007, 998) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(998, 1281) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1281, 998) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(999, 1234) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1234, 999) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1000, 1001) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1001, 1000) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1000, 1005) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1005, 1000) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1001, 1002) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1002, 1001) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1002, 1003) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1003, 1002) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1003, 1052) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1052, 1003) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1004, 1005) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1005, 1004) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1004, 1007) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1007, 1004) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1005, 1006) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1006, 1005) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1006, 1289) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1289, 1006) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1007, 1242) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1242, 1007) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1008, 1009) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1009, 1008) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1008, 1013) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1013, 1008) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1008, 1019) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1019, 1008) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1009, 1010) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1010, 1009) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1010, 1011) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1011, 1010) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1011, 1048) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1048, 1011) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1011, 1060) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1060, 1011) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1012, 1013) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1013, 1012) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1012, 1015) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1015, 1012) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1013, 1014) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1014, 1013) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1014, 1023) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1023, 1014) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1014, 1297) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1297, 1014) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1015, 1054) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1054, 1015) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1015, 1250) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1250, 1015) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1016, 1017) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1017, 1016) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1016, 1021) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1021, 1016) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1016, 1027) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1027, 1016) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1017, 1018) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1018, 1017) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1018, 1019) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1019, 1018) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1019, 1068) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1068, 1019) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1020, 1021) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1021, 1020) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1020, 1023) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1023, 1020) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1021, 1022) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1022, 1021) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1022, 1031) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1031, 1022) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1022, 1305) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1305, 1022) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1023, 1258) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1258, 1023) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1024, 1025) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1025, 1024) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1024, 1029) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1029, 1024) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1024, 1035) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1035, 1024) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1025, 1026) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1026, 1025) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1026, 1027) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1027, 1026) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1027, 1076) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1076, 1027) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1028, 1029) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1029, 1028) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1028, 1031) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1031, 1028) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1029, 1030) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1030, 1029) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1030, 1039) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1039, 1030) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1030, 1313) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1313, 1030) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1031, 1266) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1266, 1031) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1032, 1033) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1033, 1032) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1032, 1037) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1037, 1032) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1032, 1043) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1043, 1032) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1033, 1034) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1034, 1033) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1034, 1035) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1035, 1034) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1035, 1084) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1084, 1035) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1036, 1037) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1037, 1036) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1036, 1039) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1039, 1036) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1037, 1038) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1038, 1037) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1038, 1047) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1047, 1038) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1038, 1321) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1321, 1038) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1039, 1274) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1274, 1039) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1040, 1041) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1041, 1040) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1040, 1045) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1045, 1040) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1040, 1051) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1051, 1040) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1041, 1042) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1042, 1041) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1042, 1043) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1043, 1042) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1043, 1092) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1092, 1043) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1044, 1045) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1045, 1044) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1044, 1047) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1047, 1044) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1045, 1046) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1046, 1045) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1046, 1055) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1055, 1046) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1046, 1329) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1329, 1046) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1047, 1282) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1282, 1047) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1048, 1049) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1049, 1048) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1048, 1053) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1053, 1048) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1049, 1050) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1050, 1049) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1050, 1051) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1051, 1050) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1051, 1100) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1100, 1051) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1052, 1053) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1053, 1052) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1052, 1055) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1055, 1052) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1053, 1054) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1054, 1053) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1054, 1337) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1337, 1054) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1055, 1290) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1290, 1055) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1056, 1057) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1057, 1056) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1056, 1061) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1061, 1056) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1056, 1067) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1067, 1056) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1057, 1058) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1058, 1057) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1058, 1059) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1059, 1058) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1059, 1096) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1096, 1059) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1059, 1108) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1108, 1059) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1060, 1061) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1061, 1060) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1060, 1063) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1063, 1060) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1061, 1062) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1062, 1061) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1062, 1071) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1071, 1062) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1062, 1345) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1345, 1062) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1063, 1102) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1102, 1063) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1063, 1298) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1298, 1063) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1064, 1065) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1065, 1064) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1064, 1069) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1069, 1064) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1064, 1075) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1075, 1064) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1065, 1066) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1066, 1065) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1066, 1067) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1067, 1066) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1067, 1116) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1116, 1067) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1068, 1069) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1069, 1068) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1068, 1071) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1071, 1068) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1069, 1070) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1070, 1069) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1070, 1079) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1079, 1070) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1070, 1353) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1353, 1070) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1071, 1306) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1306, 1071) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1072, 1073) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1073, 1072) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1072, 1077) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1077, 1072) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1072, 1083) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1083, 1072) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1073, 1074) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1074, 1073) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1074, 1075) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1075, 1074) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1075, 1124) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1124, 1075) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1076, 1077) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1077, 1076) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1076, 1079) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1079, 1076) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1077, 1078) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1078, 1077) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1078, 1087) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1087, 1078) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1078, 1361) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1361, 1078) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1079, 1314) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1314, 1079) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1080, 1081) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1081, 1080) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1080, 1085) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1085, 1080) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1080, 1091) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1091, 1080) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1081, 1082) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1082, 1081) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1082, 1083) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1083, 1082) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1083, 1132) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1132, 1083) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1084, 1085) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1085, 1084) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1084, 1087) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1087, 1084) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1085, 1086) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1086, 1085) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1086, 1095) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1095, 1086) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1086, 1369) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1369, 1086) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1087, 1322) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1322, 1087) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1088, 1089) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1089, 1088) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1088, 1093) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1093, 1088) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1088, 1099) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1099, 1088) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1089, 1090) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1090, 1089) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1090, 1091) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1091, 1090) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1091, 1140) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1140, 1091) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1092, 1093) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1093, 1092) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1092, 1095) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1095, 1092) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1093, 1094) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1094, 1093) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1094, 1103) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1103, 1094) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1094, 1377) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1377, 1094) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1095, 1330) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1330, 1095) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1096, 1097) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1097, 1096) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1096, 1101) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1101, 1096) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1097, 1098) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1098, 1097) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1098, 1099) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1099, 1098) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1099, 1148) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1148, 1099) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1100, 1101) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1101, 1100) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1100, 1103) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1103, 1100) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1101, 1102) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1102, 1101) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1102, 1385) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1385, 1102) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1103, 1338) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1338, 1103) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1104, 1105) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1105, 1104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1104, 1109) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1109, 1104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1104, 1115) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1115, 1104) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1105, 1106) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1106, 1105) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1106, 1107) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1107, 1106) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1107, 1144) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1144, 1107) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1108, 1109) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1109, 1108) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1108, 1111) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1111, 1108) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1109, 1110) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1110, 1109) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1110, 1119) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1119, 1110) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1110, 1393) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1393, 1110) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1111, 1150) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1150, 1111) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1111, 1346) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1346, 1111) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1112, 1113) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1113, 1112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1112, 1117) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1117, 1112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1112, 1123) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1123, 1112) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1113, 1114) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1114, 1113) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1114, 1115) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1115, 1114) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1116, 1117) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1117, 1116) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1116, 1119) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1119, 1116) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1117, 1118) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1118, 1117) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1118, 1127) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1127, 1118) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1118, 1401) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1401, 1118) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1119, 1354) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1354, 1119) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1120, 1121) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1121, 1120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1120, 1125) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1125, 1120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1120, 1131) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1131, 1120) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1121, 1122) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1122, 1121) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1122, 1123) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1123, 1122) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1124, 1125) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1125, 1124) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1124, 1127) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1127, 1124) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1125, 1126) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1126, 1125) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1126, 1135) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1135, 1126) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1126, 1409) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1409, 1126) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1127, 1362) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1362, 1127) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1128, 1129) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1129, 1128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1128, 1133) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1133, 1128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1128, 1139) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1139, 1128) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1129, 1130) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1130, 1129) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1130, 1131) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1131, 1130) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1132, 1133) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1133, 1132) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1132, 1135) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1135, 1132) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1133, 1134) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1134, 1133) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1134, 1143) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1143, 1134) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1134, 1417) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1417, 1134) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1135, 1370) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1370, 1135) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1136, 1137) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1137, 1136) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1136, 1141) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1141, 1136) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1136, 1147) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1147, 1136) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1137, 1138) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1138, 1137) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1138, 1139) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1139, 1138) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1140, 1141) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1141, 1140) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1140, 1143) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1143, 1140) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1141, 1142) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1142, 1141) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1142, 1151) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1151, 1142) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1142, 1425) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1425, 1142) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1143, 1378) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1378, 1143) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1144, 1145) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1145, 1144) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1144, 1149) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1149, 1144) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1145, 1146) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1146, 1145) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1146, 1147) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1147, 1146) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1148, 1149) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1149, 1148) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1148, 1151) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1151, 1148) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1149, 1150) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1150, 1149) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1150, 1433) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1433, 1150) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1151, 1386) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1386, 1151) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1152, 1153) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1153, 1152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1152, 1157) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1157, 1152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1152, 1163) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1163, 1152) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1153, 1154) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1154, 1153) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1154, 1155) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1155, 1154) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1155, 1192) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1192, 1155) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1155, 1204) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1204, 1155) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1156, 1157) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1157, 1156) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1156, 1159) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1159, 1156) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1156, 1395) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1395, 1156) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1157, 1158) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1158, 1157) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1158, 1167) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1167, 1158) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1158, 1441) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1441, 1158) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1159, 1198) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1198, 1159) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1159, 1682) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1682, 1159) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1160, 1161) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1161, 1160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1160, 1165) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1165, 1160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1160, 1171) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1171, 1160) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1161, 1162) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1162, 1161) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1162, 1163) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1163, 1162) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1163, 1212) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1212, 1163) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1164, 1165) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1165, 1164) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1164, 1167) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1167, 1164) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1164, 1403) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1403, 1164) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1165, 1166) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1166, 1165) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1166, 1175) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1175, 1166) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1166, 1449) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1449, 1166) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1167, 1690) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1690, 1167) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1168, 1169) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1169, 1168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1168, 1173) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1173, 1168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1168, 1179) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1179, 1168) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1169, 1170) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1170, 1169) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1170, 1171) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1171, 1170) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1171, 1220) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1220, 1171) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1172, 1173) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1173, 1172) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1172, 1175) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1175, 1172) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1172, 1411) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1411, 1172) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1173, 1174) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1174, 1173) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1174, 1183) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1183, 1174) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1174, 1457) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1457, 1174) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1175, 1698) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1698, 1175) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1176, 1177) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1177, 1176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1176, 1181) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1181, 1176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1176, 1187) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1187, 1176) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1177, 1178) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1178, 1177) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1178, 1179) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1179, 1178) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1179, 1228) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1228, 1179) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1180, 1181) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1181, 1180) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1180, 1183) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1183, 1180) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1180, 1419) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1419, 1180) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1181, 1182) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1182, 1181) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1182, 1191) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1191, 1182) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1182, 1465) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1465, 1182) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1183, 1706) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1706, 1183) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1184, 1185) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1185, 1184) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1184, 1189) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1189, 1184) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1184, 1195) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1195, 1184) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1185, 1186) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1186, 1185) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1186, 1187) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1187, 1186) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1187, 1236) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1236, 1187) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1188, 1189) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1189, 1188) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1188, 1191) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1191, 1188) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1188, 1427) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1427, 1188) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1189, 1190) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1190, 1189) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1190, 1199) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1199, 1190) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1190, 1473) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1473, 1190) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1191, 1714) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1714, 1191) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1192, 1193) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1193, 1192) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1192, 1197) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1197, 1192) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1193, 1194) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1194, 1193) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1194, 1195) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1195, 1194) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1195, 1244) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1244, 1195) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1196, 1197) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1197, 1196) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1196, 1199) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1199, 1196) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1196, 1435) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1435, 1196) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1197, 1198) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1198, 1197) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1198, 1481) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1481, 1198) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1199, 1722) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1722, 1199) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1200, 1201) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1201, 1200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1200, 1205) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1205, 1200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1200, 1211) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1211, 1200) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1201, 1202) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1202, 1201) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1202, 1203) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1203, 1202) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1203, 1240) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1240, 1203) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1203, 1252) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1252, 1203) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1204, 1205) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1205, 1204) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1204, 1207) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1207, 1204) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1205, 1206) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1206, 1205) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1206, 1215) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1215, 1206) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1206, 1489) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1489, 1206) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1207, 1246) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1246, 1207) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1207, 1442) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1442, 1207) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1208, 1209) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1209, 1208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1208, 1213) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1213, 1208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1208, 1219) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1219, 1208) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1209, 1210) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1210, 1209) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1210, 1211) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1211, 1210) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1211, 1260) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1260, 1211) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1212, 1213) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1213, 1212) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1212, 1215) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1215, 1212) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1213, 1214) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1214, 1213) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1214, 1223) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1223, 1214) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1214, 1497) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1497, 1214) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1215, 1450) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1450, 1215) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1216, 1217) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1217, 1216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1216, 1221) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1221, 1216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1216, 1227) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1227, 1216) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1217, 1218) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1218, 1217) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1218, 1219) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1219, 1218) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1219, 1268) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1268, 1219) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1220, 1221) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1221, 1220) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1220, 1223) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1223, 1220) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1221, 1222) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1222, 1221) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1222, 1231) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1231, 1222) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1222, 1505) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1505, 1222) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1223, 1458) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1458, 1223) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1224, 1225) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1225, 1224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1224, 1229) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1229, 1224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1224, 1235) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1235, 1224) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1225, 1226) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1226, 1225) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1226, 1227) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1227, 1226) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1227, 1276) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1276, 1227) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1228, 1229) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1229, 1228) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1228, 1231) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1231, 1228) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1229, 1230) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1230, 1229) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1230, 1239) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1239, 1230) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1230, 1513) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1513, 1230) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1231, 1466) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1466, 1231) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1232, 1233) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1233, 1232) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1232, 1237) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1237, 1232) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1232, 1243) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1243, 1232) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1233, 1234) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1234, 1233) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1234, 1235) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1235, 1234) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1235, 1284) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1284, 1235) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1236, 1237) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1237, 1236) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1236, 1239) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1239, 1236) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1237, 1238) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1238, 1237) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1238, 1247) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1247, 1238) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1238, 1521) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1521, 1238) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1239, 1474) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1474, 1239) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1240, 1241) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1241, 1240) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1240, 1245) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1245, 1240) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1241, 1242) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1242, 1241) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1242, 1243) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1243, 1242) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1243, 1292) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1292, 1243) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1244, 1245) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1245, 1244) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1244, 1247) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1247, 1244) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1245, 1246) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1246, 1245) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1246, 1529) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1529, 1246) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1247, 1482) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1482, 1247) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1248, 1249) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1249, 1248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1248, 1253) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1253, 1248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1248, 1259) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1259, 1248) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1249, 1250) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1250, 1249) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1250, 1251) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1251, 1250) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1251, 1288) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1288, 1251) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1251, 1300) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1300, 1251) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1252, 1253) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1253, 1252) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1252, 1255) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1255, 1252) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1253, 1254) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1254, 1253) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1254, 1263) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1263, 1254) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1254, 1537) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1537, 1254) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1255, 1294) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1294, 1255) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1255, 1490) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1490, 1255) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1256, 1257) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1257, 1256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1256, 1261) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1261, 1256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1256, 1267) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1267, 1256) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1257, 1258) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1258, 1257) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1258, 1259) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1259, 1258) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1259, 1308) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1308, 1259) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1260, 1261) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1261, 1260) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1260, 1263) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1263, 1260) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1261, 1262) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1262, 1261) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1262, 1271) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1271, 1262) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1262, 1545) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1545, 1262) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1263, 1498) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1498, 1263) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1264, 1265) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1265, 1264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1264, 1269) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1269, 1264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1264, 1275) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1275, 1264) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1265, 1266) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1266, 1265) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1266, 1267) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1267, 1266) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1267, 1316) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1316, 1267) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1268, 1269) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1269, 1268) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1268, 1271) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1271, 1268) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1269, 1270) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1270, 1269) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1270, 1279) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1279, 1270) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1270, 1553) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1553, 1270) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1271, 1506) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1506, 1271) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1272, 1273) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1273, 1272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1272, 1277) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1277, 1272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1272, 1283) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1283, 1272) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1273, 1274) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1274, 1273) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1274, 1275) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1275, 1274) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1275, 1324) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1324, 1275) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1276, 1277) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1277, 1276) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1276, 1279) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1279, 1276) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1277, 1278) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1278, 1277) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1278, 1287) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1287, 1278) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1278, 1561) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1561, 1278) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1279, 1514) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1514, 1279) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1280, 1281) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1281, 1280) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1280, 1285) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1285, 1280) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1280, 1291) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1291, 1280) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1281, 1282) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1282, 1281) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1282, 1283) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1283, 1282) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1283, 1332) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1332, 1283) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1284, 1285) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1285, 1284) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1284, 1287) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1287, 1284) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1285, 1286) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1286, 1285) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1286, 1295) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1295, 1286) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1286, 1569) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1569, 1286) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1287, 1522) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1522, 1287) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1288, 1289) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1289, 1288) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1288, 1293) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1293, 1288) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1289, 1290) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1290, 1289) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1290, 1291) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1291, 1290) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1291, 1340) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1340, 1291) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1292, 1293) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1293, 1292) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1292, 1295) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1295, 1292) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1293, 1294) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1294, 1293) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1294, 1577) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1577, 1294) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1295, 1530) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1530, 1295) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1296, 1297) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1297, 1296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1296, 1301) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1301, 1296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1296, 1307) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1307, 1296) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1297, 1298) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1298, 1297) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1298, 1299) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1299, 1298) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1299, 1336) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1336, 1299) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1299, 1348) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1348, 1299) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1300, 1301) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1301, 1300) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1300, 1303) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1303, 1300) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1301, 1302) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1302, 1301) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1302, 1311) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1311, 1302) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1302, 1585) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1585, 1302) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1303, 1342) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1342, 1303) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1303, 1538) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1538, 1303) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1304, 1305) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1305, 1304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1304, 1309) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1309, 1304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1304, 1315) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1315, 1304) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1305, 1306) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1306, 1305) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1306, 1307) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1307, 1306) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1307, 1356) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1356, 1307) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1308, 1309) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1309, 1308) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1308, 1311) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1311, 1308) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1309, 1310) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1310, 1309) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1310, 1319) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1319, 1310) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1310, 1593) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1593, 1310) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1311, 1546) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1546, 1311) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1312, 1313) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1313, 1312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1312, 1317) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1317, 1312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1312, 1323) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1323, 1312) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1313, 1314) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1314, 1313) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1314, 1315) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1315, 1314) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1315, 1364) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1364, 1315) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1316, 1317) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1317, 1316) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1316, 1319) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1319, 1316) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1317, 1318) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1318, 1317) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1318, 1327) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1327, 1318) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1318, 1601) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1601, 1318) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1319, 1554) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1554, 1319) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1320, 1321) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1321, 1320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1320, 1325) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1325, 1320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1320, 1331) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1331, 1320) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1321, 1322) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1322, 1321) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1322, 1323) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1323, 1322) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1323, 1372) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1372, 1323) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1324, 1325) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1325, 1324) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1324, 1327) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1327, 1324) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1325, 1326) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1326, 1325) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1326, 1335) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1335, 1326) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1326, 1609) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1609, 1326) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1327, 1562) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1562, 1327) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1328, 1329) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1329, 1328) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1328, 1333) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1333, 1328) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1328, 1339) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1339, 1328) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1329, 1330) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1330, 1329) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1330, 1331) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1331, 1330) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1331, 1380) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1380, 1331) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1332, 1333) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1333, 1332) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1332, 1335) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1335, 1332) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1333, 1334) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1334, 1333) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1334, 1343) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1343, 1334) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1334, 1617) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1617, 1334) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1335, 1570) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1570, 1335) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1336, 1337) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1337, 1336) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1336, 1341) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1341, 1336) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1337, 1338) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1338, 1337) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1338, 1339) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1339, 1338) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1339, 1388) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1388, 1339) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1340, 1341) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1341, 1340) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1340, 1343) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1343, 1340) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1341, 1342) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1342, 1341) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1342, 1625) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1625, 1342) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1343, 1578) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1578, 1343) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1344, 1345) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1345, 1344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1344, 1349) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1349, 1344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1344, 1355) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1355, 1344) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1345, 1346) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1346, 1345) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1346, 1347) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1347, 1346) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1347, 1384) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1384, 1347) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1347, 1396) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1396, 1347) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1348, 1349) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1349, 1348) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1348, 1351) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1351, 1348) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1349, 1350) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1350, 1349) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1350, 1359) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1359, 1350) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1350, 1633) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1633, 1350) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1351, 1390) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1390, 1351) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1351, 1586) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1586, 1351) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1352, 1353) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1353, 1352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1352, 1357) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1357, 1352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1352, 1363) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1363, 1352) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1353, 1354) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1354, 1353) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1354, 1355) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1355, 1354) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1355, 1404) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1404, 1355) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1356, 1357) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1357, 1356) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1356, 1359) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1359, 1356) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1357, 1358) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1358, 1357) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1358, 1367) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1367, 1358) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1358, 1641) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1641, 1358) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1359, 1594) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1594, 1359) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1360, 1361) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1361, 1360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1360, 1365) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1365, 1360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1360, 1371) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1371, 1360) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1361, 1362) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1362, 1361) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1362, 1363) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1363, 1362) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1363, 1412) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1412, 1363) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1364, 1365) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1365, 1364) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1364, 1367) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1367, 1364) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1365, 1366) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1366, 1365) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1366, 1375) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1375, 1366) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1366, 1649) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1649, 1366) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1367, 1602) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1602, 1367) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1368, 1369) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1369, 1368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1368, 1373) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1373, 1368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1368, 1379) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1379, 1368) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1369, 1370) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1370, 1369) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1370, 1371) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1371, 1370) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1371, 1420) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1420, 1371) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1372, 1373) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1373, 1372) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1372, 1375) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1375, 1372) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1373, 1374) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1374, 1373) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1374, 1383) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1383, 1374) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1374, 1657) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1657, 1374) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1375, 1610) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1610, 1375) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1376, 1377) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1377, 1376) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1376, 1381) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1381, 1376) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1376, 1387) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1387, 1376) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1377, 1378) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1378, 1377) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1378, 1379) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1379, 1378) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1379, 1428) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1428, 1379) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1380, 1381) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1381, 1380) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1380, 1383) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1383, 1380) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1381, 1382) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1382, 1381) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1382, 1391) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1391, 1382) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1382, 1665) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1665, 1382) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1383, 1618) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1618, 1383) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1384, 1385) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1385, 1384) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1384, 1389) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1389, 1384) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1385, 1386) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1386, 1385) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1386, 1387) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1387, 1386) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1387, 1436) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1436, 1387) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1388, 1389) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1389, 1388) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1388, 1391) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1391, 1388) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1389, 1390) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1390, 1389) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1390, 1673) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1673, 1390) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1391, 1626) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1626, 1391) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1392, 1393) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1393, 1392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1392, 1397) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1397, 1392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1392, 1403) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1403, 1392) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1393, 1394) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1394, 1393) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1394, 1395) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1395, 1394) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1395, 1432) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1432, 1395) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1396, 1397) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1397, 1396) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1396, 1399) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1399, 1396) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1397, 1398) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1398, 1397) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1398, 1407) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1407, 1398) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1398, 1681) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1681, 1398) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1399, 1438) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1438, 1399) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1399, 1634) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1634, 1399) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1400, 1401) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1401, 1400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1400, 1405) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1405, 1400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1400, 1411) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1411, 1400) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1401, 1402) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1402, 1401) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1402, 1403) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1403, 1402) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1404, 1405) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1405, 1404) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1404, 1407) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1407, 1404) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1405, 1406) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1406, 1405) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1406, 1415) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1415, 1406) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1406, 1689) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1689, 1406) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1407, 1642) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1642, 1407) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1408, 1409) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1409, 1408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1408, 1413) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1413, 1408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1408, 1419) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1419, 1408) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1409, 1410) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1410, 1409) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1410, 1411) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1411, 1410) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1412, 1413) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1413, 1412) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1412, 1415) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1415, 1412) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1413, 1414) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1414, 1413) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1414, 1423) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1423, 1414) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1414, 1697) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1697, 1414) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1415, 1650) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1650, 1415) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1416, 1417) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1417, 1416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1416, 1421) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1421, 1416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1416, 1427) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1427, 1416) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1417, 1418) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1418, 1417) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1418, 1419) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1419, 1418) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1420, 1421) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1421, 1420) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1420, 1423) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1423, 1420) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1421, 1422) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1422, 1421) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1422, 1431) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1431, 1422) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1422, 1705) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1705, 1422) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1423, 1658) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1658, 1423) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1424, 1425) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1425, 1424) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1424, 1429) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1429, 1424) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1424, 1435) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1435, 1424) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1425, 1426) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1426, 1425) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1426, 1427) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1427, 1426) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1428, 1429) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1429, 1428) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1428, 1431) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1431, 1428) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1429, 1430) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1430, 1429) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1430, 1439) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1439, 1430) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1430, 1713) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1713, 1430) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1431, 1666) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1666, 1431) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1432, 1433) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1433, 1432) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1432, 1437) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1437, 1432) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1433, 1434) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1434, 1433) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1434, 1435) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1435, 1434) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1436, 1437) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1437, 1436) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1436, 1439) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1439, 1436) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1437, 1438) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1438, 1437) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1438, 1721) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1721, 1438) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1439, 1674) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1674, 1439) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1440, 1441) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1441, 1440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1440, 1445) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1445, 1440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1440, 1451) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1451, 1440) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1441, 1442) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1442, 1441) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1442, 1443) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1443, 1442) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1443, 1480) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1480, 1443) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1443, 1492) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1492, 1443) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1444, 1445) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1445, 1444) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1444, 1447) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1447, 1444) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1444, 1683) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1683, 1444) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1445, 1446) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1446, 1445) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1446, 1455) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1455, 1446) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1447, 1486) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1486, 1447) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1448, 1449) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1449, 1448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1448, 1453) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1453, 1448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1448, 1459) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1459, 1448) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1449, 1450) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1450, 1449) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1450, 1451) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1451, 1450) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1451, 1500) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1500, 1451) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1452, 1453) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1453, 1452) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1452, 1455) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1455, 1452) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1452, 1691) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1691, 1452) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1453, 1454) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1454, 1453) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1454, 1463) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1463, 1454) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1456, 1457) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1457, 1456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1456, 1461) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1461, 1456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1456, 1467) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1467, 1456) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1457, 1458) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1458, 1457) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1458, 1459) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1459, 1458) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1459, 1508) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1508, 1459) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1460, 1461) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1461, 1460) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1460, 1463) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1463, 1460) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1460, 1699) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1699, 1460) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1461, 1462) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1462, 1461) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1462, 1471) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1471, 1462) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1464, 1465) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1465, 1464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1464, 1469) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1469, 1464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1464, 1475) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1475, 1464) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1465, 1466) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1466, 1465) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1466, 1467) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1467, 1466) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1467, 1516) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1516, 1467) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1468, 1469) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1469, 1468) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1468, 1471) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1471, 1468) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1468, 1707) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1707, 1468) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1469, 1470) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1470, 1469) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1470, 1479) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1479, 1470) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1472, 1473) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1473, 1472) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1472, 1477) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1477, 1472) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1472, 1483) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1483, 1472) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1473, 1474) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1474, 1473) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1474, 1475) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1475, 1474) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1475, 1524) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1524, 1475) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1476, 1477) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1477, 1476) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1476, 1479) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1479, 1476) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1476, 1715) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1715, 1476) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1477, 1478) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1478, 1477) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1478, 1487) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1487, 1478) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1480, 1481) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1481, 1480) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1480, 1485) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1485, 1480) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1481, 1482) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1482, 1481) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1482, 1483) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1483, 1482) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1483, 1532) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1532, 1483) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1484, 1485) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1485, 1484) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1484, 1487) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1487, 1484) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1484, 1723) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1723, 1484) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1485, 1486) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1486, 1485) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1488, 1489) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1489, 1488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1488, 1493) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1493, 1488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1488, 1499) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1499, 1488) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1489, 1490) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1490, 1489) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1490, 1491) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1491, 1490) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1491, 1528) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1528, 1491) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1491, 1540) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1540, 1491) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1492, 1493) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1493, 1492) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1492, 1495) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1495, 1492) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1493, 1494) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1494, 1493) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1494, 1503) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1503, 1494) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1495, 1534) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1534, 1495) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1496, 1497) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1497, 1496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1496, 1501) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1501, 1496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1496, 1507) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1507, 1496) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1497, 1498) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1498, 1497) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1498, 1499) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1499, 1498) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1499, 1548) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1548, 1499) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1500, 1501) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1501, 1500) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1500, 1503) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1503, 1500) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1501, 1502) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1502, 1501) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1502, 1511) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1511, 1502) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1504, 1505) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1505, 1504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1504, 1509) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1509, 1504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1504, 1515) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1515, 1504) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1505, 1506) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1506, 1505) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1506, 1507) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1507, 1506) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1507, 1556) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1556, 1507) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1508, 1509) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1509, 1508) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1508, 1511) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1511, 1508) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1509, 1510) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1510, 1509) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1510, 1519) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1519, 1510) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1512, 1513) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1513, 1512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1512, 1517) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1517, 1512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1512, 1523) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1523, 1512) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1513, 1514) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1514, 1513) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1514, 1515) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1515, 1514) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1515, 1564) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1564, 1515) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1516, 1517) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1517, 1516) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1516, 1519) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1519, 1516) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1517, 1518) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1518, 1517) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1518, 1527) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1527, 1518) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1520, 1521) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1521, 1520) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1520, 1525) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1525, 1520) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1520, 1531) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1531, 1520) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1521, 1522) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1522, 1521) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1522, 1523) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1523, 1522) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1523, 1572) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1572, 1523) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1524, 1525) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1525, 1524) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1524, 1527) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1527, 1524) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1525, 1526) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1526, 1525) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1526, 1535) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1535, 1526) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1528, 1529) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1529, 1528) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1528, 1533) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1533, 1528) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1529, 1530) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1530, 1529) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1530, 1531) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1531, 1530) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1531, 1580) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1580, 1531) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1532, 1533) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1533, 1532) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1532, 1535) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1535, 1532) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1533, 1534) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1534, 1533) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1536, 1537) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1537, 1536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1536, 1541) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1541, 1536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1536, 1547) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1547, 1536) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1537, 1538) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1538, 1537) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1538, 1539) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1539, 1538) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1539, 1576) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1576, 1539) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1539, 1588) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1588, 1539) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1540, 1541) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1541, 1540) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1540, 1543) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1543, 1540) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1541, 1542) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1542, 1541) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1542, 1551) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1551, 1542) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1543, 1582) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1582, 1543) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1544, 1545) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1545, 1544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1544, 1549) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1549, 1544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1544, 1555) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1555, 1544) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1545, 1546) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1546, 1545) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1546, 1547) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1547, 1546) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1547, 1596) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1596, 1547) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1548, 1549) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1549, 1548) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1548, 1551) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1551, 1548) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1549, 1550) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1550, 1549) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1550, 1559) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1559, 1550) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1552, 1553) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1553, 1552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1552, 1557) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1557, 1552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1552, 1563) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1563, 1552) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1553, 1554) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1554, 1553) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1554, 1555) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1555, 1554) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1555, 1604) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1604, 1555) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1556, 1557) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1557, 1556) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1556, 1559) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1559, 1556) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1557, 1558) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1558, 1557) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1558, 1567) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1567, 1558) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1560, 1561) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1561, 1560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1560, 1565) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1565, 1560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1560, 1571) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1571, 1560) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1561, 1562) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1562, 1561) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1562, 1563) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1563, 1562) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1563, 1612) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1612, 1563) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1564, 1565) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1565, 1564) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1564, 1567) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1567, 1564) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1565, 1566) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1566, 1565) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1566, 1575) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1575, 1566) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1568, 1569) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1569, 1568) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1568, 1573) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1573, 1568) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1568, 1579) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1579, 1568) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1569, 1570) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1570, 1569) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1570, 1571) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1571, 1570) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1571, 1620) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1620, 1571) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1572, 1573) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1573, 1572) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1572, 1575) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1575, 1572) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1573, 1574) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1574, 1573) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1574, 1583) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1583, 1574) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1576, 1577) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1577, 1576) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1576, 1581) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1581, 1576) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1577, 1578) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1578, 1577) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1578, 1579) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1579, 1578) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1579, 1628) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1628, 1579) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1580, 1581) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1581, 1580) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1580, 1583) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1583, 1580) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1581, 1582) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1582, 1581) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1584, 1585) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1585, 1584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1584, 1589) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1589, 1584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1584, 1595) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1595, 1584) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1585, 1586) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1586, 1585) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1586, 1587) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1587, 1586) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1587, 1624) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1624, 1587) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1587, 1636) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1636, 1587) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1588, 1589) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1589, 1588) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1588, 1591) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1591, 1588) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1589, 1590) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1590, 1589) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1590, 1599) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1599, 1590) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1591, 1630) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1630, 1591) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1592, 1593) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1593, 1592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1592, 1597) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1597, 1592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1592, 1603) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1603, 1592) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1593, 1594) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1594, 1593) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1594, 1595) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1595, 1594) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1595, 1644) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1644, 1595) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1596, 1597) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1597, 1596) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1596, 1599) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1599, 1596) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1597, 1598) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1598, 1597) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1598, 1607) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1607, 1598) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1600, 1601) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1601, 1600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1600, 1605) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1605, 1600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1600, 1611) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1611, 1600) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1601, 1602) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1602, 1601) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1602, 1603) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1603, 1602) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1603, 1652) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1652, 1603) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1604, 1605) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1605, 1604) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1604, 1607) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1607, 1604) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1605, 1606) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1606, 1605) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1606, 1615) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1615, 1606) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1608, 1609) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1609, 1608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1608, 1613) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1613, 1608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1608, 1619) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1619, 1608) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1609, 1610) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1610, 1609) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1610, 1611) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1611, 1610) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1611, 1660) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1660, 1611) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1612, 1613) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1613, 1612) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1612, 1615) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1615, 1612) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1613, 1614) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1614, 1613) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1614, 1623) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1623, 1614) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1616, 1617) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1617, 1616) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1616, 1621) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1621, 1616) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1616, 1627) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1627, 1616) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1617, 1618) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1618, 1617) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1618, 1619) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1619, 1618) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1619, 1668) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1668, 1619) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1620, 1621) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1621, 1620) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1620, 1623) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1623, 1620) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1621, 1622) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1622, 1621) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1622, 1631) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1631, 1622) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1624, 1625) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1625, 1624) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1624, 1629) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1629, 1624) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1625, 1626) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1626, 1625) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1626, 1627) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1627, 1626) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1627, 1676) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1676, 1627) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1628, 1629) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1629, 1628) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1628, 1631) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1631, 1628) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1629, 1630) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1630, 1629) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1632, 1633) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1633, 1632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1632, 1637) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1637, 1632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1632, 1643) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1643, 1632) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1633, 1634) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1634, 1633) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1634, 1635) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1635, 1634) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1635, 1672) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1672, 1635) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1635, 1684) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1684, 1635) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1636, 1637) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1637, 1636) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1636, 1639) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1639, 1636) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1637, 1638) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1638, 1637) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1638, 1647) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1647, 1638) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1639, 1678) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1678, 1639) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1640, 1641) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1641, 1640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1640, 1645) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1645, 1640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1640, 1651) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1651, 1640) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1641, 1642) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1642, 1641) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1642, 1643) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1643, 1642) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1643, 1692) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1692, 1643) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1644, 1645) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1645, 1644) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1644, 1647) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1647, 1644) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1645, 1646) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1646, 1645) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1646, 1655) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1655, 1646) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1648, 1649) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1649, 1648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1648, 1653) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1653, 1648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1648, 1659) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1659, 1648) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1649, 1650) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1650, 1649) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1650, 1651) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1651, 1650) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1651, 1700) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1700, 1651) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1652, 1653) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1653, 1652) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1652, 1655) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1655, 1652) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1653, 1654) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1654, 1653) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1654, 1663) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1663, 1654) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1656, 1657) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1657, 1656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1656, 1661) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1661, 1656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1656, 1667) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1667, 1656) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1657, 1658) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1658, 1657) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1658, 1659) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1659, 1658) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1659, 1708) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1708, 1659) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1660, 1661) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1661, 1660) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1660, 1663) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1663, 1660) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1661, 1662) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1662, 1661) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1662, 1671) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1671, 1662) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1664, 1665) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1665, 1664) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1664, 1669) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1669, 1664) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1664, 1675) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1675, 1664) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1665, 1666) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1666, 1665) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1666, 1667) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1667, 1666) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1667, 1716) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1716, 1667) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1668, 1669) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1669, 1668) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1668, 1671) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1671, 1668) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1669, 1670) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1670, 1669) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1670, 1679) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1679, 1670) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1672, 1673) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1673, 1672) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1672, 1677) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1677, 1672) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1673, 1674) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1674, 1673) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1674, 1675) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1675, 1674) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1675, 1724) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1724, 1675) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1676, 1677) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1677, 1676) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1676, 1679) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1679, 1676) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1677, 1678) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1678, 1677) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1680, 1681) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1681, 1680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1680, 1685) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1685, 1680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1680, 1691) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1691, 1680) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1681, 1682) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1682, 1681) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1682, 1683) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1683, 1682) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1683, 1720) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1720, 1683) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1684, 1685) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1685, 1684) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1684, 1687) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1687, 1684) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1685, 1686) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1686, 1685) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1686, 1695) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1695, 1686) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1687, 1726) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1726, 1687) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1688, 1689) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1689, 1688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1688, 1693) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1693, 1688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1688, 1699) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1699, 1688) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1689, 1690) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1690, 1689) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1690, 1691) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1691, 1690) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1692, 1693) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1693, 1692) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1692, 1695) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1695, 1692) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1693, 1694) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1694, 1693) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1694, 1703) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1703, 1694) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1696, 1697) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1697, 1696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1696, 1701) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1701, 1696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1696, 1707) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1707, 1696) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1697, 1698) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1698, 1697) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1698, 1699) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1699, 1698) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1700, 1701) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1701, 1700) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1700, 1703) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1703, 1700) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1701, 1702) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1702, 1701) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1702, 1711) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1711, 1702) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1704, 1705) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1705, 1704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1704, 1709) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1709, 1704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1704, 1715) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1715, 1704) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1705, 1706) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1706, 1705) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1706, 1707) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1707, 1706) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1708, 1709) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1709, 1708) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1708, 1711) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1711, 1708) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1709, 1710) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1710, 1709) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1710, 1719) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1719, 1710) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1712, 1713) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1713, 1712) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1712, 1717) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1717, 1712) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1712, 1723) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1723, 1712) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1713, 1714) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1714, 1713) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1714, 1715) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1715, 1714) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1716, 1717) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1717, 1716) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1716, 1719) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1719, 1716) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1717, 1718) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1718, 1717) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1718, 1727) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1727, 1718) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1720, 1721) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1721, 1720) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1720, 1725) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1725, 1720) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1721, 1722) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1722, 1721) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1722, 1723) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1723, 1722) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1724, 1725) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1725, 1724) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1724, 1727) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1727, 1724) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1725, 1726) = std::complex<double>(0.0, 2.0*-0.3333333333333333);
A(1726, 1725) = -std::complex<double>(0.0, 2.0*-0.3333333333333333);
return A;
}
std::vector<int> non_zeros()
{
std::vector<int> nz;
int coo;
coo = 1728*0 + 1;
nz.push_back(coo);
coo = 1728*0 + 5;
nz.push_back(coo);
coo = 1728*0 + 11;
nz.push_back(coo);
coo = 1728*1 + 2;
nz.push_back(coo);
coo = 1728*1 + 1446;
nz.push_back(coo);
coo = 1728*2 + 3;
nz.push_back(coo);
coo = 1728*2 + 1495;
nz.push_back(coo);
coo = 1728*3 + 40;
nz.push_back(coo);
coo = 1728*3 + 52;
nz.push_back(coo);
coo = 1728*4 + 5;
nz.push_back(coo);
coo = 1728*4 + 7;
nz.push_back(coo);
coo = 1728*4 + 243;
nz.push_back(coo);
coo = 1728*5 + 6;
nz.push_back(coo);
coo = 1728*6 + 15;
nz.push_back(coo);
coo = 1728*6 + 289;
nz.push_back(coo);
coo = 1728*7 + 46;
nz.push_back(coo);
coo = 1728*7 + 530;
nz.push_back(coo);
coo = 1728*8 + 9;
nz.push_back(coo);
coo = 1728*8 + 13;
nz.push_back(coo);
coo = 1728*8 + 19;
nz.push_back(coo);
coo = 1728*9 + 10;
nz.push_back(coo);
coo = 1728*9 + 1454;
nz.push_back(coo);
coo = 1728*10 + 11;
nz.push_back(coo);
coo = 1728*10 + 1503;
nz.push_back(coo);
coo = 1728*11 + 60;
nz.push_back(coo);
coo = 1728*12 + 13;
nz.push_back(coo);
coo = 1728*12 + 15;
nz.push_back(coo);
coo = 1728*12 + 251;
nz.push_back(coo);
coo = 1728*13 + 14;
nz.push_back(coo);
coo = 1728*14 + 23;
nz.push_back(coo);
coo = 1728*14 + 297;
nz.push_back(coo);
coo = 1728*15 + 538;
nz.push_back(coo);
coo = 1728*16 + 17;
nz.push_back(coo);
coo = 1728*16 + 21;
nz.push_back(coo);
coo = 1728*16 + 27;
nz.push_back(coo);
coo = 1728*17 + 18;
nz.push_back(coo);
coo = 1728*17 + 1462;
nz.push_back(coo);
coo = 1728*18 + 19;
nz.push_back(coo);
coo = 1728*18 + 1511;
nz.push_back(coo);
coo = 1728*19 + 68;
nz.push_back(coo);
coo = 1728*20 + 21;
nz.push_back(coo);
coo = 1728*20 + 23;
nz.push_back(coo);
coo = 1728*20 + 259;
nz.push_back(coo);
coo = 1728*21 + 22;
nz.push_back(coo);
coo = 1728*22 + 31;
nz.push_back(coo);
coo = 1728*22 + 305;
nz.push_back(coo);
coo = 1728*23 + 546;
nz.push_back(coo);
coo = 1728*24 + 25;
nz.push_back(coo);
coo = 1728*24 + 29;
nz.push_back(coo);
coo = 1728*24 + 35;
nz.push_back(coo);
coo = 1728*25 + 26;
nz.push_back(coo);
coo = 1728*25 + 1470;
nz.push_back(coo);
coo = 1728*26 + 27;
nz.push_back(coo);
coo = 1728*26 + 1519;
nz.push_back(coo);
coo = 1728*27 + 76;
nz.push_back(coo);
coo = 1728*28 + 29;
nz.push_back(coo);
coo = 1728*28 + 31;
nz.push_back(coo);
coo = 1728*28 + 267;
nz.push_back(coo);
coo = 1728*29 + 30;
nz.push_back(coo);
coo = 1728*30 + 39;
nz.push_back(coo);
coo = 1728*30 + 313;
nz.push_back(coo);
coo = 1728*31 + 554;
nz.push_back(coo);
coo = 1728*32 + 33;
nz.push_back(coo);
coo = 1728*32 + 37;
nz.push_back(coo);
coo = 1728*32 + 43;
nz.push_back(coo);
coo = 1728*33 + 34;
nz.push_back(coo);
coo = 1728*33 + 1478;
nz.push_back(coo);
coo = 1728*34 + 35;
nz.push_back(coo);
coo = 1728*34 + 1527;
nz.push_back(coo);
coo = 1728*35 + 84;
nz.push_back(coo);
coo = 1728*36 + 37;
nz.push_back(coo);
coo = 1728*36 + 39;
nz.push_back(coo);
coo = 1728*36 + 275;
nz.push_back(coo);
coo = 1728*37 + 38;
nz.push_back(coo);
coo = 1728*38 + 47;
nz.push_back(coo);
coo = 1728*38 + 321;
nz.push_back(coo);
coo = 1728*39 + 562;
nz.push_back(coo);
coo = 1728*40 + 41;
nz.push_back(coo);
coo = 1728*40 + 45;
nz.push_back(coo);
coo = 1728*41 + 42;
nz.push_back(coo);
coo = 1728*41 + 1486;
nz.push_back(coo);
coo = 1728*42 + 43;
nz.push_back(coo);
coo = 1728*42 + 1535;
nz.push_back(coo);
coo = 1728*43 + 92;
nz.push_back(coo);
coo = 1728*44 + 45;
nz.push_back(coo);
coo = 1728*44 + 47;
nz.push_back(coo);
coo = 1728*44 + 283;
nz.push_back(coo);
coo = 1728*45 + 46;
nz.push_back(coo);
coo = 1728*46 + 329;
nz.push_back(coo);
coo = 1728*47 + 570;
nz.push_back(coo);
coo = 1728*48 + 49;
nz.push_back(coo);
coo = 1728*48 + 53;
nz.push_back(coo);
coo = 1728*48 + 59;
nz.push_back(coo);
coo = 1728*49 + 50;
nz.push_back(coo);
coo = 1728*49 + 1494;
nz.push_back(coo);
coo = 1728*50 + 51;
nz.push_back(coo);
coo = 1728*50 + 1543;
nz.push_back(coo);
coo = 1728*51 + 88;
nz.push_back(coo);
coo = 1728*51 + 100;
nz.push_back(coo);
coo = 1728*52 + 53;
nz.push_back(coo);
coo = 1728*52 + 55;
nz.push_back(coo);
coo = 1728*53 + 54;
nz.push_back(coo);
coo = 1728*54 + 63;
nz.push_back(coo);
coo = 1728*54 + 337;
nz.push_back(coo);
coo = 1728*55 + 94;
nz.push_back(coo);
coo = 1728*55 + 290;
nz.push_back(coo);
coo = 1728*56 + 57;
nz.push_back(coo);
coo = 1728*56 + 61;
nz.push_back(coo);
coo = 1728*56 + 67;
nz.push_back(coo);
coo = 1728*57 + 58;
nz.push_back(coo);
coo = 1728*57 + 1502;
nz.push_back(coo);
coo = 1728*58 + 59;
nz.push_back(coo);
coo = 1728*58 + 1551;
nz.push_back(coo);
coo = 1728*59 + 108;
nz.push_back(coo);
coo = 1728*60 + 61;
nz.push_back(coo);
coo = 1728*60 + 63;
nz.push_back(coo);
coo = 1728*61 + 62;
nz.push_back(coo);
coo = 1728*62 + 71;
nz.push_back(coo);
coo = 1728*62 + 345;
nz.push_back(coo);
coo = 1728*63 + 298;
nz.push_back(coo);
coo = 1728*64 + 65;
nz.push_back(coo);
coo = 1728*64 + 69;
nz.push_back(coo);
coo = 1728*64 + 75;
nz.push_back(coo);
coo = 1728*65 + 66;
nz.push_back(coo);
coo = 1728*65 + 1510;
nz.push_back(coo);
coo = 1728*66 + 67;
nz.push_back(coo);
coo = 1728*66 + 1559;
nz.push_back(coo);
coo = 1728*67 + 116;
nz.push_back(coo);
coo = 1728*68 + 69;
nz.push_back(coo);
coo = 1728*68 + 71;
nz.push_back(coo);
coo = 1728*69 + 70;
nz.push_back(coo);
coo = 1728*70 + 79;
nz.push_back(coo);
coo = 1728*70 + 353;
nz.push_back(coo);
coo = 1728*71 + 306;
nz.push_back(coo);
coo = 1728*72 + 73;
nz.push_back(coo);
coo = 1728*72 + 77;
nz.push_back(coo);
coo = 1728*72 + 83;
nz.push_back(coo);
coo = 1728*73 + 74;
nz.push_back(coo);
coo = 1728*73 + 1518;
nz.push_back(coo);
coo = 1728*74 + 75;
nz.push_back(coo);
coo = 1728*74 + 1567;
nz.push_back(coo);
coo = 1728*75 + 124;
nz.push_back(coo);
coo = 1728*76 + 77;
nz.push_back(coo);
coo = 1728*76 + 79;
nz.push_back(coo);
coo = 1728*77 + 78;
nz.push_back(coo);
coo = 1728*78 + 87;
nz.push_back(coo);
coo = 1728*78 + 361;
nz.push_back(coo);
coo = 1728*79 + 314;
nz.push_back(coo);
coo = 1728*80 + 81;
nz.push_back(coo);
coo = 1728*80 + 85;
nz.push_back(coo);
coo = 1728*80 + 91;
nz.push_back(coo);
coo = 1728*81 + 82;
nz.push_back(coo);
coo = 1728*81 + 1526;
nz.push_back(coo);
coo = 1728*82 + 83;
nz.push_back(coo);
coo = 1728*82 + 1575;
nz.push_back(coo);
coo = 1728*83 + 132;
nz.push_back(coo);
coo = 1728*84 + 85;
nz.push_back(coo);
coo = 1728*84 + 87;
nz.push_back(coo);
coo = 1728*85 + 86;
nz.push_back(coo);
coo = 1728*86 + 95;
nz.push_back(coo);
coo = 1728*86 + 369;
nz.push_back(coo);
coo = 1728*87 + 322;
nz.push_back(coo);
coo = 1728*88 + 89;
nz.push_back(coo);
coo = 1728*88 + 93;
nz.push_back(coo);
coo = 1728*89 + 90;
nz.push_back(coo);
coo = 1728*89 + 1534;
nz.push_back(coo);
coo = 1728*90 + 91;
nz.push_back(coo);
coo = 1728*90 + 1583;
nz.push_back(coo);
coo = 1728*91 + 140;
nz.push_back(coo);
coo = 1728*92 + 93;
nz.push_back(coo);
coo = 1728*92 + 95;
nz.push_back(coo);
coo = 1728*93 + 94;
nz.push_back(coo);
coo = 1728*94 + 377;
nz.push_back(coo);
coo = 1728*95 + 330;
nz.push_back(coo);
coo = 1728*96 + 97;
nz.push_back(coo);
coo = 1728*96 + 101;
nz.push_back(coo);
coo = 1728*96 + 107;
nz.push_back(coo);
coo = 1728*97 + 98;
nz.push_back(coo);
coo = 1728*97 + 1542;
nz.push_back(coo);
coo = 1728*98 + 99;
nz.push_back(coo);
coo = 1728*98 + 1591;
nz.push_back(coo);
coo = 1728*99 + 136;
nz.push_back(coo);
coo = 1728*99 + 148;
nz.push_back(coo);
coo = 1728*100 + 101;
nz.push_back(coo);
coo = 1728*100 + 103;
nz.push_back(coo);
coo = 1728*101 + 102;
nz.push_back(coo);
coo = 1728*102 + 111;
nz.push_back(coo);
coo = 1728*102 + 385;
nz.push_back(coo);
coo = 1728*103 + 142;
nz.push_back(coo);
coo = 1728*103 + 338;
nz.push_back(coo);
coo = 1728*104 + 105;
nz.push_back(coo);
coo = 1728*104 + 109;
nz.push_back(coo);
coo = 1728*104 + 115;
nz.push_back(coo);
coo = 1728*105 + 106;
nz.push_back(coo);
coo = 1728*105 + 1550;
nz.push_back(coo);
coo = 1728*106 + 107;
nz.push_back(coo);
coo = 1728*106 + 1599;
nz.push_back(coo);
coo = 1728*107 + 156;
nz.push_back(coo);
coo = 1728*108 + 109;
nz.push_back(coo);
coo = 1728*108 + 111;
nz.push_back(coo);
coo = 1728*109 + 110;
nz.push_back(coo);
coo = 1728*110 + 119;
nz.push_back(coo);
coo = 1728*110 + 393;
nz.push_back(coo);
coo = 1728*111 + 346;
nz.push_back(coo);
coo = 1728*112 + 113;
nz.push_back(coo);
coo = 1728*112 + 117;
nz.push_back(coo);
coo = 1728*112 + 123;
nz.push_back(coo);
coo = 1728*113 + 114;
nz.push_back(coo);
coo = 1728*113 + 1558;
nz.push_back(coo);
coo = 1728*114 + 115;
nz.push_back(coo);
coo = 1728*114 + 1607;
nz.push_back(coo);
coo = 1728*115 + 164;
nz.push_back(coo);
coo = 1728*116 + 117;
nz.push_back(coo);
coo = 1728*116 + 119;
nz.push_back(coo);
coo = 1728*117 + 118;
nz.push_back(coo);
coo = 1728*118 + 127;
nz.push_back(coo);
coo = 1728*118 + 401;
nz.push_back(coo);
coo = 1728*119 + 354;
nz.push_back(coo);
coo = 1728*120 + 121;
nz.push_back(coo);
coo = 1728*120 + 125;
nz.push_back(coo);
coo = 1728*120 + 131;
nz.push_back(coo);
coo = 1728*121 + 122;
nz.push_back(coo);
coo = 1728*121 + 1566;
nz.push_back(coo);
coo = 1728*122 + 123;
nz.push_back(coo);
coo = 1728*122 + 1615;
nz.push_back(coo);
coo = 1728*123 + 172;
nz.push_back(coo);
coo = 1728*124 + 125;
nz.push_back(coo);
coo = 1728*124 + 127;
nz.push_back(coo);
coo = 1728*125 + 126;
nz.push_back(coo);
coo = 1728*126 + 135;
nz.push_back(coo);
coo = 1728*126 + 409;
nz.push_back(coo);
coo = 1728*127 + 362;
nz.push_back(coo);
coo = 1728*128 + 129;
nz.push_back(coo);
coo = 1728*128 + 133;
nz.push_back(coo);
coo = 1728*128 + 139;
nz.push_back(coo);
coo = 1728*129 + 130;
nz.push_back(coo);
coo = 1728*129 + 1574;
nz.push_back(coo);
coo = 1728*130 + 131;
nz.push_back(coo);
coo = 1728*130 + 1623;
nz.push_back(coo);
coo = 1728*131 + 180;
nz.push_back(coo);
coo = 1728*132 + 133;
nz.push_back(coo);
coo = 1728*132 + 135;
nz.push_back(coo);
coo = 1728*133 + 134;
nz.push_back(coo);
coo = 1728*134 + 143;
nz.push_back(coo);
coo = 1728*134 + 417;
nz.push_back(coo);
coo = 1728*135 + 370;
nz.push_back(coo);
coo = 1728*136 + 137;
nz.push_back(coo);
coo = 1728*136 + 141;
nz.push_back(coo);
coo = 1728*137 + 138;
nz.push_back(coo);
coo = 1728*137 + 1582;
nz.push_back(coo);
coo = 1728*138 + 139;
nz.push_back(coo);
coo = 1728*138 + 1631;
nz.push_back(coo);
coo = 1728*139 + 188;
nz.push_back(coo);
coo = 1728*140 + 141;
nz.push_back(coo);
coo = 1728*140 + 143;
nz.push_back(coo);
coo = 1728*141 + 142;
nz.push_back(coo);
coo = 1728*142 + 425;
nz.push_back(coo);
coo = 1728*143 + 378;
nz.push_back(coo);
coo = 1728*144 + 145;
nz.push_back(coo);
coo = 1728*144 + 149;
nz.push_back(coo);
coo = 1728*144 + 155;
nz.push_back(coo);
coo = 1728*145 + 146;
nz.push_back(coo);
coo = 1728*145 + 1590;
nz.push_back(coo);
coo = 1728*146 + 147;
nz.push_back(coo);
coo = 1728*146 + 1639;
nz.push_back(coo);
coo = 1728*147 + 184;
nz.push_back(coo);
coo = 1728*147 + 196;
nz.push_back(coo);
coo = 1728*148 + 149;
nz.push_back(coo);
coo = 1728*148 + 151;
nz.push_back(coo);
coo = 1728*149 + 150;
nz.push_back(coo);
coo = 1728*150 + 159;
nz.push_back(coo);
coo = 1728*150 + 433;
nz.push_back(coo);
coo = 1728*151 + 190;
nz.push_back(coo);
coo = 1728*151 + 386;
nz.push_back(coo);
coo = 1728*152 + 153;
nz.push_back(coo);
coo = 1728*152 + 157;
nz.push_back(coo);
coo = 1728*152 + 163;
nz.push_back(coo);
coo = 1728*153 + 154;
nz.push_back(coo);
coo = 1728*153 + 1598;
nz.push_back(coo);
coo = 1728*154 + 155;
nz.push_back(coo);
coo = 1728*154 + 1647;
nz.push_back(coo);
coo = 1728*155 + 204;
nz.push_back(coo);
coo = 1728*156 + 157;
nz.push_back(coo);
coo = 1728*156 + 159;
nz.push_back(coo);
coo = 1728*157 + 158;
nz.push_back(coo);
coo = 1728*158 + 167;
nz.push_back(coo);
coo = 1728*158 + 441;
nz.push_back(coo);
coo = 1728*159 + 394;
nz.push_back(coo);
coo = 1728*160 + 161;
nz.push_back(coo);
coo = 1728*160 + 165;
nz.push_back(coo);
coo = 1728*160 + 171;
nz.push_back(coo);
coo = 1728*161 + 162;
nz.push_back(coo);
coo = 1728*161 + 1606;
nz.push_back(coo);
coo = 1728*162 + 163;
nz.push_back(coo);
coo = 1728*162 + 1655;
nz.push_back(coo);
coo = 1728*163 + 212;
nz.push_back(coo);
coo = 1728*164 + 165;
nz.push_back(coo);
coo = 1728*164 + 167;
nz.push_back(coo);
coo = 1728*165 + 166;
nz.push_back(coo);
coo = 1728*166 + 175;
nz.push_back(coo);
coo = 1728*166 + 449;
nz.push_back(coo);
coo = 1728*167 + 402;
nz.push_back(coo);
coo = 1728*168 + 169;
nz.push_back(coo);
coo = 1728*168 + 173;
nz.push_back(coo);
coo = 1728*168 + 179;
nz.push_back(coo);
coo = 1728*169 + 170;
nz.push_back(coo);
coo = 1728*169 + 1614;
nz.push_back(coo);
coo = 1728*170 + 171;
nz.push_back(coo);
coo = 1728*170 + 1663;
nz.push_back(coo);
coo = 1728*171 + 220;
nz.push_back(coo);
coo = 1728*172 + 173;
nz.push_back(coo);
coo = 1728*172 + 175;
nz.push_back(coo);
coo = 1728*173 + 174;
nz.push_back(coo);
coo = 1728*174 + 183;
nz.push_back(coo);
coo = 1728*174 + 457;
nz.push_back(coo);
coo = 1728*175 + 410;
nz.push_back(coo);
coo = 1728*176 + 177;
nz.push_back(coo);
coo = 1728*176 + 181;
nz.push_back(coo);
coo = 1728*176 + 187;
nz.push_back(coo);
coo = 1728*177 + 178;
nz.push_back(coo);
coo = 1728*177 + 1622;
nz.push_back(coo);
coo = 1728*178 + 179;
nz.push_back(coo);
coo = 1728*178 + 1671;
nz.push_back(coo);
coo = 1728*179 + 228;
nz.push_back(coo);
coo = 1728*180 + 181;
nz.push_back(coo);
coo = 1728*180 + 183;
nz.push_back(coo);
coo = 1728*181 + 182;
nz.push_back(coo);
coo = 1728*182 + 191;
nz.push_back(coo);
coo = 1728*182 + 465;
nz.push_back(coo);
coo = 1728*183 + 418;
nz.push_back(coo);
coo = 1728*184 + 185;
nz.push_back(coo);
coo = 1728*184 + 189;
nz.push_back(coo);
coo = 1728*185 + 186;
nz.push_back(coo);
coo = 1728*185 + 1630;
nz.push_back(coo);
coo = 1728*186 + 187;
nz.push_back(coo);
coo = 1728*186 + 1679;
nz.push_back(coo);
coo = 1728*187 + 236;
nz.push_back(coo);
coo = 1728*188 + 189;
nz.push_back(coo);
coo = 1728*188 + 191;
nz.push_back(coo);
coo = 1728*189 + 190;
nz.push_back(coo);
coo = 1728*190 + 473;
nz.push_back(coo);
coo = 1728*191 + 426;
nz.push_back(coo);
coo = 1728*192 + 193;
nz.push_back(coo);
coo = 1728*192 + 197;
nz.push_back(coo);
coo = 1728*192 + 203;
nz.push_back(coo);
coo = 1728*193 + 194;
nz.push_back(coo);
coo = 1728*193 + 1638;
nz.push_back(coo);
coo = 1728*194 + 195;
nz.push_back(coo);
coo = 1728*194 + 1687;
nz.push_back(coo);
coo = 1728*195 + 232;
nz.push_back(coo);
coo = 1728*195 + 244;
nz.push_back(coo);
coo = 1728*196 + 197;
nz.push_back(coo);
coo = 1728*196 + 199;
nz.push_back(coo);
coo = 1728*197 + 198;
nz.push_back(coo);
coo = 1728*198 + 207;
nz.push_back(coo);
coo = 1728*198 + 481;
nz.push_back(coo);
coo = 1728*199 + 238;
nz.push_back(coo);
coo = 1728*199 + 434;
nz.push_back(coo);
coo = 1728*200 + 201;
nz.push_back(coo);
coo = 1728*200 + 205;
nz.push_back(coo);
coo = 1728*200 + 211;
nz.push_back(coo);
coo = 1728*201 + 202;
nz.push_back(coo);
coo = 1728*201 + 1646;
nz.push_back(coo);
coo = 1728*202 + 203;
nz.push_back(coo);
coo = 1728*202 + 1695;
nz.push_back(coo);
coo = 1728*203 + 252;
nz.push_back(coo);
coo = 1728*204 + 205;
nz.push_back(coo);
coo = 1728*204 + 207;
nz.push_back(coo);
coo = 1728*205 + 206;
nz.push_back(coo);
coo = 1728*206 + 215;
nz.push_back(coo);
coo = 1728*206 + 489;
nz.push_back(coo);
coo = 1728*207 + 442;
nz.push_back(coo);
coo = 1728*208 + 209;
nz.push_back(coo);
coo = 1728*208 + 213;
nz.push_back(coo);
coo = 1728*208 + 219;
nz.push_back(coo);
coo = 1728*209 + 210;
nz.push_back(coo);
coo = 1728*209 + 1654;
nz.push_back(coo);
coo = 1728*210 + 211;
nz.push_back(coo);
coo = 1728*210 + 1703;
nz.push_back(coo);
coo = 1728*211 + 260;
nz.push_back(coo);
coo = 1728*212 + 213;
nz.push_back(coo);
coo = 1728*212 + 215;
nz.push_back(coo);
coo = 1728*213 + 214;
nz.push_back(coo);
coo = 1728*214 + 223;
nz.push_back(coo);
coo = 1728*214 + 497;
nz.push_back(coo);
coo = 1728*215 + 450;
nz.push_back(coo);
coo = 1728*216 + 217;
nz.push_back(coo);
coo = 1728*216 + 221;
nz.push_back(coo);
coo = 1728*216 + 227;
nz.push_back(coo);
coo = 1728*217 + 218;
nz.push_back(coo);
coo = 1728*217 + 1662;
nz.push_back(coo);
coo = 1728*218 + 219;
nz.push_back(coo);
coo = 1728*218 + 1711;
nz.push_back(coo);
coo = 1728*219 + 268;
nz.push_back(coo);
coo = 1728*220 + 221;
nz.push_back(coo);
coo = 1728*220 + 223;
nz.push_back(coo);
coo = 1728*221 + 222;
nz.push_back(coo);
coo = 1728*222 + 231;
nz.push_back(coo);
coo = 1728*222 + 505;
nz.push_back(coo);
coo = 1728*223 + 458;
nz.push_back(coo);
coo = 1728*224 + 225;
nz.push_back(coo);
coo = 1728*224 + 229;
nz.push_back(coo);
coo = 1728*224 + 235;
nz.push_back(coo);
coo = 1728*225 + 226;
nz.push_back(coo);
coo = 1728*225 + 1670;
nz.push_back(coo);
coo = 1728*226 + 227;
nz.push_back(coo);
coo = 1728*226 + 1719;
nz.push_back(coo);
coo = 1728*227 + 276;
nz.push_back(coo);
coo = 1728*228 + 229;
nz.push_back(coo);
coo = 1728*228 + 231;
nz.push_back(coo);
coo = 1728*229 + 230;
nz.push_back(coo);
coo = 1728*230 + 239;
nz.push_back(coo);
coo = 1728*230 + 513;
nz.push_back(coo);
coo = 1728*231 + 466;
nz.push_back(coo);
coo = 1728*232 + 233;
nz.push_back(coo);
coo = 1728*232 + 237;
nz.push_back(coo);
coo = 1728*233 + 234;
nz.push_back(coo);
coo = 1728*233 + 1678;
nz.push_back(coo);
coo = 1728*234 + 235;
nz.push_back(coo);
coo = 1728*234 + 1727;
nz.push_back(coo);
coo = 1728*235 + 284;
nz.push_back(coo);
coo = 1728*236 + 237;
nz.push_back(coo);
coo = 1728*236 + 239;
nz.push_back(coo);
coo = 1728*237 + 238;
nz.push_back(coo);
coo = 1728*238 + 521;
nz.push_back(coo);
coo = 1728*239 + 474;
nz.push_back(coo);
coo = 1728*240 + 241;
nz.push_back(coo);
coo = 1728*240 + 245;
nz.push_back(coo);
coo = 1728*240 + 251;
nz.push_back(coo);
coo = 1728*241 + 242;
nz.push_back(coo);
coo = 1728*241 + 1686;
nz.push_back(coo);
coo = 1728*242 + 243;
nz.push_back(coo);
coo = 1728*242 + 1447;
nz.push_back(coo);
coo = 1728*243 + 280;
nz.push_back(coo);
coo = 1728*244 + 245;
nz.push_back(coo);
coo = 1728*244 + 247;
nz.push_back(coo);
coo = 1728*245 + 246;
nz.push_back(coo);
coo = 1728*246 + 255;
nz.push_back(coo);
coo = 1728*246 + 529;
nz.push_back(coo);
coo = 1728*247 + 286;
nz.push_back(coo);
coo = 1728*247 + 482;
nz.push_back(coo);
coo = 1728*248 + 249;
nz.push_back(coo);
coo = 1728*248 + 253;
nz.push_back(coo);
coo = 1728*248 + 259;
nz.push_back(coo);
coo = 1728*249 + 250;
nz.push_back(coo);
coo = 1728*249 + 1694;
nz.push_back(coo);
coo = 1728*250 + 251;
nz.push_back(coo);
coo = 1728*250 + 1455;
nz.push_back(coo);
coo = 1728*252 + 253;
nz.push_back(coo);
coo = 1728*252 + 255;
nz.push_back(coo);
coo = 1728*253 + 254;
nz.push_back(coo);
coo = 1728*254 + 263;
nz.push_back(coo);
coo = 1728*254 + 537;
nz.push_back(coo);
coo = 1728*255 + 490;
nz.push_back(coo);
coo = 1728*256 + 257;
nz.push_back(coo);
coo = 1728*256 + 261;
nz.push_back(coo);
coo = 1728*256 + 267;
nz.push_back(coo);
coo = 1728*257 + 258;
nz.push_back(coo);
coo = 1728*257 + 1702;
nz.push_back(coo);
coo = 1728*258 + 259;
nz.push_back(coo);
coo = 1728*258 + 1463;
nz.push_back(coo);
coo = 1728*260 + 261;
nz.push_back(coo);
coo = 1728*260 + 263;
nz.push_back(coo);
coo = 1728*261 + 262;
nz.push_back(coo);
coo = 1728*262 + 271;
nz.push_back(coo);
coo = 1728*262 + 545;
nz.push_back(coo);
coo = 1728*263 + 498;
nz.push_back(coo);
coo = 1728*264 + 265;
nz.push_back(coo);
coo = 1728*264 + 269;
nz.push_back(coo);
coo = 1728*264 + 275;
nz.push_back(coo);
coo = 1728*265 + 266;
nz.push_back(coo);
coo = 1728*265 + 1710;
nz.push_back(coo);
coo = 1728*266 + 267;
nz.push_back(coo);
coo = 1728*266 + 1471;
nz.push_back(coo);
coo = 1728*268 + 269;
nz.push_back(coo);
coo = 1728*268 + 271;
nz.push_back(coo);
coo = 1728*269 + 270;
nz.push_back(coo);
coo = 1728*270 + 279;
nz.push_back(coo);
coo = 1728*270 + 553;
nz.push_back(coo);
coo = 1728*271 + 506;
nz.push_back(coo);
coo = 1728*272 + 273;
nz.push_back(coo);
coo = 1728*272 + 277;
nz.push_back(coo);
coo = 1728*272 + 283;
nz.push_back(coo);
coo = 1728*273 + 274;
nz.push_back(coo);
coo = 1728*273 + 1718;
nz.push_back(coo);
coo = 1728*274 + 275;
nz.push_back(coo);
coo = 1728*274 + 1479;
nz.push_back(coo);
coo = 1728*276 + 277;
nz.push_back(coo);
coo = 1728*276 + 279;
nz.push_back(coo);
coo = 1728*277 + 278;
nz.push_back(coo);
coo = 1728*278 + 287;
nz.push_back(coo);
coo = 1728*278 + 561;
nz.push_back(coo);
coo = 1728*279 + 514;
nz.push_back(coo);
coo = 1728*280 + 281;
nz.push_back(coo);
coo = 1728*280 + 285;
nz.push_back(coo);
coo = 1728*281 + 282;
nz.push_back(coo);
coo = 1728*281 + 1726;
nz.push_back(coo);
coo = 1728*282 + 283;
nz.push_back(coo);
coo = 1728*282 + 1487;
nz.push_back(coo);
coo = 1728*284 + 285;
nz.push_back(coo);
coo = 1728*284 + 287;
nz.push_back(coo);
coo = 1728*285 + 286;
nz.push_back(coo);
coo = 1728*286 + 569;
nz.push_back(coo);
coo = 1728*287 + 522;
nz.push_back(coo);
coo = 1728*288 + 289;
nz.push_back(coo);
coo = 1728*288 + 293;
nz.push_back(coo);
coo = 1728*288 + 299;
nz.push_back(coo);
coo = 1728*289 + 290;
nz.push_back(coo);
coo = 1728*290 + 291;
nz.push_back(coo);
coo = 1728*291 + 328;
nz.push_back(coo);
coo = 1728*291 + 340;
nz.push_back(coo);
coo = 1728*292 + 293;
nz.push_back(coo);
coo = 1728*292 + 295;
nz.push_back(coo);
coo = 1728*292 + 531;
nz.push_back(coo);
coo = 1728*293 + 294;
nz.push_back(coo);
coo = 1728*294 + 303;
nz.push_back(coo);
coo = 1728*294 + 577;
nz.push_back(coo);
coo = 1728*295 + 334;
nz.push_back(coo);
coo = 1728*295 + 818;
nz.push_back(coo);
coo = 1728*296 + 297;
nz.push_back(coo);
coo = 1728*296 + 301;
nz.push_back(coo);
coo = 1728*296 + 307;
nz.push_back(coo);
coo = 1728*297 + 298;
nz.push_back(coo);
coo = 1728*298 + 299;
nz.push_back(coo);
coo = 1728*299 + 348;
nz.push_back(coo);
coo = 1728*300 + 301;
nz.push_back(coo);
coo = 1728*300 + 303;
nz.push_back(coo);
coo = 1728*300 + 539;
nz.push_back(coo);
coo = 1728*301 + 302;
nz.push_back(coo);
coo = 1728*302 + 311;
nz.push_back(coo);
coo = 1728*302 + 585;
nz.push_back(coo);
coo = 1728*303 + 826;
nz.push_back(coo);
coo = 1728*304 + 305;
nz.push_back(coo);
coo = 1728*304 + 309;
nz.push_back(coo);
coo = 1728*304 + 315;
nz.push_back(coo);
coo = 1728*305 + 306;
nz.push_back(coo);
coo = 1728*306 + 307;
nz.push_back(coo);
coo = 1728*307 + 356;
nz.push_back(coo);
coo = 1728*308 + 309;
nz.push_back(coo);
coo = 1728*308 + 311;
nz.push_back(coo);
coo = 1728*308 + 547;
nz.push_back(coo);
coo = 1728*309 + 310;
nz.push_back(coo);
coo = 1728*310 + 319;
nz.push_back(coo);
coo = 1728*310 + 593;
nz.push_back(coo);
coo = 1728*311 + 834;
nz.push_back(coo);
coo = 1728*312 + 313;
nz.push_back(coo);
coo = 1728*312 + 317;
nz.push_back(coo);
coo = 1728*312 + 323;
nz.push_back(coo);
coo = 1728*313 + 314;
nz.push_back(coo);
coo = 1728*314 + 315;
nz.push_back(coo);
coo = 1728*315 + 364;
nz.push_back(coo);
coo = 1728*316 + 317;
nz.push_back(coo);
coo = 1728*316 + 319;
nz.push_back(coo);
coo = 1728*316 + 555;
nz.push_back(coo);
coo = 1728*317 + 318;
nz.push_back(coo);
coo = 1728*318 + 327;
nz.push_back(coo);
coo = 1728*318 + 601;
nz.push_back(coo);
coo = 1728*319 + 842;
nz.push_back(coo);
coo = 1728*320 + 321;
nz.push_back(coo);
coo = 1728*320 + 325;
nz.push_back(coo);
coo = 1728*320 + 331;
nz.push_back(coo);
coo = 1728*321 + 322;
nz.push_back(coo);
coo = 1728*322 + 323;
nz.push_back(coo);
coo = 1728*323 + 372;
nz.push_back(coo);
coo = 1728*324 + 325;
nz.push_back(coo);
coo = 1728*324 + 327;
nz.push_back(coo);
coo = 1728*324 + 563;
nz.push_back(coo);
coo = 1728*325 + 326;
nz.push_back(coo);
coo = 1728*326 + 335;
nz.push_back(coo);
coo = 1728*326 + 609;
nz.push_back(coo);
coo = 1728*327 + 850;
nz.push_back(coo);
coo = 1728*328 + 329;
nz.push_back(coo);
coo = 1728*328 + 333;
nz.push_back(coo);
coo = 1728*329 + 330;
nz.push_back(coo);
coo = 1728*330 + 331;
nz.push_back(coo);
coo = 1728*331 + 380;
nz.push_back(coo);
coo = 1728*332 + 333;
nz.push_back(coo);
coo = 1728*332 + 335;
nz.push_back(coo);
coo = 1728*332 + 571;
nz.push_back(coo);
coo = 1728*333 + 334;
nz.push_back(coo);
coo = 1728*334 + 617;
nz.push_back(coo);
coo = 1728*335 + 858;
nz.push_back(coo);
coo = 1728*336 + 337;
nz.push_back(coo);
coo = 1728*336 + 341;
nz.push_back(coo);
coo = 1728*336 + 347;
nz.push_back(coo);
coo = 1728*337 + 338;
nz.push_back(coo);
coo = 1728*338 + 339;
nz.push_back(coo);
coo = 1728*339 + 376;
nz.push_back(coo);
coo = 1728*339 + 388;
nz.push_back(coo);
coo = 1728*340 + 341;
nz.push_back(coo);
coo = 1728*340 + 343;
nz.push_back(coo);
coo = 1728*341 + 342;
nz.push_back(coo);
coo = 1728*342 + 351;
nz.push_back(coo);
coo = 1728*342 + 625;
nz.push_back(coo);
coo = 1728*343 + 382;
nz.push_back(coo);
coo = 1728*343 + 578;
nz.push_back(coo);
coo = 1728*344 + 345;
nz.push_back(coo);
coo = 1728*344 + 349;
nz.push_back(coo);
coo = 1728*344 + 355;
nz.push_back(coo);
coo = 1728*345 + 346;
nz.push_back(coo);
coo = 1728*346 + 347;
nz.push_back(coo);
coo = 1728*347 + 396;
nz.push_back(coo);
coo = 1728*348 + 349;
nz.push_back(coo);
coo = 1728*348 + 351;
nz.push_back(coo);
coo = 1728*349 + 350;
nz.push_back(coo);
coo = 1728*350 + 359;
nz.push_back(coo);
coo = 1728*350 + 633;
nz.push_back(coo);
coo = 1728*351 + 586;
nz.push_back(coo);
coo = 1728*352 + 353;
nz.push_back(coo);
coo = 1728*352 + 357;
nz.push_back(coo);
coo = 1728*352 + 363;
nz.push_back(coo);
coo = 1728*353 + 354;
nz.push_back(coo);
coo = 1728*354 + 355;
nz.push_back(coo);
coo = 1728*355 + 404;
nz.push_back(coo);
coo = 1728*356 + 357;
nz.push_back(coo);
coo = 1728*356 + 359;
nz.push_back(coo);
coo = 1728*357 + 358;
nz.push_back(coo);
coo = 1728*358 + 367;
nz.push_back(coo);
coo = 1728*358 + 641;
nz.push_back(coo);
coo = 1728*359 + 594;
nz.push_back(coo);
coo = 1728*360 + 361;
nz.push_back(coo);
coo = 1728*360 + 365;
nz.push_back(coo);
coo = 1728*360 + 371;
nz.push_back(coo);
coo = 1728*361 + 362;
nz.push_back(coo);
coo = 1728*362 + 363;
nz.push_back(coo);
coo = 1728*363 + 412;
nz.push_back(coo);
coo = 1728*364 + 365;
nz.push_back(coo);
coo = 1728*364 + 367;
nz.push_back(coo);
coo = 1728*365 + 366;
nz.push_back(coo);
coo = 1728*366 + 375;
nz.push_back(coo);
coo = 1728*366 + 649;
nz.push_back(coo);
coo = 1728*367 + 602;
nz.push_back(coo);
coo = 1728*368 + 369;
nz.push_back(coo);
coo = 1728*368 + 373;
nz.push_back(coo);
coo = 1728*368 + 379;
nz.push_back(coo);
coo = 1728*369 + 370;
nz.push_back(coo);
coo = 1728*370 + 371;
nz.push_back(coo);
coo = 1728*371 + 420;
nz.push_back(coo);
coo = 1728*372 + 373;
nz.push_back(coo);
coo = 1728*372 + 375;
nz.push_back(coo);
coo = 1728*373 + 374;
nz.push_back(coo);
coo = 1728*374 + 383;
nz.push_back(coo);
coo = 1728*374 + 657;
nz.push_back(coo);
coo = 1728*375 + 610;
nz.push_back(coo);
coo = 1728*376 + 377;
nz.push_back(coo);
coo = 1728*376 + 381;
nz.push_back(coo);
coo = 1728*377 + 378;
nz.push_back(coo);
coo = 1728*378 + 379;
nz.push_back(coo);
coo = 1728*379 + 428;
nz.push_back(coo);
coo = 1728*380 + 381;
nz.push_back(coo);
coo = 1728*380 + 383;
nz.push_back(coo);
coo = 1728*381 + 382;
nz.push_back(coo);
coo = 1728*382 + 665;
nz.push_back(coo);
coo = 1728*383 + 618;
nz.push_back(coo);
coo = 1728*384 + 385;
nz.push_back(coo);
coo = 1728*384 + 389;
nz.push_back(coo);
coo = 1728*384 + 395;
nz.push_back(coo);
coo = 1728*385 + 386;
nz.push_back(coo);
coo = 1728*386 + 387;
nz.push_back(coo);
coo = 1728*387 + 424;
nz.push_back(coo);
coo = 1728*387 + 436;
nz.push_back(coo);
coo = 1728*388 + 389;
nz.push_back(coo);
coo = 1728*388 + 391;
nz.push_back(coo);
coo = 1728*389 + 390;
nz.push_back(coo);
coo = 1728*390 + 399;
nz.push_back(coo);
coo = 1728*390 + 673;
nz.push_back(coo);
coo = 1728*391 + 430;
nz.push_back(coo);
coo = 1728*391 + 626;
nz.push_back(coo);
coo = 1728*392 + 393;
nz.push_back(coo);
coo = 1728*392 + 397;
nz.push_back(coo);
coo = 1728*392 + 403;
nz.push_back(coo);
coo = 1728*393 + 394;
nz.push_back(coo);
coo = 1728*394 + 395;
nz.push_back(coo);
coo = 1728*395 + 444;
nz.push_back(coo);
coo = 1728*396 + 397;
nz.push_back(coo);
coo = 1728*396 + 399;
nz.push_back(coo);
coo = 1728*397 + 398;
nz.push_back(coo);
coo = 1728*398 + 407;
nz.push_back(coo);
coo = 1728*398 + 681;
nz.push_back(coo);
coo = 1728*399 + 634;
nz.push_back(coo);
coo = 1728*400 + 401;
nz.push_back(coo);
coo = 1728*400 + 405;
nz.push_back(coo);
coo = 1728*400 + 411;
nz.push_back(coo);
coo = 1728*401 + 402;
nz.push_back(coo);
coo = 1728*402 + 403;
nz.push_back(coo);
coo = 1728*403 + 452;
nz.push_back(coo);
coo = 1728*404 + 405;
nz.push_back(coo);
coo = 1728*404 + 407;
nz.push_back(coo);
coo = 1728*405 + 406;
nz.push_back(coo);
coo = 1728*406 + 415;
nz.push_back(coo);
coo = 1728*406 + 689;
nz.push_back(coo);
coo = 1728*407 + 642;
nz.push_back(coo);
coo = 1728*408 + 409;
nz.push_back(coo);
coo = 1728*408 + 413;
nz.push_back(coo);
coo = 1728*408 + 419;
nz.push_back(coo);
coo = 1728*409 + 410;
nz.push_back(coo);
coo = 1728*410 + 411;
nz.push_back(coo);
coo = 1728*411 + 460;
nz.push_back(coo);
coo = 1728*412 + 413;
nz.push_back(coo);
coo = 1728*412 + 415;
nz.push_back(coo);
coo = 1728*413 + 414;
nz.push_back(coo);
coo = 1728*414 + 423;
nz.push_back(coo);
coo = 1728*414 + 697;
nz.push_back(coo);
coo = 1728*415 + 650;
nz.push_back(coo);
coo = 1728*416 + 417;
nz.push_back(coo);
coo = 1728*416 + 421;
nz.push_back(coo);
coo = 1728*416 + 427;
nz.push_back(coo);
coo = 1728*417 + 418;
nz.push_back(coo);
coo = 1728*418 + 419;
nz.push_back(coo);
coo = 1728*419 + 468;
nz.push_back(coo);
coo = 1728*420 + 421;
nz.push_back(coo);
coo = 1728*420 + 423;
nz.push_back(coo);
coo = 1728*421 + 422;
nz.push_back(coo);
coo = 1728*422 + 431;
nz.push_back(coo);
coo = 1728*422 + 705;
nz.push_back(coo);
coo = 1728*423 + 658;
nz.push_back(coo);
coo = 1728*424 + 425;
nz.push_back(coo);
coo = 1728*424 + 429;
nz.push_back(coo);
coo = 1728*425 + 426;
nz.push_back(coo);
coo = 1728*426 + 427;
nz.push_back(coo);
coo = 1728*427 + 476;
nz.push_back(coo);
coo = 1728*428 + 429;
nz.push_back(coo);
coo = 1728*428 + 431;
nz.push_back(coo);
coo = 1728*429 + 430;
nz.push_back(coo);
coo = 1728*430 + 713;
nz.push_back(coo);
coo = 1728*431 + 666;
nz.push_back(coo);
coo = 1728*432 + 433;
nz.push_back(coo);
coo = 1728*432 + 437;
nz.push_back(coo);
coo = 1728*432 + 443;
nz.push_back(coo);
coo = 1728*433 + 434;
nz.push_back(coo);
coo = 1728*434 + 435;
nz.push_back(coo);
coo = 1728*435 + 472;
nz.push_back(coo);
coo = 1728*435 + 484;
nz.push_back(coo);
coo = 1728*436 + 437;
nz.push_back(coo);
coo = 1728*436 + 439;
nz.push_back(coo);
coo = 1728*437 + 438;
nz.push_back(coo);
coo = 1728*438 + 447;
nz.push_back(coo);
coo = 1728*438 + 721;
nz.push_back(coo);
coo = 1728*439 + 478;
nz.push_back(coo);
coo = 1728*439 + 674;
nz.push_back(coo);
coo = 1728*440 + 441;
nz.push_back(coo);
coo = 1728*440 + 445;
nz.push_back(coo);
coo = 1728*440 + 451;
nz.push_back(coo);
coo = 1728*441 + 442;
nz.push_back(coo);
coo = 1728*442 + 443;
nz.push_back(coo);
coo = 1728*443 + 492;
nz.push_back(coo);
coo = 1728*444 + 445;
nz.push_back(coo);
coo = 1728*444 + 447;
nz.push_back(coo);
coo = 1728*445 + 446;
nz.push_back(coo);
coo = 1728*446 + 455;
nz.push_back(coo);
coo = 1728*446 + 729;
nz.push_back(coo);
coo = 1728*447 + 682;
nz.push_back(coo);
coo = 1728*448 + 449;
nz.push_back(coo);
coo = 1728*448 + 453;
nz.push_back(coo);
coo = 1728*448 + 459;
nz.push_back(coo);
coo = 1728*449 + 450;
nz.push_back(coo);
coo = 1728*450 + 451;
nz.push_back(coo);
coo = 1728*451 + 500;
nz.push_back(coo);
coo = 1728*452 + 453;
nz.push_back(coo);
coo = 1728*452 + 455;
nz.push_back(coo);
coo = 1728*453 + 454;
nz.push_back(coo);
coo = 1728*454 + 463;
nz.push_back(coo);
coo = 1728*454 + 737;
nz.push_back(coo);
coo = 1728*455 + 690;
nz.push_back(coo);
coo = 1728*456 + 457;
nz.push_back(coo);
coo = 1728*456 + 461;
nz.push_back(coo);
coo = 1728*456 + 467;
nz.push_back(coo);
coo = 1728*457 + 458;
nz.push_back(coo);
coo = 1728*458 + 459;
nz.push_back(coo);
coo = 1728*459 + 508;
nz.push_back(coo);
coo = 1728*460 + 461;
nz.push_back(coo);
coo = 1728*460 + 463;
nz.push_back(coo);
coo = 1728*461 + 462;
nz.push_back(coo);
coo = 1728*462 + 471;
nz.push_back(coo);
coo = 1728*462 + 745;
nz.push_back(coo);
coo = 1728*463 + 698;
nz.push_back(coo);
coo = 1728*464 + 465;
nz.push_back(coo);
coo = 1728*464 + 469;
nz.push_back(coo);
coo = 1728*464 + 475;
nz.push_back(coo);
coo = 1728*465 + 466;
nz.push_back(coo);
coo = 1728*466 + 467;
nz.push_back(coo);
coo = 1728*467 + 516;
nz.push_back(coo);
coo = 1728*468 + 469;
nz.push_back(coo);
coo = 1728*468 + 471;
nz.push_back(coo);
coo = 1728*469 + 470;
nz.push_back(coo);
coo = 1728*470 + 479;
nz.push_back(coo);
coo = 1728*470 + 753;
nz.push_back(coo);
coo = 1728*471 + 706;
nz.push_back(coo);
coo = 1728*472 + 473;
nz.push_back(coo);
coo = 1728*472 + 477;
nz.push_back(coo);
coo = 1728*473 + 474;
nz.push_back(coo);
coo = 1728*474 + 475;
nz.push_back(coo);
coo = 1728*475 + 524;
nz.push_back(coo);
coo = 1728*476 + 477;
nz.push_back(coo);
coo = 1728*476 + 479;
nz.push_back(coo);
coo = 1728*477 + 478;
nz.push_back(coo);
coo = 1728*478 + 761;
nz.push_back(coo);
coo = 1728*479 + 714;
nz.push_back(coo);
coo = 1728*480 + 481;
nz.push_back(coo);
coo = 1728*480 + 485;
nz.push_back(coo);
coo = 1728*480 + 491;
nz.push_back(coo);
coo = 1728*481 + 482;
nz.push_back(coo);
coo = 1728*482 + 483;
nz.push_back(coo);
coo = 1728*483 + 520;
nz.push_back(coo);
coo = 1728*483 + 532;
nz.push_back(coo);
coo = 1728*484 + 485;
nz.push_back(coo);
coo = 1728*484 + 487;
nz.push_back(coo);
coo = 1728*485 + 486;
nz.push_back(coo);
coo = 1728*486 + 495;
nz.push_back(coo);
coo = 1728*486 + 769;
nz.push_back(coo);
coo = 1728*487 + 526;
nz.push_back(coo);
coo = 1728*487 + 722;
nz.push_back(coo);
coo = 1728*488 + 489;
nz.push_back(coo);
coo = 1728*488 + 493;
nz.push_back(coo);
coo = 1728*488 + 499;
nz.push_back(coo);
coo = 1728*489 + 490;
nz.push_back(coo);
coo = 1728*490 + 491;
nz.push_back(coo);
coo = 1728*491 + 540;
nz.push_back(coo);
coo = 1728*492 + 493;
nz.push_back(coo);
coo = 1728*492 + 495;
nz.push_back(coo);
coo = 1728*493 + 494;
nz.push_back(coo);
coo = 1728*494 + 503;
nz.push_back(coo);
coo = 1728*494 + 777;
nz.push_back(coo);
coo = 1728*495 + 730;
nz.push_back(coo);
coo = 1728*496 + 497;
nz.push_back(coo);
coo = 1728*496 + 501;
nz.push_back(coo);
coo = 1728*496 + 507;
nz.push_back(coo);
coo = 1728*497 + 498;
nz.push_back(coo);
coo = 1728*498 + 499;
nz.push_back(coo);
coo = 1728*499 + 548;
nz.push_back(coo);
coo = 1728*500 + 501;
nz.push_back(coo);
coo = 1728*500 + 503;
nz.push_back(coo);
coo = 1728*501 + 502;
nz.push_back(coo);
coo = 1728*502 + 511;
nz.push_back(coo);
coo = 1728*502 + 785;
nz.push_back(coo);
coo = 1728*503 + 738;
nz.push_back(coo);
coo = 1728*504 + 505;
nz.push_back(coo);
coo = 1728*504 + 509;
nz.push_back(coo);
coo = 1728*504 + 515;
nz.push_back(coo);
coo = 1728*505 + 506;
nz.push_back(coo);
coo = 1728*506 + 507;
nz.push_back(coo);
coo = 1728*507 + 556;
nz.push_back(coo);
coo = 1728*508 + 509;
nz.push_back(coo);
coo = 1728*508 + 511;
nz.push_back(coo);
coo = 1728*509 + 510;
nz.push_back(coo);
coo = 1728*510 + 519;
nz.push_back(coo);
coo = 1728*510 + 793;
nz.push_back(coo);
coo = 1728*511 + 746;
nz.push_back(coo);
coo = 1728*512 + 513;
nz.push_back(coo);
coo = 1728*512 + 517;
nz.push_back(coo);
coo = 1728*512 + 523;
nz.push_back(coo);
coo = 1728*513 + 514;
nz.push_back(coo);
coo = 1728*514 + 515;
nz.push_back(coo);
coo = 1728*515 + 564;
nz.push_back(coo);
coo = 1728*516 + 517;
nz.push_back(coo);
coo = 1728*516 + 519;
nz.push_back(coo);
coo = 1728*517 + 518;
nz.push_back(coo);
coo = 1728*518 + 527;
nz.push_back(coo);
coo = 1728*518 + 801;
nz.push_back(coo);
coo = 1728*519 + 754;
nz.push_back(coo);
coo = 1728*520 + 521;
nz.push_back(coo);
coo = 1728*520 + 525;
nz.push_back(coo);
coo = 1728*521 + 522;
nz.push_back(coo);
coo = 1728*522 + 523;
nz.push_back(coo);
coo = 1728*523 + 572;
nz.push_back(coo);
coo = 1728*524 + 525;
nz.push_back(coo);
coo = 1728*524 + 527;
nz.push_back(coo);
coo = 1728*525 + 526;
nz.push_back(coo);
coo = 1728*526 + 809;
nz.push_back(coo);
coo = 1728*527 + 762;
nz.push_back(coo);
coo = 1728*528 + 529;
nz.push_back(coo);
coo = 1728*528 + 533;
nz.push_back(coo);
coo = 1728*528 + 539;
nz.push_back(coo);
coo = 1728*529 + 530;
nz.push_back(coo);
coo = 1728*530 + 531;
nz.push_back(coo);
coo = 1728*531 + 568;
nz.push_back(coo);
coo = 1728*532 + 533;
nz.push_back(coo);
coo = 1728*532 + 535;
nz.push_back(coo);
coo = 1728*533 + 534;
nz.push_back(coo);
coo = 1728*534 + 543;
nz.push_back(coo);
coo = 1728*534 + 817;
nz.push_back(coo);
coo = 1728*535 + 574;
nz.push_back(coo);
coo = 1728*535 + 770;
nz.push_back(coo);
coo = 1728*536 + 537;
nz.push_back(coo);
coo = 1728*536 + 541;
nz.push_back(coo);
coo = 1728*536 + 547;
nz.push_back(coo);
coo = 1728*537 + 538;
nz.push_back(coo);
coo = 1728*538 + 539;
nz.push_back(coo);
coo = 1728*540 + 541;
nz.push_back(coo);
coo = 1728*540 + 543;
nz.push_back(coo);
coo = 1728*541 + 542;
nz.push_back(coo);
coo = 1728*542 + 551;
nz.push_back(coo);
coo = 1728*542 + 825;
nz.push_back(coo);
coo = 1728*543 + 778;
nz.push_back(coo);
coo = 1728*544 + 545;
nz.push_back(coo);
coo = 1728*544 + 549;
nz.push_back(coo);
coo = 1728*544 + 555;
nz.push_back(coo);
coo = 1728*545 + 546;
nz.push_back(coo);
coo = 1728*546 + 547;
nz.push_back(coo);
coo = 1728*548 + 549;
nz.push_back(coo);
coo = 1728*548 + 551;
nz.push_back(coo);
coo = 1728*549 + 550;
nz.push_back(coo);
coo = 1728*550 + 559;
nz.push_back(coo);
coo = 1728*550 + 833;
nz.push_back(coo);
coo = 1728*551 + 786;
nz.push_back(coo);
coo = 1728*552 + 553;
nz.push_back(coo);
coo = 1728*552 + 557;
nz.push_back(coo);
coo = 1728*552 + 563;
nz.push_back(coo);
coo = 1728*553 + 554;
nz.push_back(coo);
coo = 1728*554 + 555;
nz.push_back(coo);
coo = 1728*556 + 557;
nz.push_back(coo);
coo = 1728*556 + 559;
nz.push_back(coo);
coo = 1728*557 + 558;
nz.push_back(coo);
coo = 1728*558 + 567;
nz.push_back(coo);
coo = 1728*558 + 841;
nz.push_back(coo);
coo = 1728*559 + 794;
nz.push_back(coo);
coo = 1728*560 + 561;
nz.push_back(coo);
coo = 1728*560 + 565;
nz.push_back(coo);
coo = 1728*560 + 571;
nz.push_back(coo);
coo = 1728*561 + 562;
nz.push_back(coo);
coo = 1728*562 + 563;
nz.push_back(coo);
coo = 1728*564 + 565;
nz.push_back(coo);
coo = 1728*564 + 567;
nz.push_back(coo);
coo = 1728*565 + 566;
nz.push_back(coo);
coo = 1728*566 + 575;
nz.push_back(coo);
coo = 1728*566 + 849;
nz.push_back(coo);
coo = 1728*567 + 802;
nz.push_back(coo);
coo = 1728*568 + 569;
nz.push_back(coo);
coo = 1728*568 + 573;
nz.push_back(coo);
coo = 1728*569 + 570;
nz.push_back(coo);
coo = 1728*570 + 571;
nz.push_back(coo);
coo = 1728*572 + 573;
nz.push_back(coo);
coo = 1728*572 + 575;
nz.push_back(coo);
coo = 1728*573 + 574;
nz.push_back(coo);
coo = 1728*574 + 857;
nz.push_back(coo);
coo = 1728*575 + 810;
nz.push_back(coo);
coo = 1728*576 + 577;
nz.push_back(coo);
coo = 1728*576 + 581;
nz.push_back(coo);
coo = 1728*576 + 587;
nz.push_back(coo);
coo = 1728*577 + 578;
nz.push_back(coo);
coo = 1728*578 + 579;
nz.push_back(coo);
coo = 1728*579 + 616;
nz.push_back(coo);
coo = 1728*579 + 628;
nz.push_back(coo);
coo = 1728*580 + 581;
nz.push_back(coo);
coo = 1728*580 + 583;
nz.push_back(coo);
coo = 1728*580 + 819;
nz.push_back(coo);
coo = 1728*581 + 582;
nz.push_back(coo);
coo = 1728*582 + 591;
nz.push_back(coo);
coo = 1728*582 + 865;
nz.push_back(coo);
coo = 1728*583 + 622;
nz.push_back(coo);
coo = 1728*583 + 1106;
nz.push_back(coo);
coo = 1728*584 + 585;
nz.push_back(coo);
coo = 1728*584 + 589;
nz.push_back(coo);
coo = 1728*584 + 595;
nz.push_back(coo);
coo = 1728*585 + 586;
nz.push_back(coo);
coo = 1728*586 + 587;
nz.push_back(coo);
coo = 1728*587 + 636;
nz.push_back(coo);
coo = 1728*588 + 589;
nz.push_back(coo);
coo = 1728*588 + 591;
nz.push_back(coo);
coo = 1728*588 + 827;
nz.push_back(coo);
coo = 1728*589 + 590;
nz.push_back(coo);
coo = 1728*590 + 599;
nz.push_back(coo);
coo = 1728*590 + 873;
nz.push_back(coo);
coo = 1728*591 + 1114;
nz.push_back(coo);
coo = 1728*592 + 593;
nz.push_back(coo);
coo = 1728*592 + 597;
nz.push_back(coo);
coo = 1728*592 + 603;
nz.push_back(coo);
coo = 1728*593 + 594;
nz.push_back(coo);
coo = 1728*594 + 595;
nz.push_back(coo);
coo = 1728*595 + 644;
nz.push_back(coo);
coo = 1728*596 + 597;
nz.push_back(coo);
coo = 1728*596 + 599;
nz.push_back(coo);
coo = 1728*596 + 835;
nz.push_back(coo);
coo = 1728*597 + 598;
nz.push_back(coo);
coo = 1728*598 + 607;
nz.push_back(coo);
coo = 1728*598 + 881;
nz.push_back(coo);
coo = 1728*599 + 1122;
nz.push_back(coo);
coo = 1728*600 + 601;
nz.push_back(coo);
coo = 1728*600 + 605;
nz.push_back(coo);
coo = 1728*600 + 611;
nz.push_back(coo);
coo = 1728*601 + 602;
nz.push_back(coo);
coo = 1728*602 + 603;
nz.push_back(coo);
coo = 1728*603 + 652;
nz.push_back(coo);
coo = 1728*604 + 605;
nz.push_back(coo);
coo = 1728*604 + 607;
nz.push_back(coo);
coo = 1728*604 + 843;
nz.push_back(coo);
coo = 1728*605 + 606;
nz.push_back(coo);
coo = 1728*606 + 615;
nz.push_back(coo);
coo = 1728*606 + 889;
nz.push_back(coo);
coo = 1728*607 + 1130;
nz.push_back(coo);
coo = 1728*608 + 609;
nz.push_back(coo);
coo = 1728*608 + 613;
nz.push_back(coo);
coo = 1728*608 + 619;
nz.push_back(coo);
coo = 1728*609 + 610;
nz.push_back(coo);
coo = 1728*610 + 611;
nz.push_back(coo);
coo = 1728*611 + 660;
nz.push_back(coo);
coo = 1728*612 + 613;
nz.push_back(coo);
coo = 1728*612 + 615;
nz.push_back(coo);
coo = 1728*612 + 851;
nz.push_back(coo);
coo = 1728*613 + 614;
nz.push_back(coo);
coo = 1728*614 + 623;
nz.push_back(coo);
coo = 1728*614 + 897;
nz.push_back(coo);
coo = 1728*615 + 1138;
nz.push_back(coo);
coo = 1728*616 + 617;
nz.push_back(coo);
coo = 1728*616 + 621;
nz.push_back(coo);
coo = 1728*617 + 618;
nz.push_back(coo);
coo = 1728*618 + 619;
nz.push_back(coo);
coo = 1728*619 + 668;
nz.push_back(coo);
coo = 1728*620 + 621;
nz.push_back(coo);
coo = 1728*620 + 623;
nz.push_back(coo);
coo = 1728*620 + 859;
nz.push_back(coo);
coo = 1728*621 + 622;
nz.push_back(coo);
coo = 1728*622 + 905;
nz.push_back(coo);
coo = 1728*623 + 1146;
nz.push_back(coo);
coo = 1728*624 + 625;
nz.push_back(coo);
coo = 1728*624 + 629;
nz.push_back(coo);
coo = 1728*624 + 635;
nz.push_back(coo);
coo = 1728*625 + 626;
nz.push_back(coo);
coo = 1728*626 + 627;
nz.push_back(coo);
coo = 1728*627 + 664;
nz.push_back(coo);
coo = 1728*627 + 676;
nz.push_back(coo);
coo = 1728*628 + 629;
nz.push_back(coo);
coo = 1728*628 + 631;
nz.push_back(coo);
coo = 1728*629 + 630;
nz.push_back(coo);
coo = 1728*630 + 639;
nz.push_back(coo);
coo = 1728*630 + 913;
nz.push_back(coo);
coo = 1728*631 + 670;
nz.push_back(coo);
coo = 1728*631 + 866;
nz.push_back(coo);
coo = 1728*632 + 633;
nz.push_back(coo);
coo = 1728*632 + 637;
nz.push_back(coo);
coo = 1728*632 + 643;
nz.push_back(coo);
coo = 1728*633 + 634;
nz.push_back(coo);
coo = 1728*634 + 635;
nz.push_back(coo);
coo = 1728*635 + 684;
nz.push_back(coo);
coo = 1728*636 + 637;
nz.push_back(coo);
coo = 1728*636 + 639;
nz.push_back(coo);
coo = 1728*637 + 638;
nz.push_back(coo);
coo = 1728*638 + 647;
nz.push_back(coo);
coo = 1728*638 + 921;
nz.push_back(coo);
coo = 1728*639 + 874;
nz.push_back(coo);
coo = 1728*640 + 641;
nz.push_back(coo);
coo = 1728*640 + 645;
nz.push_back(coo);
coo = 1728*640 + 651;
nz.push_back(coo);
coo = 1728*641 + 642;
nz.push_back(coo);
coo = 1728*642 + 643;
nz.push_back(coo);
coo = 1728*643 + 692;
nz.push_back(coo);
coo = 1728*644 + 645;
nz.push_back(coo);
coo = 1728*644 + 647;
nz.push_back(coo);
coo = 1728*645 + 646;
nz.push_back(coo);
coo = 1728*646 + 655;
nz.push_back(coo);
coo = 1728*646 + 929;
nz.push_back(coo);
coo = 1728*647 + 882;
nz.push_back(coo);
coo = 1728*648 + 649;
nz.push_back(coo);
coo = 1728*648 + 653;
nz.push_back(coo);
coo = 1728*648 + 659;
nz.push_back(coo);
coo = 1728*649 + 650;
nz.push_back(coo);
coo = 1728*650 + 651;
nz.push_back(coo);
coo = 1728*651 + 700;
nz.push_back(coo);
coo = 1728*652 + 653;
nz.push_back(coo);
coo = 1728*652 + 655;
nz.push_back(coo);
coo = 1728*653 + 654;
nz.push_back(coo);
coo = 1728*654 + 663;
nz.push_back(coo);
coo = 1728*654 + 937;
nz.push_back(coo);
coo = 1728*655 + 890;
nz.push_back(coo);
coo = 1728*656 + 657;
nz.push_back(coo);
coo = 1728*656 + 661;
nz.push_back(coo);
coo = 1728*656 + 667;
nz.push_back(coo);
coo = 1728*657 + 658;
nz.push_back(coo);
coo = 1728*658 + 659;
nz.push_back(coo);
coo = 1728*659 + 708;
nz.push_back(coo);
coo = 1728*660 + 661;
nz.push_back(coo);
coo = 1728*660 + 663;
nz.push_back(coo);
coo = 1728*661 + 662;
nz.push_back(coo);
coo = 1728*662 + 671;
nz.push_back(coo);
coo = 1728*662 + 945;
nz.push_back(coo);
coo = 1728*663 + 898;
nz.push_back(coo);
coo = 1728*664 + 665;
nz.push_back(coo);
coo = 1728*664 + 669;
nz.push_back(coo);
coo = 1728*665 + 666;
nz.push_back(coo);
coo = 1728*666 + 667;
nz.push_back(coo);
coo = 1728*667 + 716;
nz.push_back(coo);
coo = 1728*668 + 669;
nz.push_back(coo);
coo = 1728*668 + 671;
nz.push_back(coo);
coo = 1728*669 + 670;
nz.push_back(coo);
coo = 1728*670 + 953;
nz.push_back(coo);
coo = 1728*671 + 906;
nz.push_back(coo);
coo = 1728*672 + 673;
nz.push_back(coo);
coo = 1728*672 + 677;
nz.push_back(coo);
coo = 1728*672 + 683;
nz.push_back(coo);
coo = 1728*673 + 674;
nz.push_back(coo);
coo = 1728*674 + 675;
nz.push_back(coo);
coo = 1728*675 + 712;
nz.push_back(coo);
coo = 1728*675 + 724;
nz.push_back(coo);
coo = 1728*676 + 677;
nz.push_back(coo);
coo = 1728*676 + 679;
nz.push_back(coo);
coo = 1728*677 + 678;
nz.push_back(coo);
coo = 1728*678 + 687;
nz.push_back(coo);
coo = 1728*678 + 961;
nz.push_back(coo);
coo = 1728*679 + 718;
nz.push_back(coo);
coo = 1728*679 + 914;
nz.push_back(coo);
coo = 1728*680 + 681;
nz.push_back(coo);
coo = 1728*680 + 685;
nz.push_back(coo);
coo = 1728*680 + 691;
nz.push_back(coo);
coo = 1728*681 + 682;
nz.push_back(coo);
coo = 1728*682 + 683;
nz.push_back(coo);
coo = 1728*683 + 732;
nz.push_back(coo);
coo = 1728*684 + 685;
nz.push_back(coo);
coo = 1728*684 + 687;
nz.push_back(coo);
coo = 1728*685 + 686;
nz.push_back(coo);
coo = 1728*686 + 695;
nz.push_back(coo);
coo = 1728*686 + 969;
nz.push_back(coo);
coo = 1728*687 + 922;
nz.push_back(coo);
coo = 1728*688 + 689;
nz.push_back(coo);
coo = 1728*688 + 693;
nz.push_back(coo);
coo = 1728*688 + 699;
nz.push_back(coo);
coo = 1728*689 + 690;
nz.push_back(coo);
coo = 1728*690 + 691;
nz.push_back(coo);
coo = 1728*691 + 740;
nz.push_back(coo);
coo = 1728*692 + 693;
nz.push_back(coo);
coo = 1728*692 + 695;
nz.push_back(coo);
coo = 1728*693 + 694;
nz.push_back(coo);
coo = 1728*694 + 703;
nz.push_back(coo);
coo = 1728*694 + 977;
nz.push_back(coo);
coo = 1728*695 + 930;
nz.push_back(coo);
coo = 1728*696 + 697;
nz.push_back(coo);
coo = 1728*696 + 701;
nz.push_back(coo);
coo = 1728*696 + 707;
nz.push_back(coo);
coo = 1728*697 + 698;
nz.push_back(coo);
coo = 1728*698 + 699;
nz.push_back(coo);
coo = 1728*699 + 748;
nz.push_back(coo);
coo = 1728*700 + 701;
nz.push_back(coo);
coo = 1728*700 + 703;
nz.push_back(coo);
coo = 1728*701 + 702;
nz.push_back(coo);
coo = 1728*702 + 711;
nz.push_back(coo);
coo = 1728*702 + 985;
nz.push_back(coo);
coo = 1728*703 + 938;
nz.push_back(coo);
coo = 1728*704 + 705;
nz.push_back(coo);
coo = 1728*704 + 709;
nz.push_back(coo);
coo = 1728*704 + 715;
nz.push_back(coo);
coo = 1728*705 + 706;
nz.push_back(coo);
coo = 1728*706 + 707;
nz.push_back(coo);
coo = 1728*707 + 756;
nz.push_back(coo);
coo = 1728*708 + 709;
nz.push_back(coo);
coo = 1728*708 + 711;
nz.push_back(coo);
coo = 1728*709 + 710;
nz.push_back(coo);
coo = 1728*710 + 719;
nz.push_back(coo);
coo = 1728*710 + 993;
nz.push_back(coo);
coo = 1728*711 + 946;
nz.push_back(coo);
coo = 1728*712 + 713;
nz.push_back(coo);
coo = 1728*712 + 717;
nz.push_back(coo);
coo = 1728*713 + 714;
nz.push_back(coo);
coo = 1728*714 + 715;
nz.push_back(coo);
coo = 1728*715 + 764;
nz.push_back(coo);
coo = 1728*716 + 717;
nz.push_back(coo);
coo = 1728*716 + 719;
nz.push_back(coo);
coo = 1728*717 + 718;
nz.push_back(coo);
coo = 1728*718 + 1001;
nz.push_back(coo);
coo = 1728*719 + 954;
nz.push_back(coo);
coo = 1728*720 + 721;
nz.push_back(coo);
coo = 1728*720 + 725;
nz.push_back(coo);
coo = 1728*720 + 731;
nz.push_back(coo);
coo = 1728*721 + 722;
nz.push_back(coo);
coo = 1728*722 + 723;
nz.push_back(coo);
coo = 1728*723 + 760;
nz.push_back(coo);
coo = 1728*723 + 772;
nz.push_back(coo);
coo = 1728*724 + 725;
nz.push_back(coo);
coo = 1728*724 + 727;
nz.push_back(coo);
coo = 1728*725 + 726;
nz.push_back(coo);
coo = 1728*726 + 735;
nz.push_back(coo);
coo = 1728*726 + 1009;
nz.push_back(coo);
coo = 1728*727 + 766;
nz.push_back(coo);
coo = 1728*727 + 962;
nz.push_back(coo);
coo = 1728*728 + 729;
nz.push_back(coo);
coo = 1728*728 + 733;
nz.push_back(coo);
coo = 1728*728 + 739;
nz.push_back(coo);
coo = 1728*729 + 730;
nz.push_back(coo);
coo = 1728*730 + 731;
nz.push_back(coo);
coo = 1728*731 + 780;
nz.push_back(coo);
coo = 1728*732 + 733;
nz.push_back(coo);
coo = 1728*732 + 735;
nz.push_back(coo);
coo = 1728*733 + 734;
nz.push_back(coo);
coo = 1728*734 + 743;
nz.push_back(coo);
coo = 1728*734 + 1017;
nz.push_back(coo);
coo = 1728*735 + 970;
nz.push_back(coo);
coo = 1728*736 + 737;
nz.push_back(coo);
coo = 1728*736 + 741;
nz.push_back(coo);
coo = 1728*736 + 747;
nz.push_back(coo);
coo = 1728*737 + 738;
nz.push_back(coo);
coo = 1728*738 + 739;
nz.push_back(coo);
coo = 1728*739 + 788;
nz.push_back(coo);
coo = 1728*740 + 741;
nz.push_back(coo);
coo = 1728*740 + 743;
nz.push_back(coo);
coo = 1728*741 + 742;
nz.push_back(coo);
coo = 1728*742 + 751;
nz.push_back(coo);
coo = 1728*742 + 1025;
nz.push_back(coo);
coo = 1728*743 + 978;
nz.push_back(coo);
coo = 1728*744 + 745;
nz.push_back(coo);
coo = 1728*744 + 749;
nz.push_back(coo);
coo = 1728*744 + 755;
nz.push_back(coo);
coo = 1728*745 + 746;
nz.push_back(coo);
coo = 1728*746 + 747;
nz.push_back(coo);
coo = 1728*747 + 796;
nz.push_back(coo);
coo = 1728*748 + 749;
nz.push_back(coo);
coo = 1728*748 + 751;
nz.push_back(coo);
coo = 1728*749 + 750;
nz.push_back(coo);
coo = 1728*750 + 759;
nz.push_back(coo);
coo = 1728*750 + 1033;
nz.push_back(coo);
coo = 1728*751 + 986;
nz.push_back(coo);
coo = 1728*752 + 753;
nz.push_back(coo);
coo = 1728*752 + 757;
nz.push_back(coo);
coo = 1728*752 + 763;
nz.push_back(coo);
coo = 1728*753 + 754;
nz.push_back(coo);
coo = 1728*754 + 755;
nz.push_back(coo);
coo = 1728*755 + 804;
nz.push_back(coo);
coo = 1728*756 + 757;
nz.push_back(coo);
coo = 1728*756 + 759;
nz.push_back(coo);
coo = 1728*757 + 758;
nz.push_back(coo);
coo = 1728*758 + 767;
nz.push_back(coo);
coo = 1728*758 + 1041;
nz.push_back(coo);
coo = 1728*759 + 994;
nz.push_back(coo);
coo = 1728*760 + 761;
nz.push_back(coo);
coo = 1728*760 + 765;
nz.push_back(coo);
coo = 1728*761 + 762;
nz.push_back(coo);
coo = 1728*762 + 763;
nz.push_back(coo);
coo = 1728*763 + 812;
nz.push_back(coo);
coo = 1728*764 + 765;
nz.push_back(coo);
coo = 1728*764 + 767;
nz.push_back(coo);
coo = 1728*765 + 766;
nz.push_back(coo);
coo = 1728*766 + 1049;
nz.push_back(coo);
coo = 1728*767 + 1002;
nz.push_back(coo);
coo = 1728*768 + 769;
nz.push_back(coo);
coo = 1728*768 + 773;
nz.push_back(coo);
coo = 1728*768 + 779;
nz.push_back(coo);
coo = 1728*769 + 770;
nz.push_back(coo);
coo = 1728*770 + 771;
nz.push_back(coo);
coo = 1728*771 + 808;
nz.push_back(coo);
coo = 1728*771 + 820;
nz.push_back(coo);
coo = 1728*772 + 773;
nz.push_back(coo);
coo = 1728*772 + 775;
nz.push_back(coo);
coo = 1728*773 + 774;
nz.push_back(coo);
coo = 1728*774 + 783;
nz.push_back(coo);
coo = 1728*774 + 1057;
nz.push_back(coo);
coo = 1728*775 + 814;
nz.push_back(coo);
coo = 1728*775 + 1010;
nz.push_back(coo);
coo = 1728*776 + 777;
nz.push_back(coo);
coo = 1728*776 + 781;
nz.push_back(coo);
coo = 1728*776 + 787;
nz.push_back(coo);
coo = 1728*777 + 778;
nz.push_back(coo);
coo = 1728*778 + 779;
nz.push_back(coo);
coo = 1728*779 + 828;
nz.push_back(coo);
coo = 1728*780 + 781;
nz.push_back(coo);
coo = 1728*780 + 783;
nz.push_back(coo);
coo = 1728*781 + 782;
nz.push_back(coo);
coo = 1728*782 + 791;
nz.push_back(coo);
coo = 1728*782 + 1065;
nz.push_back(coo);
coo = 1728*783 + 1018;
nz.push_back(coo);
coo = 1728*784 + 785;
nz.push_back(coo);
coo = 1728*784 + 789;
nz.push_back(coo);
coo = 1728*784 + 795;
nz.push_back(coo);
coo = 1728*785 + 786;
nz.push_back(coo);
coo = 1728*786 + 787;
nz.push_back(coo);
coo = 1728*787 + 836;
nz.push_back(coo);
coo = 1728*788 + 789;
nz.push_back(coo);
coo = 1728*788 + 791;
nz.push_back(coo);
coo = 1728*789 + 790;
nz.push_back(coo);
coo = 1728*790 + 799;
nz.push_back(coo);
coo = 1728*790 + 1073;
nz.push_back(coo);
coo = 1728*791 + 1026;
nz.push_back(coo);
coo = 1728*792 + 793;
nz.push_back(coo);
coo = 1728*792 + 797;
nz.push_back(coo);
coo = 1728*792 + 803;
nz.push_back(coo);
coo = 1728*793 + 794;
nz.push_back(coo);
coo = 1728*794 + 795;
nz.push_back(coo);
coo = 1728*795 + 844;
nz.push_back(coo);
coo = 1728*796 + 797;
nz.push_back(coo);
coo = 1728*796 + 799;
nz.push_back(coo);
coo = 1728*797 + 798;
nz.push_back(coo);
coo = 1728*798 + 807;
nz.push_back(coo);
coo = 1728*798 + 1081;
nz.push_back(coo);
coo = 1728*799 + 1034;
nz.push_back(coo);
coo = 1728*800 + 801;
nz.push_back(coo);
coo = 1728*800 + 805;
nz.push_back(coo);
coo = 1728*800 + 811;
nz.push_back(coo);
coo = 1728*801 + 802;
nz.push_back(coo);
coo = 1728*802 + 803;
nz.push_back(coo);
coo = 1728*803 + 852;
nz.push_back(coo);
coo = 1728*804 + 805;
nz.push_back(coo);
coo = 1728*804 + 807;
nz.push_back(coo);
coo = 1728*805 + 806;
nz.push_back(coo);
coo = 1728*806 + 815;
nz.push_back(coo);
coo = 1728*806 + 1089;
nz.push_back(coo);
coo = 1728*807 + 1042;
nz.push_back(coo);
coo = 1728*808 + 809;
nz.push_back(coo);
coo = 1728*808 + 813;
nz.push_back(coo);
coo = 1728*809 + 810;
nz.push_back(coo);
coo = 1728*810 + 811;
nz.push_back(coo);
coo = 1728*811 + 860;
nz.push_back(coo);
coo = 1728*812 + 813;
nz.push_back(coo);
coo = 1728*812 + 815;
nz.push_back(coo);
coo = 1728*813 + 814;
nz.push_back(coo);
coo = 1728*814 + 1097;
nz.push_back(coo);
coo = 1728*815 + 1050;
nz.push_back(coo);
coo = 1728*816 + 817;
nz.push_back(coo);
coo = 1728*816 + 821;
nz.push_back(coo);
coo = 1728*816 + 827;
nz.push_back(coo);
coo = 1728*817 + 818;
nz.push_back(coo);
coo = 1728*818 + 819;
nz.push_back(coo);
coo = 1728*819 + 856;
nz.push_back(coo);
coo = 1728*820 + 821;
nz.push_back(coo);
coo = 1728*820 + 823;
nz.push_back(coo);
coo = 1728*821 + 822;
nz.push_back(coo);
coo = 1728*822 + 831;
nz.push_back(coo);
coo = 1728*822 + 1105;
nz.push_back(coo);
coo = 1728*823 + 862;
nz.push_back(coo);
coo = 1728*823 + 1058;
nz.push_back(coo);
coo = 1728*824 + 825;
nz.push_back(coo);
coo = 1728*824 + 829;
nz.push_back(coo);
coo = 1728*824 + 835;
nz.push_back(coo);
coo = 1728*825 + 826;
nz.push_back(coo);
coo = 1728*826 + 827;
nz.push_back(coo);
coo = 1728*828 + 829;
nz.push_back(coo);
coo = 1728*828 + 831;
nz.push_back(coo);
coo = 1728*829 + 830;
nz.push_back(coo);
coo = 1728*830 + 839;
nz.push_back(coo);
coo = 1728*830 + 1113;
nz.push_back(coo);
coo = 1728*831 + 1066;
nz.push_back(coo);
coo = 1728*832 + 833;
nz.push_back(coo);
coo = 1728*832 + 837;
nz.push_back(coo);
coo = 1728*832 + 843;
nz.push_back(coo);
coo = 1728*833 + 834;
nz.push_back(coo);
coo = 1728*834 + 835;
nz.push_back(coo);
coo = 1728*836 + 837;
nz.push_back(coo);
coo = 1728*836 + 839;
nz.push_back(coo);
coo = 1728*837 + 838;
nz.push_back(coo);
coo = 1728*838 + 847;
nz.push_back(coo);
coo = 1728*838 + 1121;
nz.push_back(coo);
coo = 1728*839 + 1074;
nz.push_back(coo);
coo = 1728*840 + 841;
nz.push_back(coo);
coo = 1728*840 + 845;
nz.push_back(coo);
coo = 1728*840 + 851;
nz.push_back(coo);
coo = 1728*841 + 842;
nz.push_back(coo);
coo = 1728*842 + 843;
nz.push_back(coo);
coo = 1728*844 + 845;
nz.push_back(coo);
coo = 1728*844 + 847;
nz.push_back(coo);
coo = 1728*845 + 846;
nz.push_back(coo);
coo = 1728*846 + 855;
nz.push_back(coo);
coo = 1728*846 + 1129;
nz.push_back(coo);
coo = 1728*847 + 1082;
nz.push_back(coo);
coo = 1728*848 + 849;
nz.push_back(coo);
coo = 1728*848 + 853;
nz.push_back(coo);
coo = 1728*848 + 859;
nz.push_back(coo);
coo = 1728*849 + 850;
nz.push_back(coo);
coo = 1728*850 + 851;
nz.push_back(coo);
coo = 1728*852 + 853;
nz.push_back(coo);
coo = 1728*852 + 855;
nz.push_back(coo);
coo = 1728*853 + 854;
nz.push_back(coo);
coo = 1728*854 + 863;
nz.push_back(coo);
coo = 1728*854 + 1137;
nz.push_back(coo);
coo = 1728*855 + 1090;
nz.push_back(coo);
coo = 1728*856 + 857;
nz.push_back(coo);
coo = 1728*856 + 861;
nz.push_back(coo);
coo = 1728*857 + 858;
nz.push_back(coo);
coo = 1728*858 + 859;
nz.push_back(coo);
coo = 1728*860 + 861;
nz.push_back(coo);
coo = 1728*860 + 863;
nz.push_back(coo);
coo = 1728*861 + 862;
nz.push_back(coo);
coo = 1728*862 + 1145;
nz.push_back(coo);
coo = 1728*863 + 1098;
nz.push_back(coo);
coo = 1728*864 + 865;
nz.push_back(coo);
coo = 1728*864 + 869;
nz.push_back(coo);
coo = 1728*864 + 875;
nz.push_back(coo);
coo = 1728*865 + 866;
nz.push_back(coo);
coo = 1728*866 + 867;
nz.push_back(coo);
coo = 1728*867 + 904;
nz.push_back(coo);
coo = 1728*867 + 916;
nz.push_back(coo);
coo = 1728*868 + 869;
nz.push_back(coo);
coo = 1728*868 + 871;
nz.push_back(coo);
coo = 1728*868 + 1107;
nz.push_back(coo);
coo = 1728*869 + 870;
nz.push_back(coo);
coo = 1728*870 + 879;
nz.push_back(coo);
coo = 1728*870 + 1153;
nz.push_back(coo);
coo = 1728*871 + 910;
nz.push_back(coo);
coo = 1728*871 + 1394;
nz.push_back(coo);
coo = 1728*872 + 873;
nz.push_back(coo);
coo = 1728*872 + 877;
nz.push_back(coo);
coo = 1728*872 + 883;
nz.push_back(coo);
coo = 1728*873 + 874;
nz.push_back(coo);
coo = 1728*874 + 875;
nz.push_back(coo);
coo = 1728*875 + 924;
nz.push_back(coo);
coo = 1728*876 + 877;
nz.push_back(coo);
coo = 1728*876 + 879;
nz.push_back(coo);
coo = 1728*876 + 1115;
nz.push_back(coo);
coo = 1728*877 + 878;
nz.push_back(coo);
coo = 1728*878 + 887;
nz.push_back(coo);
coo = 1728*878 + 1161;
nz.push_back(coo);
coo = 1728*879 + 1402;
nz.push_back(coo);
coo = 1728*880 + 881;
nz.push_back(coo);
coo = 1728*880 + 885;
nz.push_back(coo);
coo = 1728*880 + 891;
nz.push_back(coo);
coo = 1728*881 + 882;
nz.push_back(coo);
coo = 1728*882 + 883;
nz.push_back(coo);
coo = 1728*883 + 932;
nz.push_back(coo);
coo = 1728*884 + 885;
nz.push_back(coo);
coo = 1728*884 + 887;
nz.push_back(coo);
coo = 1728*884 + 1123;
nz.push_back(coo);
coo = 1728*885 + 886;
nz.push_back(coo);
coo = 1728*886 + 895;
nz.push_back(coo);
coo = 1728*886 + 1169;
nz.push_back(coo);
coo = 1728*887 + 1410;
nz.push_back(coo);
coo = 1728*888 + 889;
nz.push_back(coo);
coo = 1728*888 + 893;
nz.push_back(coo);
coo = 1728*888 + 899;
nz.push_back(coo);
coo = 1728*889 + 890;
nz.push_back(coo);
coo = 1728*890 + 891;
nz.push_back(coo);
coo = 1728*891 + 940;
nz.push_back(coo);
coo = 1728*892 + 893;
nz.push_back(coo);
coo = 1728*892 + 895;
nz.push_back(coo);
coo = 1728*892 + 1131;
nz.push_back(coo);
coo = 1728*893 + 894;
nz.push_back(coo);
coo = 1728*894 + 903;
nz.push_back(coo);
coo = 1728*894 + 1177;
nz.push_back(coo);
coo = 1728*895 + 1418;
nz.push_back(coo);
coo = 1728*896 + 897;
nz.push_back(coo);
coo = 1728*896 + 901;
nz.push_back(coo);
coo = 1728*896 + 907;
nz.push_back(coo);
coo = 1728*897 + 898;
nz.push_back(coo);
coo = 1728*898 + 899;
nz.push_back(coo);
coo = 1728*899 + 948;
nz.push_back(coo);
coo = 1728*900 + 901;
nz.push_back(coo);
coo = 1728*900 + 903;
nz.push_back(coo);
coo = 1728*900 + 1139;
nz.push_back(coo);
coo = 1728*901 + 902;
nz.push_back(coo);
coo = 1728*902 + 911;
nz.push_back(coo);
coo = 1728*902 + 1185;
nz.push_back(coo);
coo = 1728*903 + 1426;
nz.push_back(coo);
coo = 1728*904 + 905;
nz.push_back(coo);
coo = 1728*904 + 909;
nz.push_back(coo);
coo = 1728*905 + 906;
nz.push_back(coo);
coo = 1728*906 + 907;
nz.push_back(coo);
coo = 1728*907 + 956;
nz.push_back(coo);
coo = 1728*908 + 909;
nz.push_back(coo);
coo = 1728*908 + 911;
nz.push_back(coo);
coo = 1728*908 + 1147;
nz.push_back(coo);
coo = 1728*909 + 910;
nz.push_back(coo);
coo = 1728*910 + 1193;
nz.push_back(coo);
coo = 1728*911 + 1434;
nz.push_back(coo);
coo = 1728*912 + 913;
nz.push_back(coo);
coo = 1728*912 + 917;
nz.push_back(coo);
coo = 1728*912 + 923;
nz.push_back(coo);
coo = 1728*913 + 914;
nz.push_back(coo);
coo = 1728*914 + 915;
nz.push_back(coo);
coo = 1728*915 + 952;
nz.push_back(coo);
coo = 1728*915 + 964;
nz.push_back(coo);
coo = 1728*916 + 917;
nz.push_back(coo);
coo = 1728*916 + 919;
nz.push_back(coo);
coo = 1728*917 + 918;
nz.push_back(coo);
coo = 1728*918 + 927;
nz.push_back(coo);
coo = 1728*918 + 1201;
nz.push_back(coo);
coo = 1728*919 + 958;
nz.push_back(coo);
coo = 1728*919 + 1154;
nz.push_back(coo);
coo = 1728*920 + 921;
nz.push_back(coo);
coo = 1728*920 + 925;
nz.push_back(coo);
coo = 1728*920 + 931;
nz.push_back(coo);
coo = 1728*921 + 922;
nz.push_back(coo);
coo = 1728*922 + 923;
nz.push_back(coo);
coo = 1728*923 + 972;
nz.push_back(coo);
coo = 1728*924 + 925;
nz.push_back(coo);
coo = 1728*924 + 927;
nz.push_back(coo);
coo = 1728*925 + 926;
nz.push_back(coo);
coo = 1728*926 + 935;
nz.push_back(coo);
coo = 1728*926 + 1209;
nz.push_back(coo);
coo = 1728*927 + 1162;
nz.push_back(coo);
coo = 1728*928 + 929;
nz.push_back(coo);
coo = 1728*928 + 933;
nz.push_back(coo);
coo = 1728*928 + 939;
nz.push_back(coo);
coo = 1728*929 + 930;
nz.push_back(coo);
coo = 1728*930 + 931;
nz.push_back(coo);
coo = 1728*931 + 980;
nz.push_back(coo);
coo = 1728*932 + 933;
nz.push_back(coo);
coo = 1728*932 + 935;
nz.push_back(coo);
coo = 1728*933 + 934;
nz.push_back(coo);
coo = 1728*934 + 943;
nz.push_back(coo);
coo = 1728*934 + 1217;
nz.push_back(coo);
coo = 1728*935 + 1170;
nz.push_back(coo);
coo = 1728*936 + 937;
nz.push_back(coo);
coo = 1728*936 + 941;
nz.push_back(coo);
coo = 1728*936 + 947;
nz.push_back(coo);
coo = 1728*937 + 938;
nz.push_back(coo);
coo = 1728*938 + 939;
nz.push_back(coo);
coo = 1728*939 + 988;
nz.push_back(coo);
coo = 1728*940 + 941;
nz.push_back(coo);
coo = 1728*940 + 943;
nz.push_back(coo);
coo = 1728*941 + 942;
nz.push_back(coo);
coo = 1728*942 + 951;
nz.push_back(coo);
coo = 1728*942 + 1225;
nz.push_back(coo);
coo = 1728*943 + 1178;
nz.push_back(coo);
coo = 1728*944 + 945;
nz.push_back(coo);
coo = 1728*944 + 949;
nz.push_back(coo);
coo = 1728*944 + 955;
nz.push_back(coo);
coo = 1728*945 + 946;
nz.push_back(coo);
coo = 1728*946 + 947;
nz.push_back(coo);
coo = 1728*947 + 996;
nz.push_back(coo);
coo = 1728*948 + 949;
nz.push_back(coo);
coo = 1728*948 + 951;
nz.push_back(coo);
coo = 1728*949 + 950;
nz.push_back(coo);
coo = 1728*950 + 959;
nz.push_back(coo);
coo = 1728*950 + 1233;
nz.push_back(coo);
coo = 1728*951 + 1186;
nz.push_back(coo);
coo = 1728*952 + 953;
nz.push_back(coo);
coo = 1728*952 + 957;
nz.push_back(coo);
coo = 1728*953 + 954;
nz.push_back(coo);
coo = 1728*954 + 955;
nz.push_back(coo);
coo = 1728*955 + 1004;
nz.push_back(coo);
coo = 1728*956 + 957;
nz.push_back(coo);
coo = 1728*956 + 959;
nz.push_back(coo);
coo = 1728*957 + 958;
nz.push_back(coo);
coo = 1728*958 + 1241;
nz.push_back(coo);
coo = 1728*959 + 1194;
nz.push_back(coo);
coo = 1728*960 + 961;
nz.push_back(coo);
coo = 1728*960 + 965;
nz.push_back(coo);
coo = 1728*960 + 971;
nz.push_back(coo);
coo = 1728*961 + 962;
nz.push_back(coo);
coo = 1728*962 + 963;
nz.push_back(coo);
coo = 1728*963 + 1000;
nz.push_back(coo);
coo = 1728*963 + 1012;
nz.push_back(coo);
coo = 1728*964 + 965;
nz.push_back(coo);
coo = 1728*964 + 967;
nz.push_back(coo);
coo = 1728*965 + 966;
nz.push_back(coo);
coo = 1728*966 + 975;
nz.push_back(coo);
coo = 1728*966 + 1249;
nz.push_back(coo);
coo = 1728*967 + 1006;
nz.push_back(coo);
coo = 1728*967 + 1202;
nz.push_back(coo);
coo = 1728*968 + 969;
nz.push_back(coo);
coo = 1728*968 + 973;
nz.push_back(coo);
coo = 1728*968 + 979;
nz.push_back(coo);
coo = 1728*969 + 970;
nz.push_back(coo);
coo = 1728*970 + 971;
nz.push_back(coo);
coo = 1728*971 + 1020;
nz.push_back(coo);
coo = 1728*972 + 973;
nz.push_back(coo);
coo = 1728*972 + 975;
nz.push_back(coo);
coo = 1728*973 + 974;
nz.push_back(coo);
coo = 1728*974 + 983;
nz.push_back(coo);
coo = 1728*974 + 1257;
nz.push_back(coo);
coo = 1728*975 + 1210;
nz.push_back(coo);
coo = 1728*976 + 977;
nz.push_back(coo);
coo = 1728*976 + 981;
nz.push_back(coo);
coo = 1728*976 + 987;
nz.push_back(coo);
coo = 1728*977 + 978;
nz.push_back(coo);
coo = 1728*978 + 979;
nz.push_back(coo);
coo = 1728*979 + 1028;
nz.push_back(coo);
coo = 1728*980 + 981;
nz.push_back(coo);
coo = 1728*980 + 983;
nz.push_back(coo);
coo = 1728*981 + 982;
nz.push_back(coo);
coo = 1728*982 + 991;
nz.push_back(coo);
coo = 1728*982 + 1265;
nz.push_back(coo);
coo = 1728*983 + 1218;
nz.push_back(coo);
coo = 1728*984 + 985;
nz.push_back(coo);
coo = 1728*984 + 989;
nz.push_back(coo);
coo = 1728*984 + 995;
nz.push_back(coo);
coo = 1728*985 + 986;
nz.push_back(coo);
coo = 1728*986 + 987;
nz.push_back(coo);
coo = 1728*987 + 1036;
nz.push_back(coo);
coo = 1728*988 + 989;
nz.push_back(coo);
coo = 1728*988 + 991;
nz.push_back(coo);
coo = 1728*989 + 990;
nz.push_back(coo);
coo = 1728*990 + 999;
nz.push_back(coo);
coo = 1728*990 + 1273;
nz.push_back(coo);
coo = 1728*991 + 1226;
nz.push_back(coo);
coo = 1728*992 + 993;
nz.push_back(coo);
coo = 1728*992 + 997;
nz.push_back(coo);
coo = 1728*992 + 1003;
nz.push_back(coo);
coo = 1728*993 + 994;
nz.push_back(coo);
coo = 1728*994 + 995;
nz.push_back(coo);
coo = 1728*995 + 1044;
nz.push_back(coo);
coo = 1728*996 + 997;
nz.push_back(coo);
coo = 1728*996 + 999;
nz.push_back(coo);
coo = 1728*997 + 998;
nz.push_back(coo);
coo = 1728*998 + 1007;
nz.push_back(coo);
coo = 1728*998 + 1281;
nz.push_back(coo);
coo = 1728*999 + 1234;
nz.push_back(coo);
coo = 1728*1000 + 1001;
nz.push_back(coo);
coo = 1728*1000 + 1005;
nz.push_back(coo);
coo = 1728*1001 + 1002;
nz.push_back(coo);
coo = 1728*1002 + 1003;
nz.push_back(coo);
coo = 1728*1003 + 1052;
nz.push_back(coo);
coo = 1728*1004 + 1005;
nz.push_back(coo);
coo = 1728*1004 + 1007;
nz.push_back(coo);
coo = 1728*1005 + 1006;
nz.push_back(coo);
coo = 1728*1006 + 1289;
nz.push_back(coo);
coo = 1728*1007 + 1242;
nz.push_back(coo);
coo = 1728*1008 + 1009;
nz.push_back(coo);
coo = 1728*1008 + 1013;
nz.push_back(coo);
coo = 1728*1008 + 1019;
nz.push_back(coo);
coo = 1728*1009 + 1010;
nz.push_back(coo);
coo = 1728*1010 + 1011;
nz.push_back(coo);
coo = 1728*1011 + 1048;
nz.push_back(coo);
coo = 1728*1011 + 1060;
nz.push_back(coo);
coo = 1728*1012 + 1013;
nz.push_back(coo);
coo = 1728*1012 + 1015;
nz.push_back(coo);
coo = 1728*1013 + 1014;
nz.push_back(coo);
coo = 1728*1014 + 1023;
nz.push_back(coo);
coo = 1728*1014 + 1297;
nz.push_back(coo);
coo = 1728*1015 + 1054;
nz.push_back(coo);
coo = 1728*1015 + 1250;
nz.push_back(coo);
coo = 1728*1016 + 1017;
nz.push_back(coo);
coo = 1728*1016 + 1021;
nz.push_back(coo);
coo = 1728*1016 + 1027;
nz.push_back(coo);
coo = 1728*1017 + 1018;
nz.push_back(coo);
coo = 1728*1018 + 1019;
nz.push_back(coo);
coo = 1728*1019 + 1068;
nz.push_back(coo);
coo = 1728*1020 + 1021;
nz.push_back(coo);
coo = 1728*1020 + 1023;
nz.push_back(coo);
coo = 1728*1021 + 1022;
nz.push_back(coo);
coo = 1728*1022 + 1031;
nz.push_back(coo);
coo = 1728*1022 + 1305;
nz.push_back(coo);
coo = 1728*1023 + 1258;
nz.push_back(coo);
coo = 1728*1024 + 1025;
nz.push_back(coo);
coo = 1728*1024 + 1029;
nz.push_back(coo);
coo = 1728*1024 + 1035;
nz.push_back(coo);
coo = 1728*1025 + 1026;
nz.push_back(coo);
coo = 1728*1026 + 1027;
nz.push_back(coo);
coo = 1728*1027 + 1076;
nz.push_back(coo);
coo = 1728*1028 + 1029;
nz.push_back(coo);
coo = 1728*1028 + 1031;
nz.push_back(coo);
coo = 1728*1029 + 1030;
nz.push_back(coo);
coo = 1728*1030 + 1039;
nz.push_back(coo);
coo = 1728*1030 + 1313;
nz.push_back(coo);
coo = 1728*1031 + 1266;
nz.push_back(coo);
coo = 1728*1032 + 1033;
nz.push_back(coo);
coo = 1728*1032 + 1037;
nz.push_back(coo);
coo = 1728*1032 + 1043;
nz.push_back(coo);
coo = 1728*1033 + 1034;
nz.push_back(coo);
coo = 1728*1034 + 1035;
nz.push_back(coo);
coo = 1728*1035 + 1084;
nz.push_back(coo);
coo = 1728*1036 + 1037;
nz.push_back(coo);
coo = 1728*1036 + 1039;
nz.push_back(coo);
coo = 1728*1037 + 1038;
nz.push_back(coo);
coo = 1728*1038 + 1047;
nz.push_back(coo);
coo = 1728*1038 + 1321;
nz.push_back(coo);
coo = 1728*1039 + 1274;
nz.push_back(coo);
coo = 1728*1040 + 1041;
nz.push_back(coo);
coo = 1728*1040 + 1045;
nz.push_back(coo);
coo = 1728*1040 + 1051;
nz.push_back(coo);
coo = 1728*1041 + 1042;
nz.push_back(coo);
coo = 1728*1042 + 1043;
nz.push_back(coo);
coo = 1728*1043 + 1092;
nz.push_back(coo);
coo = 1728*1044 + 1045;
nz.push_back(coo);
coo = 1728*1044 + 1047;
nz.push_back(coo);
coo = 1728*1045 + 1046;
nz.push_back(coo);
coo = 1728*1046 + 1055;
nz.push_back(coo);
coo = 1728*1046 + 1329;
nz.push_back(coo);
coo = 1728*1047 + 1282;
nz.push_back(coo);
coo = 1728*1048 + 1049;
nz.push_back(coo);
coo = 1728*1048 + 1053;
nz.push_back(coo);
coo = 1728*1049 + 1050;
nz.push_back(coo);
coo = 1728*1050 + 1051;
nz.push_back(coo);
coo = 1728*1051 + 1100;
nz.push_back(coo);
coo = 1728*1052 + 1053;
nz.push_back(coo);
coo = 1728*1052 + 1055;
nz.push_back(coo);
coo = 1728*1053 + 1054;
nz.push_back(coo);
coo = 1728*1054 + 1337;
nz.push_back(coo);
coo = 1728*1055 + 1290;
nz.push_back(coo);
coo = 1728*1056 + 1057;
nz.push_back(coo);
coo = 1728*1056 + 1061;
nz.push_back(coo);
coo = 1728*1056 + 1067;
nz.push_back(coo);
coo = 1728*1057 + 1058;
nz.push_back(coo);
coo = 1728*1058 + 1059;
nz.push_back(coo);
coo = 1728*1059 + 1096;
nz.push_back(coo);
coo = 1728*1059 + 1108;
nz.push_back(coo);
coo = 1728*1060 + 1061;
nz.push_back(coo);
coo = 1728*1060 + 1063;
nz.push_back(coo);
coo = 1728*1061 + 1062;
nz.push_back(coo);
coo = 1728*1062 + 1071;
nz.push_back(coo);
coo = 1728*1062 + 1345;
nz.push_back(coo);
coo = 1728*1063 + 1102;
nz.push_back(coo);
coo = 1728*1063 + 1298;
nz.push_back(coo);
coo = 1728*1064 + 1065;
nz.push_back(coo);
coo = 1728*1064 + 1069;
nz.push_back(coo);
coo = 1728*1064 + 1075;
nz.push_back(coo);
coo = 1728*1065 + 1066;
nz.push_back(coo);
coo = 1728*1066 + 1067;
nz.push_back(coo);
coo = 1728*1067 + 1116;
nz.push_back(coo);
coo = 1728*1068 + 1069;
nz.push_back(coo);
coo = 1728*1068 + 1071;
nz.push_back(coo);
coo = 1728*1069 + 1070;
nz.push_back(coo);
coo = 1728*1070 + 1079;
nz.push_back(coo);
coo = 1728*1070 + 1353;
nz.push_back(coo);
coo = 1728*1071 + 1306;
nz.push_back(coo);
coo = 1728*1072 + 1073;
nz.push_back(coo);
coo = 1728*1072 + 1077;
nz.push_back(coo);
coo = 1728*1072 + 1083;
nz.push_back(coo);
coo = 1728*1073 + 1074;
nz.push_back(coo);
coo = 1728*1074 + 1075;
nz.push_back(coo);
coo = 1728*1075 + 1124;
nz.push_back(coo);
coo = 1728*1076 + 1077;
nz.push_back(coo);
coo = 1728*1076 + 1079;
nz.push_back(coo);
coo = 1728*1077 + 1078;
nz.push_back(coo);
coo = 1728*1078 + 1087;
nz.push_back(coo);
coo = 1728*1078 + 1361;
nz.push_back(coo);
coo = 1728*1079 + 1314;
nz.push_back(coo);
coo = 1728*1080 + 1081;
nz.push_back(coo);
coo = 1728*1080 + 1085;
nz.push_back(coo);
coo = 1728*1080 + 1091;
nz.push_back(coo);
coo = 1728*1081 + 1082;
nz.push_back(coo);
coo = 1728*1082 + 1083;
nz.push_back(coo);
coo = 1728*1083 + 1132;
nz.push_back(coo);
coo = 1728*1084 + 1085;
nz.push_back(coo);
coo = 1728*1084 + 1087;
nz.push_back(coo);
coo = 1728*1085 + 1086;
nz.push_back(coo);
coo = 1728*1086 + 1095;
nz.push_back(coo);
coo = 1728*1086 + 1369;
nz.push_back(coo);
coo = 1728*1087 + 1322;
nz.push_back(coo);
coo = 1728*1088 + 1089;
nz.push_back(coo);
coo = 1728*1088 + 1093;
nz.push_back(coo);
coo = 1728*1088 + 1099;
nz.push_back(coo);
coo = 1728*1089 + 1090;
nz.push_back(coo);
coo = 1728*1090 + 1091;
nz.push_back(coo);
coo = 1728*1091 + 1140;
nz.push_back(coo);
coo = 1728*1092 + 1093;
nz.push_back(coo);
coo = 1728*1092 + 1095;
nz.push_back(coo);
coo = 1728*1093 + 1094;
nz.push_back(coo);
coo = 1728*1094 + 1103;
nz.push_back(coo);
coo = 1728*1094 + 1377;
nz.push_back(coo);
coo = 1728*1095 + 1330;
nz.push_back(coo);
coo = 1728*1096 + 1097;
nz.push_back(coo);
coo = 1728*1096 + 1101;
nz.push_back(coo);
coo = 1728*1097 + 1098;
nz.push_back(coo);
coo = 1728*1098 + 1099;
nz.push_back(coo);
coo = 1728*1099 + 1148;
nz.push_back(coo);
coo = 1728*1100 + 1101;
nz.push_back(coo);
coo = 1728*1100 + 1103;
nz.push_back(coo);
coo = 1728*1101 + 1102;
nz.push_back(coo);
coo = 1728*1102 + 1385;
nz.push_back(coo);
coo = 1728*1103 + 1338;
nz.push_back(coo);
coo = 1728*1104 + 1105;
nz.push_back(coo);
coo = 1728*1104 + 1109;
nz.push_back(coo);
coo = 1728*1104 + 1115;
nz.push_back(coo);
coo = 1728*1105 + 1106;
nz.push_back(coo);
coo = 1728*1106 + 1107;
nz.push_back(coo);
coo = 1728*1107 + 1144;
nz.push_back(coo);
coo = 1728*1108 + 1109;
nz.push_back(coo);
coo = 1728*1108 + 1111;
nz.push_back(coo);
coo = 1728*1109 + 1110;
nz.push_back(coo);
coo = 1728*1110 + 1119;
nz.push_back(coo);
coo = 1728*1110 + 1393;
nz.push_back(coo);
coo = 1728*1111 + 1150;
nz.push_back(coo);
coo = 1728*1111 + 1346;
nz.push_back(coo);
coo = 1728*1112 + 1113;
nz.push_back(coo);
coo = 1728*1112 + 1117;
nz.push_back(coo);
coo = 1728*1112 + 1123;
nz.push_back(coo);
coo = 1728*1113 + 1114;
nz.push_back(coo);
coo = 1728*1114 + 1115;
nz.push_back(coo);
coo = 1728*1116 + 1117;
nz.push_back(coo);
coo = 1728*1116 + 1119;
nz.push_back(coo);
coo = 1728*1117 + 1118;
nz.push_back(coo);
coo = 1728*1118 + 1127;
nz.push_back(coo);
coo = 1728*1118 + 1401;
nz.push_back(coo);
coo = 1728*1119 + 1354;
nz.push_back(coo);
coo = 1728*1120 + 1121;
nz.push_back(coo);
coo = 1728*1120 + 1125;
nz.push_back(coo);
coo = 1728*1120 + 1131;
nz.push_back(coo);
coo = 1728*1121 + 1122;
nz.push_back(coo);
coo = 1728*1122 + 1123;
nz.push_back(coo);
coo = 1728*1124 + 1125;
nz.push_back(coo);
coo = 1728*1124 + 1127;
nz.push_back(coo);
coo = 1728*1125 + 1126;
nz.push_back(coo);
coo = 1728*1126 + 1135;
nz.push_back(coo);
coo = 1728*1126 + 1409;
nz.push_back(coo);
coo = 1728*1127 + 1362;
nz.push_back(coo);
coo = 1728*1128 + 1129;
nz.push_back(coo);
coo = 1728*1128 + 1133;
nz.push_back(coo);
coo = 1728*1128 + 1139;
nz.push_back(coo);
coo = 1728*1129 + 1130;
nz.push_back(coo);
coo = 1728*1130 + 1131;
nz.push_back(coo);
coo = 1728*1132 + 1133;
nz.push_back(coo);
coo = 1728*1132 + 1135;
nz.push_back(coo);
coo = 1728*1133 + 1134;
nz.push_back(coo);
coo = 1728*1134 + 1143;
nz.push_back(coo);
coo = 1728*1134 + 1417;
nz.push_back(coo);
coo = 1728*1135 + 1370;
nz.push_back(coo);
coo = 1728*1136 + 1137;
nz.push_back(coo);
coo = 1728*1136 + 1141;
nz.push_back(coo);
coo = 1728*1136 + 1147;
nz.push_back(coo);
coo = 1728*1137 + 1138;
nz.push_back(coo);
coo = 1728*1138 + 1139;
nz.push_back(coo);
coo = 1728*1140 + 1141;
nz.push_back(coo);
coo = 1728*1140 + 1143;
nz.push_back(coo);
coo = 1728*1141 + 1142;
nz.push_back(coo);
coo = 1728*1142 + 1151;
nz.push_back(coo);
coo = 1728*1142 + 1425;
nz.push_back(coo);
coo = 1728*1143 + 1378;
nz.push_back(coo);
coo = 1728*1144 + 1145;
nz.push_back(coo);
coo = 1728*1144 + 1149;
nz.push_back(coo);
coo = 1728*1145 + 1146;
nz.push_back(coo);
coo = 1728*1146 + 1147;
nz.push_back(coo);
coo = 1728*1148 + 1149;
nz.push_back(coo);
coo = 1728*1148 + 1151;
nz.push_back(coo);
coo = 1728*1149 + 1150;
nz.push_back(coo);
coo = 1728*1150 + 1433;
nz.push_back(coo);
coo = 1728*1151 + 1386;
nz.push_back(coo);
coo = 1728*1152 + 1153;
nz.push_back(coo);
coo = 1728*1152 + 1157;
nz.push_back(coo);
coo = 1728*1152 + 1163;
nz.push_back(coo);
coo = 1728*1153 + 1154;
nz.push_back(coo);
coo = 1728*1154 + 1155;
nz.push_back(coo);
coo = 1728*1155 + 1192;
nz.push_back(coo);
coo = 1728*1155 + 1204;
nz.push_back(coo);
coo = 1728*1156 + 1157;
nz.push_back(coo);
coo = 1728*1156 + 1159;
nz.push_back(coo);
coo = 1728*1156 + 1395;
nz.push_back(coo);
coo = 1728*1157 + 1158;
nz.push_back(coo);
coo = 1728*1158 + 1167;
nz.push_back(coo);
coo = 1728*1158 + 1441;
nz.push_back(coo);
coo = 1728*1159 + 1198;
nz.push_back(coo);
coo = 1728*1159 + 1682;
nz.push_back(coo);
coo = 1728*1160 + 1161;
nz.push_back(coo);
coo = 1728*1160 + 1165;
nz.push_back(coo);
coo = 1728*1160 + 1171;
nz.push_back(coo);
coo = 1728*1161 + 1162;
nz.push_back(coo);
coo = 1728*1162 + 1163;
nz.push_back(coo);
coo = 1728*1163 + 1212;
nz.push_back(coo);
coo = 1728*1164 + 1165;
nz.push_back(coo);
coo = 1728*1164 + 1167;
nz.push_back(coo);
coo = 1728*1164 + 1403;
nz.push_back(coo);
coo = 1728*1165 + 1166;
nz.push_back(coo);
coo = 1728*1166 + 1175;
nz.push_back(coo);
coo = 1728*1166 + 1449;
nz.push_back(coo);
coo = 1728*1167 + 1690;
nz.push_back(coo);
coo = 1728*1168 + 1169;
nz.push_back(coo);
coo = 1728*1168 + 1173;
nz.push_back(coo);
coo = 1728*1168 + 1179;
nz.push_back(coo);
coo = 1728*1169 + 1170;
nz.push_back(coo);
coo = 1728*1170 + 1171;
nz.push_back(coo);
coo = 1728*1171 + 1220;
nz.push_back(coo);
coo = 1728*1172 + 1173;
nz.push_back(coo);
coo = 1728*1172 + 1175;
nz.push_back(coo);
coo = 1728*1172 + 1411;
nz.push_back(coo);
coo = 1728*1173 + 1174;
nz.push_back(coo);
coo = 1728*1174 + 1183;
nz.push_back(coo);
coo = 1728*1174 + 1457;
nz.push_back(coo);
coo = 1728*1175 + 1698;
nz.push_back(coo);
coo = 1728*1176 + 1177;
nz.push_back(coo);
coo = 1728*1176 + 1181;
nz.push_back(coo);
coo = 1728*1176 + 1187;
nz.push_back(coo);
coo = 1728*1177 + 1178;
nz.push_back(coo);
coo = 1728*1178 + 1179;
nz.push_back(coo);
coo = 1728*1179 + 1228;
nz.push_back(coo);
coo = 1728*1180 + 1181;
nz.push_back(coo);
coo = 1728*1180 + 1183;
nz.push_back(coo);
coo = 1728*1180 + 1419;
nz.push_back(coo);
coo = 1728*1181 + 1182;
nz.push_back(coo);
coo = 1728*1182 + 1191;
nz.push_back(coo);
coo = 1728*1182 + 1465;
nz.push_back(coo);
coo = 1728*1183 + 1706;
nz.push_back(coo);
coo = 1728*1184 + 1185;
nz.push_back(coo);
coo = 1728*1184 + 1189;
nz.push_back(coo);
coo = 1728*1184 + 1195;
nz.push_back(coo);
coo = 1728*1185 + 1186;
nz.push_back(coo);
coo = 1728*1186 + 1187;
nz.push_back(coo);
coo = 1728*1187 + 1236;
nz.push_back(coo);
coo = 1728*1188 + 1189;
nz.push_back(coo);
coo = 1728*1188 + 1191;
nz.push_back(coo);
coo = 1728*1188 + 1427;
nz.push_back(coo);
coo = 1728*1189 + 1190;
nz.push_back(coo);
coo = 1728*1190 + 1199;
nz.push_back(coo);
coo = 1728*1190 + 1473;
nz.push_back(coo);
coo = 1728*1191 + 1714;
nz.push_back(coo);
coo = 1728*1192 + 1193;
nz.push_back(coo);
coo = 1728*1192 + 1197;
nz.push_back(coo);
coo = 1728*1193 + 1194;
nz.push_back(coo);
coo = 1728*1194 + 1195;
nz.push_back(coo);
coo = 1728*1195 + 1244;
nz.push_back(coo);
coo = 1728*1196 + 1197;
nz.push_back(coo);
coo = 1728*1196 + 1199;
nz.push_back(coo);
coo = 1728*1196 + 1435;
nz.push_back(coo);
coo = 1728*1197 + 1198;
nz.push_back(coo);
coo = 1728*1198 + 1481;
nz.push_back(coo);
coo = 1728*1199 + 1722;
nz.push_back(coo);
coo = 1728*1200 + 1201;
nz.push_back(coo);
coo = 1728*1200 + 1205;
nz.push_back(coo);
coo = 1728*1200 + 1211;
nz.push_back(coo);
coo = 1728*1201 + 1202;
nz.push_back(coo);
coo = 1728*1202 + 1203;
nz.push_back(coo);
coo = 1728*1203 + 1240;
nz.push_back(coo);
coo = 1728*1203 + 1252;
nz.push_back(coo);
coo = 1728*1204 + 1205;
nz.push_back(coo);
coo = 1728*1204 + 1207;
nz.push_back(coo);
coo = 1728*1205 + 1206;
nz.push_back(coo);
coo = 1728*1206 + 1215;
nz.push_back(coo);
coo = 1728*1206 + 1489;
nz.push_back(coo);
coo = 1728*1207 + 1246;
nz.push_back(coo);
coo = 1728*1207 + 1442;
nz.push_back(coo);
coo = 1728*1208 + 1209;
nz.push_back(coo);
coo = 1728*1208 + 1213;
nz.push_back(coo);
coo = 1728*1208 + 1219;
nz.push_back(coo);
coo = 1728*1209 + 1210;
nz.push_back(coo);
coo = 1728*1210 + 1211;
nz.push_back(coo);
coo = 1728*1211 + 1260;
nz.push_back(coo);
coo = 1728*1212 + 1213;
nz.push_back(coo);
coo = 1728*1212 + 1215;
nz.push_back(coo);
coo = 1728*1213 + 1214;
nz.push_back(coo);
coo = 1728*1214 + 1223;
nz.push_back(coo);
coo = 1728*1214 + 1497;
nz.push_back(coo);
coo = 1728*1215 + 1450;
nz.push_back(coo);
coo = 1728*1216 + 1217;
nz.push_back(coo);
coo = 1728*1216 + 1221;
nz.push_back(coo);
coo = 1728*1216 + 1227;
nz.push_back(coo);
coo = 1728*1217 + 1218;
nz.push_back(coo);
coo = 1728*1218 + 1219;
nz.push_back(coo);
coo = 1728*1219 + 1268;
nz.push_back(coo);
coo = 1728*1220 + 1221;
nz.push_back(coo);
coo = 1728*1220 + 1223;
nz.push_back(coo);
coo = 1728*1221 + 1222;
nz.push_back(coo);
coo = 1728*1222 + 1231;
nz.push_back(coo);
coo = 1728*1222 + 1505;
nz.push_back(coo);
coo = 1728*1223 + 1458;
nz.push_back(coo);
coo = 1728*1224 + 1225;
nz.push_back(coo);
coo = 1728*1224 + 1229;
nz.push_back(coo);
coo = 1728*1224 + 1235;
nz.push_back(coo);
coo = 1728*1225 + 1226;
nz.push_back(coo);
coo = 1728*1226 + 1227;
nz.push_back(coo);
coo = 1728*1227 + 1276;
nz.push_back(coo);
coo = 1728*1228 + 1229;
nz.push_back(coo);
coo = 1728*1228 + 1231;
nz.push_back(coo);
coo = 1728*1229 + 1230;
nz.push_back(coo);
coo = 1728*1230 + 1239;
nz.push_back(coo);
coo = 1728*1230 + 1513;
nz.push_back(coo);
coo = 1728*1231 + 1466;
nz.push_back(coo);
coo = 1728*1232 + 1233;
nz.push_back(coo);
coo = 1728*1232 + 1237;
nz.push_back(coo);
coo = 1728*1232 + 1243;
nz.push_back(coo);
coo = 1728*1233 + 1234;
nz.push_back(coo);
coo = 1728*1234 + 1235;
nz.push_back(coo);
coo = 1728*1235 + 1284;
nz.push_back(coo);
coo = 1728*1236 + 1237;
nz.push_back(coo);
coo = 1728*1236 + 1239;
nz.push_back(coo);
coo = 1728*1237 + 1238;
nz.push_back(coo);
coo = 1728*1238 + 1247;
nz.push_back(coo);
coo = 1728*1238 + 1521;
nz.push_back(coo);
coo = 1728*1239 + 1474;
nz.push_back(coo);
coo = 1728*1240 + 1241;
nz.push_back(coo);
coo = 1728*1240 + 1245;
nz.push_back(coo);
coo = 1728*1241 + 1242;
nz.push_back(coo);
coo = 1728*1242 + 1243;
nz.push_back(coo);
coo = 1728*1243 + 1292;
nz.push_back(coo);
coo = 1728*1244 + 1245;
nz.push_back(coo);
coo = 1728*1244 + 1247;
nz.push_back(coo);
coo = 1728*1245 + 1246;
nz.push_back(coo);
coo = 1728*1246 + 1529;
nz.push_back(coo);
coo = 1728*1247 + 1482;
nz.push_back(coo);
coo = 1728*1248 + 1249;
nz.push_back(coo);
coo = 1728*1248 + 1253;
nz.push_back(coo);
coo = 1728*1248 + 1259;
nz.push_back(coo);
coo = 1728*1249 + 1250;
nz.push_back(coo);
coo = 1728*1250 + 1251;
nz.push_back(coo);
coo = 1728*1251 + 1288;
nz.push_back(coo);
coo = 1728*1251 + 1300;
nz.push_back(coo);
coo = 1728*1252 + 1253;
nz.push_back(coo);
coo = 1728*1252 + 1255;
nz.push_back(coo);
coo = 1728*1253 + 1254;
nz.push_back(coo);
coo = 1728*1254 + 1263;
nz.push_back(coo);
coo = 1728*1254 + 1537;
nz.push_back(coo);
coo = 1728*1255 + 1294;
nz.push_back(coo);
coo = 1728*1255 + 1490;
nz.push_back(coo);
coo = 1728*1256 + 1257;
nz.push_back(coo);
coo = 1728*1256 + 1261;
nz.push_back(coo);
coo = 1728*1256 + 1267;
nz.push_back(coo);
coo = 1728*1257 + 1258;
nz.push_back(coo);
coo = 1728*1258 + 1259;
nz.push_back(coo);
coo = 1728*1259 + 1308;
nz.push_back(coo);
coo = 1728*1260 + 1261;
nz.push_back(coo);
coo = 1728*1260 + 1263;
nz.push_back(coo);
coo = 1728*1261 + 1262;
nz.push_back(coo);
coo = 1728*1262 + 1271;
nz.push_back(coo);
coo = 1728*1262 + 1545;
nz.push_back(coo);
coo = 1728*1263 + 1498;
nz.push_back(coo);
coo = 1728*1264 + 1265;
nz.push_back(coo);
coo = 1728*1264 + 1269;
nz.push_back(coo);
coo = 1728*1264 + 1275;
nz.push_back(coo);
coo = 1728*1265 + 1266;
nz.push_back(coo);
coo = 1728*1266 + 1267;
nz.push_back(coo);
coo = 1728*1267 + 1316;
nz.push_back(coo);
coo = 1728*1268 + 1269;
nz.push_back(coo);
coo = 1728*1268 + 1271;
nz.push_back(coo);
coo = 1728*1269 + 1270;
nz.push_back(coo);
coo = 1728*1270 + 1279;
nz.push_back(coo);
coo = 1728*1270 + 1553;
nz.push_back(coo);
coo = 1728*1271 + 1506;
nz.push_back(coo);
coo = 1728*1272 + 1273;
nz.push_back(coo);
coo = 1728*1272 + 1277;
nz.push_back(coo);
coo = 1728*1272 + 1283;
nz.push_back(coo);
coo = 1728*1273 + 1274;
nz.push_back(coo);
coo = 1728*1274 + 1275;
nz.push_back(coo);
coo = 1728*1275 + 1324;
nz.push_back(coo);
coo = 1728*1276 + 1277;
nz.push_back(coo);
coo = 1728*1276 + 1279;
nz.push_back(coo);
coo = 1728*1277 + 1278;
nz.push_back(coo);
coo = 1728*1278 + 1287;
nz.push_back(coo);
coo = 1728*1278 + 1561;
nz.push_back(coo);
coo = 1728*1279 + 1514;
nz.push_back(coo);
coo = 1728*1280 + 1281;
nz.push_back(coo);
coo = 1728*1280 + 1285;
nz.push_back(coo);
coo = 1728*1280 + 1291;
nz.push_back(coo);
coo = 1728*1281 + 1282;
nz.push_back(coo);
coo = 1728*1282 + 1283;
nz.push_back(coo);
coo = 1728*1283 + 1332;
nz.push_back(coo);
coo = 1728*1284 + 1285;
nz.push_back(coo);
coo = 1728*1284 + 1287;
nz.push_back(coo);
coo = 1728*1285 + 1286;
nz.push_back(coo);
coo = 1728*1286 + 1295;
nz.push_back(coo);
coo = 1728*1286 + 1569;
nz.push_back(coo);
coo = 1728*1287 + 1522;
nz.push_back(coo);
coo = 1728*1288 + 1289;
nz.push_back(coo);
coo = 1728*1288 + 1293;
nz.push_back(coo);
coo = 1728*1289 + 1290;
nz.push_back(coo);
coo = 1728*1290 + 1291;
nz.push_back(coo);
coo = 1728*1291 + 1340;
nz.push_back(coo);
coo = 1728*1292 + 1293;
nz.push_back(coo);
coo = 1728*1292 + 1295;
nz.push_back(coo);
coo = 1728*1293 + 1294;
nz.push_back(coo);
coo = 1728*1294 + 1577;
nz.push_back(coo);
coo = 1728*1295 + 1530;
nz.push_back(coo);
coo = 1728*1296 + 1297;
nz.push_back(coo);
coo = 1728*1296 + 1301;
nz.push_back(coo);
coo = 1728*1296 + 1307;
nz.push_back(coo);
coo = 1728*1297 + 1298;
nz.push_back(coo);
coo = 1728*1298 + 1299;
nz.push_back(coo);
coo = 1728*1299 + 1336;
nz.push_back(coo);
coo = 1728*1299 + 1348;
nz.push_back(coo);
coo = 1728*1300 + 1301;
nz.push_back(coo);
coo = 1728*1300 + 1303;
nz.push_back(coo);
coo = 1728*1301 + 1302;
nz.push_back(coo);
coo = 1728*1302 + 1311;
nz.push_back(coo);
coo = 1728*1302 + 1585;
nz.push_back(coo);
coo = 1728*1303 + 1342;
nz.push_back(coo);
coo = 1728*1303 + 1538;
nz.push_back(coo);
coo = 1728*1304 + 1305;
nz.push_back(coo);
coo = 1728*1304 + 1309;
nz.push_back(coo);
coo = 1728*1304 + 1315;
nz.push_back(coo);
coo = 1728*1305 + 1306;
nz.push_back(coo);
coo = 1728*1306 + 1307;
nz.push_back(coo);
coo = 1728*1307 + 1356;
nz.push_back(coo);
coo = 1728*1308 + 1309;
nz.push_back(coo);
coo = 1728*1308 + 1311;
nz.push_back(coo);
coo = 1728*1309 + 1310;
nz.push_back(coo);
coo = 1728*1310 + 1319;
nz.push_back(coo);
coo = 1728*1310 + 1593;
nz.push_back(coo);
coo = 1728*1311 + 1546;
nz.push_back(coo);
coo = 1728*1312 + 1313;
nz.push_back(coo);
coo = 1728*1312 + 1317;
nz.push_back(coo);
coo = 1728*1312 + 1323;
nz.push_back(coo);
coo = 1728*1313 + 1314;
nz.push_back(coo);
coo = 1728*1314 + 1315;
nz.push_back(coo);
coo = 1728*1315 + 1364;
nz.push_back(coo);
coo = 1728*1316 + 1317;
nz.push_back(coo);
coo = 1728*1316 + 1319;
nz.push_back(coo);
coo = 1728*1317 + 1318;
nz.push_back(coo);
coo = 1728*1318 + 1327;
nz.push_back(coo);
coo = 1728*1318 + 1601;
nz.push_back(coo);
coo = 1728*1319 + 1554;
nz.push_back(coo);
coo = 1728*1320 + 1321;
nz.push_back(coo);
coo = 1728*1320 + 1325;
nz.push_back(coo);
coo = 1728*1320 + 1331;
nz.push_back(coo);
coo = 1728*1321 + 1322;
nz.push_back(coo);
coo = 1728*1322 + 1323;
nz.push_back(coo);
coo = 1728*1323 + 1372;
nz.push_back(coo);
coo = 1728*1324 + 1325;
nz.push_back(coo);
coo = 1728*1324 + 1327;
nz.push_back(coo);
coo = 1728*1325 + 1326;
nz.push_back(coo);
coo = 1728*1326 + 1335;
nz.push_back(coo);
coo = 1728*1326 + 1609;
nz.push_back(coo);
coo = 1728*1327 + 1562;
nz.push_back(coo);
coo = 1728*1328 + 1329;
nz.push_back(coo);
coo = 1728*1328 + 1333;
nz.push_back(coo);
coo = 1728*1328 + 1339;
nz.push_back(coo);
coo = 1728*1329 + 1330;
nz.push_back(coo);
coo = 1728*1330 + 1331;
nz.push_back(coo);
coo = 1728*1331 + 1380;
nz.push_back(coo);
coo = 1728*1332 + 1333;
nz.push_back(coo);
coo = 1728*1332 + 1335;
nz.push_back(coo);
coo = 1728*1333 + 1334;
nz.push_back(coo);
coo = 1728*1334 + 1343;
nz.push_back(coo);
coo = 1728*1334 + 1617;
nz.push_back(coo);
coo = 1728*1335 + 1570;
nz.push_back(coo);
coo = 1728*1336 + 1337;
nz.push_back(coo);
coo = 1728*1336 + 1341;
nz.push_back(coo);
coo = 1728*1337 + 1338;
nz.push_back(coo);
coo = 1728*1338 + 1339;
nz.push_back(coo);
coo = 1728*1339 + 1388;
nz.push_back(coo);
coo = 1728*1340 + 1341;
nz.push_back(coo);
coo = 1728*1340 + 1343;
nz.push_back(coo);
coo = 1728*1341 + 1342;
nz.push_back(coo);
coo = 1728*1342 + 1625;
nz.push_back(coo);
coo = 1728*1343 + 1578;
nz.push_back(coo);
coo = 1728*1344 + 1345;
nz.push_back(coo);
coo = 1728*1344 + 1349;
nz.push_back(coo);
coo = 1728*1344 + 1355;
nz.push_back(coo);
coo = 1728*1345 + 1346;
nz.push_back(coo);
coo = 1728*1346 + 1347;
nz.push_back(coo);
coo = 1728*1347 + 1384;
nz.push_back(coo);
coo = 1728*1347 + 1396;
nz.push_back(coo);
coo = 1728*1348 + 1349;
nz.push_back(coo);
coo = 1728*1348 + 1351;
nz.push_back(coo);
coo = 1728*1349 + 1350;
nz.push_back(coo);
coo = 1728*1350 + 1359;
nz.push_back(coo);
coo = 1728*1350 + 1633;
nz.push_back(coo);
coo = 1728*1351 + 1390;
nz.push_back(coo);
coo = 1728*1351 + 1586;
nz.push_back(coo);
coo = 1728*1352 + 1353;
nz.push_back(coo);
coo = 1728*1352 + 1357;
nz.push_back(coo);
coo = 1728*1352 + 1363;
nz.push_back(coo);
coo = 1728*1353 + 1354;
nz.push_back(coo);
coo = 1728*1354 + 1355;
nz.push_back(coo);
coo = 1728*1355 + 1404;
nz.push_back(coo);
coo = 1728*1356 + 1357;
nz.push_back(coo);
coo = 1728*1356 + 1359;
nz.push_back(coo);
coo = 1728*1357 + 1358;
nz.push_back(coo);
coo = 1728*1358 + 1367;
nz.push_back(coo);
coo = 1728*1358 + 1641;
nz.push_back(coo);
coo = 1728*1359 + 1594;
nz.push_back(coo);
coo = 1728*1360 + 1361;
nz.push_back(coo);
coo = 1728*1360 + 1365;
nz.push_back(coo);
coo = 1728*1360 + 1371;
nz.push_back(coo);
coo = 1728*1361 + 1362;
nz.push_back(coo);
coo = 1728*1362 + 1363;
nz.push_back(coo);
coo = 1728*1363 + 1412;
nz.push_back(coo);
coo = 1728*1364 + 1365;
nz.push_back(coo);
coo = 1728*1364 + 1367;
nz.push_back(coo);
coo = 1728*1365 + 1366;
nz.push_back(coo);
coo = 1728*1366 + 1375;
nz.push_back(coo);
coo = 1728*1366 + 1649;
nz.push_back(coo);
coo = 1728*1367 + 1602;
nz.push_back(coo);
coo = 1728*1368 + 1369;
nz.push_back(coo);
coo = 1728*1368 + 1373;
nz.push_back(coo);
coo = 1728*1368 + 1379;
nz.push_back(coo);
coo = 1728*1369 + 1370;
nz.push_back(coo);
coo = 1728*1370 + 1371;
nz.push_back(coo);
coo = 1728*1371 + 1420;
nz.push_back(coo);
coo = 1728*1372 + 1373;
nz.push_back(coo);
coo = 1728*1372 + 1375;
nz.push_back(coo);
coo = 1728*1373 + 1374;
nz.push_back(coo);
coo = 1728*1374 + 1383;
nz.push_back(coo);
coo = 1728*1374 + 1657;
nz.push_back(coo);
coo = 1728*1375 + 1610;
nz.push_back(coo);
coo = 1728*1376 + 1377;
nz.push_back(coo);
coo = 1728*1376 + 1381;
nz.push_back(coo);
coo = 1728*1376 + 1387;
nz.push_back(coo);
coo = 1728*1377 + 1378;
nz.push_back(coo);
coo = 1728*1378 + 1379;
nz.push_back(coo);
coo = 1728*1379 + 1428;
nz.push_back(coo);
coo = 1728*1380 + 1381;
nz.push_back(coo);
coo = 1728*1380 + 1383;
nz.push_back(coo);
coo = 1728*1381 + 1382;
nz.push_back(coo);
coo = 1728*1382 + 1391;
nz.push_back(coo);
coo = 1728*1382 + 1665;
nz.push_back(coo);
coo = 1728*1383 + 1618;
nz.push_back(coo);
coo = 1728*1384 + 1385;
nz.push_back(coo);
coo = 1728*1384 + 1389;
nz.push_back(coo);
coo = 1728*1385 + 1386;
nz.push_back(coo);
coo = 1728*1386 + 1387;
nz.push_back(coo);
coo = 1728*1387 + 1436;
nz.push_back(coo);
coo = 1728*1388 + 1389;
nz.push_back(coo);
coo = 1728*1388 + 1391;
nz.push_back(coo);
coo = 1728*1389 + 1390;
nz.push_back(coo);
coo = 1728*1390 + 1673;
nz.push_back(coo);
coo = 1728*1391 + 1626;
nz.push_back(coo);
coo = 1728*1392 + 1393;
nz.push_back(coo);
coo = 1728*1392 + 1397;
nz.push_back(coo);
coo = 1728*1392 + 1403;
nz.push_back(coo);
coo = 1728*1393 + 1394;
nz.push_back(coo);
coo = 1728*1394 + 1395;
nz.push_back(coo);
coo = 1728*1395 + 1432;
nz.push_back(coo);
coo = 1728*1396 + 1397;
nz.push_back(coo);
coo = 1728*1396 + 1399;
nz.push_back(coo);
coo = 1728*1397 + 1398;
nz.push_back(coo);
coo = 1728*1398 + 1407;
nz.push_back(coo);
coo = 1728*1398 + 1681;
nz.push_back(coo);
coo = 1728*1399 + 1438;
nz.push_back(coo);
coo = 1728*1399 + 1634;
nz.push_back(coo);
coo = 1728*1400 + 1401;
nz.push_back(coo);
coo = 1728*1400 + 1405;
nz.push_back(coo);
coo = 1728*1400 + 1411;
nz.push_back(coo);
coo = 1728*1401 + 1402;
nz.push_back(coo);
coo = 1728*1402 + 1403;
nz.push_back(coo);
coo = 1728*1404 + 1405;
nz.push_back(coo);
coo = 1728*1404 + 1407;
nz.push_back(coo);
coo = 1728*1405 + 1406;
nz.push_back(coo);
coo = 1728*1406 + 1415;
nz.push_back(coo);
coo = 1728*1406 + 1689;
nz.push_back(coo);
coo = 1728*1407 + 1642;
nz.push_back(coo);
coo = 1728*1408 + 1409;
nz.push_back(coo);
coo = 1728*1408 + 1413;
nz.push_back(coo);
coo = 1728*1408 + 1419;
nz.push_back(coo);
coo = 1728*1409 + 1410;
nz.push_back(coo);
coo = 1728*1410 + 1411;
nz.push_back(coo);
coo = 1728*1412 + 1413;
nz.push_back(coo);
coo = 1728*1412 + 1415;
nz.push_back(coo);
coo = 1728*1413 + 1414;
nz.push_back(coo);
coo = 1728*1414 + 1423;
nz.push_back(coo);
coo = 1728*1414 + 1697;
nz.push_back(coo);
coo = 1728*1415 + 1650;
nz.push_back(coo);
coo = 1728*1416 + 1417;
nz.push_back(coo);
coo = 1728*1416 + 1421;
nz.push_back(coo);
coo = 1728*1416 + 1427;
nz.push_back(coo);
coo = 1728*1417 + 1418;
nz.push_back(coo);
coo = 1728*1418 + 1419;
nz.push_back(coo);
coo = 1728*1420 + 1421;
nz.push_back(coo);
coo = 1728*1420 + 1423;
nz.push_back(coo);
coo = 1728*1421 + 1422;
nz.push_back(coo);
coo = 1728*1422 + 1431;
nz.push_back(coo);
coo = 1728*1422 + 1705;
nz.push_back(coo);
coo = 1728*1423 + 1658;
nz.push_back(coo);
coo = 1728*1424 + 1425;
nz.push_back(coo);
coo = 1728*1424 + 1429;
nz.push_back(coo);
coo = 1728*1424 + 1435;
nz.push_back(coo);
coo = 1728*1425 + 1426;
nz.push_back(coo);
coo = 1728*1426 + 1427;
nz.push_back(coo);
coo = 1728*1428 + 1429;
nz.push_back(coo);
coo = 1728*1428 + 1431;
nz.push_back(coo);
coo = 1728*1429 + 1430;
nz.push_back(coo);
coo = 1728*1430 + 1439;
nz.push_back(coo);
coo = 1728*1430 + 1713;
nz.push_back(coo);
coo = 1728*1431 + 1666;
nz.push_back(coo);
coo = 1728*1432 + 1433;
nz.push_back(coo);
coo = 1728*1432 + 1437;
nz.push_back(coo);
coo = 1728*1433 + 1434;
nz.push_back(coo);
coo = 1728*1434 + 1435;
nz.push_back(coo);
coo = 1728*1436 + 1437;
nz.push_back(coo);
coo = 1728*1436 + 1439;
nz.push_back(coo);
coo = 1728*1437 + 1438;
nz.push_back(coo);
coo = 1728*1438 + 1721;
nz.push_back(coo);
coo = 1728*1439 + 1674;
nz.push_back(coo);
coo = 1728*1440 + 1441;
nz.push_back(coo);
coo = 1728*1440 + 1445;
nz.push_back(coo);
coo = 1728*1440 + 1451;
nz.push_back(coo);
coo = 1728*1441 + 1442;
nz.push_back(coo);
coo = 1728*1442 + 1443;
nz.push_back(coo);
coo = 1728*1443 + 1480;
nz.push_back(coo);
coo = 1728*1443 + 1492;
nz.push_back(coo);
coo = 1728*1444 + 1445;
nz.push_back(coo);
coo = 1728*1444 + 1447;
nz.push_back(coo);
coo = 1728*1444 + 1683;
nz.push_back(coo);
coo = 1728*1445 + 1446;
nz.push_back(coo);
coo = 1728*1446 + 1455;
nz.push_back(coo);
coo = 1728*1447 + 1486;
nz.push_back(coo);
coo = 1728*1448 + 1449;
nz.push_back(coo);
coo = 1728*1448 + 1453;
nz.push_back(coo);
coo = 1728*1448 + 1459;
nz.push_back(coo);
coo = 1728*1449 + 1450;
nz.push_back(coo);
coo = 1728*1450 + 1451;
nz.push_back(coo);
coo = 1728*1451 + 1500;
nz.push_back(coo);
coo = 1728*1452 + 1453;
nz.push_back(coo);
coo = 1728*1452 + 1455;
nz.push_back(coo);
coo = 1728*1452 + 1691;
nz.push_back(coo);
coo = 1728*1453 + 1454;
nz.push_back(coo);
coo = 1728*1454 + 1463;
nz.push_back(coo);
coo = 1728*1456 + 1457;
nz.push_back(coo);
coo = 1728*1456 + 1461;
nz.push_back(coo);
coo = 1728*1456 + 1467;
nz.push_back(coo);
coo = 1728*1457 + 1458;
nz.push_back(coo);
coo = 1728*1458 + 1459;
nz.push_back(coo);
coo = 1728*1459 + 1508;
nz.push_back(coo);
coo = 1728*1460 + 1461;
nz.push_back(coo);
coo = 1728*1460 + 1463;
nz.push_back(coo);
coo = 1728*1460 + 1699;
nz.push_back(coo);
coo = 1728*1461 + 1462;
nz.push_back(coo);
coo = 1728*1462 + 1471;
nz.push_back(coo);
coo = 1728*1464 + 1465;
nz.push_back(coo);
coo = 1728*1464 + 1469;
nz.push_back(coo);
coo = 1728*1464 + 1475;
nz.push_back(coo);
coo = 1728*1465 + 1466;
nz.push_back(coo);
coo = 1728*1466 + 1467;
nz.push_back(coo);
coo = 1728*1467 + 1516;
nz.push_back(coo);
coo = 1728*1468 + 1469;
nz.push_back(coo);
coo = 1728*1468 + 1471;
nz.push_back(coo);
coo = 1728*1468 + 1707;
nz.push_back(coo);
coo = 1728*1469 + 1470;
nz.push_back(coo);
coo = 1728*1470 + 1479;
nz.push_back(coo);
coo = 1728*1472 + 1473;
nz.push_back(coo);
coo = 1728*1472 + 1477;
nz.push_back(coo);
coo = 1728*1472 + 1483;
nz.push_back(coo);
coo = 1728*1473 + 1474;
nz.push_back(coo);
coo = 1728*1474 + 1475;
nz.push_back(coo);
coo = 1728*1475 + 1524;
nz.push_back(coo);
coo = 1728*1476 + 1477;
nz.push_back(coo);
coo = 1728*1476 + 1479;
nz.push_back(coo);
coo = 1728*1476 + 1715;
nz.push_back(coo);
coo = 1728*1477 + 1478;
nz.push_back(coo);
coo = 1728*1478 + 1487;
nz.push_back(coo);
coo = 1728*1480 + 1481;
nz.push_back(coo);
coo = 1728*1480 + 1485;
nz.push_back(coo);
coo = 1728*1481 + 1482;
nz.push_back(coo);
coo = 1728*1482 + 1483;
nz.push_back(coo);
coo = 1728*1483 + 1532;
nz.push_back(coo);
coo = 1728*1484 + 1485;
nz.push_back(coo);
coo = 1728*1484 + 1487;
nz.push_back(coo);
coo = 1728*1484 + 1723;
nz.push_back(coo);
coo = 1728*1485 + 1486;
nz.push_back(coo);
coo = 1728*1488 + 1489;
nz.push_back(coo);
coo = 1728*1488 + 1493;
nz.push_back(coo);
coo = 1728*1488 + 1499;
nz.push_back(coo);
coo = 1728*1489 + 1490;
nz.push_back(coo);
coo = 1728*1490 + 1491;
nz.push_back(coo);
coo = 1728*1491 + 1528;
nz.push_back(coo);
coo = 1728*1491 + 1540;
nz.push_back(coo);
coo = 1728*1492 + 1493;
nz.push_back(coo);
coo = 1728*1492 + 1495;
nz.push_back(coo);
coo = 1728*1493 + 1494;
nz.push_back(coo);
coo = 1728*1494 + 1503;
nz.push_back(coo);
coo = 1728*1495 + 1534;
nz.push_back(coo);
coo = 1728*1496 + 1497;
nz.push_back(coo);
coo = 1728*1496 + 1501;
nz.push_back(coo);
coo = 1728*1496 + 1507;
nz.push_back(coo);
coo = 1728*1497 + 1498;
nz.push_back(coo);
coo = 1728*1498 + 1499;
nz.push_back(coo);
coo = 1728*1499 + 1548;
nz.push_back(coo);
coo = 1728*1500 + 1501;
nz.push_back(coo);
coo = 1728*1500 + 1503;
nz.push_back(coo);
coo = 1728*1501 + 1502;
nz.push_back(coo);
coo = 1728*1502 + 1511;
nz.push_back(coo);
coo = 1728*1504 + 1505;
nz.push_back(coo);
coo = 1728*1504 + 1509;
nz.push_back(coo);
coo = 1728*1504 + 1515;
nz.push_back(coo);
coo = 1728*1505 + 1506;
nz.push_back(coo);
coo = 1728*1506 + 1507;
nz.push_back(coo);
coo = 1728*1507 + 1556;
nz.push_back(coo);
coo = 1728*1508 + 1509;
nz.push_back(coo);
coo = 1728*1508 + 1511;
nz.push_back(coo);
coo = 1728*1509 + 1510;
nz.push_back(coo);
coo = 1728*1510 + 1519;
nz.push_back(coo);
coo = 1728*1512 + 1513;
nz.push_back(coo);
coo = 1728*1512 + 1517;
nz.push_back(coo);
coo = 1728*1512 + 1523;
nz.push_back(coo);
coo = 1728*1513 + 1514;
nz.push_back(coo);
coo = 1728*1514 + 1515;
nz.push_back(coo);
coo = 1728*1515 + 1564;
nz.push_back(coo);
coo = 1728*1516 + 1517;
nz.push_back(coo);
coo = 1728*1516 + 1519;
nz.push_back(coo);
coo = 1728*1517 + 1518;
nz.push_back(coo);
coo = 1728*1518 + 1527;
nz.push_back(coo);
coo = 1728*1520 + 1521;
nz.push_back(coo);
coo = 1728*1520 + 1525;
nz.push_back(coo);
coo = 1728*1520 + 1531;
nz.push_back(coo);
coo = 1728*1521 + 1522;
nz.push_back(coo);
coo = 1728*1522 + 1523;
nz.push_back(coo);
coo = 1728*1523 + 1572;
nz.push_back(coo);
coo = 1728*1524 + 1525;
nz.push_back(coo);
coo = 1728*1524 + 1527;
nz.push_back(coo);
coo = 1728*1525 + 1526;
nz.push_back(coo);
coo = 1728*1526 + 1535;
nz.push_back(coo);
coo = 1728*1528 + 1529;
nz.push_back(coo);
coo = 1728*1528 + 1533;
nz.push_back(coo);
coo = 1728*1529 + 1530;
nz.push_back(coo);
coo = 1728*1530 + 1531;
nz.push_back(coo);
coo = 1728*1531 + 1580;
nz.push_back(coo);
coo = 1728*1532 + 1533;
nz.push_back(coo);
coo = 1728*1532 + 1535;
nz.push_back(coo);
coo = 1728*1533 + 1534;
nz.push_back(coo);
coo = 1728*1536 + 1537;
nz.push_back(coo);
coo = 1728*1536 + 1541;
nz.push_back(coo);
coo = 1728*1536 + 1547;
nz.push_back(coo);
coo = 1728*1537 + 1538;
nz.push_back(coo);
coo = 1728*1538 + 1539;
nz.push_back(coo);
coo = 1728*1539 + 1576;
nz.push_back(coo);
coo = 1728*1539 + 1588;
nz.push_back(coo);
coo = 1728*1540 + 1541;
nz.push_back(coo);
coo = 1728*1540 + 1543;
nz.push_back(coo);
coo = 1728*1541 + 1542;
nz.push_back(coo);
coo = 1728*1542 + 1551;
nz.push_back(coo);
coo = 1728*1543 + 1582;
nz.push_back(coo);
coo = 1728*1544 + 1545;
nz.push_back(coo);
coo = 1728*1544 + 1549;
nz.push_back(coo);
coo = 1728*1544 + 1555;
nz.push_back(coo);
coo = 1728*1545 + 1546;
nz.push_back(coo);
coo = 1728*1546 + 1547;
nz.push_back(coo);
coo = 1728*1547 + 1596;
nz.push_back(coo);
coo = 1728*1548 + 1549;
nz.push_back(coo);
coo = 1728*1548 + 1551;
nz.push_back(coo);
coo = 1728*1549 + 1550;
nz.push_back(coo);
coo = 1728*1550 + 1559;
nz.push_back(coo);
coo = 1728*1552 + 1553;
nz.push_back(coo);
coo = 1728*1552 + 1557;
nz.push_back(coo);
coo = 1728*1552 + 1563;
nz.push_back(coo);
coo = 1728*1553 + 1554;
nz.push_back(coo);
coo = 1728*1554 + 1555;
nz.push_back(coo);
coo = 1728*1555 + 1604;
nz.push_back(coo);
coo = 1728*1556 + 1557;
nz.push_back(coo);
coo = 1728*1556 + 1559;
nz.push_back(coo);
coo = 1728*1557 + 1558;
nz.push_back(coo);
coo = 1728*1558 + 1567;
nz.push_back(coo);
coo = 1728*1560 + 1561;
nz.push_back(coo);
coo = 1728*1560 + 1565;
nz.push_back(coo);
coo = 1728*1560 + 1571;
nz.push_back(coo);
coo = 1728*1561 + 1562;
nz.push_back(coo);
coo = 1728*1562 + 1563;
nz.push_back(coo);
coo = 1728*1563 + 1612;
nz.push_back(coo);
coo = 1728*1564 + 1565;
nz.push_back(coo);
coo = 1728*1564 + 1567;
nz.push_back(coo);
coo = 1728*1565 + 1566;
nz.push_back(coo);
coo = 1728*1566 + 1575;
nz.push_back(coo);
coo = 1728*1568 + 1569;
nz.push_back(coo);
coo = 1728*1568 + 1573;
nz.push_back(coo);
coo = 1728*1568 + 1579;
nz.push_back(coo);
coo = 1728*1569 + 1570;
nz.push_back(coo);
coo = 1728*1570 + 1571;
nz.push_back(coo);
coo = 1728*1571 + 1620;
nz.push_back(coo);
coo = 1728*1572 + 1573;
nz.push_back(coo);
coo = 1728*1572 + 1575;
nz.push_back(coo);
coo = 1728*1573 + 1574;
nz.push_back(coo);
coo = 1728*1574 + 1583;
nz.push_back(coo);
coo = 1728*1576 + 1577;
nz.push_back(coo);
coo = 1728*1576 + 1581;
nz.push_back(coo);
coo = 1728*1577 + 1578;
nz.push_back(coo);
coo = 1728*1578 + 1579;
nz.push_back(coo);
coo = 1728*1579 + 1628;
nz.push_back(coo);
coo = 1728*1580 + 1581;
nz.push_back(coo);
coo = 1728*1580 + 1583;
nz.push_back(coo);
coo = 1728*1581 + 1582;
nz.push_back(coo);
coo = 1728*1584 + 1585;
nz.push_back(coo);
coo = 1728*1584 + 1589;
nz.push_back(coo);
coo = 1728*1584 + 1595;
nz.push_back(coo);
coo = 1728*1585 + 1586;
nz.push_back(coo);
coo = 1728*1586 + 1587;
nz.push_back(coo);
coo = 1728*1587 + 1624;
nz.push_back(coo);
coo = 1728*1587 + 1636;
nz.push_back(coo);
coo = 1728*1588 + 1589;
nz.push_back(coo);
coo = 1728*1588 + 1591;
nz.push_back(coo);
coo = 1728*1589 + 1590;
nz.push_back(coo);
coo = 1728*1590 + 1599;
nz.push_back(coo);
coo = 1728*1591 + 1630;
nz.push_back(coo);
coo = 1728*1592 + 1593;
nz.push_back(coo);
coo = 1728*1592 + 1597;
nz.push_back(coo);
coo = 1728*1592 + 1603;
nz.push_back(coo);
coo = 1728*1593 + 1594;
nz.push_back(coo);
coo = 1728*1594 + 1595;
nz.push_back(coo);
coo = 1728*1595 + 1644;
nz.push_back(coo);
coo = 1728*1596 + 1597;
nz.push_back(coo);
coo = 1728*1596 + 1599;
nz.push_back(coo);
coo = 1728*1597 + 1598;
nz.push_back(coo);
coo = 1728*1598 + 1607;
nz.push_back(coo);
coo = 1728*1600 + 1601;
nz.push_back(coo);
coo = 1728*1600 + 1605;
nz.push_back(coo);
coo = 1728*1600 + 1611;
nz.push_back(coo);
coo = 1728*1601 + 1602;
nz.push_back(coo);
coo = 1728*1602 + 1603;
nz.push_back(coo);
coo = 1728*1603 + 1652;
nz.push_back(coo);
coo = 1728*1604 + 1605;
nz.push_back(coo);
coo = 1728*1604 + 1607;
nz.push_back(coo);
coo = 1728*1605 + 1606;
nz.push_back(coo);
coo = 1728*1606 + 1615;
nz.push_back(coo);
coo = 1728*1608 + 1609;
nz.push_back(coo);
coo = 1728*1608 + 1613;
nz.push_back(coo);
coo = 1728*1608 + 1619;
nz.push_back(coo);
coo = 1728*1609 + 1610;
nz.push_back(coo);
coo = 1728*1610 + 1611;
nz.push_back(coo);
coo = 1728*1611 + 1660;
nz.push_back(coo);
coo = 1728*1612 + 1613;
nz.push_back(coo);
coo = 1728*1612 + 1615;
nz.push_back(coo);
coo = 1728*1613 + 1614;
nz.push_back(coo);
coo = 1728*1614 + 1623;
nz.push_back(coo);
coo = 1728*1616 + 1617;
nz.push_back(coo);
coo = 1728*1616 + 1621;
nz.push_back(coo);
coo = 1728*1616 + 1627;
nz.push_back(coo);
coo = 1728*1617 + 1618;
nz.push_back(coo);
coo = 1728*1618 + 1619;
nz.push_back(coo);
coo = 1728*1619 + 1668;
nz.push_back(coo);
coo = 1728*1620 + 1621;
nz.push_back(coo);
coo = 1728*1620 + 1623;
nz.push_back(coo);
coo = 1728*1621 + 1622;
nz.push_back(coo);
coo = 1728*1622 + 1631;
nz.push_back(coo);
coo = 1728*1624 + 1625;
nz.push_back(coo);
coo = 1728*1624 + 1629;
nz.push_back(coo);
coo = 1728*1625 + 1626;
nz.push_back(coo);
coo = 1728*1626 + 1627;
nz.push_back(coo);
coo = 1728*1627 + 1676;
nz.push_back(coo);
coo = 1728*1628 + 1629;
nz.push_back(coo);
coo = 1728*1628 + 1631;
nz.push_back(coo);
coo = 1728*1629 + 1630;
nz.push_back(coo);
coo = 1728*1632 + 1633;
nz.push_back(coo);
coo = 1728*1632 + 1637;
nz.push_back(coo);
coo = 1728*1632 + 1643;
nz.push_back(coo);
coo = 1728*1633 + 1634;
nz.push_back(coo);
coo = 1728*1634 + 1635;
nz.push_back(coo);
coo = 1728*1635 + 1672;
nz.push_back(coo);
coo = 1728*1635 + 1684;
nz.push_back(coo);
coo = 1728*1636 + 1637;
nz.push_back(coo);
coo = 1728*1636 + 1639;
nz.push_back(coo);
coo = 1728*1637 + 1638;
nz.push_back(coo);
coo = 1728*1638 + 1647;
nz.push_back(coo);
coo = 1728*1639 + 1678;
nz.push_back(coo);
coo = 1728*1640 + 1641;
nz.push_back(coo);
coo = 1728*1640 + 1645;
nz.push_back(coo);
coo = 1728*1640 + 1651;
nz.push_back(coo);
coo = 1728*1641 + 1642;
nz.push_back(coo);
coo = 1728*1642 + 1643;
nz.push_back(coo);
coo = 1728*1643 + 1692;
nz.push_back(coo);
coo = 1728*1644 + 1645;
nz.push_back(coo);
coo = 1728*1644 + 1647;
nz.push_back(coo);
coo = 1728*1645 + 1646;
nz.push_back(coo);
coo = 1728*1646 + 1655;
nz.push_back(coo);
coo = 1728*1648 + 1649;
nz.push_back(coo);
coo = 1728*1648 + 1653;
nz.push_back(coo);
coo = 1728*1648 + 1659;
nz.push_back(coo);
coo = 1728*1649 + 1650;
nz.push_back(coo);
coo = 1728*1650 + 1651;
nz.push_back(coo);
coo = 1728*1651 + 1700;
nz.push_back(coo);
coo = 1728*1652 + 1653;
nz.push_back(coo);
coo = 1728*1652 + 1655;
nz.push_back(coo);
coo = 1728*1653 + 1654;
nz.push_back(coo);
coo = 1728*1654 + 1663;
nz.push_back(coo);
coo = 1728*1656 + 1657;
nz.push_back(coo);
coo = 1728*1656 + 1661;
nz.push_back(coo);
coo = 1728*1656 + 1667;
nz.push_back(coo);
coo = 1728*1657 + 1658;
nz.push_back(coo);
coo = 1728*1658 + 1659;
nz.push_back(coo);
coo = 1728*1659 + 1708;
nz.push_back(coo);
coo = 1728*1660 + 1661;
nz.push_back(coo);
coo = 1728*1660 + 1663;
nz.push_back(coo);
coo = 1728*1661 + 1662;
nz.push_back(coo);
coo = 1728*1662 + 1671;
nz.push_back(coo);
coo = 1728*1664 + 1665;
nz.push_back(coo);
coo = 1728*1664 + 1669;
nz.push_back(coo);
coo = 1728*1664 + 1675;
nz.push_back(coo);
coo = 1728*1665 + 1666;
nz.push_back(coo);
coo = 1728*1666 + 1667;
nz.push_back(coo);
coo = 1728*1667 + 1716;
nz.push_back(coo);
coo = 1728*1668 + 1669;
nz.push_back(coo);
coo = 1728*1668 + 1671;
nz.push_back(coo);
coo = 1728*1669 + 1670;
nz.push_back(coo);
coo = 1728*1670 + 1679;
nz.push_back(coo);
coo = 1728*1672 + 1673;
nz.push_back(coo);
coo = 1728*1672 + 1677;
nz.push_back(coo);
coo = 1728*1673 + 1674;
nz.push_back(coo);
coo = 1728*1674 + 1675;
nz.push_back(coo);
coo = 1728*1675 + 1724;
nz.push_back(coo);
coo = 1728*1676 + 1677;
nz.push_back(coo);
coo = 1728*1676 + 1679;
nz.push_back(coo);
coo = 1728*1677 + 1678;
nz.push_back(coo);
coo = 1728*1680 + 1681;
nz.push_back(coo);
coo = 1728*1680 + 1685;
nz.push_back(coo);
coo = 1728*1680 + 1691;
nz.push_back(coo);
coo = 1728*1681 + 1682;
nz.push_back(coo);
coo = 1728*1682 + 1683;
nz.push_back(coo);
coo = 1728*1683 + 1720;
nz.push_back(coo);
coo = 1728*1684 + 1685;
nz.push_back(coo);
coo = 1728*1684 + 1687;
nz.push_back(coo);
coo = 1728*1685 + 1686;
nz.push_back(coo);
coo = 1728*1686 + 1695;
nz.push_back(coo);
coo = 1728*1687 + 1726;
nz.push_back(coo);
coo = 1728*1688 + 1689;
nz.push_back(coo);
coo = 1728*1688 + 1693;
nz.push_back(coo);
coo = 1728*1688 + 1699;
nz.push_back(coo);
coo = 1728*1689 + 1690;
nz.push_back(coo);
coo = 1728*1690 + 1691;
nz.push_back(coo);
coo = 1728*1692 + 1693;
nz.push_back(coo);
coo = 1728*1692 + 1695;
nz.push_back(coo);
coo = 1728*1693 + 1694;
nz.push_back(coo);
coo = 1728*1694 + 1703;
nz.push_back(coo);
coo = 1728*1696 + 1697;
nz.push_back(coo);
coo = 1728*1696 + 1701;
nz.push_back(coo);
coo = 1728*1696 + 1707;
nz.push_back(coo);
coo = 1728*1697 + 1698;
nz.push_back(coo);
coo = 1728*1698 + 1699;
nz.push_back(coo);
coo = 1728*1700 + 1701;
nz.push_back(coo);
coo = 1728*1700 + 1703;
nz.push_back(coo);
coo = 1728*1701 + 1702;
nz.push_back(coo);
coo = 1728*1702 + 1711;
nz.push_back(coo);
coo = 1728*1704 + 1705;
nz.push_back(coo);
coo = 1728*1704 + 1709;
nz.push_back(coo);
coo = 1728*1704 + 1715;
nz.push_back(coo);
coo = 1728*1705 + 1706;
nz.push_back(coo);
coo = 1728*1706 + 1707;
nz.push_back(coo);
coo = 1728*1708 + 1709;
nz.push_back(coo);
coo = 1728*1708 + 1711;
nz.push_back(coo);
coo = 1728*1709 + 1710;
nz.push_back(coo);
coo = 1728*1710 + 1719;
nz.push_back(coo);
coo = 1728*1712 + 1713;
nz.push_back(coo);
coo = 1728*1712 + 1717;
nz.push_back(coo);
coo = 1728*1712 + 1723;
nz.push_back(coo);
coo = 1728*1713 + 1714;
nz.push_back(coo);
coo = 1728*1714 + 1715;
nz.push_back(coo);
coo = 1728*1716 + 1717;
nz.push_back(coo);
coo = 1728*1716 + 1719;
nz.push_back(coo);
coo = 1728*1717 + 1718;
nz.push_back(coo);
coo = 1728*1718 + 1727;
nz.push_back(coo);
coo = 1728*1720 + 1721;
nz.push_back(coo);
coo = 1728*1720 + 1725;
nz.push_back(coo);
coo = 1728*1721 + 1722;
nz.push_back(coo);
coo = 1728*1722 + 1723;
nz.push_back(coo);
coo = 1728*1724 + 1725;
nz.push_back(coo);
coo = 1728*1724 + 1727;
nz.push_back(coo);
coo = 1728*1725 + 1726;
nz.push_back(coo);
return nz;
}
Mat<int> create_plaquettes()
{
Mat<int> P(1728,10);
P(0, 0) = 1728*0+1;
P(0, 1) = 1728*1+2;
P(0, 2) = 1728*2+3;
P(0, 3) = 1728*3+52;
P(0, 4) = 1728*52+53;
P(0, 5) = 1728*53+54;
P(0, 6) = 1728*54+63;
P(0, 7) = 1728*63+60;
P(0, 8) = 1728*60+11;
P(0, 9) = 1728*11+0;
P(1, 0) = 1728*0+1;
P(1, 1) = 1728*1+2;
P(1, 2) = 1728*2+3;
P(1, 3) = 1728*3+52;
P(1, 4) = 1728*52+55;
P(1, 5) = 1728*55+290;
P(1, 6) = 1728*290+289;
P(1, 7) = 1728*289+6;
P(1, 8) = 1728*6+5;
P(1, 9) = 1728*5+0;
P(2, 0) = 1728*0+1;
P(2, 1) = 1728*1+2;
P(2, 2) = 1728*2+3;
P(2, 3) = 1728*3+40;
P(2, 4) = 1728*40+45;
P(2, 5) = 1728*45+46;
P(2, 6) = 1728*46+7;
P(2, 7) = 1728*7+4;
P(2, 8) = 1728*4+5;
P(2, 9) = 1728*5+0;
P(3, 0) = 1728*0+1;
P(3, 1) = 1728*1+2;
P(3, 2) = 1728*2+1495;
P(3, 3) = 1728*1495+1492;
P(3, 4) = 1728*1492+1493;
P(3, 5) = 1728*1493+1494;
P(3, 6) = 1728*1494+1503;
P(3, 7) = 1728*1503+10;
P(3, 8) = 1728*10+11;
P(3, 9) = 1728*11+0;
P(4, 0) = 1728*0+1;
P(4, 1) = 1728*1+1446;
P(4, 2) = 1728*1446+1445;
P(4, 3) = 1728*1445+1444;
P(4, 4) = 1728*1444+1447;
P(4, 5) = 1728*1447+242;
P(4, 6) = 1728*242+243;
P(4, 7) = 1728*243+4;
P(4, 8) = 1728*4+5;
P(4, 9) = 1728*5+0;
P(5, 0) = 1728*0+1;
P(5, 1) = 1728*1+1446;
P(5, 2) = 1728*1446+1445;
P(5, 3) = 1728*1445+1440;
P(5, 4) = 1728*1440+1451;
P(5, 5) = 1728*1451+1500;
P(5, 6) = 1728*1500+1503;
P(5, 7) = 1728*1503+10;
P(5, 8) = 1728*10+11;
P(5, 9) = 1728*11+0;
P(6, 0) = 1728*0+1;
P(6, 1) = 1728*1+1446;
P(6, 2) = 1728*1446+1455;
P(6, 3) = 1728*1455+1452;
P(6, 4) = 1728*1452+1453;
P(6, 5) = 1728*1453+1454;
P(6, 6) = 1728*1454+9;
P(6, 7) = 1728*9+10;
P(6, 8) = 1728*10+11;
P(6, 9) = 1728*11+0;
P(7, 0) = 1728*0+1;
P(7, 1) = 1728*1+1446;
P(7, 2) = 1728*1446+1455;
P(7, 3) = 1728*1455+250;
P(7, 4) = 1728*250+251;
P(7, 5) = 1728*251+12;
P(7, 6) = 1728*12+15;
P(7, 7) = 1728*15+6;
P(7, 8) = 1728*6+5;
P(7, 9) = 1728*5+0;
P(8, 0) = 1728*0+5;
P(8, 1) = 1728*5+6;
P(8, 2) = 1728*6+15;
P(8, 3) = 1728*15+12;
P(8, 4) = 1728*12+13;
P(8, 5) = 1728*13+8;
P(8, 6) = 1728*8+9;
P(8, 7) = 1728*9+10;
P(8, 8) = 1728*10+11;
P(8, 9) = 1728*11+0;
P(9, 0) = 1728*0+5;
P(9, 1) = 1728*5+6;
P(9, 2) = 1728*6+289;
P(9, 3) = 1728*289+288;
P(9, 4) = 1728*288+299;
P(9, 5) = 1728*299+298;
P(9, 6) = 1728*298+63;
P(9, 7) = 1728*63+60;
P(9, 8) = 1728*60+11;
P(9, 9) = 1728*11+0;
P(10, 0) = 1728*1+2;
P(10, 1) = 1728*2+3;
P(10, 2) = 1728*3+40;
P(10, 3) = 1728*40+41;
P(10, 4) = 1728*41+1486;
P(10, 5) = 1728*1486+1447;
P(10, 6) = 1728*1447+1444;
P(10, 7) = 1728*1444+1445;
P(10, 8) = 1728*1445+1446;
P(10, 9) = 1728*1446+1;
P(11, 0) = 1728*1+2;
P(11, 1) = 1728*2+1495;
P(11, 2) = 1728*1495+1492;
P(11, 3) = 1728*1492+1443;
P(11, 4) = 1728*1443+1442;
P(11, 5) = 1728*1442+1441;
P(11, 6) = 1728*1441+1440;
P(11, 7) = 1728*1440+1445;
P(11, 8) = 1728*1445+1446;
P(11, 9) = 1728*1446+1;
P(12, 0) = 1728*2+3;
P(12, 1) = 1728*3+52;
P(12, 2) = 1728*52+53;
P(12, 3) = 1728*53+48;
P(12, 4) = 1728*48+49;
P(12, 5) = 1728*49+1494;
P(12, 6) = 1728*1494+1493;
P(12, 7) = 1728*1493+1492;
P(12, 8) = 1728*1492+1495;
P(12, 9) = 1728*1495+2;
P(13, 0) = 1728*2+3;
P(13, 1) = 1728*3+52;
P(13, 2) = 1728*52+55;
P(13, 3) = 1728*55+94;
P(13, 4) = 1728*94+93;
P(13, 5) = 1728*93+88;
P(13, 6) = 1728*88+89;
P(13, 7) = 1728*89+1534;
P(13, 8) = 1728*1534+1495;
P(13, 9) = 1728*1495+2;
P(14, 0) = 1728*2+3;
P(14, 1) = 1728*3+40;
P(14, 2) = 1728*40+41;
P(14, 3) = 1728*41+42;
P(14, 4) = 1728*42+1535;
P(14, 5) = 1728*1535+1532;
P(14, 6) = 1728*1532+1533;
P(14, 7) = 1728*1533+1534;
P(14, 8) = 1728*1534+1495;
P(14, 9) = 1728*1495+2;
P(15, 0) = 1728*2+3;
P(15, 1) = 1728*3+40;
P(15, 2) = 1728*40+41;
P(15, 3) = 1728*41+1486;
P(15, 4) = 1728*1486+1485;
P(15, 5) = 1728*1485+1480;
P(15, 6) = 1728*1480+1443;
P(15, 7) = 1728*1443+1492;
P(15, 8) = 1728*1492+1495;
P(15, 9) = 1728*1495+2;
P(16, 0) = 1728*3+52;
P(16, 1) = 1728*52+55;
P(16, 2) = 1728*55+94;
P(16, 3) = 1728*94+93;
P(16, 4) = 1728*93+92;
P(16, 5) = 1728*92+43;
P(16, 6) = 1728*43+42;
P(16, 7) = 1728*42+41;
P(16, 8) = 1728*41+40;
P(16, 9) = 1728*40+3;
P(17, 0) = 1728*3+52;
P(17, 1) = 1728*52+55;
P(17, 2) = 1728*55+290;
P(17, 3) = 1728*290+291;
P(17, 4) = 1728*291+328;
P(17, 5) = 1728*328+329;
P(17, 6) = 1728*329+46;
P(17, 7) = 1728*46+45;
P(17, 8) = 1728*45+40;
P(17, 9) = 1728*40+3;
P(18, 0) = 1728*4+5;
P(18, 1) = 1728*5+6;
P(18, 2) = 1728*6+15;
P(18, 3) = 1728*15+12;
P(18, 4) = 1728*12+251;
P(18, 5) = 1728*251+240;
P(18, 6) = 1728*240+241;
P(18, 7) = 1728*241+242;
P(18, 8) = 1728*242+243;
P(18, 9) = 1728*243+4;
P(19, 0) = 1728*4+5;
P(19, 1) = 1728*5+6;
P(19, 2) = 1728*6+15;
P(19, 3) = 1728*15+538;
P(19, 4) = 1728*538+539;
P(19, 5) = 1728*539+528;
P(19, 6) = 1728*528+529;
P(19, 7) = 1728*529+530;
P(19, 8) = 1728*530+7;
P(19, 9) = 1728*7+4;
P(20, 0) = 1728*4+5;
P(20, 1) = 1728*5+6;
P(20, 2) = 1728*6+289;
P(20, 3) = 1728*289+288;
P(20, 4) = 1728*288+293;
P(20, 5) = 1728*293+292;
P(20, 6) = 1728*292+531;
P(20, 7) = 1728*531+530;
P(20, 8) = 1728*530+7;
P(20, 9) = 1728*7+4;
P(21, 0) = 1728*4+5;
P(21, 1) = 1728*5+6;
P(21, 2) = 1728*6+289;
P(21, 3) = 1728*289+290;
P(21, 4) = 1728*290+291;
P(21, 5) = 1728*291+328;
P(21, 6) = 1728*328+329;
P(21, 7) = 1728*329+46;
P(21, 8) = 1728*46+7;
P(21, 9) = 1728*7+4;
P(22, 0) = 1728*4+243;
P(22, 1) = 1728*243+242;
P(22, 2) = 1728*242+241;
P(22, 3) = 1728*241+240;
P(22, 4) = 1728*240+245;
P(22, 5) = 1728*245+246;
P(22, 6) = 1728*246+529;
P(22, 7) = 1728*529+530;
P(22, 8) = 1728*530+7;
P(22, 9) = 1728*7+4;
P(23, 0) = 1728*4+243;
P(23, 1) = 1728*243+242;
P(23, 2) = 1728*242+1447;
P(23, 3) = 1728*1447+1486;
P(23, 4) = 1728*1486+41;
P(23, 5) = 1728*41+40;
P(23, 6) = 1728*40+45;
P(23, 7) = 1728*45+46;
P(23, 8) = 1728*46+7;
P(23, 9) = 1728*7+4;
P(24, 0) = 1728*4+243;
P(24, 1) = 1728*243+280;
P(24, 2) = 1728*280+281;
P(24, 3) = 1728*281+282;
P(24, 4) = 1728*282+283;
P(24, 5) = 1728*283+44;
P(24, 6) = 1728*44+45;
P(24, 7) = 1728*45+46;
P(24, 8) = 1728*46+7;
P(24, 9) = 1728*7+4;
P(25, 0) = 1728*4+243;
P(25, 1) = 1728*243+280;
P(25, 2) = 1728*280+285;
P(25, 3) = 1728*285+286;
P(25, 4) = 1728*286+569;
P(25, 5) = 1728*569+568;
P(25, 6) = 1728*568+531;
P(25, 7) = 1728*531+530;
P(25, 8) = 1728*530+7;
P(25, 9) = 1728*7+4;
P(26, 0) = 1728*6+15;
P(26, 1) = 1728*15+12;
P(26, 2) = 1728*12+13;
P(26, 3) = 1728*13+14;
P(26, 4) = 1728*14+297;
P(26, 5) = 1728*297+298;
P(26, 6) = 1728*298+299;
P(26, 7) = 1728*299+288;
P(26, 8) = 1728*288+289;
P(26, 9) = 1728*289+6;
P(27, 0) = 1728*6+15;
P(27, 1) = 1728*15+538;
P(27, 2) = 1728*538+539;
P(27, 3) = 1728*539+300;
P(27, 4) = 1728*300+303;
P(27, 5) = 1728*303+294;
P(27, 6) = 1728*294+293;
P(27, 7) = 1728*293+288;
P(27, 8) = 1728*288+289;
P(27, 9) = 1728*289+6;
P(28, 0) = 1728*7+46;
P(28, 1) = 1728*46+45;
P(28, 2) = 1728*45+44;
P(28, 3) = 1728*44+47;
P(28, 4) = 1728*47+570;
P(28, 5) = 1728*570+569;
P(28, 6) = 1728*569+568;
P(28, 7) = 1728*568+531;
P(28, 8) = 1728*531+530;
P(28, 9) = 1728*530+7;
P(29, 0) = 1728*7+46;
P(29, 1) = 1728*46+329;
P(29, 2) = 1728*329+328;
P(29, 3) = 1728*328+333;
P(29, 4) = 1728*333+334;
P(29, 5) = 1728*334+295;
P(29, 6) = 1728*295+292;
P(29, 7) = 1728*292+531;
P(29, 8) = 1728*531+530;
P(29, 9) = 1728*530+7;
P(30, 0) = 1728*8+9;
P(30, 1) = 1728*9+10;
P(30, 2) = 1728*10+11;
P(30, 3) = 1728*11+60;
P(30, 4) = 1728*60+61;
P(30, 5) = 1728*61+62;
P(30, 6) = 1728*62+71;
P(30, 7) = 1728*71+68;
P(30, 8) = 1728*68+19;
P(30, 9) = 1728*19+8;
P(31, 0) = 1728*8+9;
P(31, 1) = 1728*9+10;
P(31, 2) = 1728*10+11;
P(31, 3) = 1728*11+60;
P(31, 4) = 1728*60+63;
P(31, 5) = 1728*63+298;
P(31, 6) = 1728*298+297;
P(31, 7) = 1728*297+14;
P(31, 8) = 1728*14+13;
P(31, 9) = 1728*13+8;
P(32, 0) = 1728*8+9;
P(32, 1) = 1728*9+10;
P(32, 2) = 1728*10+1503;
P(32, 3) = 1728*1503+1500;
P(32, 4) = 1728*1500+1501;
P(32, 5) = 1728*1501+1502;
P(32, 6) = 1728*1502+1511;
P(32, 7) = 1728*1511+18;
P(32, 8) = 1728*18+19;
P(32, 9) = 1728*19+8;
P(33, 0) = 1728*8+9;
P(33, 1) = 1728*9+1454;
P(33, 2) = 1728*1454+1453;
P(33, 3) = 1728*1453+1452;
P(33, 4) = 1728*1452+1455;
P(33, 5) = 1728*1455+250;
P(33, 6) = 1728*250+251;
P(33, 7) = 1728*251+12;
P(33, 8) = 1728*12+13;
P(33, 9) = 1728*13+8;
P(34, 0) = 1728*8+9;
P(34, 1) = 1728*9+1454;
P(34, 2) = 1728*1454+1453;
P(34, 3) = 1728*1453+1448;
P(34, 4) = 1728*1448+1459;
P(34, 5) = 1728*1459+1508;
P(34, 6) = 1728*1508+1511;
P(34, 7) = 1728*1511+18;
P(34, 8) = 1728*18+19;
P(34, 9) = 1728*19+8;
P(35, 0) = 1728*8+9;
P(35, 1) = 1728*9+1454;
P(35, 2) = 1728*1454+1463;
P(35, 3) = 1728*1463+1460;
P(35, 4) = 1728*1460+1461;
P(35, 5) = 1728*1461+1462;
P(35, 6) = 1728*1462+17;
P(35, 7) = 1728*17+18;
P(35, 8) = 1728*18+19;
P(35, 9) = 1728*19+8;
P(36, 0) = 1728*8+9;
P(36, 1) = 1728*9+1454;
P(36, 2) = 1728*1454+1463;
P(36, 3) = 1728*1463+258;
P(36, 4) = 1728*258+259;
P(36, 5) = 1728*259+20;
P(36, 6) = 1728*20+23;
P(36, 7) = 1728*23+14;
P(36, 8) = 1728*14+13;
P(36, 9) = 1728*13+8;
P(37, 0) = 1728*8+13;
P(37, 1) = 1728*13+14;
P(37, 2) = 1728*14+23;
P(37, 3) = 1728*23+20;
P(37, 4) = 1728*20+21;
P(37, 5) = 1728*21+16;
P(37, 6) = 1728*16+17;
P(37, 7) = 1728*17+18;
P(37, 8) = 1728*18+19;
P(37, 9) = 1728*19+8;
P(38, 0) = 1728*8+13;
P(38, 1) = 1728*13+14;
P(38, 2) = 1728*14+297;
P(38, 3) = 1728*297+296;
P(38, 4) = 1728*296+307;
P(38, 5) = 1728*307+306;
P(38, 6) = 1728*306+71;
P(38, 7) = 1728*71+68;
P(38, 8) = 1728*68+19;
P(38, 9) = 1728*19+8;
P(39, 0) = 1728*9+10;
P(39, 1) = 1728*10+1503;
P(39, 2) = 1728*1503+1500;
P(39, 3) = 1728*1500+1451;
P(39, 4) = 1728*1451+1450;
P(39, 5) = 1728*1450+1449;
P(39, 6) = 1728*1449+1448;
P(39, 7) = 1728*1448+1453;
P(39, 8) = 1728*1453+1454;
P(39, 9) = 1728*1454+9;
P(40, 0) = 1728*10+11;
P(40, 1) = 1728*11+60;
P(40, 2) = 1728*60+61;
P(40, 3) = 1728*61+56;
P(40, 4) = 1728*56+57;
P(40, 5) = 1728*57+1502;
P(40, 6) = 1728*1502+1501;
P(40, 7) = 1728*1501+1500;
P(40, 8) = 1728*1500+1503;
P(40, 9) = 1728*1503+10;
P(41, 0) = 1728*10+11;
P(41, 1) = 1728*11+60;
P(41, 2) = 1728*60+63;
P(41, 3) = 1728*63+54;
P(41, 4) = 1728*54+53;
P(41, 5) = 1728*53+48;
P(41, 6) = 1728*48+49;
P(41, 7) = 1728*49+1494;
P(41, 8) = 1728*1494+1503;
P(41, 9) = 1728*1503+10;
P(42, 0) = 1728*12+13;
P(42, 1) = 1728*13+14;
P(42, 2) = 1728*14+23;
P(42, 3) = 1728*23+20;
P(42, 4) = 1728*20+259;
P(42, 5) = 1728*259+248;
P(42, 6) = 1728*248+249;
P(42, 7) = 1728*249+250;
P(42, 8) = 1728*250+251;
P(42, 9) = 1728*251+12;
P(43, 0) = 1728*12+13;
P(43, 1) = 1728*13+14;
P(43, 2) = 1728*14+23;
P(43, 3) = 1728*23+546;
P(43, 4) = 1728*546+547;
P(43, 5) = 1728*547+536;
P(43, 6) = 1728*536+537;
P(43, 7) = 1728*537+538;
P(43, 8) = 1728*538+15;
P(43, 9) = 1728*15+12;
P(44, 0) = 1728*12+13;
P(44, 1) = 1728*13+14;
P(44, 2) = 1728*14+297;
P(44, 3) = 1728*297+296;
P(44, 4) = 1728*296+301;
P(44, 5) = 1728*301+300;
P(44, 6) = 1728*300+539;
P(44, 7) = 1728*539+538;
P(44, 8) = 1728*538+15;
P(44, 9) = 1728*15+12;
P(45, 0) = 1728*12+251;
P(45, 1) = 1728*251+250;
P(45, 2) = 1728*250+249;
P(45, 3) = 1728*249+248;
P(45, 4) = 1728*248+253;
P(45, 5) = 1728*253+254;
P(45, 6) = 1728*254+537;
P(45, 7) = 1728*537+538;
P(45, 8) = 1728*538+15;
P(45, 9) = 1728*15+12;
P(46, 0) = 1728*12+251;
P(46, 1) = 1728*251+240;
P(46, 2) = 1728*240+245;
P(46, 3) = 1728*245+246;
P(46, 4) = 1728*246+529;
P(46, 5) = 1728*529+528;
P(46, 6) = 1728*528+539;
P(46, 7) = 1728*539+538;
P(46, 8) = 1728*538+15;
P(46, 9) = 1728*15+12;
P(47, 0) = 1728*14+23;
P(47, 1) = 1728*23+20;
P(47, 2) = 1728*20+21;
P(47, 3) = 1728*21+22;
P(47, 4) = 1728*22+305;
P(47, 5) = 1728*305+306;
P(47, 6) = 1728*306+307;
P(47, 7) = 1728*307+296;
P(47, 8) = 1728*296+297;
P(47, 9) = 1728*297+14;
P(48, 0) = 1728*14+23;
P(48, 1) = 1728*23+546;
P(48, 2) = 1728*546+547;
P(48, 3) = 1728*547+308;
P(48, 4) = 1728*308+311;
P(48, 5) = 1728*311+302;
P(48, 6) = 1728*302+301;
P(48, 7) = 1728*301+296;
P(48, 8) = 1728*296+297;
P(48, 9) = 1728*297+14;
P(49, 0) = 1728*16+17;
P(49, 1) = 1728*17+18;
P(49, 2) = 1728*18+19;
P(49, 3) = 1728*19+68;
P(49, 4) = 1728*68+69;
P(49, 5) = 1728*69+70;
P(49, 6) = 1728*70+79;
P(49, 7) = 1728*79+76;
P(49, 8) = 1728*76+27;
P(49, 9) = 1728*27+16;
P(50, 0) = 1728*16+17;
P(50, 1) = 1728*17+18;
P(50, 2) = 1728*18+19;
P(50, 3) = 1728*19+68;
P(50, 4) = 1728*68+71;
P(50, 5) = 1728*71+306;
P(50, 6) = 1728*306+305;
P(50, 7) = 1728*305+22;
P(50, 8) = 1728*22+21;
P(50, 9) = 1728*21+16;
P(51, 0) = 1728*16+17;
P(51, 1) = 1728*17+18;
P(51, 2) = 1728*18+1511;
P(51, 3) = 1728*1511+1508;
P(51, 4) = 1728*1508+1509;
P(51, 5) = 1728*1509+1510;
P(51, 6) = 1728*1510+1519;
P(51, 7) = 1728*1519+26;
P(51, 8) = 1728*26+27;
P(51, 9) = 1728*27+16;
P(52, 0) = 1728*16+17;
P(52, 1) = 1728*17+1462;
P(52, 2) = 1728*1462+1461;
P(52, 3) = 1728*1461+1460;
P(52, 4) = 1728*1460+1463;
P(52, 5) = 1728*1463+258;
P(52, 6) = 1728*258+259;
P(52, 7) = 1728*259+20;
P(52, 8) = 1728*20+21;
P(52, 9) = 1728*21+16;
P(53, 0) = 1728*16+17;
P(53, 1) = 1728*17+1462;
P(53, 2) = 1728*1462+1461;
P(53, 3) = 1728*1461+1456;
P(53, 4) = 1728*1456+1467;
P(53, 5) = 1728*1467+1516;
P(53, 6) = 1728*1516+1519;
P(53, 7) = 1728*1519+26;
P(53, 8) = 1728*26+27;
P(53, 9) = 1728*27+16;
P(54, 0) = 1728*16+17;
P(54, 1) = 1728*17+1462;
P(54, 2) = 1728*1462+1471;
P(54, 3) = 1728*1471+1468;
P(54, 4) = 1728*1468+1469;
P(54, 5) = 1728*1469+1470;
P(54, 6) = 1728*1470+25;
P(54, 7) = 1728*25+26;
P(54, 8) = 1728*26+27;
P(54, 9) = 1728*27+16;
P(55, 0) = 1728*16+17;
P(55, 1) = 1728*17+1462;
P(55, 2) = 1728*1462+1471;
P(55, 3) = 1728*1471+266;
P(55, 4) = 1728*266+267;
P(55, 5) = 1728*267+28;
P(55, 6) = 1728*28+31;
P(55, 7) = 1728*31+22;
P(55, 8) = 1728*22+21;
P(55, 9) = 1728*21+16;
P(56, 0) = 1728*16+21;
P(56, 1) = 1728*21+22;
P(56, 2) = 1728*22+31;
P(56, 3) = 1728*31+28;
P(56, 4) = 1728*28+29;
P(56, 5) = 1728*29+24;
P(56, 6) = 1728*24+25;
P(56, 7) = 1728*25+26;
P(56, 8) = 1728*26+27;
P(56, 9) = 1728*27+16;
P(57, 0) = 1728*16+21;
P(57, 1) = 1728*21+22;
P(57, 2) = 1728*22+305;
P(57, 3) = 1728*305+304;
P(57, 4) = 1728*304+315;
P(57, 5) = 1728*315+314;
P(57, 6) = 1728*314+79;
P(57, 7) = 1728*79+76;
P(57, 8) = 1728*76+27;
P(57, 9) = 1728*27+16;
P(58, 0) = 1728*17+18;
P(58, 1) = 1728*18+1511;
P(58, 2) = 1728*1511+1508;
P(58, 3) = 1728*1508+1459;
P(58, 4) = 1728*1459+1458;
P(58, 5) = 1728*1458+1457;
P(58, 6) = 1728*1457+1456;
P(58, 7) = 1728*1456+1461;
P(58, 8) = 1728*1461+1462;
P(58, 9) = 1728*1462+17;
P(59, 0) = 1728*18+19;
P(59, 1) = 1728*19+68;
P(59, 2) = 1728*68+69;
P(59, 3) = 1728*69+64;
P(59, 4) = 1728*64+65;
P(59, 5) = 1728*65+1510;
P(59, 6) = 1728*1510+1509;
P(59, 7) = 1728*1509+1508;
P(59, 8) = 1728*1508+1511;
P(59, 9) = 1728*1511+18;
P(60, 0) = 1728*18+19;
P(60, 1) = 1728*19+68;
P(60, 2) = 1728*68+71;
P(60, 3) = 1728*71+62;
P(60, 4) = 1728*62+61;
P(60, 5) = 1728*61+56;
P(60, 6) = 1728*56+57;
P(60, 7) = 1728*57+1502;
P(60, 8) = 1728*1502+1511;
P(60, 9) = 1728*1511+18;
P(61, 0) = 1728*20+21;
P(61, 1) = 1728*21+22;
P(61, 2) = 1728*22+31;
P(61, 3) = 1728*31+28;
P(61, 4) = 1728*28+267;
P(61, 5) = 1728*267+256;
P(61, 6) = 1728*256+257;
P(61, 7) = 1728*257+258;
P(61, 8) = 1728*258+259;
P(61, 9) = 1728*259+20;
P(62, 0) = 1728*20+21;
P(62, 1) = 1728*21+22;
P(62, 2) = 1728*22+31;
P(62, 3) = 1728*31+554;
P(62, 4) = 1728*554+555;
P(62, 5) = 1728*555+544;
P(62, 6) = 1728*544+545;
P(62, 7) = 1728*545+546;
P(62, 8) = 1728*546+23;
P(62, 9) = 1728*23+20;
P(63, 0) = 1728*20+21;
P(63, 1) = 1728*21+22;
P(63, 2) = 1728*22+305;
P(63, 3) = 1728*305+304;
P(63, 4) = 1728*304+309;
P(63, 5) = 1728*309+308;
P(63, 6) = 1728*308+547;
P(63, 7) = 1728*547+546;
P(63, 8) = 1728*546+23;
P(63, 9) = 1728*23+20;
P(64, 0) = 1728*20+259;
P(64, 1) = 1728*259+258;
P(64, 2) = 1728*258+257;
P(64, 3) = 1728*257+256;
P(64, 4) = 1728*256+261;
P(64, 5) = 1728*261+262;
P(64, 6) = 1728*262+545;
P(64, 7) = 1728*545+546;
P(64, 8) = 1728*546+23;
P(64, 9) = 1728*23+20;
P(65, 0) = 1728*20+259;
P(65, 1) = 1728*259+248;
P(65, 2) = 1728*248+253;
P(65, 3) = 1728*253+254;
P(65, 4) = 1728*254+537;
P(65, 5) = 1728*537+536;
P(65, 6) = 1728*536+547;
P(65, 7) = 1728*547+546;
P(65, 8) = 1728*546+23;
P(65, 9) = 1728*23+20;
P(66, 0) = 1728*22+31;
P(66, 1) = 1728*31+28;
P(66, 2) = 1728*28+29;
P(66, 3) = 1728*29+30;
P(66, 4) = 1728*30+313;
P(66, 5) = 1728*313+314;
P(66, 6) = 1728*314+315;
P(66, 7) = 1728*315+304;
P(66, 8) = 1728*304+305;
P(66, 9) = 1728*305+22;
P(67, 0) = 1728*22+31;
P(67, 1) = 1728*31+554;
P(67, 2) = 1728*554+555;
P(67, 3) = 1728*555+316;
P(67, 4) = 1728*316+319;
P(67, 5) = 1728*319+310;
P(67, 6) = 1728*310+309;
P(67, 7) = 1728*309+304;
P(67, 8) = 1728*304+305;
P(67, 9) = 1728*305+22;
P(68, 0) = 1728*24+25;
P(68, 1) = 1728*25+26;
P(68, 2) = 1728*26+27;
P(68, 3) = 1728*27+76;
P(68, 4) = 1728*76+77;
P(68, 5) = 1728*77+78;
P(68, 6) = 1728*78+87;
P(68, 7) = 1728*87+84;
P(68, 8) = 1728*84+35;
P(68, 9) = 1728*35+24;
P(69, 0) = 1728*24+25;
P(69, 1) = 1728*25+26;
P(69, 2) = 1728*26+27;
P(69, 3) = 1728*27+76;
P(69, 4) = 1728*76+79;
P(69, 5) = 1728*79+314;
P(69, 6) = 1728*314+313;
P(69, 7) = 1728*313+30;
P(69, 8) = 1728*30+29;
P(69, 9) = 1728*29+24;
P(70, 0) = 1728*24+25;
P(70, 1) = 1728*25+26;
P(70, 2) = 1728*26+1519;
P(70, 3) = 1728*1519+1516;
P(70, 4) = 1728*1516+1517;
P(70, 5) = 1728*1517+1518;
P(70, 6) = 1728*1518+1527;
P(70, 7) = 1728*1527+34;
P(70, 8) = 1728*34+35;
P(70, 9) = 1728*35+24;
P(71, 0) = 1728*24+25;
P(71, 1) = 1728*25+1470;
P(71, 2) = 1728*1470+1469;
P(71, 3) = 1728*1469+1468;
P(71, 4) = 1728*1468+1471;
P(71, 5) = 1728*1471+266;
P(71, 6) = 1728*266+267;
P(71, 7) = 1728*267+28;
P(71, 8) = 1728*28+29;
P(71, 9) = 1728*29+24;
P(72, 0) = 1728*24+25;
P(72, 1) = 1728*25+1470;
P(72, 2) = 1728*1470+1469;
P(72, 3) = 1728*1469+1464;
P(72, 4) = 1728*1464+1475;
P(72, 5) = 1728*1475+1524;
P(72, 6) = 1728*1524+1527;
P(72, 7) = 1728*1527+34;
P(72, 8) = 1728*34+35;
P(72, 9) = 1728*35+24;
P(73, 0) = 1728*24+25;
P(73, 1) = 1728*25+1470;
P(73, 2) = 1728*1470+1479;
P(73, 3) = 1728*1479+1476;
P(73, 4) = 1728*1476+1477;
P(73, 5) = 1728*1477+1478;
P(73, 6) = 1728*1478+33;
P(73, 7) = 1728*33+34;
P(73, 8) = 1728*34+35;
P(73, 9) = 1728*35+24;
P(74, 0) = 1728*24+25;
P(74, 1) = 1728*25+1470;
P(74, 2) = 1728*1470+1479;
P(74, 3) = 1728*1479+274;
P(74, 4) = 1728*274+275;
P(74, 5) = 1728*275+36;
P(74, 6) = 1728*36+39;
P(74, 7) = 1728*39+30;
P(74, 8) = 1728*30+29;
P(74, 9) = 1728*29+24;
P(75, 0) = 1728*24+29;
P(75, 1) = 1728*29+30;
P(75, 2) = 1728*30+39;
P(75, 3) = 1728*39+36;
P(75, 4) = 1728*36+37;
P(75, 5) = 1728*37+32;
P(75, 6) = 1728*32+33;
P(75, 7) = 1728*33+34;
P(75, 8) = 1728*34+35;
P(75, 9) = 1728*35+24;
P(76, 0) = 1728*24+29;
P(76, 1) = 1728*29+30;
P(76, 2) = 1728*30+313;
P(76, 3) = 1728*313+312;
P(76, 4) = 1728*312+323;
P(76, 5) = 1728*323+322;
P(76, 6) = 1728*322+87;
P(76, 7) = 1728*87+84;
P(76, 8) = 1728*84+35;
P(76, 9) = 1728*35+24;
P(77, 0) = 1728*25+26;
P(77, 1) = 1728*26+1519;
P(77, 2) = 1728*1519+1516;
P(77, 3) = 1728*1516+1467;
P(77, 4) = 1728*1467+1466;
P(77, 5) = 1728*1466+1465;
P(77, 6) = 1728*1465+1464;
P(77, 7) = 1728*1464+1469;
P(77, 8) = 1728*1469+1470;
P(77, 9) = 1728*1470+25;
P(78, 0) = 1728*26+27;
P(78, 1) = 1728*27+76;
P(78, 2) = 1728*76+77;
P(78, 3) = 1728*77+72;
P(78, 4) = 1728*72+73;
P(78, 5) = 1728*73+1518;
P(78, 6) = 1728*1518+1517;
P(78, 7) = 1728*1517+1516;
P(78, 8) = 1728*1516+1519;
P(78, 9) = 1728*1519+26;
P(79, 0) = 1728*26+27;
P(79, 1) = 1728*27+76;
P(79, 2) = 1728*76+79;
P(79, 3) = 1728*79+70;
P(79, 4) = 1728*70+69;
P(79, 5) = 1728*69+64;
P(79, 6) = 1728*64+65;
P(79, 7) = 1728*65+1510;
P(79, 8) = 1728*1510+1519;
P(79, 9) = 1728*1519+26;
P(80, 0) = 1728*28+29;
P(80, 1) = 1728*29+30;
P(80, 2) = 1728*30+39;
P(80, 3) = 1728*39+36;
P(80, 4) = 1728*36+275;
P(80, 5) = 1728*275+264;
P(80, 6) = 1728*264+265;
P(80, 7) = 1728*265+266;
P(80, 8) = 1728*266+267;
P(80, 9) = 1728*267+28;
P(81, 0) = 1728*28+29;
P(81, 1) = 1728*29+30;
P(81, 2) = 1728*30+39;
P(81, 3) = 1728*39+562;
P(81, 4) = 1728*562+563;
P(81, 5) = 1728*563+552;
P(81, 6) = 1728*552+553;
P(81, 7) = 1728*553+554;
P(81, 8) = 1728*554+31;
P(81, 9) = 1728*31+28;
P(82, 0) = 1728*28+29;
P(82, 1) = 1728*29+30;
P(82, 2) = 1728*30+313;
P(82, 3) = 1728*313+312;
P(82, 4) = 1728*312+317;
P(82, 5) = 1728*317+316;
P(82, 6) = 1728*316+555;
P(82, 7) = 1728*555+554;
P(82, 8) = 1728*554+31;
P(82, 9) = 1728*31+28;
P(83, 0) = 1728*28+267;
P(83, 1) = 1728*267+266;
P(83, 2) = 1728*266+265;
P(83, 3) = 1728*265+264;
P(83, 4) = 1728*264+269;
P(83, 5) = 1728*269+270;
P(83, 6) = 1728*270+553;
P(83, 7) = 1728*553+554;
P(83, 8) = 1728*554+31;
P(83, 9) = 1728*31+28;
P(84, 0) = 1728*28+267;
P(84, 1) = 1728*267+256;
P(84, 2) = 1728*256+261;
P(84, 3) = 1728*261+262;
P(84, 4) = 1728*262+545;
P(84, 5) = 1728*545+544;
P(84, 6) = 1728*544+555;
P(84, 7) = 1728*555+554;
P(84, 8) = 1728*554+31;
P(84, 9) = 1728*31+28;
P(85, 0) = 1728*30+39;
P(85, 1) = 1728*39+36;
P(85, 2) = 1728*36+37;
P(85, 3) = 1728*37+38;
P(85, 4) = 1728*38+321;
P(85, 5) = 1728*321+322;
P(85, 6) = 1728*322+323;
P(85, 7) = 1728*323+312;
P(85, 8) = 1728*312+313;
P(85, 9) = 1728*313+30;
P(86, 0) = 1728*30+39;
P(86, 1) = 1728*39+562;
P(86, 2) = 1728*562+563;
P(86, 3) = 1728*563+324;
P(86, 4) = 1728*324+327;
P(86, 5) = 1728*327+318;
P(86, 6) = 1728*318+317;
P(86, 7) = 1728*317+312;
P(86, 8) = 1728*312+313;
P(86, 9) = 1728*313+30;
P(87, 0) = 1728*32+33;
P(87, 1) = 1728*33+34;
P(87, 2) = 1728*34+35;
P(87, 3) = 1728*35+84;
P(87, 4) = 1728*84+85;
P(87, 5) = 1728*85+86;
P(87, 6) = 1728*86+95;
P(87, 7) = 1728*95+92;
P(87, 8) = 1728*92+43;
P(87, 9) = 1728*43+32;
P(88, 0) = 1728*32+33;
P(88, 1) = 1728*33+34;
P(88, 2) = 1728*34+35;
P(88, 3) = 1728*35+84;
P(88, 4) = 1728*84+87;
P(88, 5) = 1728*87+322;
P(88, 6) = 1728*322+321;
P(88, 7) = 1728*321+38;
P(88, 8) = 1728*38+37;
P(88, 9) = 1728*37+32;
P(89, 0) = 1728*32+33;
P(89, 1) = 1728*33+34;
P(89, 2) = 1728*34+1527;
P(89, 3) = 1728*1527+1524;
P(89, 4) = 1728*1524+1525;
P(89, 5) = 1728*1525+1526;
P(89, 6) = 1728*1526+1535;
P(89, 7) = 1728*1535+42;
P(89, 8) = 1728*42+43;
P(89, 9) = 1728*43+32;
P(90, 0) = 1728*32+33;
P(90, 1) = 1728*33+1478;
P(90, 2) = 1728*1478+1477;
P(90, 3) = 1728*1477+1476;
P(90, 4) = 1728*1476+1479;
P(90, 5) = 1728*1479+274;
P(90, 6) = 1728*274+275;
P(90, 7) = 1728*275+36;
P(90, 8) = 1728*36+37;
P(90, 9) = 1728*37+32;
P(91, 0) = 1728*32+33;
P(91, 1) = 1728*33+1478;
P(91, 2) = 1728*1478+1477;
P(91, 3) = 1728*1477+1472;
P(91, 4) = 1728*1472+1483;
P(91, 5) = 1728*1483+1532;
P(91, 6) = 1728*1532+1535;
P(91, 7) = 1728*1535+42;
P(91, 8) = 1728*42+43;
P(91, 9) = 1728*43+32;
P(92, 0) = 1728*32+33;
P(92, 1) = 1728*33+1478;
P(92, 2) = 1728*1478+1487;
P(92, 3) = 1728*1487+1484;
P(92, 4) = 1728*1484+1485;
P(92, 5) = 1728*1485+1486;
P(92, 6) = 1728*1486+41;
P(92, 7) = 1728*41+42;
P(92, 8) = 1728*42+43;
P(92, 9) = 1728*43+32;
P(93, 0) = 1728*32+33;
P(93, 1) = 1728*33+1478;
P(93, 2) = 1728*1478+1487;
P(93, 3) = 1728*1487+282;
P(93, 4) = 1728*282+283;
P(93, 5) = 1728*283+44;
P(93, 6) = 1728*44+47;
P(93, 7) = 1728*47+38;
P(93, 8) = 1728*38+37;
P(93, 9) = 1728*37+32;
P(94, 0) = 1728*32+37;
P(94, 1) = 1728*37+38;
P(94, 2) = 1728*38+47;
P(94, 3) = 1728*47+44;
P(94, 4) = 1728*44+45;
P(94, 5) = 1728*45+40;
P(94, 6) = 1728*40+41;
P(94, 7) = 1728*41+42;
P(94, 8) = 1728*42+43;
P(94, 9) = 1728*43+32;
P(95, 0) = 1728*32+37;
P(95, 1) = 1728*37+38;
P(95, 2) = 1728*38+321;
P(95, 3) = 1728*321+320;
P(95, 4) = 1728*320+331;
P(95, 5) = 1728*331+330;
P(95, 6) = 1728*330+95;
P(95, 7) = 1728*95+92;
P(95, 8) = 1728*92+43;
P(95, 9) = 1728*43+32;
P(96, 0) = 1728*33+34;
P(96, 1) = 1728*34+1527;
P(96, 2) = 1728*1527+1524;
P(96, 3) = 1728*1524+1475;
P(96, 4) = 1728*1475+1474;
P(96, 5) = 1728*1474+1473;
P(96, 6) = 1728*1473+1472;
P(96, 7) = 1728*1472+1477;
P(96, 8) = 1728*1477+1478;
P(96, 9) = 1728*1478+33;
P(97, 0) = 1728*34+35;
P(97, 1) = 1728*35+84;
P(97, 2) = 1728*84+85;
P(97, 3) = 1728*85+80;
P(97, 4) = 1728*80+81;
P(97, 5) = 1728*81+1526;
P(97, 6) = 1728*1526+1525;
P(97, 7) = 1728*1525+1524;
P(97, 8) = 1728*1524+1527;
P(97, 9) = 1728*1527+34;
P(98, 0) = 1728*34+35;
P(98, 1) = 1728*35+84;
P(98, 2) = 1728*84+87;
P(98, 3) = 1728*87+78;
P(98, 4) = 1728*78+77;
P(98, 5) = 1728*77+72;
P(98, 6) = 1728*72+73;
P(98, 7) = 1728*73+1518;
P(98, 8) = 1728*1518+1527;
P(98, 9) = 1728*1527+34;
P(99, 0) = 1728*36+37;
P(99, 1) = 1728*37+38;
P(99, 2) = 1728*38+47;
P(99, 3) = 1728*47+44;
P(99, 4) = 1728*44+283;
P(99, 5) = 1728*283+272;
P(99, 6) = 1728*272+273;
P(99, 7) = 1728*273+274;
P(99, 8) = 1728*274+275;
P(99, 9) = 1728*275+36;
P(100, 0) = 1728*36+37;
P(100, 1) = 1728*37+38;
P(100, 2) = 1728*38+47;
P(100, 3) = 1728*47+570;
P(100, 4) = 1728*570+571;
P(100, 5) = 1728*571+560;
P(100, 6) = 1728*560+561;
P(100, 7) = 1728*561+562;
P(100, 8) = 1728*562+39;
P(100, 9) = 1728*39+36;
P(101, 0) = 1728*36+37;
P(101, 1) = 1728*37+38;
P(101, 2) = 1728*38+321;
P(101, 3) = 1728*321+320;
P(101, 4) = 1728*320+325;
P(101, 5) = 1728*325+324;
P(101, 6) = 1728*324+563;
P(101, 7) = 1728*563+562;
P(101, 8) = 1728*562+39;
P(101, 9) = 1728*39+36;
P(102, 0) = 1728*36+275;
P(102, 1) = 1728*275+274;
P(102, 2) = 1728*274+273;
P(102, 3) = 1728*273+272;
P(102, 4) = 1728*272+277;
P(102, 5) = 1728*277+278;
P(102, 6) = 1728*278+561;
P(102, 7) = 1728*561+562;
P(102, 8) = 1728*562+39;
P(102, 9) = 1728*39+36;
P(103, 0) = 1728*36+275;
P(103, 1) = 1728*275+264;
P(103, 2) = 1728*264+269;
P(103, 3) = 1728*269+270;
P(103, 4) = 1728*270+553;
P(103, 5) = 1728*553+552;
P(103, 6) = 1728*552+563;
P(103, 7) = 1728*563+562;
P(103, 8) = 1728*562+39;
P(103, 9) = 1728*39+36;
P(104, 0) = 1728*38+47;
P(104, 1) = 1728*47+44;
P(104, 2) = 1728*44+45;
P(104, 3) = 1728*45+46;
P(104, 4) = 1728*46+329;
P(104, 5) = 1728*329+330;
P(104, 6) = 1728*330+331;
P(104, 7) = 1728*331+320;
P(104, 8) = 1728*320+321;
P(104, 9) = 1728*321+38;
P(105, 0) = 1728*38+47;
P(105, 1) = 1728*47+570;
P(105, 2) = 1728*570+571;
P(105, 3) = 1728*571+332;
P(105, 4) = 1728*332+335;
P(105, 5) = 1728*335+326;
P(105, 6) = 1728*326+325;
P(105, 7) = 1728*325+320;
P(105, 8) = 1728*320+321;
P(105, 9) = 1728*321+38;
P(106, 0) = 1728*40+41;
P(106, 1) = 1728*41+42;
P(106, 2) = 1728*42+43;
P(106, 3) = 1728*43+92;
P(106, 4) = 1728*92+95;
P(106, 5) = 1728*95+330;
P(106, 6) = 1728*330+329;
P(106, 7) = 1728*329+46;
P(106, 8) = 1728*46+45;
P(106, 9) = 1728*45+40;
P(107, 0) = 1728*40+41;
P(107, 1) = 1728*41+1486;
P(107, 2) = 1728*1486+1485;
P(107, 3) = 1728*1485+1484;
P(107, 4) = 1728*1484+1487;
P(107, 5) = 1728*1487+282;
P(107, 6) = 1728*282+283;
P(107, 7) = 1728*283+44;
P(107, 8) = 1728*44+45;
P(107, 9) = 1728*45+40;
P(108, 0) = 1728*41+42;
P(108, 1) = 1728*42+1535;
P(108, 2) = 1728*1535+1532;
P(108, 3) = 1728*1532+1483;
P(108, 4) = 1728*1483+1482;
P(108, 5) = 1728*1482+1481;
P(108, 6) = 1728*1481+1480;
P(108, 7) = 1728*1480+1485;
P(108, 8) = 1728*1485+1486;
P(108, 9) = 1728*1486+41;
P(109, 0) = 1728*42+43;
P(109, 1) = 1728*43+92;
P(109, 2) = 1728*92+93;
P(109, 3) = 1728*93+88;
P(109, 4) = 1728*88+89;
P(109, 5) = 1728*89+1534;
P(109, 6) = 1728*1534+1533;
P(109, 7) = 1728*1533+1532;
P(109, 8) = 1728*1532+1535;
P(109, 9) = 1728*1535+42;
P(110, 0) = 1728*42+43;
P(110, 1) = 1728*43+92;
P(110, 2) = 1728*92+95;
P(110, 3) = 1728*95+86;
P(110, 4) = 1728*86+85;
P(110, 5) = 1728*85+80;
P(110, 6) = 1728*80+81;
P(110, 7) = 1728*81+1526;
P(110, 8) = 1728*1526+1535;
P(110, 9) = 1728*1535+42;
P(111, 0) = 1728*44+45;
P(111, 1) = 1728*45+46;
P(111, 2) = 1728*46+329;
P(111, 3) = 1728*329+328;
P(111, 4) = 1728*328+333;
P(111, 5) = 1728*333+332;
P(111, 6) = 1728*332+571;
P(111, 7) = 1728*571+570;
P(111, 8) = 1728*570+47;
P(111, 9) = 1728*47+44;
P(112, 0) = 1728*44+283;
P(112, 1) = 1728*283+282;
P(112, 2) = 1728*282+281;
P(112, 3) = 1728*281+280;
P(112, 4) = 1728*280+285;
P(112, 5) = 1728*285+286;
P(112, 6) = 1728*286+569;
P(112, 7) = 1728*569+570;
P(112, 8) = 1728*570+47;
P(112, 9) = 1728*47+44;
P(113, 0) = 1728*44+283;
P(113, 1) = 1728*283+272;
P(113, 2) = 1728*272+277;
P(113, 3) = 1728*277+278;
P(113, 4) = 1728*278+561;
P(113, 5) = 1728*561+560;
P(113, 6) = 1728*560+571;
P(113, 7) = 1728*571+570;
P(113, 8) = 1728*570+47;
P(113, 9) = 1728*47+44;
P(114, 0) = 1728*48+49;
P(114, 1) = 1728*49+50;
P(114, 2) = 1728*50+51;
P(114, 3) = 1728*51+100;
P(114, 4) = 1728*100+101;
P(114, 5) = 1728*101+102;
P(114, 6) = 1728*102+111;
P(114, 7) = 1728*111+108;
P(114, 8) = 1728*108+59;
P(114, 9) = 1728*59+48;
P(115, 0) = 1728*48+49;
P(115, 1) = 1728*49+50;
P(115, 2) = 1728*50+51;
P(115, 3) = 1728*51+100;
P(115, 4) = 1728*100+103;
P(115, 5) = 1728*103+338;
P(115, 6) = 1728*338+337;
P(115, 7) = 1728*337+54;
P(115, 8) = 1728*54+53;
P(115, 9) = 1728*53+48;
P(116, 0) = 1728*48+49;
P(116, 1) = 1728*49+50;
P(116, 2) = 1728*50+51;
P(116, 3) = 1728*51+88;
P(116, 4) = 1728*88+93;
P(116, 5) = 1728*93+94;
P(116, 6) = 1728*94+55;
P(116, 7) = 1728*55+52;
P(116, 8) = 1728*52+53;
P(116, 9) = 1728*53+48;
P(117, 0) = 1728*48+49;
P(117, 1) = 1728*49+50;
P(117, 2) = 1728*50+1543;
P(117, 3) = 1728*1543+1540;
P(117, 4) = 1728*1540+1541;
P(117, 5) = 1728*1541+1542;
P(117, 6) = 1728*1542+1551;
P(117, 7) = 1728*1551+58;
P(117, 8) = 1728*58+59;
P(117, 9) = 1728*59+48;
P(118, 0) = 1728*48+49;
P(118, 1) = 1728*49+1494;
P(118, 2) = 1728*1494+1493;
P(118, 3) = 1728*1493+1488;
P(118, 4) = 1728*1488+1499;
P(118, 5) = 1728*1499+1548;
P(118, 6) = 1728*1548+1551;
P(118, 7) = 1728*1551+58;
P(118, 8) = 1728*58+59;
P(118, 9) = 1728*59+48;
P(119, 0) = 1728*48+49;
P(119, 1) = 1728*49+1494;
P(119, 2) = 1728*1494+1503;
P(119, 3) = 1728*1503+1500;
P(119, 4) = 1728*1500+1501;
P(119, 5) = 1728*1501+1502;
P(119, 6) = 1728*1502+57;
P(119, 7) = 1728*57+58;
P(119, 8) = 1728*58+59;
P(119, 9) = 1728*59+48;
P(120, 0) = 1728*48+53;
P(120, 1) = 1728*53+54;
P(120, 2) = 1728*54+63;
P(120, 3) = 1728*63+60;
P(120, 4) = 1728*60+61;
P(120, 5) = 1728*61+56;
P(120, 6) = 1728*56+57;
P(120, 7) = 1728*57+58;
P(120, 8) = 1728*58+59;
P(120, 9) = 1728*59+48;
P(121, 0) = 1728*48+53;
P(121, 1) = 1728*53+54;
P(121, 2) = 1728*54+337;
P(121, 3) = 1728*337+336;
P(121, 4) = 1728*336+347;
P(121, 5) = 1728*347+346;
P(121, 6) = 1728*346+111;
P(121, 7) = 1728*111+108;
P(121, 8) = 1728*108+59;
P(121, 9) = 1728*59+48;
P(122, 0) = 1728*49+50;
P(122, 1) = 1728*50+51;
P(122, 2) = 1728*51+88;
P(122, 3) = 1728*88+89;
P(122, 4) = 1728*89+1534;
P(122, 5) = 1728*1534+1495;
P(122, 6) = 1728*1495+1492;
P(122, 7) = 1728*1492+1493;
P(122, 8) = 1728*1493+1494;
P(122, 9) = 1728*1494+49;
P(123, 0) = 1728*49+50;
P(123, 1) = 1728*50+1543;
P(123, 2) = 1728*1543+1540;
P(123, 3) = 1728*1540+1491;
P(123, 4) = 1728*1491+1490;
P(123, 5) = 1728*1490+1489;
P(123, 6) = 1728*1489+1488;
P(123, 7) = 1728*1488+1493;
P(123, 8) = 1728*1493+1494;
P(123, 9) = 1728*1494+49;
P(124, 0) = 1728*50+51;
P(124, 1) = 1728*51+100;
P(124, 2) = 1728*100+101;
P(124, 3) = 1728*101+96;
P(124, 4) = 1728*96+97;
P(124, 5) = 1728*97+1542;
P(124, 6) = 1728*1542+1541;
P(124, 7) = 1728*1541+1540;
P(124, 8) = 1728*1540+1543;
P(124, 9) = 1728*1543+50;
P(125, 0) = 1728*50+51;
P(125, 1) = 1728*51+100;
P(125, 2) = 1728*100+103;
P(125, 3) = 1728*103+142;
P(125, 4) = 1728*142+141;
P(125, 5) = 1728*141+136;
P(125, 6) = 1728*136+137;
P(125, 7) = 1728*137+1582;
P(125, 8) = 1728*1582+1543;
P(125, 9) = 1728*1543+50;
P(126, 0) = 1728*50+51;
P(126, 1) = 1728*51+88;
P(126, 2) = 1728*88+89;
P(126, 3) = 1728*89+90;
P(126, 4) = 1728*90+1583;
P(126, 5) = 1728*1583+1580;
P(126, 6) = 1728*1580+1581;
P(126, 7) = 1728*1581+1582;
P(126, 8) = 1728*1582+1543;
P(126, 9) = 1728*1543+50;
P(127, 0) = 1728*50+51;
P(127, 1) = 1728*51+88;
P(127, 2) = 1728*88+89;
P(127, 3) = 1728*89+1534;
P(127, 4) = 1728*1534+1533;
P(127, 5) = 1728*1533+1528;
P(127, 6) = 1728*1528+1491;
P(127, 7) = 1728*1491+1540;
P(127, 8) = 1728*1540+1543;
P(127, 9) = 1728*1543+50;
P(128, 0) = 1728*51+100;
P(128, 1) = 1728*100+103;
P(128, 2) = 1728*103+142;
P(128, 3) = 1728*142+141;
P(128, 4) = 1728*141+140;
P(128, 5) = 1728*140+91;
P(128, 6) = 1728*91+90;
P(128, 7) = 1728*90+89;
P(128, 8) = 1728*89+88;
P(128, 9) = 1728*88+51;
P(129, 0) = 1728*51+100;
P(129, 1) = 1728*100+103;
P(129, 2) = 1728*103+338;
P(129, 3) = 1728*338+339;
P(129, 4) = 1728*339+376;
P(129, 5) = 1728*376+377;
P(129, 6) = 1728*377+94;
P(129, 7) = 1728*94+93;
P(129, 8) = 1728*93+88;
P(129, 9) = 1728*88+51;
P(130, 0) = 1728*52+53;
P(130, 1) = 1728*53+54;
P(130, 2) = 1728*54+63;
P(130, 3) = 1728*63+298;
P(130, 4) = 1728*298+299;
P(130, 5) = 1728*299+288;
P(130, 6) = 1728*288+289;
P(130, 7) = 1728*289+290;
P(130, 8) = 1728*290+55;
P(130, 9) = 1728*55+52;
P(131, 0) = 1728*52+53;
P(131, 1) = 1728*53+54;
P(131, 2) = 1728*54+337;
P(131, 3) = 1728*337+336;
P(131, 4) = 1728*336+341;
P(131, 5) = 1728*341+340;
P(131, 6) = 1728*340+291;
P(131, 7) = 1728*291+290;
P(131, 8) = 1728*290+55;
P(131, 9) = 1728*55+52;
P(132, 0) = 1728*52+53;
P(132, 1) = 1728*53+54;
P(132, 2) = 1728*54+337;
P(132, 3) = 1728*337+338;
P(132, 4) = 1728*338+339;
P(132, 5) = 1728*339+376;
P(132, 6) = 1728*376+377;
P(132, 7) = 1728*377+94;
P(132, 8) = 1728*94+55;
P(132, 9) = 1728*55+52;
P(133, 0) = 1728*54+63;
P(133, 1) = 1728*63+60;
P(133, 2) = 1728*60+61;
P(133, 3) = 1728*61+62;
P(133, 4) = 1728*62+345;
P(133, 5) = 1728*345+346;
P(133, 6) = 1728*346+347;
P(133, 7) = 1728*347+336;
P(133, 8) = 1728*336+337;
P(133, 9) = 1728*337+54;
P(134, 0) = 1728*54+63;
P(134, 1) = 1728*63+298;
P(134, 2) = 1728*298+299;
P(134, 3) = 1728*299+348;
P(134, 4) = 1728*348+351;
P(134, 5) = 1728*351+342;
P(134, 6) = 1728*342+341;
P(134, 7) = 1728*341+336;
P(134, 8) = 1728*336+337;
P(134, 9) = 1728*337+54;
P(135, 0) = 1728*55+94;
P(135, 1) = 1728*94+93;
P(135, 2) = 1728*93+92;
P(135, 3) = 1728*92+95;
P(135, 4) = 1728*95+330;
P(135, 5) = 1728*330+329;
P(135, 6) = 1728*329+328;
P(135, 7) = 1728*328+291;
P(135, 8) = 1728*291+290;
P(135, 9) = 1728*290+55;
P(136, 0) = 1728*55+94;
P(136, 1) = 1728*94+377;
P(136, 2) = 1728*377+376;
P(136, 3) = 1728*376+381;
P(136, 4) = 1728*381+382;
P(136, 5) = 1728*382+343;
P(136, 6) = 1728*343+340;
P(136, 7) = 1728*340+291;
P(136, 8) = 1728*291+290;
P(136, 9) = 1728*290+55;
P(137, 0) = 1728*56+57;
P(137, 1) = 1728*57+58;
P(137, 2) = 1728*58+59;
P(137, 3) = 1728*59+108;
P(137, 4) = 1728*108+109;
P(137, 5) = 1728*109+110;
P(137, 6) = 1728*110+119;
P(137, 7) = 1728*119+116;
P(137, 8) = 1728*116+67;
P(137, 9) = 1728*67+56;
P(138, 0) = 1728*56+57;
P(138, 1) = 1728*57+58;
P(138, 2) = 1728*58+59;
P(138, 3) = 1728*59+108;
P(138, 4) = 1728*108+111;
P(138, 5) = 1728*111+346;
P(138, 6) = 1728*346+345;
P(138, 7) = 1728*345+62;
P(138, 8) = 1728*62+61;
P(138, 9) = 1728*61+56;
P(139, 0) = 1728*56+57;
P(139, 1) = 1728*57+58;
P(139, 2) = 1728*58+1551;
P(139, 3) = 1728*1551+1548;
P(139, 4) = 1728*1548+1549;
P(139, 5) = 1728*1549+1550;
P(139, 6) = 1728*1550+1559;
P(139, 7) = 1728*1559+66;
P(139, 8) = 1728*66+67;
P(139, 9) = 1728*67+56;
P(140, 0) = 1728*56+57;
P(140, 1) = 1728*57+1502;
P(140, 2) = 1728*1502+1501;
P(140, 3) = 1728*1501+1496;
P(140, 4) = 1728*1496+1507;
P(140, 5) = 1728*1507+1556;
P(140, 6) = 1728*1556+1559;
P(140, 7) = 1728*1559+66;
P(140, 8) = 1728*66+67;
P(140, 9) = 1728*67+56;
P(141, 0) = 1728*56+57;
P(141, 1) = 1728*57+1502;
P(141, 2) = 1728*1502+1511;
P(141, 3) = 1728*1511+1508;
P(141, 4) = 1728*1508+1509;
P(141, 5) = 1728*1509+1510;
P(141, 6) = 1728*1510+65;
P(141, 7) = 1728*65+66;
P(141, 8) = 1728*66+67;
P(141, 9) = 1728*67+56;
P(142, 0) = 1728*56+61;
P(142, 1) = 1728*61+62;
P(142, 2) = 1728*62+71;
P(142, 3) = 1728*71+68;
P(142, 4) = 1728*68+69;
P(142, 5) = 1728*69+64;
P(142, 6) = 1728*64+65;
P(142, 7) = 1728*65+66;
P(142, 8) = 1728*66+67;
P(142, 9) = 1728*67+56;
P(143, 0) = 1728*56+61;
P(143, 1) = 1728*61+62;
P(143, 2) = 1728*62+345;
P(143, 3) = 1728*345+344;
P(143, 4) = 1728*344+355;
P(143, 5) = 1728*355+354;
P(143, 6) = 1728*354+119;
P(143, 7) = 1728*119+116;
P(143, 8) = 1728*116+67;
P(143, 9) = 1728*67+56;
P(144, 0) = 1728*57+58;
P(144, 1) = 1728*58+1551;
P(144, 2) = 1728*1551+1548;
P(144, 3) = 1728*1548+1499;
P(144, 4) = 1728*1499+1498;
P(144, 5) = 1728*1498+1497;
P(144, 6) = 1728*1497+1496;
P(144, 7) = 1728*1496+1501;
P(144, 8) = 1728*1501+1502;
P(144, 9) = 1728*1502+57;
P(145, 0) = 1728*58+59;
P(145, 1) = 1728*59+108;
P(145, 2) = 1728*108+109;
P(145, 3) = 1728*109+104;
P(145, 4) = 1728*104+105;
P(145, 5) = 1728*105+1550;
P(145, 6) = 1728*1550+1549;
P(145, 7) = 1728*1549+1548;
P(145, 8) = 1728*1548+1551;
P(145, 9) = 1728*1551+58;
P(146, 0) = 1728*58+59;
P(146, 1) = 1728*59+108;
P(146, 2) = 1728*108+111;
P(146, 3) = 1728*111+102;
P(146, 4) = 1728*102+101;
P(146, 5) = 1728*101+96;
P(146, 6) = 1728*96+97;
P(146, 7) = 1728*97+1542;
P(146, 8) = 1728*1542+1551;
P(146, 9) = 1728*1551+58;
P(147, 0) = 1728*60+61;
P(147, 1) = 1728*61+62;
P(147, 2) = 1728*62+71;
P(147, 3) = 1728*71+306;
P(147, 4) = 1728*306+307;
P(147, 5) = 1728*307+296;
P(147, 6) = 1728*296+297;
P(147, 7) = 1728*297+298;
P(147, 8) = 1728*298+63;
P(147, 9) = 1728*63+60;
P(148, 0) = 1728*60+61;
P(148, 1) = 1728*61+62;
P(148, 2) = 1728*62+345;
P(148, 3) = 1728*345+344;
P(148, 4) = 1728*344+349;
P(148, 5) = 1728*349+348;
P(148, 6) = 1728*348+299;
P(148, 7) = 1728*299+298;
P(148, 8) = 1728*298+63;
P(148, 9) = 1728*63+60;
P(149, 0) = 1728*62+71;
P(149, 1) = 1728*71+68;
P(149, 2) = 1728*68+69;
P(149, 3) = 1728*69+70;
P(149, 4) = 1728*70+353;
P(149, 5) = 1728*353+354;
P(149, 6) = 1728*354+355;
P(149, 7) = 1728*355+344;
P(149, 8) = 1728*344+345;
P(149, 9) = 1728*345+62;
P(150, 0) = 1728*62+71;
P(150, 1) = 1728*71+306;
P(150, 2) = 1728*306+307;
P(150, 3) = 1728*307+356;
P(150, 4) = 1728*356+359;
P(150, 5) = 1728*359+350;
P(150, 6) = 1728*350+349;
P(150, 7) = 1728*349+344;
P(150, 8) = 1728*344+345;
P(150, 9) = 1728*345+62;
P(151, 0) = 1728*64+65;
P(151, 1) = 1728*65+66;
P(151, 2) = 1728*66+67;
P(151, 3) = 1728*67+116;
P(151, 4) = 1728*116+117;
P(151, 5) = 1728*117+118;
P(151, 6) = 1728*118+127;
P(151, 7) = 1728*127+124;
P(151, 8) = 1728*124+75;
P(151, 9) = 1728*75+64;
P(152, 0) = 1728*64+65;
P(152, 1) = 1728*65+66;
P(152, 2) = 1728*66+67;
P(152, 3) = 1728*67+116;
P(152, 4) = 1728*116+119;
P(152, 5) = 1728*119+354;
P(152, 6) = 1728*354+353;
P(152, 7) = 1728*353+70;
P(152, 8) = 1728*70+69;
P(152, 9) = 1728*69+64;
P(153, 0) = 1728*64+65;
P(153, 1) = 1728*65+66;
P(153, 2) = 1728*66+1559;
P(153, 3) = 1728*1559+1556;
P(153, 4) = 1728*1556+1557;
P(153, 5) = 1728*1557+1558;
P(153, 6) = 1728*1558+1567;
P(153, 7) = 1728*1567+74;
P(153, 8) = 1728*74+75;
P(153, 9) = 1728*75+64;
P(154, 0) = 1728*64+65;
P(154, 1) = 1728*65+1510;
P(154, 2) = 1728*1510+1509;
P(154, 3) = 1728*1509+1504;
P(154, 4) = 1728*1504+1515;
P(154, 5) = 1728*1515+1564;
P(154, 6) = 1728*1564+1567;
P(154, 7) = 1728*1567+74;
P(154, 8) = 1728*74+75;
P(154, 9) = 1728*75+64;
P(155, 0) = 1728*64+65;
P(155, 1) = 1728*65+1510;
P(155, 2) = 1728*1510+1519;
P(155, 3) = 1728*1519+1516;
P(155, 4) = 1728*1516+1517;
P(155, 5) = 1728*1517+1518;
P(155, 6) = 1728*1518+73;
P(155, 7) = 1728*73+74;
P(155, 8) = 1728*74+75;
P(155, 9) = 1728*75+64;
P(156, 0) = 1728*64+69;
P(156, 1) = 1728*69+70;
P(156, 2) = 1728*70+79;
P(156, 3) = 1728*79+76;
P(156, 4) = 1728*76+77;
P(156, 5) = 1728*77+72;
P(156, 6) = 1728*72+73;
P(156, 7) = 1728*73+74;
P(156, 8) = 1728*74+75;
P(156, 9) = 1728*75+64;
P(157, 0) = 1728*64+69;
P(157, 1) = 1728*69+70;
P(157, 2) = 1728*70+353;
P(157, 3) = 1728*353+352;
P(157, 4) = 1728*352+363;
P(157, 5) = 1728*363+362;
P(157, 6) = 1728*362+127;
P(157, 7) = 1728*127+124;
P(157, 8) = 1728*124+75;
P(157, 9) = 1728*75+64;
P(158, 0) = 1728*65+66;
P(158, 1) = 1728*66+1559;
P(158, 2) = 1728*1559+1556;
P(158, 3) = 1728*1556+1507;
P(158, 4) = 1728*1507+1506;
P(158, 5) = 1728*1506+1505;
P(158, 6) = 1728*1505+1504;
P(158, 7) = 1728*1504+1509;
P(158, 8) = 1728*1509+1510;
P(158, 9) = 1728*1510+65;
P(159, 0) = 1728*66+67;
P(159, 1) = 1728*67+116;
P(159, 2) = 1728*116+117;
P(159, 3) = 1728*117+112;
P(159, 4) = 1728*112+113;
P(159, 5) = 1728*113+1558;
P(159, 6) = 1728*1558+1557;
P(159, 7) = 1728*1557+1556;
P(159, 8) = 1728*1556+1559;
P(159, 9) = 1728*1559+66;
P(160, 0) = 1728*66+67;
P(160, 1) = 1728*67+116;
P(160, 2) = 1728*116+119;
P(160, 3) = 1728*119+110;
P(160, 4) = 1728*110+109;
P(160, 5) = 1728*109+104;
P(160, 6) = 1728*104+105;
P(160, 7) = 1728*105+1550;
P(160, 8) = 1728*1550+1559;
P(160, 9) = 1728*1559+66;
P(161, 0) = 1728*68+69;
P(161, 1) = 1728*69+70;
P(161, 2) = 1728*70+79;
P(161, 3) = 1728*79+314;
P(161, 4) = 1728*314+315;
P(161, 5) = 1728*315+304;
P(161, 6) = 1728*304+305;
P(161, 7) = 1728*305+306;
P(161, 8) = 1728*306+71;
P(161, 9) = 1728*71+68;
P(162, 0) = 1728*68+69;
P(162, 1) = 1728*69+70;
P(162, 2) = 1728*70+353;
P(162, 3) = 1728*353+352;
P(162, 4) = 1728*352+357;
P(162, 5) = 1728*357+356;
P(162, 6) = 1728*356+307;
P(162, 7) = 1728*307+306;
P(162, 8) = 1728*306+71;
P(162, 9) = 1728*71+68;
P(163, 0) = 1728*70+79;
P(163, 1) = 1728*79+76;
P(163, 2) = 1728*76+77;
P(163, 3) = 1728*77+78;
P(163, 4) = 1728*78+361;
P(163, 5) = 1728*361+362;
P(163, 6) = 1728*362+363;
P(163, 7) = 1728*363+352;
P(163, 8) = 1728*352+353;
P(163, 9) = 1728*353+70;
P(164, 0) = 1728*70+79;
P(164, 1) = 1728*79+314;
P(164, 2) = 1728*314+315;
P(164, 3) = 1728*315+364;
P(164, 4) = 1728*364+367;
P(164, 5) = 1728*367+358;
P(164, 6) = 1728*358+357;
P(164, 7) = 1728*357+352;
P(164, 8) = 1728*352+353;
P(164, 9) = 1728*353+70;
P(165, 0) = 1728*72+73;
P(165, 1) = 1728*73+74;
P(165, 2) = 1728*74+75;
P(165, 3) = 1728*75+124;
P(165, 4) = 1728*124+125;
P(165, 5) = 1728*125+126;
P(165, 6) = 1728*126+135;
P(165, 7) = 1728*135+132;
P(165, 8) = 1728*132+83;
P(165, 9) = 1728*83+72;
P(166, 0) = 1728*72+73;
P(166, 1) = 1728*73+74;
P(166, 2) = 1728*74+75;
P(166, 3) = 1728*75+124;
P(166, 4) = 1728*124+127;
P(166, 5) = 1728*127+362;
P(166, 6) = 1728*362+361;
P(166, 7) = 1728*361+78;
P(166, 8) = 1728*78+77;
P(166, 9) = 1728*77+72;
P(167, 0) = 1728*72+73;
P(167, 1) = 1728*73+74;
P(167, 2) = 1728*74+1567;
P(167, 3) = 1728*1567+1564;
P(167, 4) = 1728*1564+1565;
P(167, 5) = 1728*1565+1566;
P(167, 6) = 1728*1566+1575;
P(167, 7) = 1728*1575+82;
P(167, 8) = 1728*82+83;
P(167, 9) = 1728*83+72;
P(168, 0) = 1728*72+73;
P(168, 1) = 1728*73+1518;
P(168, 2) = 1728*1518+1517;
P(168, 3) = 1728*1517+1512;
P(168, 4) = 1728*1512+1523;
P(168, 5) = 1728*1523+1572;
P(168, 6) = 1728*1572+1575;
P(168, 7) = 1728*1575+82;
P(168, 8) = 1728*82+83;
P(168, 9) = 1728*83+72;
P(169, 0) = 1728*72+73;
P(169, 1) = 1728*73+1518;
P(169, 2) = 1728*1518+1527;
P(169, 3) = 1728*1527+1524;
P(169, 4) = 1728*1524+1525;
P(169, 5) = 1728*1525+1526;
P(169, 6) = 1728*1526+81;
P(169, 7) = 1728*81+82;
P(169, 8) = 1728*82+83;
P(169, 9) = 1728*83+72;
P(170, 0) = 1728*72+77;
P(170, 1) = 1728*77+78;
P(170, 2) = 1728*78+87;
P(170, 3) = 1728*87+84;
P(170, 4) = 1728*84+85;
P(170, 5) = 1728*85+80;
P(170, 6) = 1728*80+81;
P(170, 7) = 1728*81+82;
P(170, 8) = 1728*82+83;
P(170, 9) = 1728*83+72;
P(171, 0) = 1728*72+77;
P(171, 1) = 1728*77+78;
P(171, 2) = 1728*78+361;
P(171, 3) = 1728*361+360;
P(171, 4) = 1728*360+371;
P(171, 5) = 1728*371+370;
P(171, 6) = 1728*370+135;
P(171, 7) = 1728*135+132;
P(171, 8) = 1728*132+83;
P(171, 9) = 1728*83+72;
P(172, 0) = 1728*73+74;
P(172, 1) = 1728*74+1567;
P(172, 2) = 1728*1567+1564;
P(172, 3) = 1728*1564+1515;
P(172, 4) = 1728*1515+1514;
P(172, 5) = 1728*1514+1513;
P(172, 6) = 1728*1513+1512;
P(172, 7) = 1728*1512+1517;
P(172, 8) = 1728*1517+1518;
P(172, 9) = 1728*1518+73;
P(173, 0) = 1728*74+75;
P(173, 1) = 1728*75+124;
P(173, 2) = 1728*124+125;
P(173, 3) = 1728*125+120;
P(173, 4) = 1728*120+121;
P(173, 5) = 1728*121+1566;
P(173, 6) = 1728*1566+1565;
P(173, 7) = 1728*1565+1564;
P(173, 8) = 1728*1564+1567;
P(173, 9) = 1728*1567+74;
P(174, 0) = 1728*74+75;
P(174, 1) = 1728*75+124;
P(174, 2) = 1728*124+127;
P(174, 3) = 1728*127+118;
P(174, 4) = 1728*118+117;
P(174, 5) = 1728*117+112;
P(174, 6) = 1728*112+113;
P(174, 7) = 1728*113+1558;
P(174, 8) = 1728*1558+1567;
P(174, 9) = 1728*1567+74;
P(175, 0) = 1728*76+77;
P(175, 1) = 1728*77+78;
P(175, 2) = 1728*78+87;
P(175, 3) = 1728*87+322;
P(175, 4) = 1728*322+323;
P(175, 5) = 1728*323+312;
P(175, 6) = 1728*312+313;
P(175, 7) = 1728*313+314;
P(175, 8) = 1728*314+79;
P(175, 9) = 1728*79+76;
P(176, 0) = 1728*76+77;
P(176, 1) = 1728*77+78;
P(176, 2) = 1728*78+361;
P(176, 3) = 1728*361+360;
P(176, 4) = 1728*360+365;
P(176, 5) = 1728*365+364;
P(176, 6) = 1728*364+315;
P(176, 7) = 1728*315+314;
P(176, 8) = 1728*314+79;
P(176, 9) = 1728*79+76;
P(177, 0) = 1728*78+87;
P(177, 1) = 1728*87+84;
P(177, 2) = 1728*84+85;
P(177, 3) = 1728*85+86;
P(177, 4) = 1728*86+369;
P(177, 5) = 1728*369+370;
P(177, 6) = 1728*370+371;
P(177, 7) = 1728*371+360;
P(177, 8) = 1728*360+361;
P(177, 9) = 1728*361+78;
P(178, 0) = 1728*78+87;
P(178, 1) = 1728*87+322;
P(178, 2) = 1728*322+323;
P(178, 3) = 1728*323+372;
P(178, 4) = 1728*372+375;
P(178, 5) = 1728*375+366;
P(178, 6) = 1728*366+365;
P(178, 7) = 1728*365+360;
P(178, 8) = 1728*360+361;
P(178, 9) = 1728*361+78;
P(179, 0) = 1728*80+81;
P(179, 1) = 1728*81+82;
P(179, 2) = 1728*82+83;
P(179, 3) = 1728*83+132;
P(179, 4) = 1728*132+133;
P(179, 5) = 1728*133+134;
P(179, 6) = 1728*134+143;
P(179, 7) = 1728*143+140;
P(179, 8) = 1728*140+91;
P(179, 9) = 1728*91+80;
P(180, 0) = 1728*80+81;
P(180, 1) = 1728*81+82;
P(180, 2) = 1728*82+83;
P(180, 3) = 1728*83+132;
P(180, 4) = 1728*132+135;
P(180, 5) = 1728*135+370;
P(180, 6) = 1728*370+369;
P(180, 7) = 1728*369+86;
P(180, 8) = 1728*86+85;
P(180, 9) = 1728*85+80;
P(181, 0) = 1728*80+81;
P(181, 1) = 1728*81+82;
P(181, 2) = 1728*82+1575;
P(181, 3) = 1728*1575+1572;
P(181, 4) = 1728*1572+1573;
P(181, 5) = 1728*1573+1574;
P(181, 6) = 1728*1574+1583;
P(181, 7) = 1728*1583+90;
P(181, 8) = 1728*90+91;
P(181, 9) = 1728*91+80;
P(182, 0) = 1728*80+81;
P(182, 1) = 1728*81+1526;
P(182, 2) = 1728*1526+1525;
P(182, 3) = 1728*1525+1520;
P(182, 4) = 1728*1520+1531;
P(182, 5) = 1728*1531+1580;
P(182, 6) = 1728*1580+1583;
P(182, 7) = 1728*1583+90;
P(182, 8) = 1728*90+91;
P(182, 9) = 1728*91+80;
P(183, 0) = 1728*80+81;
P(183, 1) = 1728*81+1526;
P(183, 2) = 1728*1526+1535;
P(183, 3) = 1728*1535+1532;
P(183, 4) = 1728*1532+1533;
P(183, 5) = 1728*1533+1534;
P(183, 6) = 1728*1534+89;
P(183, 7) = 1728*89+90;
P(183, 8) = 1728*90+91;
P(183, 9) = 1728*91+80;
P(184, 0) = 1728*80+85;
P(184, 1) = 1728*85+86;
P(184, 2) = 1728*86+95;
P(184, 3) = 1728*95+92;
P(184, 4) = 1728*92+93;
P(184, 5) = 1728*93+88;
P(184, 6) = 1728*88+89;
P(184, 7) = 1728*89+90;
P(184, 8) = 1728*90+91;
P(184, 9) = 1728*91+80;
P(185, 0) = 1728*80+85;
P(185, 1) = 1728*85+86;
P(185, 2) = 1728*86+369;
P(185, 3) = 1728*369+368;
P(185, 4) = 1728*368+379;
P(185, 5) = 1728*379+378;
P(185, 6) = 1728*378+143;
P(185, 7) = 1728*143+140;
P(185, 8) = 1728*140+91;
P(185, 9) = 1728*91+80;
P(186, 0) = 1728*81+82;
P(186, 1) = 1728*82+1575;
P(186, 2) = 1728*1575+1572;
P(186, 3) = 1728*1572+1523;
P(186, 4) = 1728*1523+1522;
P(186, 5) = 1728*1522+1521;
P(186, 6) = 1728*1521+1520;
P(186, 7) = 1728*1520+1525;
P(186, 8) = 1728*1525+1526;
P(186, 9) = 1728*1526+81;
P(187, 0) = 1728*82+83;
P(187, 1) = 1728*83+132;
P(187, 2) = 1728*132+133;
P(187, 3) = 1728*133+128;
P(187, 4) = 1728*128+129;
P(187, 5) = 1728*129+1574;
P(187, 6) = 1728*1574+1573;
P(187, 7) = 1728*1573+1572;
P(187, 8) = 1728*1572+1575;
P(187, 9) = 1728*1575+82;
P(188, 0) = 1728*82+83;
P(188, 1) = 1728*83+132;
P(188, 2) = 1728*132+135;
P(188, 3) = 1728*135+126;
P(188, 4) = 1728*126+125;
P(188, 5) = 1728*125+120;
P(188, 6) = 1728*120+121;
P(188, 7) = 1728*121+1566;
P(188, 8) = 1728*1566+1575;
P(188, 9) = 1728*1575+82;
P(189, 0) = 1728*84+85;
P(189, 1) = 1728*85+86;
P(189, 2) = 1728*86+95;
P(189, 3) = 1728*95+330;
P(189, 4) = 1728*330+331;
P(189, 5) = 1728*331+320;
P(189, 6) = 1728*320+321;
P(189, 7) = 1728*321+322;
P(189, 8) = 1728*322+87;
P(189, 9) = 1728*87+84;
P(190, 0) = 1728*84+85;
P(190, 1) = 1728*85+86;
P(190, 2) = 1728*86+369;
P(190, 3) = 1728*369+368;
P(190, 4) = 1728*368+373;
P(190, 5) = 1728*373+372;
P(190, 6) = 1728*372+323;
P(190, 7) = 1728*323+322;
P(190, 8) = 1728*322+87;
P(190, 9) = 1728*87+84;
P(191, 0) = 1728*86+95;
P(191, 1) = 1728*95+92;
P(191, 2) = 1728*92+93;
P(191, 3) = 1728*93+94;
P(191, 4) = 1728*94+377;
P(191, 5) = 1728*377+378;
P(191, 6) = 1728*378+379;
P(191, 7) = 1728*379+368;
P(191, 8) = 1728*368+369;
P(191, 9) = 1728*369+86;
P(192, 0) = 1728*86+95;
P(192, 1) = 1728*95+330;
P(192, 2) = 1728*330+331;
P(192, 3) = 1728*331+380;
P(192, 4) = 1728*380+383;
P(192, 5) = 1728*383+374;
P(192, 6) = 1728*374+373;
P(192, 7) = 1728*373+368;
P(192, 8) = 1728*368+369;
P(192, 9) = 1728*369+86;
P(193, 0) = 1728*88+89;
P(193, 1) = 1728*89+90;
P(193, 2) = 1728*90+91;
P(193, 3) = 1728*91+140;
P(193, 4) = 1728*140+143;
P(193, 5) = 1728*143+378;
P(193, 6) = 1728*378+377;
P(193, 7) = 1728*377+94;
P(193, 8) = 1728*94+93;
P(193, 9) = 1728*93+88;
P(194, 0) = 1728*89+90;
P(194, 1) = 1728*90+1583;
P(194, 2) = 1728*1583+1580;
P(194, 3) = 1728*1580+1531;
P(194, 4) = 1728*1531+1530;
P(194, 5) = 1728*1530+1529;
P(194, 6) = 1728*1529+1528;
P(194, 7) = 1728*1528+1533;
P(194, 8) = 1728*1533+1534;
P(194, 9) = 1728*1534+89;
P(195, 0) = 1728*90+91;
P(195, 1) = 1728*91+140;
P(195, 2) = 1728*140+141;
P(195, 3) = 1728*141+136;
P(195, 4) = 1728*136+137;
P(195, 5) = 1728*137+1582;
P(195, 6) = 1728*1582+1581;
P(195, 7) = 1728*1581+1580;
P(195, 8) = 1728*1580+1583;
P(195, 9) = 1728*1583+90;
P(196, 0) = 1728*90+91;
P(196, 1) = 1728*91+140;
P(196, 2) = 1728*140+143;
P(196, 3) = 1728*143+134;
P(196, 4) = 1728*134+133;
P(196, 5) = 1728*133+128;
P(196, 6) = 1728*128+129;
P(196, 7) = 1728*129+1574;
P(196, 8) = 1728*1574+1583;
P(196, 9) = 1728*1583+90;
P(197, 0) = 1728*92+93;
P(197, 1) = 1728*93+94;
P(197, 2) = 1728*94+377;
P(197, 3) = 1728*377+376;
P(197, 4) = 1728*376+381;
P(197, 5) = 1728*381+380;
P(197, 6) = 1728*380+331;
P(197, 7) = 1728*331+330;
P(197, 8) = 1728*330+95;
P(197, 9) = 1728*95+92;
P(198, 0) = 1728*96+97;
P(198, 1) = 1728*97+98;
P(198, 2) = 1728*98+99;
P(198, 3) = 1728*99+148;
P(198, 4) = 1728*148+149;
P(198, 5) = 1728*149+150;
P(198, 6) = 1728*150+159;
P(198, 7) = 1728*159+156;
P(198, 8) = 1728*156+107;
P(198, 9) = 1728*107+96;
P(199, 0) = 1728*96+97;
P(199, 1) = 1728*97+98;
P(199, 2) = 1728*98+99;
P(199, 3) = 1728*99+148;
P(199, 4) = 1728*148+151;
P(199, 5) = 1728*151+386;
P(199, 6) = 1728*386+385;
P(199, 7) = 1728*385+102;
P(199, 8) = 1728*102+101;
P(199, 9) = 1728*101+96;
P(200, 0) = 1728*96+97;
P(200, 1) = 1728*97+98;
P(200, 2) = 1728*98+99;
P(200, 3) = 1728*99+136;
P(200, 4) = 1728*136+141;
P(200, 5) = 1728*141+142;
P(200, 6) = 1728*142+103;
P(200, 7) = 1728*103+100;
P(200, 8) = 1728*100+101;
P(200, 9) = 1728*101+96;
P(201, 0) = 1728*96+97;
P(201, 1) = 1728*97+98;
P(201, 2) = 1728*98+1591;
P(201, 3) = 1728*1591+1588;
P(201, 4) = 1728*1588+1589;
P(201, 5) = 1728*1589+1590;
P(201, 6) = 1728*1590+1599;
P(201, 7) = 1728*1599+106;
P(201, 8) = 1728*106+107;
P(201, 9) = 1728*107+96;
P(202, 0) = 1728*96+97;
P(202, 1) = 1728*97+1542;
P(202, 2) = 1728*1542+1541;
P(202, 3) = 1728*1541+1536;
P(202, 4) = 1728*1536+1547;
P(202, 5) = 1728*1547+1596;
P(202, 6) = 1728*1596+1599;
P(202, 7) = 1728*1599+106;
P(202, 8) = 1728*106+107;
P(202, 9) = 1728*107+96;
P(203, 0) = 1728*96+97;
P(203, 1) = 1728*97+1542;
P(203, 2) = 1728*1542+1551;
P(203, 3) = 1728*1551+1548;
P(203, 4) = 1728*1548+1549;
P(203, 5) = 1728*1549+1550;
P(203, 6) = 1728*1550+105;
P(203, 7) = 1728*105+106;
P(203, 8) = 1728*106+107;
P(203, 9) = 1728*107+96;
P(204, 0) = 1728*96+101;
P(204, 1) = 1728*101+102;
P(204, 2) = 1728*102+111;
P(204, 3) = 1728*111+108;
P(204, 4) = 1728*108+109;
P(204, 5) = 1728*109+104;
P(204, 6) = 1728*104+105;
P(204, 7) = 1728*105+106;
P(204, 8) = 1728*106+107;
P(204, 9) = 1728*107+96;
P(205, 0) = 1728*96+101;
P(205, 1) = 1728*101+102;
P(205, 2) = 1728*102+385;
P(205, 3) = 1728*385+384;
P(205, 4) = 1728*384+395;
P(205, 5) = 1728*395+394;
P(205, 6) = 1728*394+159;
P(205, 7) = 1728*159+156;
P(205, 8) = 1728*156+107;
P(205, 9) = 1728*107+96;
P(206, 0) = 1728*97+98;
P(206, 1) = 1728*98+99;
P(206, 2) = 1728*99+136;
P(206, 3) = 1728*136+137;
P(206, 4) = 1728*137+1582;
P(206, 5) = 1728*1582+1543;
P(206, 6) = 1728*1543+1540;
P(206, 7) = 1728*1540+1541;
P(206, 8) = 1728*1541+1542;
P(206, 9) = 1728*1542+97;
P(207, 0) = 1728*97+98;
P(207, 1) = 1728*98+1591;
P(207, 2) = 1728*1591+1588;
P(207, 3) = 1728*1588+1539;
P(207, 4) = 1728*1539+1538;
P(207, 5) = 1728*1538+1537;
P(207, 6) = 1728*1537+1536;
P(207, 7) = 1728*1536+1541;
P(207, 8) = 1728*1541+1542;
P(207, 9) = 1728*1542+97;
P(208, 0) = 1728*98+99;
P(208, 1) = 1728*99+148;
P(208, 2) = 1728*148+149;
P(208, 3) = 1728*149+144;
P(208, 4) = 1728*144+145;
P(208, 5) = 1728*145+1590;
P(208, 6) = 1728*1590+1589;
P(208, 7) = 1728*1589+1588;
P(208, 8) = 1728*1588+1591;
P(208, 9) = 1728*1591+98;
P(209, 0) = 1728*98+99;
P(209, 1) = 1728*99+148;
P(209, 2) = 1728*148+151;
P(209, 3) = 1728*151+190;
P(209, 4) = 1728*190+189;
P(209, 5) = 1728*189+184;
P(209, 6) = 1728*184+185;
P(209, 7) = 1728*185+1630;
P(209, 8) = 1728*1630+1591;
P(209, 9) = 1728*1591+98;
P(210, 0) = 1728*98+99;
P(210, 1) = 1728*99+136;
P(210, 2) = 1728*136+137;
P(210, 3) = 1728*137+138;
P(210, 4) = 1728*138+1631;
P(210, 5) = 1728*1631+1628;
P(210, 6) = 1728*1628+1629;
P(210, 7) = 1728*1629+1630;
P(210, 8) = 1728*1630+1591;
P(210, 9) = 1728*1591+98;
P(211, 0) = 1728*98+99;
P(211, 1) = 1728*99+136;
P(211, 2) = 1728*136+137;
P(211, 3) = 1728*137+1582;
P(211, 4) = 1728*1582+1581;
P(211, 5) = 1728*1581+1576;
P(211, 6) = 1728*1576+1539;
P(211, 7) = 1728*1539+1588;
P(211, 8) = 1728*1588+1591;
P(211, 9) = 1728*1591+98;
P(212, 0) = 1728*99+148;
P(212, 1) = 1728*148+151;
P(212, 2) = 1728*151+190;
P(212, 3) = 1728*190+189;
P(212, 4) = 1728*189+188;
P(212, 5) = 1728*188+139;
P(212, 6) = 1728*139+138;
P(212, 7) = 1728*138+137;
P(212, 8) = 1728*137+136;
P(212, 9) = 1728*136+99;
P(213, 0) = 1728*99+148;
P(213, 1) = 1728*148+151;
P(213, 2) = 1728*151+386;
P(213, 3) = 1728*386+387;
P(213, 4) = 1728*387+424;
P(213, 5) = 1728*424+425;
P(213, 6) = 1728*425+142;
P(213, 7) = 1728*142+141;
P(213, 8) = 1728*141+136;
P(213, 9) = 1728*136+99;
P(214, 0) = 1728*100+101;
P(214, 1) = 1728*101+102;
P(214, 2) = 1728*102+111;
P(214, 3) = 1728*111+346;
P(214, 4) = 1728*346+347;
P(214, 5) = 1728*347+336;
P(214, 6) = 1728*336+337;
P(214, 7) = 1728*337+338;
P(214, 8) = 1728*338+103;
P(214, 9) = 1728*103+100;
P(215, 0) = 1728*100+101;
P(215, 1) = 1728*101+102;
P(215, 2) = 1728*102+385;
P(215, 3) = 1728*385+384;
P(215, 4) = 1728*384+389;
P(215, 5) = 1728*389+388;
P(215, 6) = 1728*388+339;
P(215, 7) = 1728*339+338;
P(215, 8) = 1728*338+103;
P(215, 9) = 1728*103+100;
P(216, 0) = 1728*100+101;
P(216, 1) = 1728*101+102;
P(216, 2) = 1728*102+385;
P(216, 3) = 1728*385+386;
P(216, 4) = 1728*386+387;
P(216, 5) = 1728*387+424;
P(216, 6) = 1728*424+425;
P(216, 7) = 1728*425+142;
P(216, 8) = 1728*142+103;
P(216, 9) = 1728*103+100;
P(217, 0) = 1728*102+111;
P(217, 1) = 1728*111+108;
P(217, 2) = 1728*108+109;
P(217, 3) = 1728*109+110;
P(217, 4) = 1728*110+393;
P(217, 5) = 1728*393+394;
P(217, 6) = 1728*394+395;
P(217, 7) = 1728*395+384;
P(217, 8) = 1728*384+385;
P(217, 9) = 1728*385+102;
P(218, 0) = 1728*102+111;
P(218, 1) = 1728*111+346;
P(218, 2) = 1728*346+347;
P(218, 3) = 1728*347+396;
P(218, 4) = 1728*396+399;
P(218, 5) = 1728*399+390;
P(218, 6) = 1728*390+389;
P(218, 7) = 1728*389+384;
P(218, 8) = 1728*384+385;
P(218, 9) = 1728*385+102;
P(219, 0) = 1728*103+142;
P(219, 1) = 1728*142+141;
P(219, 2) = 1728*141+140;
P(219, 3) = 1728*140+143;
P(219, 4) = 1728*143+378;
P(219, 5) = 1728*378+377;
P(219, 6) = 1728*377+376;
P(219, 7) = 1728*376+339;
P(219, 8) = 1728*339+338;
P(219, 9) = 1728*338+103;
P(220, 0) = 1728*103+142;
P(220, 1) = 1728*142+425;
P(220, 2) = 1728*425+424;
P(220, 3) = 1728*424+429;
P(220, 4) = 1728*429+430;
P(220, 5) = 1728*430+391;
P(220, 6) = 1728*391+388;
P(220, 7) = 1728*388+339;
P(220, 8) = 1728*339+338;
P(220, 9) = 1728*338+103;
P(221, 0) = 1728*104+105;
P(221, 1) = 1728*105+106;
P(221, 2) = 1728*106+107;
P(221, 3) = 1728*107+156;
P(221, 4) = 1728*156+157;
P(221, 5) = 1728*157+158;
P(221, 6) = 1728*158+167;
P(221, 7) = 1728*167+164;
P(221, 8) = 1728*164+115;
P(221, 9) = 1728*115+104;
P(222, 0) = 1728*104+105;
P(222, 1) = 1728*105+106;
P(222, 2) = 1728*106+107;
P(222, 3) = 1728*107+156;
P(222, 4) = 1728*156+159;
P(222, 5) = 1728*159+394;
P(222, 6) = 1728*394+393;
P(222, 7) = 1728*393+110;
P(222, 8) = 1728*110+109;
P(222, 9) = 1728*109+104;
P(223, 0) = 1728*104+105;
P(223, 1) = 1728*105+106;
P(223, 2) = 1728*106+1599;
P(223, 3) = 1728*1599+1596;
P(223, 4) = 1728*1596+1597;
P(223, 5) = 1728*1597+1598;
P(223, 6) = 1728*1598+1607;
P(223, 7) = 1728*1607+114;
P(223, 8) = 1728*114+115;
P(223, 9) = 1728*115+104;
P(224, 0) = 1728*104+105;
P(224, 1) = 1728*105+1550;
P(224, 2) = 1728*1550+1549;
P(224, 3) = 1728*1549+1544;
P(224, 4) = 1728*1544+1555;
P(224, 5) = 1728*1555+1604;
P(224, 6) = 1728*1604+1607;
P(224, 7) = 1728*1607+114;
P(224, 8) = 1728*114+115;
P(224, 9) = 1728*115+104;
P(225, 0) = 1728*104+105;
P(225, 1) = 1728*105+1550;
P(225, 2) = 1728*1550+1559;
P(225, 3) = 1728*1559+1556;
P(225, 4) = 1728*1556+1557;
P(225, 5) = 1728*1557+1558;
P(225, 6) = 1728*1558+113;
P(225, 7) = 1728*113+114;
P(225, 8) = 1728*114+115;
P(225, 9) = 1728*115+104;
P(226, 0) = 1728*104+109;
P(226, 1) = 1728*109+110;
P(226, 2) = 1728*110+119;
P(226, 3) = 1728*119+116;
P(226, 4) = 1728*116+117;
P(226, 5) = 1728*117+112;
P(226, 6) = 1728*112+113;
P(226, 7) = 1728*113+114;
P(226, 8) = 1728*114+115;
P(226, 9) = 1728*115+104;
P(227, 0) = 1728*104+109;
P(227, 1) = 1728*109+110;
P(227, 2) = 1728*110+393;
P(227, 3) = 1728*393+392;
P(227, 4) = 1728*392+403;
P(227, 5) = 1728*403+402;
P(227, 6) = 1728*402+167;
P(227, 7) = 1728*167+164;
P(227, 8) = 1728*164+115;
P(227, 9) = 1728*115+104;
P(228, 0) = 1728*105+106;
P(228, 1) = 1728*106+1599;
P(228, 2) = 1728*1599+1596;
P(228, 3) = 1728*1596+1547;
P(228, 4) = 1728*1547+1546;
P(228, 5) = 1728*1546+1545;
P(228, 6) = 1728*1545+1544;
P(228, 7) = 1728*1544+1549;
P(228, 8) = 1728*1549+1550;
P(228, 9) = 1728*1550+105;
P(229, 0) = 1728*106+107;
P(229, 1) = 1728*107+156;
P(229, 2) = 1728*156+157;
P(229, 3) = 1728*157+152;
P(229, 4) = 1728*152+153;
P(229, 5) = 1728*153+1598;
P(229, 6) = 1728*1598+1597;
P(229, 7) = 1728*1597+1596;
P(229, 8) = 1728*1596+1599;
P(229, 9) = 1728*1599+106;
P(230, 0) = 1728*106+107;
P(230, 1) = 1728*107+156;
P(230, 2) = 1728*156+159;
P(230, 3) = 1728*159+150;
P(230, 4) = 1728*150+149;
P(230, 5) = 1728*149+144;
P(230, 6) = 1728*144+145;
P(230, 7) = 1728*145+1590;
P(230, 8) = 1728*1590+1599;
P(230, 9) = 1728*1599+106;
P(231, 0) = 1728*108+109;
P(231, 1) = 1728*109+110;
P(231, 2) = 1728*110+119;
P(231, 3) = 1728*119+354;
P(231, 4) = 1728*354+355;
P(231, 5) = 1728*355+344;
P(231, 6) = 1728*344+345;
P(231, 7) = 1728*345+346;
P(231, 8) = 1728*346+111;
P(231, 9) = 1728*111+108;
P(232, 0) = 1728*108+109;
P(232, 1) = 1728*109+110;
P(232, 2) = 1728*110+393;
P(232, 3) = 1728*393+392;
P(232, 4) = 1728*392+397;
P(232, 5) = 1728*397+396;
P(232, 6) = 1728*396+347;
P(232, 7) = 1728*347+346;
P(232, 8) = 1728*346+111;
P(232, 9) = 1728*111+108;
P(233, 0) = 1728*110+119;
P(233, 1) = 1728*119+116;
P(233, 2) = 1728*116+117;
P(233, 3) = 1728*117+118;
P(233, 4) = 1728*118+401;
P(233, 5) = 1728*401+402;
P(233, 6) = 1728*402+403;
P(233, 7) = 1728*403+392;
P(233, 8) = 1728*392+393;
P(233, 9) = 1728*393+110;
P(234, 0) = 1728*110+119;
P(234, 1) = 1728*119+354;
P(234, 2) = 1728*354+355;
P(234, 3) = 1728*355+404;
P(234, 4) = 1728*404+407;
P(234, 5) = 1728*407+398;
P(234, 6) = 1728*398+397;
P(234, 7) = 1728*397+392;
P(234, 8) = 1728*392+393;
P(234, 9) = 1728*393+110;
P(235, 0) = 1728*112+113;
P(235, 1) = 1728*113+114;
P(235, 2) = 1728*114+115;
P(235, 3) = 1728*115+164;
P(235, 4) = 1728*164+165;
P(235, 5) = 1728*165+166;
P(235, 6) = 1728*166+175;
P(235, 7) = 1728*175+172;
P(235, 8) = 1728*172+123;
P(235, 9) = 1728*123+112;
P(236, 0) = 1728*112+113;
P(236, 1) = 1728*113+114;
P(236, 2) = 1728*114+115;
P(236, 3) = 1728*115+164;
P(236, 4) = 1728*164+167;
P(236, 5) = 1728*167+402;
P(236, 6) = 1728*402+401;
P(236, 7) = 1728*401+118;
P(236, 8) = 1728*118+117;
P(236, 9) = 1728*117+112;
P(237, 0) = 1728*112+113;
P(237, 1) = 1728*113+114;
P(237, 2) = 1728*114+1607;
P(237, 3) = 1728*1607+1604;
P(237, 4) = 1728*1604+1605;
P(237, 5) = 1728*1605+1606;
P(237, 6) = 1728*1606+1615;
P(237, 7) = 1728*1615+122;
P(237, 8) = 1728*122+123;
P(237, 9) = 1728*123+112;
P(238, 0) = 1728*112+113;
P(238, 1) = 1728*113+1558;
P(238, 2) = 1728*1558+1557;
P(238, 3) = 1728*1557+1552;
P(238, 4) = 1728*1552+1563;
P(238, 5) = 1728*1563+1612;
P(238, 6) = 1728*1612+1615;
P(238, 7) = 1728*1615+122;
P(238, 8) = 1728*122+123;
P(238, 9) = 1728*123+112;
P(239, 0) = 1728*112+113;
P(239, 1) = 1728*113+1558;
P(239, 2) = 1728*1558+1567;
P(239, 3) = 1728*1567+1564;
P(239, 4) = 1728*1564+1565;
P(239, 5) = 1728*1565+1566;
P(239, 6) = 1728*1566+121;
P(239, 7) = 1728*121+122;
P(239, 8) = 1728*122+123;
P(239, 9) = 1728*123+112;
P(240, 0) = 1728*112+117;
P(240, 1) = 1728*117+118;
P(240, 2) = 1728*118+127;
P(240, 3) = 1728*127+124;
P(240, 4) = 1728*124+125;
P(240, 5) = 1728*125+120;
P(240, 6) = 1728*120+121;
P(240, 7) = 1728*121+122;
P(240, 8) = 1728*122+123;
P(240, 9) = 1728*123+112;
P(241, 0) = 1728*112+117;
P(241, 1) = 1728*117+118;
P(241, 2) = 1728*118+401;
P(241, 3) = 1728*401+400;
P(241, 4) = 1728*400+411;
P(241, 5) = 1728*411+410;
P(241, 6) = 1728*410+175;
P(241, 7) = 1728*175+172;
P(241, 8) = 1728*172+123;
P(241, 9) = 1728*123+112;
P(242, 0) = 1728*113+114;
P(242, 1) = 1728*114+1607;
P(242, 2) = 1728*1607+1604;
P(242, 3) = 1728*1604+1555;
P(242, 4) = 1728*1555+1554;
P(242, 5) = 1728*1554+1553;
P(242, 6) = 1728*1553+1552;
P(242, 7) = 1728*1552+1557;
P(242, 8) = 1728*1557+1558;
P(242, 9) = 1728*1558+113;
P(243, 0) = 1728*114+115;
P(243, 1) = 1728*115+164;
P(243, 2) = 1728*164+165;
P(243, 3) = 1728*165+160;
P(243, 4) = 1728*160+161;
P(243, 5) = 1728*161+1606;
P(243, 6) = 1728*1606+1605;
P(243, 7) = 1728*1605+1604;
P(243, 8) = 1728*1604+1607;
P(243, 9) = 1728*1607+114;
P(244, 0) = 1728*114+115;
P(244, 1) = 1728*115+164;
P(244, 2) = 1728*164+167;
P(244, 3) = 1728*167+158;
P(244, 4) = 1728*158+157;
P(244, 5) = 1728*157+152;
P(244, 6) = 1728*152+153;
P(244, 7) = 1728*153+1598;
P(244, 8) = 1728*1598+1607;
P(244, 9) = 1728*1607+114;
P(245, 0) = 1728*116+117;
P(245, 1) = 1728*117+118;
P(245, 2) = 1728*118+127;
P(245, 3) = 1728*127+362;
P(245, 4) = 1728*362+363;
P(245, 5) = 1728*363+352;
P(245, 6) = 1728*352+353;
P(245, 7) = 1728*353+354;
P(245, 8) = 1728*354+119;
P(245, 9) = 1728*119+116;
P(246, 0) = 1728*116+117;
P(246, 1) = 1728*117+118;
P(246, 2) = 1728*118+401;
P(246, 3) = 1728*401+400;
P(246, 4) = 1728*400+405;
P(246, 5) = 1728*405+404;
P(246, 6) = 1728*404+355;
P(246, 7) = 1728*355+354;
P(246, 8) = 1728*354+119;
P(246, 9) = 1728*119+116;
P(247, 0) = 1728*118+127;
P(247, 1) = 1728*127+124;
P(247, 2) = 1728*124+125;
P(247, 3) = 1728*125+126;
P(247, 4) = 1728*126+409;
P(247, 5) = 1728*409+410;
P(247, 6) = 1728*410+411;
P(247, 7) = 1728*411+400;
P(247, 8) = 1728*400+401;
P(247, 9) = 1728*401+118;
P(248, 0) = 1728*118+127;
P(248, 1) = 1728*127+362;
P(248, 2) = 1728*362+363;
P(248, 3) = 1728*363+412;
P(248, 4) = 1728*412+415;
P(248, 5) = 1728*415+406;
P(248, 6) = 1728*406+405;
P(248, 7) = 1728*405+400;
P(248, 8) = 1728*400+401;
P(248, 9) = 1728*401+118;
P(249, 0) = 1728*120+121;
P(249, 1) = 1728*121+122;
P(249, 2) = 1728*122+123;
P(249, 3) = 1728*123+172;
P(249, 4) = 1728*172+173;
P(249, 5) = 1728*173+174;
P(249, 6) = 1728*174+183;
P(249, 7) = 1728*183+180;
P(249, 8) = 1728*180+131;
P(249, 9) = 1728*131+120;
P(250, 0) = 1728*120+121;
P(250, 1) = 1728*121+122;
P(250, 2) = 1728*122+123;
P(250, 3) = 1728*123+172;
P(250, 4) = 1728*172+175;
P(250, 5) = 1728*175+410;
P(250, 6) = 1728*410+409;
P(250, 7) = 1728*409+126;
P(250, 8) = 1728*126+125;
P(250, 9) = 1728*125+120;
P(251, 0) = 1728*120+121;
P(251, 1) = 1728*121+122;
P(251, 2) = 1728*122+1615;
P(251, 3) = 1728*1615+1612;
P(251, 4) = 1728*1612+1613;
P(251, 5) = 1728*1613+1614;
P(251, 6) = 1728*1614+1623;
P(251, 7) = 1728*1623+130;
P(251, 8) = 1728*130+131;
P(251, 9) = 1728*131+120;
P(252, 0) = 1728*120+121;
P(252, 1) = 1728*121+1566;
P(252, 2) = 1728*1566+1565;
P(252, 3) = 1728*1565+1560;
P(252, 4) = 1728*1560+1571;
P(252, 5) = 1728*1571+1620;
P(252, 6) = 1728*1620+1623;
P(252, 7) = 1728*1623+130;
P(252, 8) = 1728*130+131;
P(252, 9) = 1728*131+120;
P(253, 0) = 1728*120+121;
P(253, 1) = 1728*121+1566;
P(253, 2) = 1728*1566+1575;
P(253, 3) = 1728*1575+1572;
P(253, 4) = 1728*1572+1573;
P(253, 5) = 1728*1573+1574;
P(253, 6) = 1728*1574+129;
P(253, 7) = 1728*129+130;
P(253, 8) = 1728*130+131;
P(253, 9) = 1728*131+120;
P(254, 0) = 1728*120+125;
P(254, 1) = 1728*125+126;
P(254, 2) = 1728*126+135;
P(254, 3) = 1728*135+132;
P(254, 4) = 1728*132+133;
P(254, 5) = 1728*133+128;
P(254, 6) = 1728*128+129;
P(254, 7) = 1728*129+130;
P(254, 8) = 1728*130+131;
P(254, 9) = 1728*131+120;
P(255, 0) = 1728*120+125;
P(255, 1) = 1728*125+126;
P(255, 2) = 1728*126+409;
P(255, 3) = 1728*409+408;
P(255, 4) = 1728*408+419;
P(255, 5) = 1728*419+418;
P(255, 6) = 1728*418+183;
P(255, 7) = 1728*183+180;
P(255, 8) = 1728*180+131;
P(255, 9) = 1728*131+120;
P(256, 0) = 1728*121+122;
P(256, 1) = 1728*122+1615;
P(256, 2) = 1728*1615+1612;
P(256, 3) = 1728*1612+1563;
P(256, 4) = 1728*1563+1562;
P(256, 5) = 1728*1562+1561;
P(256, 6) = 1728*1561+1560;
P(256, 7) = 1728*1560+1565;
P(256, 8) = 1728*1565+1566;
P(256, 9) = 1728*1566+121;
P(257, 0) = 1728*122+123;
P(257, 1) = 1728*123+172;
P(257, 2) = 1728*172+173;
P(257, 3) = 1728*173+168;
P(257, 4) = 1728*168+169;
P(257, 5) = 1728*169+1614;
P(257, 6) = 1728*1614+1613;
P(257, 7) = 1728*1613+1612;
P(257, 8) = 1728*1612+1615;
P(257, 9) = 1728*1615+122;
P(258, 0) = 1728*122+123;
P(258, 1) = 1728*123+172;
P(258, 2) = 1728*172+175;
P(258, 3) = 1728*175+166;
P(258, 4) = 1728*166+165;
P(258, 5) = 1728*165+160;
P(258, 6) = 1728*160+161;
P(258, 7) = 1728*161+1606;
P(258, 8) = 1728*1606+1615;
P(258, 9) = 1728*1615+122;
P(259, 0) = 1728*124+125;
P(259, 1) = 1728*125+126;
P(259, 2) = 1728*126+135;
P(259, 3) = 1728*135+370;
P(259, 4) = 1728*370+371;
P(259, 5) = 1728*371+360;
P(259, 6) = 1728*360+361;
P(259, 7) = 1728*361+362;
P(259, 8) = 1728*362+127;
P(259, 9) = 1728*127+124;
P(260, 0) = 1728*124+125;
P(260, 1) = 1728*125+126;
P(260, 2) = 1728*126+409;
P(260, 3) = 1728*409+408;
P(260, 4) = 1728*408+413;
P(260, 5) = 1728*413+412;
P(260, 6) = 1728*412+363;
P(260, 7) = 1728*363+362;
P(260, 8) = 1728*362+127;
P(260, 9) = 1728*127+124;
P(261, 0) = 1728*126+135;
P(261, 1) = 1728*135+132;
P(261, 2) = 1728*132+133;
P(261, 3) = 1728*133+134;
P(261, 4) = 1728*134+417;
P(261, 5) = 1728*417+418;
P(261, 6) = 1728*418+419;
P(261, 7) = 1728*419+408;
P(261, 8) = 1728*408+409;
P(261, 9) = 1728*409+126;
P(262, 0) = 1728*126+135;
P(262, 1) = 1728*135+370;
P(262, 2) = 1728*370+371;
P(262, 3) = 1728*371+420;
P(262, 4) = 1728*420+423;
P(262, 5) = 1728*423+414;
P(262, 6) = 1728*414+413;
P(262, 7) = 1728*413+408;
P(262, 8) = 1728*408+409;
P(262, 9) = 1728*409+126;
P(263, 0) = 1728*128+129;
P(263, 1) = 1728*129+130;
P(263, 2) = 1728*130+131;
P(263, 3) = 1728*131+180;
P(263, 4) = 1728*180+181;
P(263, 5) = 1728*181+182;
P(263, 6) = 1728*182+191;
P(263, 7) = 1728*191+188;
P(263, 8) = 1728*188+139;
P(263, 9) = 1728*139+128;
P(264, 0) = 1728*128+129;
P(264, 1) = 1728*129+130;
P(264, 2) = 1728*130+131;
P(264, 3) = 1728*131+180;
P(264, 4) = 1728*180+183;
P(264, 5) = 1728*183+418;
P(264, 6) = 1728*418+417;
P(264, 7) = 1728*417+134;
P(264, 8) = 1728*134+133;
P(264, 9) = 1728*133+128;
P(265, 0) = 1728*128+129;
P(265, 1) = 1728*129+130;
P(265, 2) = 1728*130+1623;
P(265, 3) = 1728*1623+1620;
P(265, 4) = 1728*1620+1621;
P(265, 5) = 1728*1621+1622;
P(265, 6) = 1728*1622+1631;
P(265, 7) = 1728*1631+138;
P(265, 8) = 1728*138+139;
P(265, 9) = 1728*139+128;
P(266, 0) = 1728*128+129;
P(266, 1) = 1728*129+1574;
P(266, 2) = 1728*1574+1573;
P(266, 3) = 1728*1573+1568;
P(266, 4) = 1728*1568+1579;
P(266, 5) = 1728*1579+1628;
P(266, 6) = 1728*1628+1631;
P(266, 7) = 1728*1631+138;
P(266, 8) = 1728*138+139;
P(266, 9) = 1728*139+128;
P(267, 0) = 1728*128+129;
P(267, 1) = 1728*129+1574;
P(267, 2) = 1728*1574+1583;
P(267, 3) = 1728*1583+1580;
P(267, 4) = 1728*1580+1581;
P(267, 5) = 1728*1581+1582;
P(267, 6) = 1728*1582+137;
P(267, 7) = 1728*137+138;
P(267, 8) = 1728*138+139;
P(267, 9) = 1728*139+128;
P(268, 0) = 1728*128+133;
P(268, 1) = 1728*133+134;
P(268, 2) = 1728*134+143;
P(268, 3) = 1728*143+140;
P(268, 4) = 1728*140+141;
P(268, 5) = 1728*141+136;
P(268, 6) = 1728*136+137;
P(268, 7) = 1728*137+138;
P(268, 8) = 1728*138+139;
P(268, 9) = 1728*139+128;
P(269, 0) = 1728*128+133;
P(269, 1) = 1728*133+134;
P(269, 2) = 1728*134+417;
P(269, 3) = 1728*417+416;
P(269, 4) = 1728*416+427;
P(269, 5) = 1728*427+426;
P(269, 6) = 1728*426+191;
P(269, 7) = 1728*191+188;
P(269, 8) = 1728*188+139;
P(269, 9) = 1728*139+128;
P(270, 0) = 1728*129+130;
P(270, 1) = 1728*130+1623;
P(270, 2) = 1728*1623+1620;
P(270, 3) = 1728*1620+1571;
P(270, 4) = 1728*1571+1570;
P(270, 5) = 1728*1570+1569;
P(270, 6) = 1728*1569+1568;
P(270, 7) = 1728*1568+1573;
P(270, 8) = 1728*1573+1574;
P(270, 9) = 1728*1574+129;
P(271, 0) = 1728*130+131;
P(271, 1) = 1728*131+180;
P(271, 2) = 1728*180+181;
P(271, 3) = 1728*181+176;
P(271, 4) = 1728*176+177;
P(271, 5) = 1728*177+1622;
P(271, 6) = 1728*1622+1621;
P(271, 7) = 1728*1621+1620;
P(271, 8) = 1728*1620+1623;
P(271, 9) = 1728*1623+130;
P(272, 0) = 1728*130+131;
P(272, 1) = 1728*131+180;
P(272, 2) = 1728*180+183;
P(272, 3) = 1728*183+174;
P(272, 4) = 1728*174+173;
P(272, 5) = 1728*173+168;
P(272, 6) = 1728*168+169;
P(272, 7) = 1728*169+1614;
P(272, 8) = 1728*1614+1623;
P(272, 9) = 1728*1623+130;
P(273, 0) = 1728*132+133;
P(273, 1) = 1728*133+134;
P(273, 2) = 1728*134+143;
P(273, 3) = 1728*143+378;
P(273, 4) = 1728*378+379;
P(273, 5) = 1728*379+368;
P(273, 6) = 1728*368+369;
P(273, 7) = 1728*369+370;
P(273, 8) = 1728*370+135;
P(273, 9) = 1728*135+132;
P(274, 0) = 1728*132+133;
P(274, 1) = 1728*133+134;
P(274, 2) = 1728*134+417;
P(274, 3) = 1728*417+416;
P(274, 4) = 1728*416+421;
P(274, 5) = 1728*421+420;
P(274, 6) = 1728*420+371;
P(274, 7) = 1728*371+370;
P(274, 8) = 1728*370+135;
P(274, 9) = 1728*135+132;
P(275, 0) = 1728*134+143;
P(275, 1) = 1728*143+140;
P(275, 2) = 1728*140+141;
P(275, 3) = 1728*141+142;
P(275, 4) = 1728*142+425;
P(275, 5) = 1728*425+426;
P(275, 6) = 1728*426+427;
P(275, 7) = 1728*427+416;
P(275, 8) = 1728*416+417;
P(275, 9) = 1728*417+134;
P(276, 0) = 1728*134+143;
P(276, 1) = 1728*143+378;
P(276, 2) = 1728*378+379;
P(276, 3) = 1728*379+428;
P(276, 4) = 1728*428+431;
P(276, 5) = 1728*431+422;
P(276, 6) = 1728*422+421;
P(276, 7) = 1728*421+416;
P(276, 8) = 1728*416+417;
P(276, 9) = 1728*417+134;
P(277, 0) = 1728*136+137;
P(277, 1) = 1728*137+138;
P(277, 2) = 1728*138+139;
P(277, 3) = 1728*139+188;
P(277, 4) = 1728*188+191;
P(277, 5) = 1728*191+426;
P(277, 6) = 1728*426+425;
P(277, 7) = 1728*425+142;
P(277, 8) = 1728*142+141;
P(277, 9) = 1728*141+136;
P(278, 0) = 1728*137+138;
P(278, 1) = 1728*138+1631;
P(278, 2) = 1728*1631+1628;
P(278, 3) = 1728*1628+1579;
P(278, 4) = 1728*1579+1578;
P(278, 5) = 1728*1578+1577;
P(278, 6) = 1728*1577+1576;
P(278, 7) = 1728*1576+1581;
P(278, 8) = 1728*1581+1582;
P(278, 9) = 1728*1582+137;
P(279, 0) = 1728*138+139;
P(279, 1) = 1728*139+188;
P(279, 2) = 1728*188+189;
P(279, 3) = 1728*189+184;
P(279, 4) = 1728*184+185;
P(279, 5) = 1728*185+1630;
P(279, 6) = 1728*1630+1629;
P(279, 7) = 1728*1629+1628;
P(279, 8) = 1728*1628+1631;
P(279, 9) = 1728*1631+138;
P(280, 0) = 1728*138+139;
P(280, 1) = 1728*139+188;
P(280, 2) = 1728*188+191;
P(280, 3) = 1728*191+182;
P(280, 4) = 1728*182+181;
P(280, 5) = 1728*181+176;
P(280, 6) = 1728*176+177;
P(280, 7) = 1728*177+1622;
P(280, 8) = 1728*1622+1631;
P(280, 9) = 1728*1631+138;
P(281, 0) = 1728*140+141;
P(281, 1) = 1728*141+142;
P(281, 2) = 1728*142+425;
P(281, 3) = 1728*425+424;
P(281, 4) = 1728*424+429;
P(281, 5) = 1728*429+428;
P(281, 6) = 1728*428+379;
P(281, 7) = 1728*379+378;
P(281, 8) = 1728*378+143;
P(281, 9) = 1728*143+140;
P(282, 0) = 1728*144+145;
P(282, 1) = 1728*145+146;
P(282, 2) = 1728*146+147;
P(282, 3) = 1728*147+196;
P(282, 4) = 1728*196+197;
P(282, 5) = 1728*197+198;
P(282, 6) = 1728*198+207;
P(282, 7) = 1728*207+204;
P(282, 8) = 1728*204+155;
P(282, 9) = 1728*155+144;
P(283, 0) = 1728*144+145;
P(283, 1) = 1728*145+146;
P(283, 2) = 1728*146+147;
P(283, 3) = 1728*147+196;
P(283, 4) = 1728*196+199;
P(283, 5) = 1728*199+434;
P(283, 6) = 1728*434+433;
P(283, 7) = 1728*433+150;
P(283, 8) = 1728*150+149;
P(283, 9) = 1728*149+144;
P(284, 0) = 1728*144+145;
P(284, 1) = 1728*145+146;
P(284, 2) = 1728*146+147;
P(284, 3) = 1728*147+184;
P(284, 4) = 1728*184+189;
P(284, 5) = 1728*189+190;
P(284, 6) = 1728*190+151;
P(284, 7) = 1728*151+148;
P(284, 8) = 1728*148+149;
P(284, 9) = 1728*149+144;
P(285, 0) = 1728*144+145;
P(285, 1) = 1728*145+146;
P(285, 2) = 1728*146+1639;
P(285, 3) = 1728*1639+1636;
P(285, 4) = 1728*1636+1637;
P(285, 5) = 1728*1637+1638;
P(285, 6) = 1728*1638+1647;
P(285, 7) = 1728*1647+154;
P(285, 8) = 1728*154+155;
P(285, 9) = 1728*155+144;
P(286, 0) = 1728*144+145;
P(286, 1) = 1728*145+1590;
P(286, 2) = 1728*1590+1589;
P(286, 3) = 1728*1589+1584;
P(286, 4) = 1728*1584+1595;
P(286, 5) = 1728*1595+1644;
P(286, 6) = 1728*1644+1647;
P(286, 7) = 1728*1647+154;
P(286, 8) = 1728*154+155;
P(286, 9) = 1728*155+144;
P(287, 0) = 1728*144+145;
P(287, 1) = 1728*145+1590;
P(287, 2) = 1728*1590+1599;
P(287, 3) = 1728*1599+1596;
P(287, 4) = 1728*1596+1597;
P(287, 5) = 1728*1597+1598;
P(287, 6) = 1728*1598+153;
P(287, 7) = 1728*153+154;
P(287, 8) = 1728*154+155;
P(287, 9) = 1728*155+144;
P(288, 0) = 1728*144+149;
P(288, 1) = 1728*149+150;
P(288, 2) = 1728*150+159;
P(288, 3) = 1728*159+156;
P(288, 4) = 1728*156+157;
P(288, 5) = 1728*157+152;
P(288, 6) = 1728*152+153;
P(288, 7) = 1728*153+154;
P(288, 8) = 1728*154+155;
P(288, 9) = 1728*155+144;
P(289, 0) = 1728*144+149;
P(289, 1) = 1728*149+150;
P(289, 2) = 1728*150+433;
P(289, 3) = 1728*433+432;
P(289, 4) = 1728*432+443;
P(289, 5) = 1728*443+442;
P(289, 6) = 1728*442+207;
P(289, 7) = 1728*207+204;
P(289, 8) = 1728*204+155;
P(289, 9) = 1728*155+144;
P(290, 0) = 1728*145+146;
P(290, 1) = 1728*146+147;
P(290, 2) = 1728*147+184;
P(290, 3) = 1728*184+185;
P(290, 4) = 1728*185+1630;
P(290, 5) = 1728*1630+1591;
P(290, 6) = 1728*1591+1588;
P(290, 7) = 1728*1588+1589;
P(290, 8) = 1728*1589+1590;
P(290, 9) = 1728*1590+145;
P(291, 0) = 1728*145+146;
P(291, 1) = 1728*146+1639;
P(291, 2) = 1728*1639+1636;
P(291, 3) = 1728*1636+1587;
P(291, 4) = 1728*1587+1586;
P(291, 5) = 1728*1586+1585;
P(291, 6) = 1728*1585+1584;
P(291, 7) = 1728*1584+1589;
P(291, 8) = 1728*1589+1590;
P(291, 9) = 1728*1590+145;
P(292, 0) = 1728*146+147;
P(292, 1) = 1728*147+196;
P(292, 2) = 1728*196+197;
P(292, 3) = 1728*197+192;
P(292, 4) = 1728*192+193;
P(292, 5) = 1728*193+1638;
P(292, 6) = 1728*1638+1637;
P(292, 7) = 1728*1637+1636;
P(292, 8) = 1728*1636+1639;
P(292, 9) = 1728*1639+146;
P(293, 0) = 1728*146+147;
P(293, 1) = 1728*147+196;
P(293, 2) = 1728*196+199;
P(293, 3) = 1728*199+238;
P(293, 4) = 1728*238+237;
P(293, 5) = 1728*237+232;
P(293, 6) = 1728*232+233;
P(293, 7) = 1728*233+1678;
P(293, 8) = 1728*1678+1639;
P(293, 9) = 1728*1639+146;
P(294, 0) = 1728*146+147;
P(294, 1) = 1728*147+184;
P(294, 2) = 1728*184+185;
P(294, 3) = 1728*185+186;
P(294, 4) = 1728*186+1679;
P(294, 5) = 1728*1679+1676;
P(294, 6) = 1728*1676+1677;
P(294, 7) = 1728*1677+1678;
P(294, 8) = 1728*1678+1639;
P(294, 9) = 1728*1639+146;
P(295, 0) = 1728*146+147;
P(295, 1) = 1728*147+184;
P(295, 2) = 1728*184+185;
P(295, 3) = 1728*185+1630;
P(295, 4) = 1728*1630+1629;
P(295, 5) = 1728*1629+1624;
P(295, 6) = 1728*1624+1587;
P(295, 7) = 1728*1587+1636;
P(295, 8) = 1728*1636+1639;
P(295, 9) = 1728*1639+146;
P(296, 0) = 1728*147+196;
P(296, 1) = 1728*196+199;
P(296, 2) = 1728*199+238;
P(296, 3) = 1728*238+237;
P(296, 4) = 1728*237+236;
P(296, 5) = 1728*236+187;
P(296, 6) = 1728*187+186;
P(296, 7) = 1728*186+185;
P(296, 8) = 1728*185+184;
P(296, 9) = 1728*184+147;
P(297, 0) = 1728*147+196;
P(297, 1) = 1728*196+199;
P(297, 2) = 1728*199+434;
P(297, 3) = 1728*434+435;
P(297, 4) = 1728*435+472;
P(297, 5) = 1728*472+473;
P(297, 6) = 1728*473+190;
P(297, 7) = 1728*190+189;
P(297, 8) = 1728*189+184;
P(297, 9) = 1728*184+147;
P(298, 0) = 1728*148+149;
P(298, 1) = 1728*149+150;
P(298, 2) = 1728*150+159;
P(298, 3) = 1728*159+394;
P(298, 4) = 1728*394+395;
P(298, 5) = 1728*395+384;
P(298, 6) = 1728*384+385;
P(298, 7) = 1728*385+386;
P(298, 8) = 1728*386+151;
P(298, 9) = 1728*151+148;
P(299, 0) = 1728*148+149;
P(299, 1) = 1728*149+150;
P(299, 2) = 1728*150+433;
P(299, 3) = 1728*433+432;
P(299, 4) = 1728*432+437;
P(299, 5) = 1728*437+436;
P(299, 6) = 1728*436+387;
P(299, 7) = 1728*387+386;
P(299, 8) = 1728*386+151;
P(299, 9) = 1728*151+148;
P(300, 0) = 1728*148+149;
P(300, 1) = 1728*149+150;
P(300, 2) = 1728*150+433;
P(300, 3) = 1728*433+434;
P(300, 4) = 1728*434+435;
P(300, 5) = 1728*435+472;
P(300, 6) = 1728*472+473;
P(300, 7) = 1728*473+190;
P(300, 8) = 1728*190+151;
P(300, 9) = 1728*151+148;
P(301, 0) = 1728*150+159;
P(301, 1) = 1728*159+156;
P(301, 2) = 1728*156+157;
P(301, 3) = 1728*157+158;
P(301, 4) = 1728*158+441;
P(301, 5) = 1728*441+442;
P(301, 6) = 1728*442+443;
P(301, 7) = 1728*443+432;
P(301, 8) = 1728*432+433;
P(301, 9) = 1728*433+150;
P(302, 0) = 1728*150+159;
P(302, 1) = 1728*159+394;
P(302, 2) = 1728*394+395;
P(302, 3) = 1728*395+444;
P(302, 4) = 1728*444+447;
P(302, 5) = 1728*447+438;
P(302, 6) = 1728*438+437;
P(302, 7) = 1728*437+432;
P(302, 8) = 1728*432+433;
P(302, 9) = 1728*433+150;
P(303, 0) = 1728*151+190;
P(303, 1) = 1728*190+189;
P(303, 2) = 1728*189+188;
P(303, 3) = 1728*188+191;
P(303, 4) = 1728*191+426;
P(303, 5) = 1728*426+425;
P(303, 6) = 1728*425+424;
P(303, 7) = 1728*424+387;
P(303, 8) = 1728*387+386;
P(303, 9) = 1728*386+151;
P(304, 0) = 1728*151+190;
P(304, 1) = 1728*190+473;
P(304, 2) = 1728*473+472;
P(304, 3) = 1728*472+477;
P(304, 4) = 1728*477+478;
P(304, 5) = 1728*478+439;
P(304, 6) = 1728*439+436;
P(304, 7) = 1728*436+387;
P(304, 8) = 1728*387+386;
P(304, 9) = 1728*386+151;
P(305, 0) = 1728*152+153;
P(305, 1) = 1728*153+154;
P(305, 2) = 1728*154+155;
P(305, 3) = 1728*155+204;
P(305, 4) = 1728*204+205;
P(305, 5) = 1728*205+206;
P(305, 6) = 1728*206+215;
P(305, 7) = 1728*215+212;
P(305, 8) = 1728*212+163;
P(305, 9) = 1728*163+152;
P(306, 0) = 1728*152+153;
P(306, 1) = 1728*153+154;
P(306, 2) = 1728*154+155;
P(306, 3) = 1728*155+204;
P(306, 4) = 1728*204+207;
P(306, 5) = 1728*207+442;
P(306, 6) = 1728*442+441;
P(306, 7) = 1728*441+158;
P(306, 8) = 1728*158+157;
P(306, 9) = 1728*157+152;
P(307, 0) = 1728*152+153;
P(307, 1) = 1728*153+154;
P(307, 2) = 1728*154+1647;
P(307, 3) = 1728*1647+1644;
P(307, 4) = 1728*1644+1645;
P(307, 5) = 1728*1645+1646;
P(307, 6) = 1728*1646+1655;
P(307, 7) = 1728*1655+162;
P(307, 8) = 1728*162+163;
P(307, 9) = 1728*163+152;
P(308, 0) = 1728*152+153;
P(308, 1) = 1728*153+1598;
P(308, 2) = 1728*1598+1597;
P(308, 3) = 1728*1597+1592;
P(308, 4) = 1728*1592+1603;
P(308, 5) = 1728*1603+1652;
P(308, 6) = 1728*1652+1655;
P(308, 7) = 1728*1655+162;
P(308, 8) = 1728*162+163;
P(308, 9) = 1728*163+152;
P(309, 0) = 1728*152+153;
P(309, 1) = 1728*153+1598;
P(309, 2) = 1728*1598+1607;
P(309, 3) = 1728*1607+1604;
P(309, 4) = 1728*1604+1605;
P(309, 5) = 1728*1605+1606;
P(309, 6) = 1728*1606+161;
P(309, 7) = 1728*161+162;
P(309, 8) = 1728*162+163;
P(309, 9) = 1728*163+152;
P(310, 0) = 1728*152+157;
P(310, 1) = 1728*157+158;
P(310, 2) = 1728*158+167;
P(310, 3) = 1728*167+164;
P(310, 4) = 1728*164+165;
P(310, 5) = 1728*165+160;
P(310, 6) = 1728*160+161;
P(310, 7) = 1728*161+162;
P(310, 8) = 1728*162+163;
P(310, 9) = 1728*163+152;
P(311, 0) = 1728*152+157;
P(311, 1) = 1728*157+158;
P(311, 2) = 1728*158+441;
P(311, 3) = 1728*441+440;
P(311, 4) = 1728*440+451;
P(311, 5) = 1728*451+450;
P(311, 6) = 1728*450+215;
P(311, 7) = 1728*215+212;
P(311, 8) = 1728*212+163;
P(311, 9) = 1728*163+152;
P(312, 0) = 1728*153+154;
P(312, 1) = 1728*154+1647;
P(312, 2) = 1728*1647+1644;
P(312, 3) = 1728*1644+1595;
P(312, 4) = 1728*1595+1594;
P(312, 5) = 1728*1594+1593;
P(312, 6) = 1728*1593+1592;
P(312, 7) = 1728*1592+1597;
P(312, 8) = 1728*1597+1598;
P(312, 9) = 1728*1598+153;
P(313, 0) = 1728*154+155;
P(313, 1) = 1728*155+204;
P(313, 2) = 1728*204+205;
P(313, 3) = 1728*205+200;
P(313, 4) = 1728*200+201;
P(313, 5) = 1728*201+1646;
P(313, 6) = 1728*1646+1645;
P(313, 7) = 1728*1645+1644;
P(313, 8) = 1728*1644+1647;
P(313, 9) = 1728*1647+154;
P(314, 0) = 1728*154+155;
P(314, 1) = 1728*155+204;
P(314, 2) = 1728*204+207;
P(314, 3) = 1728*207+198;
P(314, 4) = 1728*198+197;
P(314, 5) = 1728*197+192;
P(314, 6) = 1728*192+193;
P(314, 7) = 1728*193+1638;
P(314, 8) = 1728*1638+1647;
P(314, 9) = 1728*1647+154;
P(315, 0) = 1728*156+157;
P(315, 1) = 1728*157+158;
P(315, 2) = 1728*158+167;
P(315, 3) = 1728*167+402;
P(315, 4) = 1728*402+403;
P(315, 5) = 1728*403+392;
P(315, 6) = 1728*392+393;
P(315, 7) = 1728*393+394;
P(315, 8) = 1728*394+159;
P(315, 9) = 1728*159+156;
P(316, 0) = 1728*156+157;
P(316, 1) = 1728*157+158;
P(316, 2) = 1728*158+441;
P(316, 3) = 1728*441+440;
P(316, 4) = 1728*440+445;
P(316, 5) = 1728*445+444;
P(316, 6) = 1728*444+395;
P(316, 7) = 1728*395+394;
P(316, 8) = 1728*394+159;
P(316, 9) = 1728*159+156;
P(317, 0) = 1728*158+167;
P(317, 1) = 1728*167+164;
P(317, 2) = 1728*164+165;
P(317, 3) = 1728*165+166;
P(317, 4) = 1728*166+449;
P(317, 5) = 1728*449+450;
P(317, 6) = 1728*450+451;
P(317, 7) = 1728*451+440;
P(317, 8) = 1728*440+441;
P(317, 9) = 1728*441+158;
P(318, 0) = 1728*158+167;
P(318, 1) = 1728*167+402;
P(318, 2) = 1728*402+403;
P(318, 3) = 1728*403+452;
P(318, 4) = 1728*452+455;
P(318, 5) = 1728*455+446;
P(318, 6) = 1728*446+445;
P(318, 7) = 1728*445+440;
P(318, 8) = 1728*440+441;
P(318, 9) = 1728*441+158;
P(319, 0) = 1728*160+161;
P(319, 1) = 1728*161+162;
P(319, 2) = 1728*162+163;
P(319, 3) = 1728*163+212;
P(319, 4) = 1728*212+213;
P(319, 5) = 1728*213+214;
P(319, 6) = 1728*214+223;
P(319, 7) = 1728*223+220;
P(319, 8) = 1728*220+171;
P(319, 9) = 1728*171+160;
P(320, 0) = 1728*160+161;
P(320, 1) = 1728*161+162;
P(320, 2) = 1728*162+163;
P(320, 3) = 1728*163+212;
P(320, 4) = 1728*212+215;
P(320, 5) = 1728*215+450;
P(320, 6) = 1728*450+449;
P(320, 7) = 1728*449+166;
P(320, 8) = 1728*166+165;
P(320, 9) = 1728*165+160;
P(321, 0) = 1728*160+161;
P(321, 1) = 1728*161+162;
P(321, 2) = 1728*162+1655;
P(321, 3) = 1728*1655+1652;
P(321, 4) = 1728*1652+1653;
P(321, 5) = 1728*1653+1654;
P(321, 6) = 1728*1654+1663;
P(321, 7) = 1728*1663+170;
P(321, 8) = 1728*170+171;
P(321, 9) = 1728*171+160;
P(322, 0) = 1728*160+161;
P(322, 1) = 1728*161+1606;
P(322, 2) = 1728*1606+1605;
P(322, 3) = 1728*1605+1600;
P(322, 4) = 1728*1600+1611;
P(322, 5) = 1728*1611+1660;
P(322, 6) = 1728*1660+1663;
P(322, 7) = 1728*1663+170;
P(322, 8) = 1728*170+171;
P(322, 9) = 1728*171+160;
P(323, 0) = 1728*160+161;
P(323, 1) = 1728*161+1606;
P(323, 2) = 1728*1606+1615;
P(323, 3) = 1728*1615+1612;
P(323, 4) = 1728*1612+1613;
P(323, 5) = 1728*1613+1614;
P(323, 6) = 1728*1614+169;
P(323, 7) = 1728*169+170;
P(323, 8) = 1728*170+171;
P(323, 9) = 1728*171+160;
P(324, 0) = 1728*160+165;
P(324, 1) = 1728*165+166;
P(324, 2) = 1728*166+175;
P(324, 3) = 1728*175+172;
P(324, 4) = 1728*172+173;
P(324, 5) = 1728*173+168;
P(324, 6) = 1728*168+169;
P(324, 7) = 1728*169+170;
P(324, 8) = 1728*170+171;
P(324, 9) = 1728*171+160;
P(325, 0) = 1728*160+165;
P(325, 1) = 1728*165+166;
P(325, 2) = 1728*166+449;
P(325, 3) = 1728*449+448;
P(325, 4) = 1728*448+459;
P(325, 5) = 1728*459+458;
P(325, 6) = 1728*458+223;
P(325, 7) = 1728*223+220;
P(325, 8) = 1728*220+171;
P(325, 9) = 1728*171+160;
P(326, 0) = 1728*161+162;
P(326, 1) = 1728*162+1655;
P(326, 2) = 1728*1655+1652;
P(326, 3) = 1728*1652+1603;
P(326, 4) = 1728*1603+1602;
P(326, 5) = 1728*1602+1601;
P(326, 6) = 1728*1601+1600;
P(326, 7) = 1728*1600+1605;
P(326, 8) = 1728*1605+1606;
P(326, 9) = 1728*1606+161;
P(327, 0) = 1728*162+163;
P(327, 1) = 1728*163+212;
P(327, 2) = 1728*212+213;
P(327, 3) = 1728*213+208;
P(327, 4) = 1728*208+209;
P(327, 5) = 1728*209+1654;
P(327, 6) = 1728*1654+1653;
P(327, 7) = 1728*1653+1652;
P(327, 8) = 1728*1652+1655;
P(327, 9) = 1728*1655+162;
P(328, 0) = 1728*162+163;
P(328, 1) = 1728*163+212;
P(328, 2) = 1728*212+215;
P(328, 3) = 1728*215+206;
P(328, 4) = 1728*206+205;
P(328, 5) = 1728*205+200;
P(328, 6) = 1728*200+201;
P(328, 7) = 1728*201+1646;
P(328, 8) = 1728*1646+1655;
P(328, 9) = 1728*1655+162;
P(329, 0) = 1728*164+165;
P(329, 1) = 1728*165+166;
P(329, 2) = 1728*166+175;
P(329, 3) = 1728*175+410;
P(329, 4) = 1728*410+411;
P(329, 5) = 1728*411+400;
P(329, 6) = 1728*400+401;
P(329, 7) = 1728*401+402;
P(329, 8) = 1728*402+167;
P(329, 9) = 1728*167+164;
P(330, 0) = 1728*164+165;
P(330, 1) = 1728*165+166;
P(330, 2) = 1728*166+449;
P(330, 3) = 1728*449+448;
P(330, 4) = 1728*448+453;
P(330, 5) = 1728*453+452;
P(330, 6) = 1728*452+403;
P(330, 7) = 1728*403+402;
P(330, 8) = 1728*402+167;
P(330, 9) = 1728*167+164;
P(331, 0) = 1728*166+175;
P(331, 1) = 1728*175+172;
P(331, 2) = 1728*172+173;
P(331, 3) = 1728*173+174;
P(331, 4) = 1728*174+457;
P(331, 5) = 1728*457+458;
P(331, 6) = 1728*458+459;
P(331, 7) = 1728*459+448;
P(331, 8) = 1728*448+449;
P(331, 9) = 1728*449+166;
P(332, 0) = 1728*166+175;
P(332, 1) = 1728*175+410;
P(332, 2) = 1728*410+411;
P(332, 3) = 1728*411+460;
P(332, 4) = 1728*460+463;
P(332, 5) = 1728*463+454;
P(332, 6) = 1728*454+453;
P(332, 7) = 1728*453+448;
P(332, 8) = 1728*448+449;
P(332, 9) = 1728*449+166;
P(333, 0) = 1728*168+169;
P(333, 1) = 1728*169+170;
P(333, 2) = 1728*170+171;
P(333, 3) = 1728*171+220;
P(333, 4) = 1728*220+221;
P(333, 5) = 1728*221+222;
P(333, 6) = 1728*222+231;
P(333, 7) = 1728*231+228;
P(333, 8) = 1728*228+179;
P(333, 9) = 1728*179+168;
P(334, 0) = 1728*168+169;
P(334, 1) = 1728*169+170;
P(334, 2) = 1728*170+171;
P(334, 3) = 1728*171+220;
P(334, 4) = 1728*220+223;
P(334, 5) = 1728*223+458;
P(334, 6) = 1728*458+457;
P(334, 7) = 1728*457+174;
P(334, 8) = 1728*174+173;
P(334, 9) = 1728*173+168;
P(335, 0) = 1728*168+169;
P(335, 1) = 1728*169+170;
P(335, 2) = 1728*170+1663;
P(335, 3) = 1728*1663+1660;
P(335, 4) = 1728*1660+1661;
P(335, 5) = 1728*1661+1662;
P(335, 6) = 1728*1662+1671;
P(335, 7) = 1728*1671+178;
P(335, 8) = 1728*178+179;
P(335, 9) = 1728*179+168;
P(336, 0) = 1728*168+169;
P(336, 1) = 1728*169+1614;
P(336, 2) = 1728*1614+1613;
P(336, 3) = 1728*1613+1608;
P(336, 4) = 1728*1608+1619;
P(336, 5) = 1728*1619+1668;
P(336, 6) = 1728*1668+1671;
P(336, 7) = 1728*1671+178;
P(336, 8) = 1728*178+179;
P(336, 9) = 1728*179+168;
P(337, 0) = 1728*168+169;
P(337, 1) = 1728*169+1614;
P(337, 2) = 1728*1614+1623;
P(337, 3) = 1728*1623+1620;
P(337, 4) = 1728*1620+1621;
P(337, 5) = 1728*1621+1622;
P(337, 6) = 1728*1622+177;
P(337, 7) = 1728*177+178;
P(337, 8) = 1728*178+179;
P(337, 9) = 1728*179+168;
P(338, 0) = 1728*168+173;
P(338, 1) = 1728*173+174;
P(338, 2) = 1728*174+183;
P(338, 3) = 1728*183+180;
P(338, 4) = 1728*180+181;
P(338, 5) = 1728*181+176;
P(338, 6) = 1728*176+177;
P(338, 7) = 1728*177+178;
P(338, 8) = 1728*178+179;
P(338, 9) = 1728*179+168;
P(339, 0) = 1728*168+173;
P(339, 1) = 1728*173+174;
P(339, 2) = 1728*174+457;
P(339, 3) = 1728*457+456;
P(339, 4) = 1728*456+467;
P(339, 5) = 1728*467+466;
P(339, 6) = 1728*466+231;
P(339, 7) = 1728*231+228;
P(339, 8) = 1728*228+179;
P(339, 9) = 1728*179+168;
P(340, 0) = 1728*169+170;
P(340, 1) = 1728*170+1663;
P(340, 2) = 1728*1663+1660;
P(340, 3) = 1728*1660+1611;
P(340, 4) = 1728*1611+1610;
P(340, 5) = 1728*1610+1609;
P(340, 6) = 1728*1609+1608;
P(340, 7) = 1728*1608+1613;
P(340, 8) = 1728*1613+1614;
P(340, 9) = 1728*1614+169;
P(341, 0) = 1728*170+171;
P(341, 1) = 1728*171+220;
P(341, 2) = 1728*220+221;
P(341, 3) = 1728*221+216;
P(341, 4) = 1728*216+217;
P(341, 5) = 1728*217+1662;
P(341, 6) = 1728*1662+1661;
P(341, 7) = 1728*1661+1660;
P(341, 8) = 1728*1660+1663;
P(341, 9) = 1728*1663+170;
P(342, 0) = 1728*170+171;
P(342, 1) = 1728*171+220;
P(342, 2) = 1728*220+223;
P(342, 3) = 1728*223+214;
P(342, 4) = 1728*214+213;
P(342, 5) = 1728*213+208;
P(342, 6) = 1728*208+209;
P(342, 7) = 1728*209+1654;
P(342, 8) = 1728*1654+1663;
P(342, 9) = 1728*1663+170;
P(343, 0) = 1728*172+173;
P(343, 1) = 1728*173+174;
P(343, 2) = 1728*174+183;
P(343, 3) = 1728*183+418;
P(343, 4) = 1728*418+419;
P(343, 5) = 1728*419+408;
P(343, 6) = 1728*408+409;
P(343, 7) = 1728*409+410;
P(343, 8) = 1728*410+175;
P(343, 9) = 1728*175+172;
P(344, 0) = 1728*172+173;
P(344, 1) = 1728*173+174;
P(344, 2) = 1728*174+457;
P(344, 3) = 1728*457+456;
P(344, 4) = 1728*456+461;
P(344, 5) = 1728*461+460;
P(344, 6) = 1728*460+411;
P(344, 7) = 1728*411+410;
P(344, 8) = 1728*410+175;
P(344, 9) = 1728*175+172;
P(345, 0) = 1728*174+183;
P(345, 1) = 1728*183+180;
P(345, 2) = 1728*180+181;
P(345, 3) = 1728*181+182;
P(345, 4) = 1728*182+465;
P(345, 5) = 1728*465+466;
P(345, 6) = 1728*466+467;
P(345, 7) = 1728*467+456;
P(345, 8) = 1728*456+457;
P(345, 9) = 1728*457+174;
P(346, 0) = 1728*174+183;
P(346, 1) = 1728*183+418;
P(346, 2) = 1728*418+419;
P(346, 3) = 1728*419+468;
P(346, 4) = 1728*468+471;
P(346, 5) = 1728*471+462;
P(346, 6) = 1728*462+461;
P(346, 7) = 1728*461+456;
P(346, 8) = 1728*456+457;
P(346, 9) = 1728*457+174;
P(347, 0) = 1728*176+177;
P(347, 1) = 1728*177+178;
P(347, 2) = 1728*178+179;
P(347, 3) = 1728*179+228;
P(347, 4) = 1728*228+229;
P(347, 5) = 1728*229+230;
P(347, 6) = 1728*230+239;
P(347, 7) = 1728*239+236;
P(347, 8) = 1728*236+187;
P(347, 9) = 1728*187+176;
P(348, 0) = 1728*176+177;
P(348, 1) = 1728*177+178;
P(348, 2) = 1728*178+179;
P(348, 3) = 1728*179+228;
P(348, 4) = 1728*228+231;
P(348, 5) = 1728*231+466;
P(348, 6) = 1728*466+465;
P(348, 7) = 1728*465+182;
P(348, 8) = 1728*182+181;
P(348, 9) = 1728*181+176;
P(349, 0) = 1728*176+177;
P(349, 1) = 1728*177+178;
P(349, 2) = 1728*178+1671;
P(349, 3) = 1728*1671+1668;
P(349, 4) = 1728*1668+1669;
P(349, 5) = 1728*1669+1670;
P(349, 6) = 1728*1670+1679;
P(349, 7) = 1728*1679+186;
P(349, 8) = 1728*186+187;
P(349, 9) = 1728*187+176;
P(350, 0) = 1728*176+177;
P(350, 1) = 1728*177+1622;
P(350, 2) = 1728*1622+1621;
P(350, 3) = 1728*1621+1616;
P(350, 4) = 1728*1616+1627;
P(350, 5) = 1728*1627+1676;
P(350, 6) = 1728*1676+1679;
P(350, 7) = 1728*1679+186;
P(350, 8) = 1728*186+187;
P(350, 9) = 1728*187+176;
P(351, 0) = 1728*176+177;
P(351, 1) = 1728*177+1622;
P(351, 2) = 1728*1622+1631;
P(351, 3) = 1728*1631+1628;
P(351, 4) = 1728*1628+1629;
P(351, 5) = 1728*1629+1630;
P(351, 6) = 1728*1630+185;
P(351, 7) = 1728*185+186;
P(351, 8) = 1728*186+187;
P(351, 9) = 1728*187+176;
P(352, 0) = 1728*176+181;
P(352, 1) = 1728*181+182;
P(352, 2) = 1728*182+191;
P(352, 3) = 1728*191+188;
P(352, 4) = 1728*188+189;
P(352, 5) = 1728*189+184;
P(352, 6) = 1728*184+185;
P(352, 7) = 1728*185+186;
P(352, 8) = 1728*186+187;
P(352, 9) = 1728*187+176;
P(353, 0) = 1728*176+181;
P(353, 1) = 1728*181+182;
P(353, 2) = 1728*182+465;
P(353, 3) = 1728*465+464;
P(353, 4) = 1728*464+475;
P(353, 5) = 1728*475+474;
P(353, 6) = 1728*474+239;
P(353, 7) = 1728*239+236;
P(353, 8) = 1728*236+187;
P(353, 9) = 1728*187+176;
P(354, 0) = 1728*177+178;
P(354, 1) = 1728*178+1671;
P(354, 2) = 1728*1671+1668;
P(354, 3) = 1728*1668+1619;
P(354, 4) = 1728*1619+1618;
P(354, 5) = 1728*1618+1617;
P(354, 6) = 1728*1617+1616;
P(354, 7) = 1728*1616+1621;
P(354, 8) = 1728*1621+1622;
P(354, 9) = 1728*1622+177;
P(355, 0) = 1728*178+179;
P(355, 1) = 1728*179+228;
P(355, 2) = 1728*228+229;
P(355, 3) = 1728*229+224;
P(355, 4) = 1728*224+225;
P(355, 5) = 1728*225+1670;
P(355, 6) = 1728*1670+1669;
P(355, 7) = 1728*1669+1668;
P(355, 8) = 1728*1668+1671;
P(355, 9) = 1728*1671+178;
P(356, 0) = 1728*178+179;
P(356, 1) = 1728*179+228;
P(356, 2) = 1728*228+231;
P(356, 3) = 1728*231+222;
P(356, 4) = 1728*222+221;
P(356, 5) = 1728*221+216;
P(356, 6) = 1728*216+217;
P(356, 7) = 1728*217+1662;
P(356, 8) = 1728*1662+1671;
P(356, 9) = 1728*1671+178;
P(357, 0) = 1728*180+181;
P(357, 1) = 1728*181+182;
P(357, 2) = 1728*182+191;
P(357, 3) = 1728*191+426;
P(357, 4) = 1728*426+427;
P(357, 5) = 1728*427+416;
P(357, 6) = 1728*416+417;
P(357, 7) = 1728*417+418;
P(357, 8) = 1728*418+183;
P(357, 9) = 1728*183+180;
P(358, 0) = 1728*180+181;
P(358, 1) = 1728*181+182;
P(358, 2) = 1728*182+465;
P(358, 3) = 1728*465+464;
P(358, 4) = 1728*464+469;
P(358, 5) = 1728*469+468;
P(358, 6) = 1728*468+419;
P(358, 7) = 1728*419+418;
P(358, 8) = 1728*418+183;
P(358, 9) = 1728*183+180;
P(359, 0) = 1728*182+191;
P(359, 1) = 1728*191+188;
P(359, 2) = 1728*188+189;
P(359, 3) = 1728*189+190;
P(359, 4) = 1728*190+473;
P(359, 5) = 1728*473+474;
P(359, 6) = 1728*474+475;
P(359, 7) = 1728*475+464;
P(359, 8) = 1728*464+465;
P(359, 9) = 1728*465+182;
P(360, 0) = 1728*182+191;
P(360, 1) = 1728*191+426;
P(360, 2) = 1728*426+427;
P(360, 3) = 1728*427+476;
P(360, 4) = 1728*476+479;
P(360, 5) = 1728*479+470;
P(360, 6) = 1728*470+469;
P(360, 7) = 1728*469+464;
P(360, 8) = 1728*464+465;
P(360, 9) = 1728*465+182;
P(361, 0) = 1728*184+185;
P(361, 1) = 1728*185+186;
P(361, 2) = 1728*186+187;
P(361, 3) = 1728*187+236;
P(361, 4) = 1728*236+239;
P(361, 5) = 1728*239+474;
P(361, 6) = 1728*474+473;
P(361, 7) = 1728*473+190;
P(361, 8) = 1728*190+189;
P(361, 9) = 1728*189+184;
P(362, 0) = 1728*185+186;
P(362, 1) = 1728*186+1679;
P(362, 2) = 1728*1679+1676;
P(362, 3) = 1728*1676+1627;
P(362, 4) = 1728*1627+1626;
P(362, 5) = 1728*1626+1625;
P(362, 6) = 1728*1625+1624;
P(362, 7) = 1728*1624+1629;
P(362, 8) = 1728*1629+1630;
P(362, 9) = 1728*1630+185;
P(363, 0) = 1728*186+187;
P(363, 1) = 1728*187+236;
P(363, 2) = 1728*236+237;
P(363, 3) = 1728*237+232;
P(363, 4) = 1728*232+233;
P(363, 5) = 1728*233+1678;
P(363, 6) = 1728*1678+1677;
P(363, 7) = 1728*1677+1676;
P(363, 8) = 1728*1676+1679;
P(363, 9) = 1728*1679+186;
P(364, 0) = 1728*186+187;
P(364, 1) = 1728*187+236;
P(364, 2) = 1728*236+239;
P(364, 3) = 1728*239+230;
P(364, 4) = 1728*230+229;
P(364, 5) = 1728*229+224;
P(364, 6) = 1728*224+225;
P(364, 7) = 1728*225+1670;
P(364, 8) = 1728*1670+1679;
P(364, 9) = 1728*1679+186;
P(365, 0) = 1728*188+189;
P(365, 1) = 1728*189+190;
P(365, 2) = 1728*190+473;
P(365, 3) = 1728*473+472;
P(365, 4) = 1728*472+477;
P(365, 5) = 1728*477+476;
P(365, 6) = 1728*476+427;
P(365, 7) = 1728*427+426;
P(365, 8) = 1728*426+191;
P(365, 9) = 1728*191+188;
P(366, 0) = 1728*192+193;
P(366, 1) = 1728*193+194;
P(366, 2) = 1728*194+195;
P(366, 3) = 1728*195+244;
P(366, 4) = 1728*244+245;
P(366, 5) = 1728*245+246;
P(366, 6) = 1728*246+255;
P(366, 7) = 1728*255+252;
P(366, 8) = 1728*252+203;
P(366, 9) = 1728*203+192;
P(367, 0) = 1728*192+193;
P(367, 1) = 1728*193+194;
P(367, 2) = 1728*194+195;
P(367, 3) = 1728*195+244;
P(367, 4) = 1728*244+247;
P(367, 5) = 1728*247+482;
P(367, 6) = 1728*482+481;
P(367, 7) = 1728*481+198;
P(367, 8) = 1728*198+197;
P(367, 9) = 1728*197+192;
P(368, 0) = 1728*192+193;
P(368, 1) = 1728*193+194;
P(368, 2) = 1728*194+195;
P(368, 3) = 1728*195+232;
P(368, 4) = 1728*232+237;
P(368, 5) = 1728*237+238;
P(368, 6) = 1728*238+199;
P(368, 7) = 1728*199+196;
P(368, 8) = 1728*196+197;
P(368, 9) = 1728*197+192;
P(369, 0) = 1728*192+193;
P(369, 1) = 1728*193+194;
P(369, 2) = 1728*194+1687;
P(369, 3) = 1728*1687+1684;
P(369, 4) = 1728*1684+1685;
P(369, 5) = 1728*1685+1686;
P(369, 6) = 1728*1686+1695;
P(369, 7) = 1728*1695+202;
P(369, 8) = 1728*202+203;
P(369, 9) = 1728*203+192;
P(370, 0) = 1728*192+193;
P(370, 1) = 1728*193+1638;
P(370, 2) = 1728*1638+1637;
P(370, 3) = 1728*1637+1632;
P(370, 4) = 1728*1632+1643;
P(370, 5) = 1728*1643+1692;
P(370, 6) = 1728*1692+1695;
P(370, 7) = 1728*1695+202;
P(370, 8) = 1728*202+203;
P(370, 9) = 1728*203+192;
P(371, 0) = 1728*192+193;
P(371, 1) = 1728*193+1638;
P(371, 2) = 1728*1638+1647;
P(371, 3) = 1728*1647+1644;
P(371, 4) = 1728*1644+1645;
P(371, 5) = 1728*1645+1646;
P(371, 6) = 1728*1646+201;
P(371, 7) = 1728*201+202;
P(371, 8) = 1728*202+203;
P(371, 9) = 1728*203+192;
P(372, 0) = 1728*192+197;
P(372, 1) = 1728*197+198;
P(372, 2) = 1728*198+207;
P(372, 3) = 1728*207+204;
P(372, 4) = 1728*204+205;
P(372, 5) = 1728*205+200;
P(372, 6) = 1728*200+201;
P(372, 7) = 1728*201+202;
P(372, 8) = 1728*202+203;
P(372, 9) = 1728*203+192;
P(373, 0) = 1728*192+197;
P(373, 1) = 1728*197+198;
P(373, 2) = 1728*198+481;
P(373, 3) = 1728*481+480;
P(373, 4) = 1728*480+491;
P(373, 5) = 1728*491+490;
P(373, 6) = 1728*490+255;
P(373, 7) = 1728*255+252;
P(373, 8) = 1728*252+203;
P(373, 9) = 1728*203+192;
P(374, 0) = 1728*193+194;
P(374, 1) = 1728*194+195;
P(374, 2) = 1728*195+232;
P(374, 3) = 1728*232+233;
P(374, 4) = 1728*233+1678;
P(374, 5) = 1728*1678+1639;
P(374, 6) = 1728*1639+1636;
P(374, 7) = 1728*1636+1637;
P(374, 8) = 1728*1637+1638;
P(374, 9) = 1728*1638+193;
P(375, 0) = 1728*193+194;
P(375, 1) = 1728*194+1687;
P(375, 2) = 1728*1687+1684;
P(375, 3) = 1728*1684+1635;
P(375, 4) = 1728*1635+1634;
P(375, 5) = 1728*1634+1633;
P(375, 6) = 1728*1633+1632;
P(375, 7) = 1728*1632+1637;
P(375, 8) = 1728*1637+1638;
P(375, 9) = 1728*1638+193;
P(376, 0) = 1728*194+195;
P(376, 1) = 1728*195+244;
P(376, 2) = 1728*244+245;
P(376, 3) = 1728*245+240;
P(376, 4) = 1728*240+241;
P(376, 5) = 1728*241+1686;
P(376, 6) = 1728*1686+1685;
P(376, 7) = 1728*1685+1684;
P(376, 8) = 1728*1684+1687;
P(376, 9) = 1728*1687+194;
P(377, 0) = 1728*194+195;
P(377, 1) = 1728*195+244;
P(377, 2) = 1728*244+247;
P(377, 3) = 1728*247+286;
P(377, 4) = 1728*286+285;
P(377, 5) = 1728*285+280;
P(377, 6) = 1728*280+281;
P(377, 7) = 1728*281+1726;
P(377, 8) = 1728*1726+1687;
P(377, 9) = 1728*1687+194;
P(378, 0) = 1728*194+195;
P(378, 1) = 1728*195+232;
P(378, 2) = 1728*232+233;
P(378, 3) = 1728*233+234;
P(378, 4) = 1728*234+1727;
P(378, 5) = 1728*1727+1724;
P(378, 6) = 1728*1724+1725;
P(378, 7) = 1728*1725+1726;
P(378, 8) = 1728*1726+1687;
P(378, 9) = 1728*1687+194;
P(379, 0) = 1728*194+195;
P(379, 1) = 1728*195+232;
P(379, 2) = 1728*232+233;
P(379, 3) = 1728*233+1678;
P(379, 4) = 1728*1678+1677;
P(379, 5) = 1728*1677+1672;
P(379, 6) = 1728*1672+1635;
P(379, 7) = 1728*1635+1684;
P(379, 8) = 1728*1684+1687;
P(379, 9) = 1728*1687+194;
P(380, 0) = 1728*195+244;
P(380, 1) = 1728*244+247;
P(380, 2) = 1728*247+286;
P(380, 3) = 1728*286+285;
P(380, 4) = 1728*285+284;
P(380, 5) = 1728*284+235;
P(380, 6) = 1728*235+234;
P(380, 7) = 1728*234+233;
P(380, 8) = 1728*233+232;
P(380, 9) = 1728*232+195;
P(381, 0) = 1728*195+244;
P(381, 1) = 1728*244+247;
P(381, 2) = 1728*247+482;
P(381, 3) = 1728*482+483;
P(381, 4) = 1728*483+520;
P(381, 5) = 1728*520+521;
P(381, 6) = 1728*521+238;
P(381, 7) = 1728*238+237;
P(381, 8) = 1728*237+232;
P(381, 9) = 1728*232+195;
P(382, 0) = 1728*196+197;
P(382, 1) = 1728*197+198;
P(382, 2) = 1728*198+207;
P(382, 3) = 1728*207+442;
P(382, 4) = 1728*442+443;
P(382, 5) = 1728*443+432;
P(382, 6) = 1728*432+433;
P(382, 7) = 1728*433+434;
P(382, 8) = 1728*434+199;
P(382, 9) = 1728*199+196;
P(383, 0) = 1728*196+197;
P(383, 1) = 1728*197+198;
P(383, 2) = 1728*198+481;
P(383, 3) = 1728*481+480;
P(383, 4) = 1728*480+485;
P(383, 5) = 1728*485+484;
P(383, 6) = 1728*484+435;
P(383, 7) = 1728*435+434;
P(383, 8) = 1728*434+199;
P(383, 9) = 1728*199+196;
P(384, 0) = 1728*196+197;
P(384, 1) = 1728*197+198;
P(384, 2) = 1728*198+481;
P(384, 3) = 1728*481+482;
P(384, 4) = 1728*482+483;
P(384, 5) = 1728*483+520;
P(384, 6) = 1728*520+521;
P(384, 7) = 1728*521+238;
P(384, 8) = 1728*238+199;
P(384, 9) = 1728*199+196;
P(385, 0) = 1728*198+207;
P(385, 1) = 1728*207+204;
P(385, 2) = 1728*204+205;
P(385, 3) = 1728*205+206;
P(385, 4) = 1728*206+489;
P(385, 5) = 1728*489+490;
P(385, 6) = 1728*490+491;
P(385, 7) = 1728*491+480;
P(385, 8) = 1728*480+481;
P(385, 9) = 1728*481+198;
P(386, 0) = 1728*198+207;
P(386, 1) = 1728*207+442;
P(386, 2) = 1728*442+443;
P(386, 3) = 1728*443+492;
P(386, 4) = 1728*492+495;
P(386, 5) = 1728*495+486;
P(386, 6) = 1728*486+485;
P(386, 7) = 1728*485+480;
P(386, 8) = 1728*480+481;
P(386, 9) = 1728*481+198;
P(387, 0) = 1728*199+238;
P(387, 1) = 1728*238+237;
P(387, 2) = 1728*237+236;
P(387, 3) = 1728*236+239;
P(387, 4) = 1728*239+474;
P(387, 5) = 1728*474+473;
P(387, 6) = 1728*473+472;
P(387, 7) = 1728*472+435;
P(387, 8) = 1728*435+434;
P(387, 9) = 1728*434+199;
P(388, 0) = 1728*199+238;
P(388, 1) = 1728*238+521;
P(388, 2) = 1728*521+520;
P(388, 3) = 1728*520+525;
P(388, 4) = 1728*525+526;
P(388, 5) = 1728*526+487;
P(388, 6) = 1728*487+484;
P(388, 7) = 1728*484+435;
P(388, 8) = 1728*435+434;
P(388, 9) = 1728*434+199;
P(389, 0) = 1728*200+201;
P(389, 1) = 1728*201+202;
P(389, 2) = 1728*202+203;
P(389, 3) = 1728*203+252;
P(389, 4) = 1728*252+253;
P(389, 5) = 1728*253+254;
P(389, 6) = 1728*254+263;
P(389, 7) = 1728*263+260;
P(389, 8) = 1728*260+211;
P(389, 9) = 1728*211+200;
P(390, 0) = 1728*200+201;
P(390, 1) = 1728*201+202;
P(390, 2) = 1728*202+203;
P(390, 3) = 1728*203+252;
P(390, 4) = 1728*252+255;
P(390, 5) = 1728*255+490;
P(390, 6) = 1728*490+489;
P(390, 7) = 1728*489+206;
P(390, 8) = 1728*206+205;
P(390, 9) = 1728*205+200;
P(391, 0) = 1728*200+201;
P(391, 1) = 1728*201+202;
P(391, 2) = 1728*202+1695;
P(391, 3) = 1728*1695+1692;
P(391, 4) = 1728*1692+1693;
P(391, 5) = 1728*1693+1694;
P(391, 6) = 1728*1694+1703;
P(391, 7) = 1728*1703+210;
P(391, 8) = 1728*210+211;
P(391, 9) = 1728*211+200;
P(392, 0) = 1728*200+201;
P(392, 1) = 1728*201+1646;
P(392, 2) = 1728*1646+1645;
P(392, 3) = 1728*1645+1640;
P(392, 4) = 1728*1640+1651;
P(392, 5) = 1728*1651+1700;
P(392, 6) = 1728*1700+1703;
P(392, 7) = 1728*1703+210;
P(392, 8) = 1728*210+211;
P(392, 9) = 1728*211+200;
P(393, 0) = 1728*200+201;
P(393, 1) = 1728*201+1646;
P(393, 2) = 1728*1646+1655;
P(393, 3) = 1728*1655+1652;
P(393, 4) = 1728*1652+1653;
P(393, 5) = 1728*1653+1654;
P(393, 6) = 1728*1654+209;
P(393, 7) = 1728*209+210;
P(393, 8) = 1728*210+211;
P(393, 9) = 1728*211+200;
P(394, 0) = 1728*200+205;
P(394, 1) = 1728*205+206;
P(394, 2) = 1728*206+215;
P(394, 3) = 1728*215+212;
P(394, 4) = 1728*212+213;
P(394, 5) = 1728*213+208;
P(394, 6) = 1728*208+209;
P(394, 7) = 1728*209+210;
P(394, 8) = 1728*210+211;
P(394, 9) = 1728*211+200;
P(395, 0) = 1728*200+205;
P(395, 1) = 1728*205+206;
P(395, 2) = 1728*206+489;
P(395, 3) = 1728*489+488;
P(395, 4) = 1728*488+499;
P(395, 5) = 1728*499+498;
P(395, 6) = 1728*498+263;
P(395, 7) = 1728*263+260;
P(395, 8) = 1728*260+211;
P(395, 9) = 1728*211+200;
P(396, 0) = 1728*201+202;
P(396, 1) = 1728*202+1695;
P(396, 2) = 1728*1695+1692;
P(396, 3) = 1728*1692+1643;
P(396, 4) = 1728*1643+1642;
P(396, 5) = 1728*1642+1641;
P(396, 6) = 1728*1641+1640;
P(396, 7) = 1728*1640+1645;
P(396, 8) = 1728*1645+1646;
P(396, 9) = 1728*1646+201;
P(397, 0) = 1728*202+203;
P(397, 1) = 1728*203+252;
P(397, 2) = 1728*252+253;
P(397, 3) = 1728*253+248;
P(397, 4) = 1728*248+249;
P(397, 5) = 1728*249+1694;
P(397, 6) = 1728*1694+1693;
P(397, 7) = 1728*1693+1692;
P(397, 8) = 1728*1692+1695;
P(397, 9) = 1728*1695+202;
P(398, 0) = 1728*202+203;
P(398, 1) = 1728*203+252;
P(398, 2) = 1728*252+255;
P(398, 3) = 1728*255+246;
P(398, 4) = 1728*246+245;
P(398, 5) = 1728*245+240;
P(398, 6) = 1728*240+241;
P(398, 7) = 1728*241+1686;
P(398, 8) = 1728*1686+1695;
P(398, 9) = 1728*1695+202;
P(399, 0) = 1728*204+205;
P(399, 1) = 1728*205+206;
P(399, 2) = 1728*206+215;
P(399, 3) = 1728*215+450;
P(399, 4) = 1728*450+451;
P(399, 5) = 1728*451+440;
P(399, 6) = 1728*440+441;
P(399, 7) = 1728*441+442;
P(399, 8) = 1728*442+207;
P(399, 9) = 1728*207+204;
P(400, 0) = 1728*204+205;
P(400, 1) = 1728*205+206;
P(400, 2) = 1728*206+489;
P(400, 3) = 1728*489+488;
P(400, 4) = 1728*488+493;
P(400, 5) = 1728*493+492;
P(400, 6) = 1728*492+443;
P(400, 7) = 1728*443+442;
P(400, 8) = 1728*442+207;
P(400, 9) = 1728*207+204;
P(401, 0) = 1728*206+215;
P(401, 1) = 1728*215+212;
P(401, 2) = 1728*212+213;
P(401, 3) = 1728*213+214;
P(401, 4) = 1728*214+497;
P(401, 5) = 1728*497+498;
P(401, 6) = 1728*498+499;
P(401, 7) = 1728*499+488;
P(401, 8) = 1728*488+489;
P(401, 9) = 1728*489+206;
P(402, 0) = 1728*206+215;
P(402, 1) = 1728*215+450;
P(402, 2) = 1728*450+451;
P(402, 3) = 1728*451+500;
P(402, 4) = 1728*500+503;
P(402, 5) = 1728*503+494;
P(402, 6) = 1728*494+493;
P(402, 7) = 1728*493+488;
P(402, 8) = 1728*488+489;
P(402, 9) = 1728*489+206;
P(403, 0) = 1728*208+209;
P(403, 1) = 1728*209+210;
P(403, 2) = 1728*210+211;
P(403, 3) = 1728*211+260;
P(403, 4) = 1728*260+261;
P(403, 5) = 1728*261+262;
P(403, 6) = 1728*262+271;
P(403, 7) = 1728*271+268;
P(403, 8) = 1728*268+219;
P(403, 9) = 1728*219+208;
P(404, 0) = 1728*208+209;
P(404, 1) = 1728*209+210;
P(404, 2) = 1728*210+211;
P(404, 3) = 1728*211+260;
P(404, 4) = 1728*260+263;
P(404, 5) = 1728*263+498;
P(404, 6) = 1728*498+497;
P(404, 7) = 1728*497+214;
P(404, 8) = 1728*214+213;
P(404, 9) = 1728*213+208;
P(405, 0) = 1728*208+209;
P(405, 1) = 1728*209+210;
P(405, 2) = 1728*210+1703;
P(405, 3) = 1728*1703+1700;
P(405, 4) = 1728*1700+1701;
P(405, 5) = 1728*1701+1702;
P(405, 6) = 1728*1702+1711;
P(405, 7) = 1728*1711+218;
P(405, 8) = 1728*218+219;
P(405, 9) = 1728*219+208;
P(406, 0) = 1728*208+209;
P(406, 1) = 1728*209+1654;
P(406, 2) = 1728*1654+1653;
P(406, 3) = 1728*1653+1648;
P(406, 4) = 1728*1648+1659;
P(406, 5) = 1728*1659+1708;
P(406, 6) = 1728*1708+1711;
P(406, 7) = 1728*1711+218;
P(406, 8) = 1728*218+219;
P(406, 9) = 1728*219+208;
P(407, 0) = 1728*208+209;
P(407, 1) = 1728*209+1654;
P(407, 2) = 1728*1654+1663;
P(407, 3) = 1728*1663+1660;
P(407, 4) = 1728*1660+1661;
P(407, 5) = 1728*1661+1662;
P(407, 6) = 1728*1662+217;
P(407, 7) = 1728*217+218;
P(407, 8) = 1728*218+219;
P(407, 9) = 1728*219+208;
P(408, 0) = 1728*208+213;
P(408, 1) = 1728*213+214;
P(408, 2) = 1728*214+223;
P(408, 3) = 1728*223+220;
P(408, 4) = 1728*220+221;
P(408, 5) = 1728*221+216;
P(408, 6) = 1728*216+217;
P(408, 7) = 1728*217+218;
P(408, 8) = 1728*218+219;
P(408, 9) = 1728*219+208;
P(409, 0) = 1728*208+213;
P(409, 1) = 1728*213+214;
P(409, 2) = 1728*214+497;
P(409, 3) = 1728*497+496;
P(409, 4) = 1728*496+507;
P(409, 5) = 1728*507+506;
P(409, 6) = 1728*506+271;
P(409, 7) = 1728*271+268;
P(409, 8) = 1728*268+219;
P(409, 9) = 1728*219+208;
P(410, 0) = 1728*209+210;
P(410, 1) = 1728*210+1703;
P(410, 2) = 1728*1703+1700;
P(410, 3) = 1728*1700+1651;
P(410, 4) = 1728*1651+1650;
P(410, 5) = 1728*1650+1649;
P(410, 6) = 1728*1649+1648;
P(410, 7) = 1728*1648+1653;
P(410, 8) = 1728*1653+1654;
P(410, 9) = 1728*1654+209;
P(411, 0) = 1728*210+211;
P(411, 1) = 1728*211+260;
P(411, 2) = 1728*260+261;
P(411, 3) = 1728*261+256;
P(411, 4) = 1728*256+257;
P(411, 5) = 1728*257+1702;
P(411, 6) = 1728*1702+1701;
P(411, 7) = 1728*1701+1700;
P(411, 8) = 1728*1700+1703;
P(411, 9) = 1728*1703+210;
P(412, 0) = 1728*210+211;
P(412, 1) = 1728*211+260;
P(412, 2) = 1728*260+263;
P(412, 3) = 1728*263+254;
P(412, 4) = 1728*254+253;
P(412, 5) = 1728*253+248;
P(412, 6) = 1728*248+249;
P(412, 7) = 1728*249+1694;
P(412, 8) = 1728*1694+1703;
P(412, 9) = 1728*1703+210;
P(413, 0) = 1728*212+213;
P(413, 1) = 1728*213+214;
P(413, 2) = 1728*214+223;
P(413, 3) = 1728*223+458;
P(413, 4) = 1728*458+459;
P(413, 5) = 1728*459+448;
P(413, 6) = 1728*448+449;
P(413, 7) = 1728*449+450;
P(413, 8) = 1728*450+215;
P(413, 9) = 1728*215+212;
P(414, 0) = 1728*212+213;
P(414, 1) = 1728*213+214;
P(414, 2) = 1728*214+497;
P(414, 3) = 1728*497+496;
P(414, 4) = 1728*496+501;
P(414, 5) = 1728*501+500;
P(414, 6) = 1728*500+451;
P(414, 7) = 1728*451+450;
P(414, 8) = 1728*450+215;
P(414, 9) = 1728*215+212;
P(415, 0) = 1728*214+223;
P(415, 1) = 1728*223+220;
P(415, 2) = 1728*220+221;
P(415, 3) = 1728*221+222;
P(415, 4) = 1728*222+505;
P(415, 5) = 1728*505+506;
P(415, 6) = 1728*506+507;
P(415, 7) = 1728*507+496;
P(415, 8) = 1728*496+497;
P(415, 9) = 1728*497+214;
P(416, 0) = 1728*214+223;
P(416, 1) = 1728*223+458;
P(416, 2) = 1728*458+459;
P(416, 3) = 1728*459+508;
P(416, 4) = 1728*508+511;
P(416, 5) = 1728*511+502;
P(416, 6) = 1728*502+501;
P(416, 7) = 1728*501+496;
P(416, 8) = 1728*496+497;
P(416, 9) = 1728*497+214;
P(417, 0) = 1728*216+217;
P(417, 1) = 1728*217+218;
P(417, 2) = 1728*218+219;
P(417, 3) = 1728*219+268;
P(417, 4) = 1728*268+269;
P(417, 5) = 1728*269+270;
P(417, 6) = 1728*270+279;
P(417, 7) = 1728*279+276;
P(417, 8) = 1728*276+227;
P(417, 9) = 1728*227+216;
P(418, 0) = 1728*216+217;
P(418, 1) = 1728*217+218;
P(418, 2) = 1728*218+219;
P(418, 3) = 1728*219+268;
P(418, 4) = 1728*268+271;
P(418, 5) = 1728*271+506;
P(418, 6) = 1728*506+505;
P(418, 7) = 1728*505+222;
P(418, 8) = 1728*222+221;
P(418, 9) = 1728*221+216;
P(419, 0) = 1728*216+217;
P(419, 1) = 1728*217+218;
P(419, 2) = 1728*218+1711;
P(419, 3) = 1728*1711+1708;
P(419, 4) = 1728*1708+1709;
P(419, 5) = 1728*1709+1710;
P(419, 6) = 1728*1710+1719;
P(419, 7) = 1728*1719+226;
P(419, 8) = 1728*226+227;
P(419, 9) = 1728*227+216;
P(420, 0) = 1728*216+217;
P(420, 1) = 1728*217+1662;
P(420, 2) = 1728*1662+1661;
P(420, 3) = 1728*1661+1656;
P(420, 4) = 1728*1656+1667;
P(420, 5) = 1728*1667+1716;
P(420, 6) = 1728*1716+1719;
P(420, 7) = 1728*1719+226;
P(420, 8) = 1728*226+227;
P(420, 9) = 1728*227+216;
P(421, 0) = 1728*216+217;
P(421, 1) = 1728*217+1662;
P(421, 2) = 1728*1662+1671;
P(421, 3) = 1728*1671+1668;
P(421, 4) = 1728*1668+1669;
P(421, 5) = 1728*1669+1670;
P(421, 6) = 1728*1670+225;
P(421, 7) = 1728*225+226;
P(421, 8) = 1728*226+227;
P(421, 9) = 1728*227+216;
P(422, 0) = 1728*216+221;
P(422, 1) = 1728*221+222;
P(422, 2) = 1728*222+231;
P(422, 3) = 1728*231+228;
P(422, 4) = 1728*228+229;
P(422, 5) = 1728*229+224;
P(422, 6) = 1728*224+225;
P(422, 7) = 1728*225+226;
P(422, 8) = 1728*226+227;
P(422, 9) = 1728*227+216;
P(423, 0) = 1728*216+221;
P(423, 1) = 1728*221+222;
P(423, 2) = 1728*222+505;
P(423, 3) = 1728*505+504;
P(423, 4) = 1728*504+515;
P(423, 5) = 1728*515+514;
P(423, 6) = 1728*514+279;
P(423, 7) = 1728*279+276;
P(423, 8) = 1728*276+227;
P(423, 9) = 1728*227+216;
P(424, 0) = 1728*217+218;
P(424, 1) = 1728*218+1711;
P(424, 2) = 1728*1711+1708;
P(424, 3) = 1728*1708+1659;
P(424, 4) = 1728*1659+1658;
P(424, 5) = 1728*1658+1657;
P(424, 6) = 1728*1657+1656;
P(424, 7) = 1728*1656+1661;
P(424, 8) = 1728*1661+1662;
P(424, 9) = 1728*1662+217;
P(425, 0) = 1728*218+219;
P(425, 1) = 1728*219+268;
P(425, 2) = 1728*268+269;
P(425, 3) = 1728*269+264;
P(425, 4) = 1728*264+265;
P(425, 5) = 1728*265+1710;
P(425, 6) = 1728*1710+1709;
P(425, 7) = 1728*1709+1708;
P(425, 8) = 1728*1708+1711;
P(425, 9) = 1728*1711+218;
P(426, 0) = 1728*218+219;
P(426, 1) = 1728*219+268;
P(426, 2) = 1728*268+271;
P(426, 3) = 1728*271+262;
P(426, 4) = 1728*262+261;
P(426, 5) = 1728*261+256;
P(426, 6) = 1728*256+257;
P(426, 7) = 1728*257+1702;
P(426, 8) = 1728*1702+1711;
P(426, 9) = 1728*1711+218;
P(427, 0) = 1728*220+221;
P(427, 1) = 1728*221+222;
P(427, 2) = 1728*222+231;
P(427, 3) = 1728*231+466;
P(427, 4) = 1728*466+467;
P(427, 5) = 1728*467+456;
P(427, 6) = 1728*456+457;
P(427, 7) = 1728*457+458;
P(427, 8) = 1728*458+223;
P(427, 9) = 1728*223+220;
P(428, 0) = 1728*220+221;
P(428, 1) = 1728*221+222;
P(428, 2) = 1728*222+505;
P(428, 3) = 1728*505+504;
P(428, 4) = 1728*504+509;
P(428, 5) = 1728*509+508;
P(428, 6) = 1728*508+459;
P(428, 7) = 1728*459+458;
P(428, 8) = 1728*458+223;
P(428, 9) = 1728*223+220;
P(429, 0) = 1728*222+231;
P(429, 1) = 1728*231+228;
P(429, 2) = 1728*228+229;
P(429, 3) = 1728*229+230;
P(429, 4) = 1728*230+513;
P(429, 5) = 1728*513+514;
P(429, 6) = 1728*514+515;
P(429, 7) = 1728*515+504;
P(429, 8) = 1728*504+505;
P(429, 9) = 1728*505+222;
P(430, 0) = 1728*222+231;
P(430, 1) = 1728*231+466;
P(430, 2) = 1728*466+467;
P(430, 3) = 1728*467+516;
P(430, 4) = 1728*516+519;
P(430, 5) = 1728*519+510;
P(430, 6) = 1728*510+509;
P(430, 7) = 1728*509+504;
P(430, 8) = 1728*504+505;
P(430, 9) = 1728*505+222;
P(431, 0) = 1728*224+225;
P(431, 1) = 1728*225+226;
P(431, 2) = 1728*226+227;
P(431, 3) = 1728*227+276;
P(431, 4) = 1728*276+277;
P(431, 5) = 1728*277+278;
P(431, 6) = 1728*278+287;
P(431, 7) = 1728*287+284;
P(431, 8) = 1728*284+235;
P(431, 9) = 1728*235+224;
P(432, 0) = 1728*224+225;
P(432, 1) = 1728*225+226;
P(432, 2) = 1728*226+227;
P(432, 3) = 1728*227+276;
P(432, 4) = 1728*276+279;
P(432, 5) = 1728*279+514;
P(432, 6) = 1728*514+513;
P(432, 7) = 1728*513+230;
P(432, 8) = 1728*230+229;
P(432, 9) = 1728*229+224;
P(433, 0) = 1728*224+225;
P(433, 1) = 1728*225+226;
P(433, 2) = 1728*226+1719;
P(433, 3) = 1728*1719+1716;
P(433, 4) = 1728*1716+1717;
P(433, 5) = 1728*1717+1718;
P(433, 6) = 1728*1718+1727;
P(433, 7) = 1728*1727+234;
P(433, 8) = 1728*234+235;
P(433, 9) = 1728*235+224;
P(434, 0) = 1728*224+225;
P(434, 1) = 1728*225+1670;
P(434, 2) = 1728*1670+1669;
P(434, 3) = 1728*1669+1664;
P(434, 4) = 1728*1664+1675;
P(434, 5) = 1728*1675+1724;
P(434, 6) = 1728*1724+1727;
P(434, 7) = 1728*1727+234;
P(434, 8) = 1728*234+235;
P(434, 9) = 1728*235+224;
P(435, 0) = 1728*224+225;
P(435, 1) = 1728*225+1670;
P(435, 2) = 1728*1670+1679;
P(435, 3) = 1728*1679+1676;
P(435, 4) = 1728*1676+1677;
P(435, 5) = 1728*1677+1678;
P(435, 6) = 1728*1678+233;
P(435, 7) = 1728*233+234;
P(435, 8) = 1728*234+235;
P(435, 9) = 1728*235+224;
P(436, 0) = 1728*224+229;
P(436, 1) = 1728*229+230;
P(436, 2) = 1728*230+239;
P(436, 3) = 1728*239+236;
P(436, 4) = 1728*236+237;
P(436, 5) = 1728*237+232;
P(436, 6) = 1728*232+233;
P(436, 7) = 1728*233+234;
P(436, 8) = 1728*234+235;
P(436, 9) = 1728*235+224;
P(437, 0) = 1728*224+229;
P(437, 1) = 1728*229+230;
P(437, 2) = 1728*230+513;
P(437, 3) = 1728*513+512;
P(437, 4) = 1728*512+523;
P(437, 5) = 1728*523+522;
P(437, 6) = 1728*522+287;
P(437, 7) = 1728*287+284;
P(437, 8) = 1728*284+235;
P(437, 9) = 1728*235+224;
P(438, 0) = 1728*225+226;
P(438, 1) = 1728*226+1719;
P(438, 2) = 1728*1719+1716;
P(438, 3) = 1728*1716+1667;
P(438, 4) = 1728*1667+1666;
P(438, 5) = 1728*1666+1665;
P(438, 6) = 1728*1665+1664;
P(438, 7) = 1728*1664+1669;
P(438, 8) = 1728*1669+1670;
P(438, 9) = 1728*1670+225;
P(439, 0) = 1728*226+227;
P(439, 1) = 1728*227+276;
P(439, 2) = 1728*276+277;
P(439, 3) = 1728*277+272;
P(439, 4) = 1728*272+273;
P(439, 5) = 1728*273+1718;
P(439, 6) = 1728*1718+1717;
P(439, 7) = 1728*1717+1716;
P(439, 8) = 1728*1716+1719;
P(439, 9) = 1728*1719+226;
P(440, 0) = 1728*226+227;
P(440, 1) = 1728*227+276;
P(440, 2) = 1728*276+279;
P(440, 3) = 1728*279+270;
P(440, 4) = 1728*270+269;
P(440, 5) = 1728*269+264;
P(440, 6) = 1728*264+265;
P(440, 7) = 1728*265+1710;
P(440, 8) = 1728*1710+1719;
P(440, 9) = 1728*1719+226;
P(441, 0) = 1728*228+229;
P(441, 1) = 1728*229+230;
P(441, 2) = 1728*230+239;
P(441, 3) = 1728*239+474;
P(441, 4) = 1728*474+475;
P(441, 5) = 1728*475+464;
P(441, 6) = 1728*464+465;
P(441, 7) = 1728*465+466;
P(441, 8) = 1728*466+231;
P(441, 9) = 1728*231+228;
P(442, 0) = 1728*228+229;
P(442, 1) = 1728*229+230;
P(442, 2) = 1728*230+513;
P(442, 3) = 1728*513+512;
P(442, 4) = 1728*512+517;
P(442, 5) = 1728*517+516;
P(442, 6) = 1728*516+467;
P(442, 7) = 1728*467+466;
P(442, 8) = 1728*466+231;
P(442, 9) = 1728*231+228;
P(443, 0) = 1728*230+239;
P(443, 1) = 1728*239+236;
P(443, 2) = 1728*236+237;
P(443, 3) = 1728*237+238;
P(443, 4) = 1728*238+521;
P(443, 5) = 1728*521+522;
P(443, 6) = 1728*522+523;
P(443, 7) = 1728*523+512;
P(443, 8) = 1728*512+513;
P(443, 9) = 1728*513+230;
P(444, 0) = 1728*230+239;
P(444, 1) = 1728*239+474;
P(444, 2) = 1728*474+475;
P(444, 3) = 1728*475+524;
P(444, 4) = 1728*524+527;
P(444, 5) = 1728*527+518;
P(444, 6) = 1728*518+517;
P(444, 7) = 1728*517+512;
P(444, 8) = 1728*512+513;
P(444, 9) = 1728*513+230;
P(445, 0) = 1728*232+233;
P(445, 1) = 1728*233+234;
P(445, 2) = 1728*234+235;
P(445, 3) = 1728*235+284;
P(445, 4) = 1728*284+287;
P(445, 5) = 1728*287+522;
P(445, 6) = 1728*522+521;
P(445, 7) = 1728*521+238;
P(445, 8) = 1728*238+237;
P(445, 9) = 1728*237+232;
P(446, 0) = 1728*233+234;
P(446, 1) = 1728*234+1727;
P(446, 2) = 1728*1727+1724;
P(446, 3) = 1728*1724+1675;
P(446, 4) = 1728*1675+1674;
P(446, 5) = 1728*1674+1673;
P(446, 6) = 1728*1673+1672;
P(446, 7) = 1728*1672+1677;
P(446, 8) = 1728*1677+1678;
P(446, 9) = 1728*1678+233;
P(447, 0) = 1728*234+235;
P(447, 1) = 1728*235+284;
P(447, 2) = 1728*284+285;
P(447, 3) = 1728*285+280;
P(447, 4) = 1728*280+281;
P(447, 5) = 1728*281+1726;
P(447, 6) = 1728*1726+1725;
P(447, 7) = 1728*1725+1724;
P(447, 8) = 1728*1724+1727;
P(447, 9) = 1728*1727+234;
P(448, 0) = 1728*234+235;
P(448, 1) = 1728*235+284;
P(448, 2) = 1728*284+287;
P(448, 3) = 1728*287+278;
P(448, 4) = 1728*278+277;
P(448, 5) = 1728*277+272;
P(448, 6) = 1728*272+273;
P(448, 7) = 1728*273+1718;
P(448, 8) = 1728*1718+1727;
P(448, 9) = 1728*1727+234;
P(449, 0) = 1728*236+237;
P(449, 1) = 1728*237+238;
P(449, 2) = 1728*238+521;
P(449, 3) = 1728*521+520;
P(449, 4) = 1728*520+525;
P(449, 5) = 1728*525+524;
P(449, 6) = 1728*524+475;
P(449, 7) = 1728*475+474;
P(449, 8) = 1728*474+239;
P(449, 9) = 1728*239+236;
P(450, 0) = 1728*240+241;
P(450, 1) = 1728*241+242;
P(450, 2) = 1728*242+243;
P(450, 3) = 1728*243+280;
P(450, 4) = 1728*280+285;
P(450, 5) = 1728*285+286;
P(450, 6) = 1728*286+247;
P(450, 7) = 1728*247+244;
P(450, 8) = 1728*244+245;
P(450, 9) = 1728*245+240;
P(451, 0) = 1728*240+241;
P(451, 1) = 1728*241+242;
P(451, 2) = 1728*242+1447;
P(451, 3) = 1728*1447+1444;
P(451, 4) = 1728*1444+1445;
P(451, 5) = 1728*1445+1446;
P(451, 6) = 1728*1446+1455;
P(451, 7) = 1728*1455+250;
P(451, 8) = 1728*250+251;
P(451, 9) = 1728*251+240;
P(452, 0) = 1728*240+241;
P(452, 1) = 1728*241+1686;
P(452, 2) = 1728*1686+1685;
P(452, 3) = 1728*1685+1680;
P(452, 4) = 1728*1680+1691;
P(452, 5) = 1728*1691+1452;
P(452, 6) = 1728*1452+1455;
P(452, 7) = 1728*1455+250;
P(452, 8) = 1728*250+251;
P(452, 9) = 1728*251+240;
P(453, 0) = 1728*240+241;
P(453, 1) = 1728*241+1686;
P(453, 2) = 1728*1686+1695;
P(453, 3) = 1728*1695+1692;
P(453, 4) = 1728*1692+1693;
P(453, 5) = 1728*1693+1694;
P(453, 6) = 1728*1694+249;
P(453, 7) = 1728*249+250;
P(453, 8) = 1728*250+251;
P(453, 9) = 1728*251+240;
P(454, 0) = 1728*240+245;
P(454, 1) = 1728*245+246;
P(454, 2) = 1728*246+255;
P(454, 3) = 1728*255+252;
P(454, 4) = 1728*252+253;
P(454, 5) = 1728*253+248;
P(454, 6) = 1728*248+249;
P(454, 7) = 1728*249+250;
P(454, 8) = 1728*250+251;
P(454, 9) = 1728*251+240;
P(455, 0) = 1728*241+242;
P(455, 1) = 1728*242+243;
P(455, 2) = 1728*243+280;
P(455, 3) = 1728*280+281;
P(455, 4) = 1728*281+1726;
P(455, 5) = 1728*1726+1687;
P(455, 6) = 1728*1687+1684;
P(455, 7) = 1728*1684+1685;
P(455, 8) = 1728*1685+1686;
P(455, 9) = 1728*1686+241;
P(456, 0) = 1728*241+242;
P(456, 1) = 1728*242+1447;
P(456, 2) = 1728*1447+1444;
P(456, 3) = 1728*1444+1683;
P(456, 4) = 1728*1683+1682;
P(456, 5) = 1728*1682+1681;
P(456, 6) = 1728*1681+1680;
P(456, 7) = 1728*1680+1685;
P(456, 8) = 1728*1685+1686;
P(456, 9) = 1728*1686+241;
P(457, 0) = 1728*242+243;
P(457, 1) = 1728*243+280;
P(457, 2) = 1728*280+281;
P(457, 3) = 1728*281+282;
P(457, 4) = 1728*282+1487;
P(457, 5) = 1728*1487+1484;
P(457, 6) = 1728*1484+1485;
P(457, 7) = 1728*1485+1486;
P(457, 8) = 1728*1486+1447;
P(457, 9) = 1728*1447+242;
P(458, 0) = 1728*242+243;
P(458, 1) = 1728*243+280;
P(458, 2) = 1728*280+281;
P(458, 3) = 1728*281+1726;
P(458, 4) = 1728*1726+1725;
P(458, 5) = 1728*1725+1720;
P(458, 6) = 1728*1720+1683;
P(458, 7) = 1728*1683+1444;
P(458, 8) = 1728*1444+1447;
P(458, 9) = 1728*1447+242;
P(459, 0) = 1728*244+245;
P(459, 1) = 1728*245+246;
P(459, 2) = 1728*246+255;
P(459, 3) = 1728*255+490;
P(459, 4) = 1728*490+491;
P(459, 5) = 1728*491+480;
P(459, 6) = 1728*480+481;
P(459, 7) = 1728*481+482;
P(459, 8) = 1728*482+247;
P(459, 9) = 1728*247+244;
P(460, 0) = 1728*244+245;
P(460, 1) = 1728*245+246;
P(460, 2) = 1728*246+529;
P(460, 3) = 1728*529+528;
P(460, 4) = 1728*528+533;
P(460, 5) = 1728*533+532;
P(460, 6) = 1728*532+483;
P(460, 7) = 1728*483+482;
P(460, 8) = 1728*482+247;
P(460, 9) = 1728*247+244;
P(461, 0) = 1728*244+245;
P(461, 1) = 1728*245+246;
P(461, 2) = 1728*246+529;
P(461, 3) = 1728*529+530;
P(461, 4) = 1728*530+531;
P(461, 5) = 1728*531+568;
P(461, 6) = 1728*568+569;
P(461, 7) = 1728*569+286;
P(461, 8) = 1728*286+247;
P(461, 9) = 1728*247+244;
P(462, 0) = 1728*246+255;
P(462, 1) = 1728*255+252;
P(462, 2) = 1728*252+253;
P(462, 3) = 1728*253+254;
P(462, 4) = 1728*254+537;
P(462, 5) = 1728*537+538;
P(462, 6) = 1728*538+539;
P(462, 7) = 1728*539+528;
P(462, 8) = 1728*528+529;
P(462, 9) = 1728*529+246;
P(463, 0) = 1728*246+255;
P(463, 1) = 1728*255+490;
P(463, 2) = 1728*490+491;
P(463, 3) = 1728*491+540;
P(463, 4) = 1728*540+543;
P(463, 5) = 1728*543+534;
P(463, 6) = 1728*534+533;
P(463, 7) = 1728*533+528;
P(463, 8) = 1728*528+529;
P(463, 9) = 1728*529+246;
P(464, 0) = 1728*247+286;
P(464, 1) = 1728*286+285;
P(464, 2) = 1728*285+284;
P(464, 3) = 1728*284+287;
P(464, 4) = 1728*287+522;
P(464, 5) = 1728*522+521;
P(464, 6) = 1728*521+520;
P(464, 7) = 1728*520+483;
P(464, 8) = 1728*483+482;
P(464, 9) = 1728*482+247;
P(465, 0) = 1728*247+286;
P(465, 1) = 1728*286+569;
P(465, 2) = 1728*569+568;
P(465, 3) = 1728*568+573;
P(465, 4) = 1728*573+574;
P(465, 5) = 1728*574+535;
P(465, 6) = 1728*535+532;
P(465, 7) = 1728*532+483;
P(465, 8) = 1728*483+482;
P(465, 9) = 1728*482+247;
P(466, 0) = 1728*248+249;
P(466, 1) = 1728*249+250;
P(466, 2) = 1728*250+1455;
P(466, 3) = 1728*1455+1452;
P(466, 4) = 1728*1452+1453;
P(466, 5) = 1728*1453+1454;
P(466, 6) = 1728*1454+1463;
P(466, 7) = 1728*1463+258;
P(466, 8) = 1728*258+259;
P(466, 9) = 1728*259+248;
P(467, 0) = 1728*248+249;
P(467, 1) = 1728*249+1694;
P(467, 2) = 1728*1694+1693;
P(467, 3) = 1728*1693+1688;
P(467, 4) = 1728*1688+1699;
P(467, 5) = 1728*1699+1460;
P(467, 6) = 1728*1460+1463;
P(467, 7) = 1728*1463+258;
P(467, 8) = 1728*258+259;
P(467, 9) = 1728*259+248;
P(468, 0) = 1728*248+249;
P(468, 1) = 1728*249+1694;
P(468, 2) = 1728*1694+1703;
P(468, 3) = 1728*1703+1700;
P(468, 4) = 1728*1700+1701;
P(468, 5) = 1728*1701+1702;
P(468, 6) = 1728*1702+257;
P(468, 7) = 1728*257+258;
P(468, 8) = 1728*258+259;
P(468, 9) = 1728*259+248;
P(469, 0) = 1728*248+253;
P(469, 1) = 1728*253+254;
P(469, 2) = 1728*254+263;
P(469, 3) = 1728*263+260;
P(469, 4) = 1728*260+261;
P(469, 5) = 1728*261+256;
P(469, 6) = 1728*256+257;
P(469, 7) = 1728*257+258;
P(469, 8) = 1728*258+259;
P(469, 9) = 1728*259+248;
P(470, 0) = 1728*249+250;
P(470, 1) = 1728*250+1455;
P(470, 2) = 1728*1455+1452;
P(470, 3) = 1728*1452+1691;
P(470, 4) = 1728*1691+1690;
P(470, 5) = 1728*1690+1689;
P(470, 6) = 1728*1689+1688;
P(470, 7) = 1728*1688+1693;
P(470, 8) = 1728*1693+1694;
P(470, 9) = 1728*1694+249;
P(471, 0) = 1728*252+253;
P(471, 1) = 1728*253+254;
P(471, 2) = 1728*254+263;
P(471, 3) = 1728*263+498;
P(471, 4) = 1728*498+499;
P(471, 5) = 1728*499+488;
P(471, 6) = 1728*488+489;
P(471, 7) = 1728*489+490;
P(471, 8) = 1728*490+255;
P(471, 9) = 1728*255+252;
P(472, 0) = 1728*252+253;
P(472, 1) = 1728*253+254;
P(472, 2) = 1728*254+537;
P(472, 3) = 1728*537+536;
P(472, 4) = 1728*536+541;
P(472, 5) = 1728*541+540;
P(472, 6) = 1728*540+491;
P(472, 7) = 1728*491+490;
P(472, 8) = 1728*490+255;
P(472, 9) = 1728*255+252;
P(473, 0) = 1728*254+263;
P(473, 1) = 1728*263+260;
P(473, 2) = 1728*260+261;
P(473, 3) = 1728*261+262;
P(473, 4) = 1728*262+545;
P(473, 5) = 1728*545+546;
P(473, 6) = 1728*546+547;
P(473, 7) = 1728*547+536;
P(473, 8) = 1728*536+537;
P(473, 9) = 1728*537+254;
P(474, 0) = 1728*254+263;
P(474, 1) = 1728*263+498;
P(474, 2) = 1728*498+499;
P(474, 3) = 1728*499+548;
P(474, 4) = 1728*548+551;
P(474, 5) = 1728*551+542;
P(474, 6) = 1728*542+541;
P(474, 7) = 1728*541+536;
P(474, 8) = 1728*536+537;
P(474, 9) = 1728*537+254;
P(475, 0) = 1728*256+257;
P(475, 1) = 1728*257+258;
P(475, 2) = 1728*258+1463;
P(475, 3) = 1728*1463+1460;
P(475, 4) = 1728*1460+1461;
P(475, 5) = 1728*1461+1462;
P(475, 6) = 1728*1462+1471;
P(475, 7) = 1728*1471+266;
P(475, 8) = 1728*266+267;
P(475, 9) = 1728*267+256;
P(476, 0) = 1728*256+257;
P(476, 1) = 1728*257+1702;
P(476, 2) = 1728*1702+1701;
P(476, 3) = 1728*1701+1696;
P(476, 4) = 1728*1696+1707;
P(476, 5) = 1728*1707+1468;
P(476, 6) = 1728*1468+1471;
P(476, 7) = 1728*1471+266;
P(476, 8) = 1728*266+267;
P(476, 9) = 1728*267+256;
P(477, 0) = 1728*256+257;
P(477, 1) = 1728*257+1702;
P(477, 2) = 1728*1702+1711;
P(477, 3) = 1728*1711+1708;
P(477, 4) = 1728*1708+1709;
P(477, 5) = 1728*1709+1710;
P(477, 6) = 1728*1710+265;
P(477, 7) = 1728*265+266;
P(477, 8) = 1728*266+267;
P(477, 9) = 1728*267+256;
P(478, 0) = 1728*256+261;
P(478, 1) = 1728*261+262;
P(478, 2) = 1728*262+271;
P(478, 3) = 1728*271+268;
P(478, 4) = 1728*268+269;
P(478, 5) = 1728*269+264;
P(478, 6) = 1728*264+265;
P(478, 7) = 1728*265+266;
P(478, 8) = 1728*266+267;
P(478, 9) = 1728*267+256;
P(479, 0) = 1728*257+258;
P(479, 1) = 1728*258+1463;
P(479, 2) = 1728*1463+1460;
P(479, 3) = 1728*1460+1699;
P(479, 4) = 1728*1699+1698;
P(479, 5) = 1728*1698+1697;
P(479, 6) = 1728*1697+1696;
P(479, 7) = 1728*1696+1701;
P(479, 8) = 1728*1701+1702;
P(479, 9) = 1728*1702+257;
P(480, 0) = 1728*260+261;
P(480, 1) = 1728*261+262;
P(480, 2) = 1728*262+271;
P(480, 3) = 1728*271+506;
P(480, 4) = 1728*506+507;
P(480, 5) = 1728*507+496;
P(480, 6) = 1728*496+497;
P(480, 7) = 1728*497+498;
P(480, 8) = 1728*498+263;
P(480, 9) = 1728*263+260;
P(481, 0) = 1728*260+261;
P(481, 1) = 1728*261+262;
P(481, 2) = 1728*262+545;
P(481, 3) = 1728*545+544;
P(481, 4) = 1728*544+549;
P(481, 5) = 1728*549+548;
P(481, 6) = 1728*548+499;
P(481, 7) = 1728*499+498;
P(481, 8) = 1728*498+263;
P(481, 9) = 1728*263+260;
P(482, 0) = 1728*262+271;
P(482, 1) = 1728*271+268;
P(482, 2) = 1728*268+269;
P(482, 3) = 1728*269+270;
P(482, 4) = 1728*270+553;
P(482, 5) = 1728*553+554;
P(482, 6) = 1728*554+555;
P(482, 7) = 1728*555+544;
P(482, 8) = 1728*544+545;
P(482, 9) = 1728*545+262;
P(483, 0) = 1728*262+271;
P(483, 1) = 1728*271+506;
P(483, 2) = 1728*506+507;
P(483, 3) = 1728*507+556;
P(483, 4) = 1728*556+559;
P(483, 5) = 1728*559+550;
P(483, 6) = 1728*550+549;
P(483, 7) = 1728*549+544;
P(483, 8) = 1728*544+545;
P(483, 9) = 1728*545+262;
P(484, 0) = 1728*264+265;
P(484, 1) = 1728*265+266;
P(484, 2) = 1728*266+1471;
P(484, 3) = 1728*1471+1468;
P(484, 4) = 1728*1468+1469;
P(484, 5) = 1728*1469+1470;
P(484, 6) = 1728*1470+1479;
P(484, 7) = 1728*1479+274;
P(484, 8) = 1728*274+275;
P(484, 9) = 1728*275+264;
P(485, 0) = 1728*264+265;
P(485, 1) = 1728*265+1710;
P(485, 2) = 1728*1710+1709;
P(485, 3) = 1728*1709+1704;
P(485, 4) = 1728*1704+1715;
P(485, 5) = 1728*1715+1476;
P(485, 6) = 1728*1476+1479;
P(485, 7) = 1728*1479+274;
P(485, 8) = 1728*274+275;
P(485, 9) = 1728*275+264;
P(486, 0) = 1728*264+265;
P(486, 1) = 1728*265+1710;
P(486, 2) = 1728*1710+1719;
P(486, 3) = 1728*1719+1716;
P(486, 4) = 1728*1716+1717;
P(486, 5) = 1728*1717+1718;
P(486, 6) = 1728*1718+273;
P(486, 7) = 1728*273+274;
P(486, 8) = 1728*274+275;
P(486, 9) = 1728*275+264;
P(487, 0) = 1728*264+269;
P(487, 1) = 1728*269+270;
P(487, 2) = 1728*270+279;
P(487, 3) = 1728*279+276;
P(487, 4) = 1728*276+277;
P(487, 5) = 1728*277+272;
P(487, 6) = 1728*272+273;
P(487, 7) = 1728*273+274;
P(487, 8) = 1728*274+275;
P(487, 9) = 1728*275+264;
P(488, 0) = 1728*265+266;
P(488, 1) = 1728*266+1471;
P(488, 2) = 1728*1471+1468;
P(488, 3) = 1728*1468+1707;
P(488, 4) = 1728*1707+1706;
P(488, 5) = 1728*1706+1705;
P(488, 6) = 1728*1705+1704;
P(488, 7) = 1728*1704+1709;
P(488, 8) = 1728*1709+1710;
P(488, 9) = 1728*1710+265;
P(489, 0) = 1728*268+269;
P(489, 1) = 1728*269+270;
P(489, 2) = 1728*270+279;
P(489, 3) = 1728*279+514;
P(489, 4) = 1728*514+515;
P(489, 5) = 1728*515+504;
P(489, 6) = 1728*504+505;
P(489, 7) = 1728*505+506;
P(489, 8) = 1728*506+271;
P(489, 9) = 1728*271+268;
P(490, 0) = 1728*268+269;
P(490, 1) = 1728*269+270;
P(490, 2) = 1728*270+553;
P(490, 3) = 1728*553+552;
P(490, 4) = 1728*552+557;
P(490, 5) = 1728*557+556;
P(490, 6) = 1728*556+507;
P(490, 7) = 1728*507+506;
P(490, 8) = 1728*506+271;
P(490, 9) = 1728*271+268;
P(491, 0) = 1728*270+279;
P(491, 1) = 1728*279+276;
P(491, 2) = 1728*276+277;
P(491, 3) = 1728*277+278;
P(491, 4) = 1728*278+561;
P(491, 5) = 1728*561+562;
P(491, 6) = 1728*562+563;
P(491, 7) = 1728*563+552;
P(491, 8) = 1728*552+553;
P(491, 9) = 1728*553+270;
P(492, 0) = 1728*270+279;
P(492, 1) = 1728*279+514;
P(492, 2) = 1728*514+515;
P(492, 3) = 1728*515+564;
P(492, 4) = 1728*564+567;
P(492, 5) = 1728*567+558;
P(492, 6) = 1728*558+557;
P(492, 7) = 1728*557+552;
P(492, 8) = 1728*552+553;
P(492, 9) = 1728*553+270;
P(493, 0) = 1728*272+273;
P(493, 1) = 1728*273+274;
P(493, 2) = 1728*274+1479;
P(493, 3) = 1728*1479+1476;
P(493, 4) = 1728*1476+1477;
P(493, 5) = 1728*1477+1478;
P(493, 6) = 1728*1478+1487;
P(493, 7) = 1728*1487+282;
P(493, 8) = 1728*282+283;
P(493, 9) = 1728*283+272;
P(494, 0) = 1728*272+273;
P(494, 1) = 1728*273+1718;
P(494, 2) = 1728*1718+1717;
P(494, 3) = 1728*1717+1712;
P(494, 4) = 1728*1712+1723;
P(494, 5) = 1728*1723+1484;
P(494, 6) = 1728*1484+1487;
P(494, 7) = 1728*1487+282;
P(494, 8) = 1728*282+283;
P(494, 9) = 1728*283+272;
P(495, 0) = 1728*272+273;
P(495, 1) = 1728*273+1718;
P(495, 2) = 1728*1718+1727;
P(495, 3) = 1728*1727+1724;
P(495, 4) = 1728*1724+1725;
P(495, 5) = 1728*1725+1726;
P(495, 6) = 1728*1726+281;
P(495, 7) = 1728*281+282;
P(495, 8) = 1728*282+283;
P(495, 9) = 1728*283+272;
P(496, 0) = 1728*272+277;
P(496, 1) = 1728*277+278;
P(496, 2) = 1728*278+287;
P(496, 3) = 1728*287+284;
P(496, 4) = 1728*284+285;
P(496, 5) = 1728*285+280;
P(496, 6) = 1728*280+281;
P(496, 7) = 1728*281+282;
P(496, 8) = 1728*282+283;
P(496, 9) = 1728*283+272;
P(497, 0) = 1728*273+274;
P(497, 1) = 1728*274+1479;
P(497, 2) = 1728*1479+1476;
P(497, 3) = 1728*1476+1715;
P(497, 4) = 1728*1715+1714;
P(497, 5) = 1728*1714+1713;
P(497, 6) = 1728*1713+1712;
P(497, 7) = 1728*1712+1717;
P(497, 8) = 1728*1717+1718;
P(497, 9) = 1728*1718+273;
P(498, 0) = 1728*276+277;
P(498, 1) = 1728*277+278;
P(498, 2) = 1728*278+287;
P(498, 3) = 1728*287+522;
P(498, 4) = 1728*522+523;
P(498, 5) = 1728*523+512;
P(498, 6) = 1728*512+513;
P(498, 7) = 1728*513+514;
P(498, 8) = 1728*514+279;
P(498, 9) = 1728*279+276;
P(499, 0) = 1728*276+277;
P(499, 1) = 1728*277+278;
P(499, 2) = 1728*278+561;
P(499, 3) = 1728*561+560;
P(499, 4) = 1728*560+565;
P(499, 5) = 1728*565+564;
P(499, 6) = 1728*564+515;
P(499, 7) = 1728*515+514;
P(499, 8) = 1728*514+279;
P(499, 9) = 1728*279+276;
P(500, 0) = 1728*278+287;
P(500, 1) = 1728*287+284;
P(500, 2) = 1728*284+285;
P(500, 3) = 1728*285+286;
P(500, 4) = 1728*286+569;
P(500, 5) = 1728*569+570;
P(500, 6) = 1728*570+571;
P(500, 7) = 1728*571+560;
P(500, 8) = 1728*560+561;
P(500, 9) = 1728*561+278;
P(501, 0) = 1728*278+287;
P(501, 1) = 1728*287+522;
P(501, 2) = 1728*522+523;
P(501, 3) = 1728*523+572;
P(501, 4) = 1728*572+575;
P(501, 5) = 1728*575+566;
P(501, 6) = 1728*566+565;
P(501, 7) = 1728*565+560;
P(501, 8) = 1728*560+561;
P(501, 9) = 1728*561+278;
P(502, 0) = 1728*281+282;
P(502, 1) = 1728*282+1487;
P(502, 2) = 1728*1487+1484;
P(502, 3) = 1728*1484+1723;
P(502, 4) = 1728*1723+1722;
P(502, 5) = 1728*1722+1721;
P(502, 6) = 1728*1721+1720;
P(502, 7) = 1728*1720+1725;
P(502, 8) = 1728*1725+1726;
P(502, 9) = 1728*1726+281;
P(503, 0) = 1728*284+285;
P(503, 1) = 1728*285+286;
P(503, 2) = 1728*286+569;
P(503, 3) = 1728*569+568;
P(503, 4) = 1728*568+573;
P(503, 5) = 1728*573+572;
P(503, 6) = 1728*572+523;
P(503, 7) = 1728*523+522;
P(503, 8) = 1728*522+287;
P(503, 9) = 1728*287+284;
P(504, 0) = 1728*288+289;
P(504, 1) = 1728*289+290;
P(504, 2) = 1728*290+291;
P(504, 3) = 1728*291+340;
P(504, 4) = 1728*340+341;
P(504, 5) = 1728*341+342;
P(504, 6) = 1728*342+351;
P(504, 7) = 1728*351+348;
P(504, 8) = 1728*348+299;
P(504, 9) = 1728*299+288;
P(505, 0) = 1728*288+289;
P(505, 1) = 1728*289+290;
P(505, 2) = 1728*290+291;
P(505, 3) = 1728*291+340;
P(505, 4) = 1728*340+343;
P(505, 5) = 1728*343+578;
P(505, 6) = 1728*578+577;
P(505, 7) = 1728*577+294;
P(505, 8) = 1728*294+293;
P(505, 9) = 1728*293+288;
P(506, 0) = 1728*288+289;
P(506, 1) = 1728*289+290;
P(506, 2) = 1728*290+291;
P(506, 3) = 1728*291+328;
P(506, 4) = 1728*328+333;
P(506, 5) = 1728*333+334;
P(506, 6) = 1728*334+295;
P(506, 7) = 1728*295+292;
P(506, 8) = 1728*292+293;
P(506, 9) = 1728*293+288;
P(507, 0) = 1728*288+293;
P(507, 1) = 1728*293+294;
P(507, 2) = 1728*294+303;
P(507, 3) = 1728*303+300;
P(507, 4) = 1728*300+301;
P(507, 5) = 1728*301+296;
P(507, 6) = 1728*296+297;
P(507, 7) = 1728*297+298;
P(507, 8) = 1728*298+299;
P(507, 9) = 1728*299+288;
P(508, 0) = 1728*288+293;
P(508, 1) = 1728*293+294;
P(508, 2) = 1728*294+577;
P(508, 3) = 1728*577+576;
P(508, 4) = 1728*576+587;
P(508, 5) = 1728*587+586;
P(508, 6) = 1728*586+351;
P(508, 7) = 1728*351+348;
P(508, 8) = 1728*348+299;
P(508, 9) = 1728*299+288;
P(509, 0) = 1728*291+340;
P(509, 1) = 1728*340+343;
P(509, 2) = 1728*343+382;
P(509, 3) = 1728*382+381;
P(509, 4) = 1728*381+380;
P(509, 5) = 1728*380+331;
P(509, 6) = 1728*331+330;
P(509, 7) = 1728*330+329;
P(509, 8) = 1728*329+328;
P(509, 9) = 1728*328+291;
P(510, 0) = 1728*291+340;
P(510, 1) = 1728*340+343;
P(510, 2) = 1728*343+578;
P(510, 3) = 1728*578+579;
P(510, 4) = 1728*579+616;
P(510, 5) = 1728*616+617;
P(510, 6) = 1728*617+334;
P(510, 7) = 1728*334+333;
P(510, 8) = 1728*333+328;
P(510, 9) = 1728*328+291;
P(511, 0) = 1728*292+293;
P(511, 1) = 1728*293+294;
P(511, 2) = 1728*294+303;
P(511, 3) = 1728*303+300;
P(511, 4) = 1728*300+539;
P(511, 5) = 1728*539+528;
P(511, 6) = 1728*528+529;
P(511, 7) = 1728*529+530;
P(511, 8) = 1728*530+531;
P(511, 9) = 1728*531+292;
P(512, 0) = 1728*292+293;
P(512, 1) = 1728*293+294;
P(512, 2) = 1728*294+303;
P(512, 3) = 1728*303+826;
P(512, 4) = 1728*826+827;
P(512, 5) = 1728*827+816;
P(512, 6) = 1728*816+817;
P(512, 7) = 1728*817+818;
P(512, 8) = 1728*818+295;
P(512, 9) = 1728*295+292;
P(513, 0) = 1728*292+293;
P(513, 1) = 1728*293+294;
P(513, 2) = 1728*294+577;
P(513, 3) = 1728*577+576;
P(513, 4) = 1728*576+581;
P(513, 5) = 1728*581+580;
P(513, 6) = 1728*580+819;
P(513, 7) = 1728*819+818;
P(513, 8) = 1728*818+295;
P(513, 9) = 1728*295+292;
P(514, 0) = 1728*292+293;
P(514, 1) = 1728*293+294;
P(514, 2) = 1728*294+577;
P(514, 3) = 1728*577+578;
P(514, 4) = 1728*578+579;
P(514, 5) = 1728*579+616;
P(514, 6) = 1728*616+617;
P(514, 7) = 1728*617+334;
P(514, 8) = 1728*334+295;
P(514, 9) = 1728*295+292;
P(515, 0) = 1728*292+531;
P(515, 1) = 1728*531+530;
P(515, 2) = 1728*530+529;
P(515, 3) = 1728*529+528;
P(515, 4) = 1728*528+533;
P(515, 5) = 1728*533+534;
P(515, 6) = 1728*534+817;
P(515, 7) = 1728*817+818;
P(515, 8) = 1728*818+295;
P(515, 9) = 1728*295+292;
P(516, 0) = 1728*292+531;
P(516, 1) = 1728*531+568;
P(516, 2) = 1728*568+569;
P(516, 3) = 1728*569+570;
P(516, 4) = 1728*570+571;
P(516, 5) = 1728*571+332;
P(516, 6) = 1728*332+333;
P(516, 7) = 1728*333+334;
P(516, 8) = 1728*334+295;
P(516, 9) = 1728*295+292;
P(517, 0) = 1728*292+531;
P(517, 1) = 1728*531+568;
P(517, 2) = 1728*568+573;
P(517, 3) = 1728*573+574;
P(517, 4) = 1728*574+857;
P(517, 5) = 1728*857+856;
P(517, 6) = 1728*856+819;
P(517, 7) = 1728*819+818;
P(517, 8) = 1728*818+295;
P(517, 9) = 1728*295+292;
P(518, 0) = 1728*294+303;
P(518, 1) = 1728*303+300;
P(518, 2) = 1728*300+301;
P(518, 3) = 1728*301+302;
P(518, 4) = 1728*302+585;
P(518, 5) = 1728*585+586;
P(518, 6) = 1728*586+587;
P(518, 7) = 1728*587+576;
P(518, 8) = 1728*576+577;
P(518, 9) = 1728*577+294;
P(519, 0) = 1728*294+303;
P(519, 1) = 1728*303+826;
P(519, 2) = 1728*826+827;
P(519, 3) = 1728*827+588;
P(519, 4) = 1728*588+591;
P(519, 5) = 1728*591+582;
P(519, 6) = 1728*582+581;
P(519, 7) = 1728*581+576;
P(519, 8) = 1728*576+577;
P(519, 9) = 1728*577+294;
P(520, 0) = 1728*295+334;
P(520, 1) = 1728*334+333;
P(520, 2) = 1728*333+332;
P(520, 3) = 1728*332+335;
P(520, 4) = 1728*335+858;
P(520, 5) = 1728*858+857;
P(520, 6) = 1728*857+856;
P(520, 7) = 1728*856+819;
P(520, 8) = 1728*819+818;
P(520, 9) = 1728*818+295;
P(521, 0) = 1728*295+334;
P(521, 1) = 1728*334+617;
P(521, 2) = 1728*617+616;
P(521, 3) = 1728*616+621;
P(521, 4) = 1728*621+622;
P(521, 5) = 1728*622+583;
P(521, 6) = 1728*583+580;
P(521, 7) = 1728*580+819;
P(521, 8) = 1728*819+818;
P(521, 9) = 1728*818+295;
P(522, 0) = 1728*296+297;
P(522, 1) = 1728*297+298;
P(522, 2) = 1728*298+299;
P(522, 3) = 1728*299+348;
P(522, 4) = 1728*348+349;
P(522, 5) = 1728*349+350;
P(522, 6) = 1728*350+359;
P(522, 7) = 1728*359+356;
P(522, 8) = 1728*356+307;
P(522, 9) = 1728*307+296;
P(523, 0) = 1728*296+297;
P(523, 1) = 1728*297+298;
P(523, 2) = 1728*298+299;
P(523, 3) = 1728*299+348;
P(523, 4) = 1728*348+351;
P(523, 5) = 1728*351+586;
P(523, 6) = 1728*586+585;
P(523, 7) = 1728*585+302;
P(523, 8) = 1728*302+301;
P(523, 9) = 1728*301+296;
P(524, 0) = 1728*296+301;
P(524, 1) = 1728*301+302;
P(524, 2) = 1728*302+311;
P(524, 3) = 1728*311+308;
P(524, 4) = 1728*308+309;
P(524, 5) = 1728*309+304;
P(524, 6) = 1728*304+305;
P(524, 7) = 1728*305+306;
P(524, 8) = 1728*306+307;
P(524, 9) = 1728*307+296;
P(525, 0) = 1728*296+301;
P(525, 1) = 1728*301+302;
P(525, 2) = 1728*302+585;
P(525, 3) = 1728*585+584;
P(525, 4) = 1728*584+595;
P(525, 5) = 1728*595+594;
P(525, 6) = 1728*594+359;
P(525, 7) = 1728*359+356;
P(525, 8) = 1728*356+307;
P(525, 9) = 1728*307+296;
P(526, 0) = 1728*300+301;
P(526, 1) = 1728*301+302;
P(526, 2) = 1728*302+311;
P(526, 3) = 1728*311+308;
P(526, 4) = 1728*308+547;
P(526, 5) = 1728*547+536;
P(526, 6) = 1728*536+537;
P(526, 7) = 1728*537+538;
P(526, 8) = 1728*538+539;
P(526, 9) = 1728*539+300;
P(527, 0) = 1728*300+301;
P(527, 1) = 1728*301+302;
P(527, 2) = 1728*302+311;
P(527, 3) = 1728*311+834;
P(527, 4) = 1728*834+835;
P(527, 5) = 1728*835+824;
P(527, 6) = 1728*824+825;
P(527, 7) = 1728*825+826;
P(527, 8) = 1728*826+303;
P(527, 9) = 1728*303+300;
P(528, 0) = 1728*300+301;
P(528, 1) = 1728*301+302;
P(528, 2) = 1728*302+585;
P(528, 3) = 1728*585+584;
P(528, 4) = 1728*584+589;
P(528, 5) = 1728*589+588;
P(528, 6) = 1728*588+827;
P(528, 7) = 1728*827+826;
P(528, 8) = 1728*826+303;
P(528, 9) = 1728*303+300;
P(529, 0) = 1728*300+539;
P(529, 1) = 1728*539+538;
P(529, 2) = 1728*538+537;
P(529, 3) = 1728*537+536;
P(529, 4) = 1728*536+541;
P(529, 5) = 1728*541+542;
P(529, 6) = 1728*542+825;
P(529, 7) = 1728*825+826;
P(529, 8) = 1728*826+303;
P(529, 9) = 1728*303+300;
P(530, 0) = 1728*300+539;
P(530, 1) = 1728*539+528;
P(530, 2) = 1728*528+533;
P(530, 3) = 1728*533+534;
P(530, 4) = 1728*534+817;
P(530, 5) = 1728*817+816;
P(530, 6) = 1728*816+827;
P(530, 7) = 1728*827+826;
P(530, 8) = 1728*826+303;
P(530, 9) = 1728*303+300;
P(531, 0) = 1728*302+311;
P(531, 1) = 1728*311+308;
P(531, 2) = 1728*308+309;
P(531, 3) = 1728*309+310;
P(531, 4) = 1728*310+593;
P(531, 5) = 1728*593+594;
P(531, 6) = 1728*594+595;
P(531, 7) = 1728*595+584;
P(531, 8) = 1728*584+585;
P(531, 9) = 1728*585+302;
P(532, 0) = 1728*302+311;
P(532, 1) = 1728*311+834;
P(532, 2) = 1728*834+835;
P(532, 3) = 1728*835+596;
P(532, 4) = 1728*596+599;
P(532, 5) = 1728*599+590;
P(532, 6) = 1728*590+589;
P(532, 7) = 1728*589+584;
P(532, 8) = 1728*584+585;
P(532, 9) = 1728*585+302;
P(533, 0) = 1728*304+305;
P(533, 1) = 1728*305+306;
P(533, 2) = 1728*306+307;
P(533, 3) = 1728*307+356;
P(533, 4) = 1728*356+357;
P(533, 5) = 1728*357+358;
P(533, 6) = 1728*358+367;
P(533, 7) = 1728*367+364;
P(533, 8) = 1728*364+315;
P(533, 9) = 1728*315+304;
P(534, 0) = 1728*304+305;
P(534, 1) = 1728*305+306;
P(534, 2) = 1728*306+307;
P(534, 3) = 1728*307+356;
P(534, 4) = 1728*356+359;
P(534, 5) = 1728*359+594;
P(534, 6) = 1728*594+593;
P(534, 7) = 1728*593+310;
P(534, 8) = 1728*310+309;
P(534, 9) = 1728*309+304;
P(535, 0) = 1728*304+309;
P(535, 1) = 1728*309+310;
P(535, 2) = 1728*310+319;
P(535, 3) = 1728*319+316;
P(535, 4) = 1728*316+317;
P(535, 5) = 1728*317+312;
P(535, 6) = 1728*312+313;
P(535, 7) = 1728*313+314;
P(535, 8) = 1728*314+315;
P(535, 9) = 1728*315+304;
P(536, 0) = 1728*304+309;
P(536, 1) = 1728*309+310;
P(536, 2) = 1728*310+593;
P(536, 3) = 1728*593+592;
P(536, 4) = 1728*592+603;
P(536, 5) = 1728*603+602;
P(536, 6) = 1728*602+367;
P(536, 7) = 1728*367+364;
P(536, 8) = 1728*364+315;
P(536, 9) = 1728*315+304;
P(537, 0) = 1728*308+309;
P(537, 1) = 1728*309+310;
P(537, 2) = 1728*310+319;
P(537, 3) = 1728*319+316;
P(537, 4) = 1728*316+555;
P(537, 5) = 1728*555+544;
P(537, 6) = 1728*544+545;
P(537, 7) = 1728*545+546;
P(537, 8) = 1728*546+547;
P(537, 9) = 1728*547+308;
P(538, 0) = 1728*308+309;
P(538, 1) = 1728*309+310;
P(538, 2) = 1728*310+319;
P(538, 3) = 1728*319+842;
P(538, 4) = 1728*842+843;
P(538, 5) = 1728*843+832;
P(538, 6) = 1728*832+833;
P(538, 7) = 1728*833+834;
P(538, 8) = 1728*834+311;
P(538, 9) = 1728*311+308;
P(539, 0) = 1728*308+309;
P(539, 1) = 1728*309+310;
P(539, 2) = 1728*310+593;
P(539, 3) = 1728*593+592;
P(539, 4) = 1728*592+597;
P(539, 5) = 1728*597+596;
P(539, 6) = 1728*596+835;
P(539, 7) = 1728*835+834;
P(539, 8) = 1728*834+311;
P(539, 9) = 1728*311+308;
P(540, 0) = 1728*308+547;
P(540, 1) = 1728*547+546;
P(540, 2) = 1728*546+545;
P(540, 3) = 1728*545+544;
P(540, 4) = 1728*544+549;
P(540, 5) = 1728*549+550;
P(540, 6) = 1728*550+833;
P(540, 7) = 1728*833+834;
P(540, 8) = 1728*834+311;
P(540, 9) = 1728*311+308;
P(541, 0) = 1728*308+547;
P(541, 1) = 1728*547+536;
P(541, 2) = 1728*536+541;
P(541, 3) = 1728*541+542;
P(541, 4) = 1728*542+825;
P(541, 5) = 1728*825+824;
P(541, 6) = 1728*824+835;
P(541, 7) = 1728*835+834;
P(541, 8) = 1728*834+311;
P(541, 9) = 1728*311+308;
P(542, 0) = 1728*310+319;
P(542, 1) = 1728*319+316;
P(542, 2) = 1728*316+317;
P(542, 3) = 1728*317+318;
P(542, 4) = 1728*318+601;
P(542, 5) = 1728*601+602;
P(542, 6) = 1728*602+603;
P(542, 7) = 1728*603+592;
P(542, 8) = 1728*592+593;
P(542, 9) = 1728*593+310;
P(543, 0) = 1728*310+319;
P(543, 1) = 1728*319+842;
P(543, 2) = 1728*842+843;
P(543, 3) = 1728*843+604;
P(543, 4) = 1728*604+607;
P(543, 5) = 1728*607+598;
P(543, 6) = 1728*598+597;
P(543, 7) = 1728*597+592;
P(543, 8) = 1728*592+593;
P(543, 9) = 1728*593+310;
P(544, 0) = 1728*312+313;
P(544, 1) = 1728*313+314;
P(544, 2) = 1728*314+315;
P(544, 3) = 1728*315+364;
P(544, 4) = 1728*364+365;
P(544, 5) = 1728*365+366;
P(544, 6) = 1728*366+375;
P(544, 7) = 1728*375+372;
P(544, 8) = 1728*372+323;
P(544, 9) = 1728*323+312;
P(545, 0) = 1728*312+313;
P(545, 1) = 1728*313+314;
P(545, 2) = 1728*314+315;
P(545, 3) = 1728*315+364;
P(545, 4) = 1728*364+367;
P(545, 5) = 1728*367+602;
P(545, 6) = 1728*602+601;
P(545, 7) = 1728*601+318;
P(545, 8) = 1728*318+317;
P(545, 9) = 1728*317+312;
P(546, 0) = 1728*312+317;
P(546, 1) = 1728*317+318;
P(546, 2) = 1728*318+327;
P(546, 3) = 1728*327+324;
P(546, 4) = 1728*324+325;
P(546, 5) = 1728*325+320;
P(546, 6) = 1728*320+321;
P(546, 7) = 1728*321+322;
P(546, 8) = 1728*322+323;
P(546, 9) = 1728*323+312;
P(547, 0) = 1728*312+317;
P(547, 1) = 1728*317+318;
P(547, 2) = 1728*318+601;
P(547, 3) = 1728*601+600;
P(547, 4) = 1728*600+611;
P(547, 5) = 1728*611+610;
P(547, 6) = 1728*610+375;
P(547, 7) = 1728*375+372;
P(547, 8) = 1728*372+323;
P(547, 9) = 1728*323+312;
P(548, 0) = 1728*316+317;
P(548, 1) = 1728*317+318;
P(548, 2) = 1728*318+327;
P(548, 3) = 1728*327+324;
P(548, 4) = 1728*324+563;
P(548, 5) = 1728*563+552;
P(548, 6) = 1728*552+553;
P(548, 7) = 1728*553+554;
P(548, 8) = 1728*554+555;
P(548, 9) = 1728*555+316;
P(549, 0) = 1728*316+317;
P(549, 1) = 1728*317+318;
P(549, 2) = 1728*318+327;
P(549, 3) = 1728*327+850;
P(549, 4) = 1728*850+851;
P(549, 5) = 1728*851+840;
P(549, 6) = 1728*840+841;
P(549, 7) = 1728*841+842;
P(549, 8) = 1728*842+319;
P(549, 9) = 1728*319+316;
P(550, 0) = 1728*316+317;
P(550, 1) = 1728*317+318;
P(550, 2) = 1728*318+601;
P(550, 3) = 1728*601+600;
P(550, 4) = 1728*600+605;
P(550, 5) = 1728*605+604;
P(550, 6) = 1728*604+843;
P(550, 7) = 1728*843+842;
P(550, 8) = 1728*842+319;
P(550, 9) = 1728*319+316;
P(551, 0) = 1728*316+555;
P(551, 1) = 1728*555+554;
P(551, 2) = 1728*554+553;
P(551, 3) = 1728*553+552;
P(551, 4) = 1728*552+557;
P(551, 5) = 1728*557+558;
P(551, 6) = 1728*558+841;
P(551, 7) = 1728*841+842;
P(551, 8) = 1728*842+319;
P(551, 9) = 1728*319+316;
P(552, 0) = 1728*316+555;
P(552, 1) = 1728*555+544;
P(552, 2) = 1728*544+549;
P(552, 3) = 1728*549+550;
P(552, 4) = 1728*550+833;
P(552, 5) = 1728*833+832;
P(552, 6) = 1728*832+843;
P(552, 7) = 1728*843+842;
P(552, 8) = 1728*842+319;
P(552, 9) = 1728*319+316;
P(553, 0) = 1728*318+327;
P(553, 1) = 1728*327+324;
P(553, 2) = 1728*324+325;
P(553, 3) = 1728*325+326;
P(553, 4) = 1728*326+609;
P(553, 5) = 1728*609+610;
P(553, 6) = 1728*610+611;
P(553, 7) = 1728*611+600;
P(553, 8) = 1728*600+601;
P(553, 9) = 1728*601+318;
P(554, 0) = 1728*318+327;
P(554, 1) = 1728*327+850;
P(554, 2) = 1728*850+851;
P(554, 3) = 1728*851+612;
P(554, 4) = 1728*612+615;
P(554, 5) = 1728*615+606;
P(554, 6) = 1728*606+605;
P(554, 7) = 1728*605+600;
P(554, 8) = 1728*600+601;
P(554, 9) = 1728*601+318;
P(555, 0) = 1728*320+321;
P(555, 1) = 1728*321+322;
P(555, 2) = 1728*322+323;
P(555, 3) = 1728*323+372;
P(555, 4) = 1728*372+373;
P(555, 5) = 1728*373+374;
P(555, 6) = 1728*374+383;
P(555, 7) = 1728*383+380;
P(555, 8) = 1728*380+331;
P(555, 9) = 1728*331+320;
P(556, 0) = 1728*320+321;
P(556, 1) = 1728*321+322;
P(556, 2) = 1728*322+323;
P(556, 3) = 1728*323+372;
P(556, 4) = 1728*372+375;
P(556, 5) = 1728*375+610;
P(556, 6) = 1728*610+609;
P(556, 7) = 1728*609+326;
P(556, 8) = 1728*326+325;
P(556, 9) = 1728*325+320;
P(557, 0) = 1728*320+325;
P(557, 1) = 1728*325+326;
P(557, 2) = 1728*326+335;
P(557, 3) = 1728*335+332;
P(557, 4) = 1728*332+333;
P(557, 5) = 1728*333+328;
P(557, 6) = 1728*328+329;
P(557, 7) = 1728*329+330;
P(557, 8) = 1728*330+331;
P(557, 9) = 1728*331+320;
P(558, 0) = 1728*320+325;
P(558, 1) = 1728*325+326;
P(558, 2) = 1728*326+609;
P(558, 3) = 1728*609+608;
P(558, 4) = 1728*608+619;
P(558, 5) = 1728*619+618;
P(558, 6) = 1728*618+383;
P(558, 7) = 1728*383+380;
P(558, 8) = 1728*380+331;
P(558, 9) = 1728*331+320;
P(559, 0) = 1728*324+325;
P(559, 1) = 1728*325+326;
P(559, 2) = 1728*326+335;
P(559, 3) = 1728*335+332;
P(559, 4) = 1728*332+571;
P(559, 5) = 1728*571+560;
P(559, 6) = 1728*560+561;
P(559, 7) = 1728*561+562;
P(559, 8) = 1728*562+563;
P(559, 9) = 1728*563+324;
P(560, 0) = 1728*324+325;
P(560, 1) = 1728*325+326;
P(560, 2) = 1728*326+335;
P(560, 3) = 1728*335+858;
P(560, 4) = 1728*858+859;
P(560, 5) = 1728*859+848;
P(560, 6) = 1728*848+849;
P(560, 7) = 1728*849+850;
P(560, 8) = 1728*850+327;
P(560, 9) = 1728*327+324;
P(561, 0) = 1728*324+325;
P(561, 1) = 1728*325+326;
P(561, 2) = 1728*326+609;
P(561, 3) = 1728*609+608;
P(561, 4) = 1728*608+613;
P(561, 5) = 1728*613+612;
P(561, 6) = 1728*612+851;
P(561, 7) = 1728*851+850;
P(561, 8) = 1728*850+327;
P(561, 9) = 1728*327+324;
P(562, 0) = 1728*324+563;
P(562, 1) = 1728*563+562;
P(562, 2) = 1728*562+561;
P(562, 3) = 1728*561+560;
P(562, 4) = 1728*560+565;
P(562, 5) = 1728*565+566;
P(562, 6) = 1728*566+849;
P(562, 7) = 1728*849+850;
P(562, 8) = 1728*850+327;
P(562, 9) = 1728*327+324;
P(563, 0) = 1728*324+563;
P(563, 1) = 1728*563+552;
P(563, 2) = 1728*552+557;
P(563, 3) = 1728*557+558;
P(563, 4) = 1728*558+841;
P(563, 5) = 1728*841+840;
P(563, 6) = 1728*840+851;
P(563, 7) = 1728*851+850;
P(563, 8) = 1728*850+327;
P(563, 9) = 1728*327+324;
P(564, 0) = 1728*326+335;
P(564, 1) = 1728*335+332;
P(564, 2) = 1728*332+333;
P(564, 3) = 1728*333+334;
P(564, 4) = 1728*334+617;
P(564, 5) = 1728*617+618;
P(564, 6) = 1728*618+619;
P(564, 7) = 1728*619+608;
P(564, 8) = 1728*608+609;
P(564, 9) = 1728*609+326;
P(565, 0) = 1728*326+335;
P(565, 1) = 1728*335+858;
P(565, 2) = 1728*858+859;
P(565, 3) = 1728*859+620;
P(565, 4) = 1728*620+623;
P(565, 5) = 1728*623+614;
P(565, 6) = 1728*614+613;
P(565, 7) = 1728*613+608;
P(565, 8) = 1728*608+609;
P(565, 9) = 1728*609+326;
P(566, 0) = 1728*328+329;
P(566, 1) = 1728*329+330;
P(566, 2) = 1728*330+331;
P(566, 3) = 1728*331+380;
P(566, 4) = 1728*380+383;
P(566, 5) = 1728*383+618;
P(566, 6) = 1728*618+617;
P(566, 7) = 1728*617+334;
P(566, 8) = 1728*334+333;
P(566, 9) = 1728*333+328;
P(567, 0) = 1728*332+333;
P(567, 1) = 1728*333+334;
P(567, 2) = 1728*334+617;
P(567, 3) = 1728*617+616;
P(567, 4) = 1728*616+621;
P(567, 5) = 1728*621+620;
P(567, 6) = 1728*620+859;
P(567, 7) = 1728*859+858;
P(567, 8) = 1728*858+335;
P(567, 9) = 1728*335+332;
P(568, 0) = 1728*332+571;
P(568, 1) = 1728*571+570;
P(568, 2) = 1728*570+569;
P(568, 3) = 1728*569+568;
P(568, 4) = 1728*568+573;
P(568, 5) = 1728*573+574;
P(568, 6) = 1728*574+857;
P(568, 7) = 1728*857+858;
P(568, 8) = 1728*858+335;
P(568, 9) = 1728*335+332;
P(569, 0) = 1728*332+571;
P(569, 1) = 1728*571+560;
P(569, 2) = 1728*560+565;
P(569, 3) = 1728*565+566;
P(569, 4) = 1728*566+849;
P(569, 5) = 1728*849+848;
P(569, 6) = 1728*848+859;
P(569, 7) = 1728*859+858;
P(569, 8) = 1728*858+335;
P(569, 9) = 1728*335+332;
P(570, 0) = 1728*336+337;
P(570, 1) = 1728*337+338;
P(570, 2) = 1728*338+339;
P(570, 3) = 1728*339+388;
P(570, 4) = 1728*388+389;
P(570, 5) = 1728*389+390;
P(570, 6) = 1728*390+399;
P(570, 7) = 1728*399+396;
P(570, 8) = 1728*396+347;
P(570, 9) = 1728*347+336;
P(571, 0) = 1728*336+337;
P(571, 1) = 1728*337+338;
P(571, 2) = 1728*338+339;
P(571, 3) = 1728*339+388;
P(571, 4) = 1728*388+391;
P(571, 5) = 1728*391+626;
P(571, 6) = 1728*626+625;
P(571, 7) = 1728*625+342;
P(571, 8) = 1728*342+341;
P(571, 9) = 1728*341+336;
P(572, 0) = 1728*336+337;
P(572, 1) = 1728*337+338;
P(572, 2) = 1728*338+339;
P(572, 3) = 1728*339+376;
P(572, 4) = 1728*376+381;
P(572, 5) = 1728*381+382;
P(572, 6) = 1728*382+343;
P(572, 7) = 1728*343+340;
P(572, 8) = 1728*340+341;
P(572, 9) = 1728*341+336;
P(573, 0) = 1728*336+341;
P(573, 1) = 1728*341+342;
P(573, 2) = 1728*342+351;
P(573, 3) = 1728*351+348;
P(573, 4) = 1728*348+349;
P(573, 5) = 1728*349+344;
P(573, 6) = 1728*344+345;
P(573, 7) = 1728*345+346;
P(573, 8) = 1728*346+347;
P(573, 9) = 1728*347+336;
P(574, 0) = 1728*336+341;
P(574, 1) = 1728*341+342;
P(574, 2) = 1728*342+625;
P(574, 3) = 1728*625+624;
P(574, 4) = 1728*624+635;
P(574, 5) = 1728*635+634;
P(574, 6) = 1728*634+399;
P(574, 7) = 1728*399+396;
P(574, 8) = 1728*396+347;
P(574, 9) = 1728*347+336;
P(575, 0) = 1728*339+388;
P(575, 1) = 1728*388+391;
P(575, 2) = 1728*391+430;
P(575, 3) = 1728*430+429;
P(575, 4) = 1728*429+428;
P(575, 5) = 1728*428+379;
P(575, 6) = 1728*379+378;
P(575, 7) = 1728*378+377;
P(575, 8) = 1728*377+376;
P(575, 9) = 1728*376+339;
P(576, 0) = 1728*339+388;
P(576, 1) = 1728*388+391;
P(576, 2) = 1728*391+626;
P(576, 3) = 1728*626+627;
P(576, 4) = 1728*627+664;
P(576, 5) = 1728*664+665;
P(576, 6) = 1728*665+382;
P(576, 7) = 1728*382+381;
P(576, 8) = 1728*381+376;
P(576, 9) = 1728*376+339;
P(577, 0) = 1728*340+341;
P(577, 1) = 1728*341+342;
P(577, 2) = 1728*342+351;
P(577, 3) = 1728*351+586;
P(577, 4) = 1728*586+587;
P(577, 5) = 1728*587+576;
P(577, 6) = 1728*576+577;
P(577, 7) = 1728*577+578;
P(577, 8) = 1728*578+343;
P(577, 9) = 1728*343+340;
P(578, 0) = 1728*340+341;
P(578, 1) = 1728*341+342;
P(578, 2) = 1728*342+625;
P(578, 3) = 1728*625+624;
P(578, 4) = 1728*624+629;
P(578, 5) = 1728*629+628;
P(578, 6) = 1728*628+579;
P(578, 7) = 1728*579+578;
P(578, 8) = 1728*578+343;
P(578, 9) = 1728*343+340;
P(579, 0) = 1728*340+341;
P(579, 1) = 1728*341+342;
P(579, 2) = 1728*342+625;
P(579, 3) = 1728*625+626;
P(579, 4) = 1728*626+627;
P(579, 5) = 1728*627+664;
P(579, 6) = 1728*664+665;
P(579, 7) = 1728*665+382;
P(579, 8) = 1728*382+343;
P(579, 9) = 1728*343+340;
P(580, 0) = 1728*342+351;
P(580, 1) = 1728*351+348;
P(580, 2) = 1728*348+349;
P(580, 3) = 1728*349+350;
P(580, 4) = 1728*350+633;
P(580, 5) = 1728*633+634;
P(580, 6) = 1728*634+635;
P(580, 7) = 1728*635+624;
P(580, 8) = 1728*624+625;
P(580, 9) = 1728*625+342;
P(581, 0) = 1728*342+351;
P(581, 1) = 1728*351+586;
P(581, 2) = 1728*586+587;
P(581, 3) = 1728*587+636;
P(581, 4) = 1728*636+639;
P(581, 5) = 1728*639+630;
P(581, 6) = 1728*630+629;
P(581, 7) = 1728*629+624;
P(581, 8) = 1728*624+625;
P(581, 9) = 1728*625+342;
P(582, 0) = 1728*343+382;
P(582, 1) = 1728*382+381;
P(582, 2) = 1728*381+380;
P(582, 3) = 1728*380+383;
P(582, 4) = 1728*383+618;
P(582, 5) = 1728*618+617;
P(582, 6) = 1728*617+616;
P(582, 7) = 1728*616+579;
P(582, 8) = 1728*579+578;
P(582, 9) = 1728*578+343;
P(583, 0) = 1728*343+382;
P(583, 1) = 1728*382+665;
P(583, 2) = 1728*665+664;
P(583, 3) = 1728*664+669;
P(583, 4) = 1728*669+670;
P(583, 5) = 1728*670+631;
P(583, 6) = 1728*631+628;
P(583, 7) = 1728*628+579;
P(583, 8) = 1728*579+578;
P(583, 9) = 1728*578+343;
P(584, 0) = 1728*344+345;
P(584, 1) = 1728*345+346;
P(584, 2) = 1728*346+347;
P(584, 3) = 1728*347+396;
P(584, 4) = 1728*396+397;
P(584, 5) = 1728*397+398;
P(584, 6) = 1728*398+407;
P(584, 7) = 1728*407+404;
P(584, 8) = 1728*404+355;
P(584, 9) = 1728*355+344;
P(585, 0) = 1728*344+345;
P(585, 1) = 1728*345+346;
P(585, 2) = 1728*346+347;
P(585, 3) = 1728*347+396;
P(585, 4) = 1728*396+399;
P(585, 5) = 1728*399+634;
P(585, 6) = 1728*634+633;
P(585, 7) = 1728*633+350;
P(585, 8) = 1728*350+349;
P(585, 9) = 1728*349+344;
P(586, 0) = 1728*344+349;
P(586, 1) = 1728*349+350;
P(586, 2) = 1728*350+359;
P(586, 3) = 1728*359+356;
P(586, 4) = 1728*356+357;
P(586, 5) = 1728*357+352;
P(586, 6) = 1728*352+353;
P(586, 7) = 1728*353+354;
P(586, 8) = 1728*354+355;
P(586, 9) = 1728*355+344;
P(587, 0) = 1728*344+349;
P(587, 1) = 1728*349+350;
P(587, 2) = 1728*350+633;
P(587, 3) = 1728*633+632;
P(587, 4) = 1728*632+643;
P(587, 5) = 1728*643+642;
P(587, 6) = 1728*642+407;
P(587, 7) = 1728*407+404;
P(587, 8) = 1728*404+355;
P(587, 9) = 1728*355+344;
P(588, 0) = 1728*348+349;
P(588, 1) = 1728*349+350;
P(588, 2) = 1728*350+359;
P(588, 3) = 1728*359+594;
P(588, 4) = 1728*594+595;
P(588, 5) = 1728*595+584;
P(588, 6) = 1728*584+585;
P(588, 7) = 1728*585+586;
P(588, 8) = 1728*586+351;
P(588, 9) = 1728*351+348;
P(589, 0) = 1728*348+349;
P(589, 1) = 1728*349+350;
P(589, 2) = 1728*350+633;
P(589, 3) = 1728*633+632;
P(589, 4) = 1728*632+637;
P(589, 5) = 1728*637+636;
P(589, 6) = 1728*636+587;
P(589, 7) = 1728*587+586;
P(589, 8) = 1728*586+351;
P(589, 9) = 1728*351+348;
P(590, 0) = 1728*350+359;
P(590, 1) = 1728*359+356;
P(590, 2) = 1728*356+357;
P(590, 3) = 1728*357+358;
P(590, 4) = 1728*358+641;
P(590, 5) = 1728*641+642;
P(590, 6) = 1728*642+643;
P(590, 7) = 1728*643+632;
P(590, 8) = 1728*632+633;
P(590, 9) = 1728*633+350;
P(591, 0) = 1728*350+359;
P(591, 1) = 1728*359+594;
P(591, 2) = 1728*594+595;
P(591, 3) = 1728*595+644;
P(591, 4) = 1728*644+647;
P(591, 5) = 1728*647+638;
P(591, 6) = 1728*638+637;
P(591, 7) = 1728*637+632;
P(591, 8) = 1728*632+633;
P(591, 9) = 1728*633+350;
P(592, 0) = 1728*352+353;
P(592, 1) = 1728*353+354;
P(592, 2) = 1728*354+355;
P(592, 3) = 1728*355+404;
P(592, 4) = 1728*404+405;
P(592, 5) = 1728*405+406;
P(592, 6) = 1728*406+415;
P(592, 7) = 1728*415+412;
P(592, 8) = 1728*412+363;
P(592, 9) = 1728*363+352;
P(593, 0) = 1728*352+353;
P(593, 1) = 1728*353+354;
P(593, 2) = 1728*354+355;
P(593, 3) = 1728*355+404;
P(593, 4) = 1728*404+407;
P(593, 5) = 1728*407+642;
P(593, 6) = 1728*642+641;
P(593, 7) = 1728*641+358;
P(593, 8) = 1728*358+357;
P(593, 9) = 1728*357+352;
P(594, 0) = 1728*352+357;
P(594, 1) = 1728*357+358;
P(594, 2) = 1728*358+367;
P(594, 3) = 1728*367+364;
P(594, 4) = 1728*364+365;
P(594, 5) = 1728*365+360;
P(594, 6) = 1728*360+361;
P(594, 7) = 1728*361+362;
P(594, 8) = 1728*362+363;
P(594, 9) = 1728*363+352;
P(595, 0) = 1728*352+357;
P(595, 1) = 1728*357+358;
P(595, 2) = 1728*358+641;
P(595, 3) = 1728*641+640;
P(595, 4) = 1728*640+651;
P(595, 5) = 1728*651+650;
P(595, 6) = 1728*650+415;
P(595, 7) = 1728*415+412;
P(595, 8) = 1728*412+363;
P(595, 9) = 1728*363+352;
P(596, 0) = 1728*356+357;
P(596, 1) = 1728*357+358;
P(596, 2) = 1728*358+367;
P(596, 3) = 1728*367+602;
P(596, 4) = 1728*602+603;
P(596, 5) = 1728*603+592;
P(596, 6) = 1728*592+593;
P(596, 7) = 1728*593+594;
P(596, 8) = 1728*594+359;
P(596, 9) = 1728*359+356;
P(597, 0) = 1728*356+357;
P(597, 1) = 1728*357+358;
P(597, 2) = 1728*358+641;
P(597, 3) = 1728*641+640;
P(597, 4) = 1728*640+645;
P(597, 5) = 1728*645+644;
P(597, 6) = 1728*644+595;
P(597, 7) = 1728*595+594;
P(597, 8) = 1728*594+359;
P(597, 9) = 1728*359+356;
P(598, 0) = 1728*358+367;
P(598, 1) = 1728*367+364;
P(598, 2) = 1728*364+365;
P(598, 3) = 1728*365+366;
P(598, 4) = 1728*366+649;
P(598, 5) = 1728*649+650;
P(598, 6) = 1728*650+651;
P(598, 7) = 1728*651+640;
P(598, 8) = 1728*640+641;
P(598, 9) = 1728*641+358;
P(599, 0) = 1728*358+367;
P(599, 1) = 1728*367+602;
P(599, 2) = 1728*602+603;
P(599, 3) = 1728*603+652;
P(599, 4) = 1728*652+655;
P(599, 5) = 1728*655+646;
P(599, 6) = 1728*646+645;
P(599, 7) = 1728*645+640;
P(599, 8) = 1728*640+641;
P(599, 9) = 1728*641+358;
P(600, 0) = 1728*360+361;
P(600, 1) = 1728*361+362;
P(600, 2) = 1728*362+363;
P(600, 3) = 1728*363+412;
P(600, 4) = 1728*412+413;
P(600, 5) = 1728*413+414;
P(600, 6) = 1728*414+423;
P(600, 7) = 1728*423+420;
P(600, 8) = 1728*420+371;
P(600, 9) = 1728*371+360;
P(601, 0) = 1728*360+361;
P(601, 1) = 1728*361+362;
P(601, 2) = 1728*362+363;
P(601, 3) = 1728*363+412;
P(601, 4) = 1728*412+415;
P(601, 5) = 1728*415+650;
P(601, 6) = 1728*650+649;
P(601, 7) = 1728*649+366;
P(601, 8) = 1728*366+365;
P(601, 9) = 1728*365+360;
P(602, 0) = 1728*360+365;
P(602, 1) = 1728*365+366;
P(602, 2) = 1728*366+375;
P(602, 3) = 1728*375+372;
P(602, 4) = 1728*372+373;
P(602, 5) = 1728*373+368;
P(602, 6) = 1728*368+369;
P(602, 7) = 1728*369+370;
P(602, 8) = 1728*370+371;
P(602, 9) = 1728*371+360;
P(603, 0) = 1728*360+365;
P(603, 1) = 1728*365+366;
P(603, 2) = 1728*366+649;
P(603, 3) = 1728*649+648;
P(603, 4) = 1728*648+659;
P(603, 5) = 1728*659+658;
P(603, 6) = 1728*658+423;
P(603, 7) = 1728*423+420;
P(603, 8) = 1728*420+371;
P(603, 9) = 1728*371+360;
P(604, 0) = 1728*364+365;
P(604, 1) = 1728*365+366;
P(604, 2) = 1728*366+375;
P(604, 3) = 1728*375+610;
P(604, 4) = 1728*610+611;
P(604, 5) = 1728*611+600;
P(604, 6) = 1728*600+601;
P(604, 7) = 1728*601+602;
P(604, 8) = 1728*602+367;
P(604, 9) = 1728*367+364;
P(605, 0) = 1728*364+365;
P(605, 1) = 1728*365+366;
P(605, 2) = 1728*366+649;
P(605, 3) = 1728*649+648;
P(605, 4) = 1728*648+653;
P(605, 5) = 1728*653+652;
P(605, 6) = 1728*652+603;
P(605, 7) = 1728*603+602;
P(605, 8) = 1728*602+367;
P(605, 9) = 1728*367+364;
P(606, 0) = 1728*366+375;
P(606, 1) = 1728*375+372;
P(606, 2) = 1728*372+373;
P(606, 3) = 1728*373+374;
P(606, 4) = 1728*374+657;
P(606, 5) = 1728*657+658;
P(606, 6) = 1728*658+659;
P(606, 7) = 1728*659+648;
P(606, 8) = 1728*648+649;
P(606, 9) = 1728*649+366;
P(607, 0) = 1728*366+375;
P(607, 1) = 1728*375+610;
P(607, 2) = 1728*610+611;
P(607, 3) = 1728*611+660;
P(607, 4) = 1728*660+663;
P(607, 5) = 1728*663+654;
P(607, 6) = 1728*654+653;
P(607, 7) = 1728*653+648;
P(607, 8) = 1728*648+649;
P(607, 9) = 1728*649+366;
P(608, 0) = 1728*368+369;
P(608, 1) = 1728*369+370;
P(608, 2) = 1728*370+371;
P(608, 3) = 1728*371+420;
P(608, 4) = 1728*420+421;
P(608, 5) = 1728*421+422;
P(608, 6) = 1728*422+431;
P(608, 7) = 1728*431+428;
P(608, 8) = 1728*428+379;
P(608, 9) = 1728*379+368;
P(609, 0) = 1728*368+369;
P(609, 1) = 1728*369+370;
P(609, 2) = 1728*370+371;
P(609, 3) = 1728*371+420;
P(609, 4) = 1728*420+423;
P(609, 5) = 1728*423+658;
P(609, 6) = 1728*658+657;
P(609, 7) = 1728*657+374;
P(609, 8) = 1728*374+373;
P(609, 9) = 1728*373+368;
P(610, 0) = 1728*368+373;
P(610, 1) = 1728*373+374;
P(610, 2) = 1728*374+383;
P(610, 3) = 1728*383+380;
P(610, 4) = 1728*380+381;
P(610, 5) = 1728*381+376;
P(610, 6) = 1728*376+377;
P(610, 7) = 1728*377+378;
P(610, 8) = 1728*378+379;
P(610, 9) = 1728*379+368;
P(611, 0) = 1728*368+373;
P(611, 1) = 1728*373+374;
P(611, 2) = 1728*374+657;
P(611, 3) = 1728*657+656;
P(611, 4) = 1728*656+667;
P(611, 5) = 1728*667+666;
P(611, 6) = 1728*666+431;
P(611, 7) = 1728*431+428;
P(611, 8) = 1728*428+379;
P(611, 9) = 1728*379+368;
P(612, 0) = 1728*372+373;
P(612, 1) = 1728*373+374;
P(612, 2) = 1728*374+383;
P(612, 3) = 1728*383+618;
P(612, 4) = 1728*618+619;
P(612, 5) = 1728*619+608;
P(612, 6) = 1728*608+609;
P(612, 7) = 1728*609+610;
P(612, 8) = 1728*610+375;
P(612, 9) = 1728*375+372;
P(613, 0) = 1728*372+373;
P(613, 1) = 1728*373+374;
P(613, 2) = 1728*374+657;
P(613, 3) = 1728*657+656;
P(613, 4) = 1728*656+661;
P(613, 5) = 1728*661+660;
P(613, 6) = 1728*660+611;
P(613, 7) = 1728*611+610;
P(613, 8) = 1728*610+375;
P(613, 9) = 1728*375+372;
P(614, 0) = 1728*374+383;
P(614, 1) = 1728*383+380;
P(614, 2) = 1728*380+381;
P(614, 3) = 1728*381+382;
P(614, 4) = 1728*382+665;
P(614, 5) = 1728*665+666;
P(614, 6) = 1728*666+667;
P(614, 7) = 1728*667+656;
P(614, 8) = 1728*656+657;
P(614, 9) = 1728*657+374;
P(615, 0) = 1728*374+383;
P(615, 1) = 1728*383+618;
P(615, 2) = 1728*618+619;
P(615, 3) = 1728*619+668;
P(615, 4) = 1728*668+671;
P(615, 5) = 1728*671+662;
P(615, 6) = 1728*662+661;
P(615, 7) = 1728*661+656;
P(615, 8) = 1728*656+657;
P(615, 9) = 1728*657+374;
P(616, 0) = 1728*376+377;
P(616, 1) = 1728*377+378;
P(616, 2) = 1728*378+379;
P(616, 3) = 1728*379+428;
P(616, 4) = 1728*428+431;
P(616, 5) = 1728*431+666;
P(616, 6) = 1728*666+665;
P(616, 7) = 1728*665+382;
P(616, 8) = 1728*382+381;
P(616, 9) = 1728*381+376;
P(617, 0) = 1728*380+381;
P(617, 1) = 1728*381+382;
P(617, 2) = 1728*382+665;
P(617, 3) = 1728*665+664;
P(617, 4) = 1728*664+669;
P(617, 5) = 1728*669+668;
P(617, 6) = 1728*668+619;
P(617, 7) = 1728*619+618;
P(617, 8) = 1728*618+383;
P(617, 9) = 1728*383+380;
P(618, 0) = 1728*384+385;
P(618, 1) = 1728*385+386;
P(618, 2) = 1728*386+387;
P(618, 3) = 1728*387+436;
P(618, 4) = 1728*436+437;
P(618, 5) = 1728*437+438;
P(618, 6) = 1728*438+447;
P(618, 7) = 1728*447+444;
P(618, 8) = 1728*444+395;
P(618, 9) = 1728*395+384;
P(619, 0) = 1728*384+385;
P(619, 1) = 1728*385+386;
P(619, 2) = 1728*386+387;
P(619, 3) = 1728*387+436;
P(619, 4) = 1728*436+439;
P(619, 5) = 1728*439+674;
P(619, 6) = 1728*674+673;
P(619, 7) = 1728*673+390;
P(619, 8) = 1728*390+389;
P(619, 9) = 1728*389+384;
P(620, 0) = 1728*384+385;
P(620, 1) = 1728*385+386;
P(620, 2) = 1728*386+387;
P(620, 3) = 1728*387+424;
P(620, 4) = 1728*424+429;
P(620, 5) = 1728*429+430;
P(620, 6) = 1728*430+391;
P(620, 7) = 1728*391+388;
P(620, 8) = 1728*388+389;
P(620, 9) = 1728*389+384;
P(621, 0) = 1728*384+389;
P(621, 1) = 1728*389+390;
P(621, 2) = 1728*390+399;
P(621, 3) = 1728*399+396;
P(621, 4) = 1728*396+397;
P(621, 5) = 1728*397+392;
P(621, 6) = 1728*392+393;
P(621, 7) = 1728*393+394;
P(621, 8) = 1728*394+395;
P(621, 9) = 1728*395+384;
P(622, 0) = 1728*384+389;
P(622, 1) = 1728*389+390;
P(622, 2) = 1728*390+673;
P(622, 3) = 1728*673+672;
P(622, 4) = 1728*672+683;
P(622, 5) = 1728*683+682;
P(622, 6) = 1728*682+447;
P(622, 7) = 1728*447+444;
P(622, 8) = 1728*444+395;
P(622, 9) = 1728*395+384;
P(623, 0) = 1728*387+436;
P(623, 1) = 1728*436+439;
P(623, 2) = 1728*439+478;
P(623, 3) = 1728*478+477;
P(623, 4) = 1728*477+476;
P(623, 5) = 1728*476+427;
P(623, 6) = 1728*427+426;
P(623, 7) = 1728*426+425;
P(623, 8) = 1728*425+424;
P(623, 9) = 1728*424+387;
P(624, 0) = 1728*387+436;
P(624, 1) = 1728*436+439;
P(624, 2) = 1728*439+674;
P(624, 3) = 1728*674+675;
P(624, 4) = 1728*675+712;
P(624, 5) = 1728*712+713;
P(624, 6) = 1728*713+430;
P(624, 7) = 1728*430+429;
P(624, 8) = 1728*429+424;
P(624, 9) = 1728*424+387;
P(625, 0) = 1728*388+389;
P(625, 1) = 1728*389+390;
P(625, 2) = 1728*390+399;
P(625, 3) = 1728*399+634;
P(625, 4) = 1728*634+635;
P(625, 5) = 1728*635+624;
P(625, 6) = 1728*624+625;
P(625, 7) = 1728*625+626;
P(625, 8) = 1728*626+391;
P(625, 9) = 1728*391+388;
P(626, 0) = 1728*388+389;
P(626, 1) = 1728*389+390;
P(626, 2) = 1728*390+673;
P(626, 3) = 1728*673+672;
P(626, 4) = 1728*672+677;
P(626, 5) = 1728*677+676;
P(626, 6) = 1728*676+627;
P(626, 7) = 1728*627+626;
P(626, 8) = 1728*626+391;
P(626, 9) = 1728*391+388;
P(627, 0) = 1728*388+389;
P(627, 1) = 1728*389+390;
P(627, 2) = 1728*390+673;
P(627, 3) = 1728*673+674;
P(627, 4) = 1728*674+675;
P(627, 5) = 1728*675+712;
P(627, 6) = 1728*712+713;
P(627, 7) = 1728*713+430;
P(627, 8) = 1728*430+391;
P(627, 9) = 1728*391+388;
P(628, 0) = 1728*390+399;
P(628, 1) = 1728*399+396;
P(628, 2) = 1728*396+397;
P(628, 3) = 1728*397+398;
P(628, 4) = 1728*398+681;
P(628, 5) = 1728*681+682;
P(628, 6) = 1728*682+683;
P(628, 7) = 1728*683+672;
P(628, 8) = 1728*672+673;
P(628, 9) = 1728*673+390;
P(629, 0) = 1728*390+399;
P(629, 1) = 1728*399+634;
P(629, 2) = 1728*634+635;
P(629, 3) = 1728*635+684;
P(629, 4) = 1728*684+687;
P(629, 5) = 1728*687+678;
P(629, 6) = 1728*678+677;
P(629, 7) = 1728*677+672;
P(629, 8) = 1728*672+673;
P(629, 9) = 1728*673+390;
P(630, 0) = 1728*391+430;
P(630, 1) = 1728*430+429;
P(630, 2) = 1728*429+428;
P(630, 3) = 1728*428+431;
P(630, 4) = 1728*431+666;
P(630, 5) = 1728*666+665;
P(630, 6) = 1728*665+664;
P(630, 7) = 1728*664+627;
P(630, 8) = 1728*627+626;
P(630, 9) = 1728*626+391;
P(631, 0) = 1728*391+430;
P(631, 1) = 1728*430+713;
P(631, 2) = 1728*713+712;
P(631, 3) = 1728*712+717;
P(631, 4) = 1728*717+718;
P(631, 5) = 1728*718+679;
P(631, 6) = 1728*679+676;
P(631, 7) = 1728*676+627;
P(631, 8) = 1728*627+626;
P(631, 9) = 1728*626+391;
P(632, 0) = 1728*392+393;
P(632, 1) = 1728*393+394;
P(632, 2) = 1728*394+395;
P(632, 3) = 1728*395+444;
P(632, 4) = 1728*444+445;
P(632, 5) = 1728*445+446;
P(632, 6) = 1728*446+455;
P(632, 7) = 1728*455+452;
P(632, 8) = 1728*452+403;
P(632, 9) = 1728*403+392;
P(633, 0) = 1728*392+393;
P(633, 1) = 1728*393+394;
P(633, 2) = 1728*394+395;
P(633, 3) = 1728*395+444;
P(633, 4) = 1728*444+447;
P(633, 5) = 1728*447+682;
P(633, 6) = 1728*682+681;
P(633, 7) = 1728*681+398;
P(633, 8) = 1728*398+397;
P(633, 9) = 1728*397+392;
P(634, 0) = 1728*392+397;
P(634, 1) = 1728*397+398;
P(634, 2) = 1728*398+407;
P(634, 3) = 1728*407+404;
P(634, 4) = 1728*404+405;
P(634, 5) = 1728*405+400;
P(634, 6) = 1728*400+401;
P(634, 7) = 1728*401+402;
P(634, 8) = 1728*402+403;
P(634, 9) = 1728*403+392;
P(635, 0) = 1728*392+397;
P(635, 1) = 1728*397+398;
P(635, 2) = 1728*398+681;
P(635, 3) = 1728*681+680;
P(635, 4) = 1728*680+691;
P(635, 5) = 1728*691+690;
P(635, 6) = 1728*690+455;
P(635, 7) = 1728*455+452;
P(635, 8) = 1728*452+403;
P(635, 9) = 1728*403+392;
P(636, 0) = 1728*396+397;
P(636, 1) = 1728*397+398;
P(636, 2) = 1728*398+407;
P(636, 3) = 1728*407+642;
P(636, 4) = 1728*642+643;
P(636, 5) = 1728*643+632;
P(636, 6) = 1728*632+633;
P(636, 7) = 1728*633+634;
P(636, 8) = 1728*634+399;
P(636, 9) = 1728*399+396;
P(637, 0) = 1728*396+397;
P(637, 1) = 1728*397+398;
P(637, 2) = 1728*398+681;
P(637, 3) = 1728*681+680;
P(637, 4) = 1728*680+685;
P(637, 5) = 1728*685+684;
P(637, 6) = 1728*684+635;
P(637, 7) = 1728*635+634;
P(637, 8) = 1728*634+399;
P(637, 9) = 1728*399+396;
P(638, 0) = 1728*398+407;
P(638, 1) = 1728*407+404;
P(638, 2) = 1728*404+405;
P(638, 3) = 1728*405+406;
P(638, 4) = 1728*406+689;
P(638, 5) = 1728*689+690;
P(638, 6) = 1728*690+691;
P(638, 7) = 1728*691+680;
P(638, 8) = 1728*680+681;
P(638, 9) = 1728*681+398;
P(639, 0) = 1728*398+407;
P(639, 1) = 1728*407+642;
P(639, 2) = 1728*642+643;
P(639, 3) = 1728*643+692;
P(639, 4) = 1728*692+695;
P(639, 5) = 1728*695+686;
P(639, 6) = 1728*686+685;
P(639, 7) = 1728*685+680;
P(639, 8) = 1728*680+681;
P(639, 9) = 1728*681+398;
P(640, 0) = 1728*400+401;
P(640, 1) = 1728*401+402;
P(640, 2) = 1728*402+403;
P(640, 3) = 1728*403+452;
P(640, 4) = 1728*452+453;
P(640, 5) = 1728*453+454;
P(640, 6) = 1728*454+463;
P(640, 7) = 1728*463+460;
P(640, 8) = 1728*460+411;
P(640, 9) = 1728*411+400;
P(641, 0) = 1728*400+401;
P(641, 1) = 1728*401+402;
P(641, 2) = 1728*402+403;
P(641, 3) = 1728*403+452;
P(641, 4) = 1728*452+455;
P(641, 5) = 1728*455+690;
P(641, 6) = 1728*690+689;
P(641, 7) = 1728*689+406;
P(641, 8) = 1728*406+405;
P(641, 9) = 1728*405+400;
P(642, 0) = 1728*400+405;
P(642, 1) = 1728*405+406;
P(642, 2) = 1728*406+415;
P(642, 3) = 1728*415+412;
P(642, 4) = 1728*412+413;
P(642, 5) = 1728*413+408;
P(642, 6) = 1728*408+409;
P(642, 7) = 1728*409+410;
P(642, 8) = 1728*410+411;
P(642, 9) = 1728*411+400;
P(643, 0) = 1728*400+405;
P(643, 1) = 1728*405+406;
P(643, 2) = 1728*406+689;
P(643, 3) = 1728*689+688;
P(643, 4) = 1728*688+699;
P(643, 5) = 1728*699+698;
P(643, 6) = 1728*698+463;
P(643, 7) = 1728*463+460;
P(643, 8) = 1728*460+411;
P(643, 9) = 1728*411+400;
P(644, 0) = 1728*404+405;
P(644, 1) = 1728*405+406;
P(644, 2) = 1728*406+415;
P(644, 3) = 1728*415+650;
P(644, 4) = 1728*650+651;
P(644, 5) = 1728*651+640;
P(644, 6) = 1728*640+641;
P(644, 7) = 1728*641+642;
P(644, 8) = 1728*642+407;
P(644, 9) = 1728*407+404;
P(645, 0) = 1728*404+405;
P(645, 1) = 1728*405+406;
P(645, 2) = 1728*406+689;
P(645, 3) = 1728*689+688;
P(645, 4) = 1728*688+693;
P(645, 5) = 1728*693+692;
P(645, 6) = 1728*692+643;
P(645, 7) = 1728*643+642;
P(645, 8) = 1728*642+407;
P(645, 9) = 1728*407+404;
P(646, 0) = 1728*406+415;
P(646, 1) = 1728*415+412;
P(646, 2) = 1728*412+413;
P(646, 3) = 1728*413+414;
P(646, 4) = 1728*414+697;
P(646, 5) = 1728*697+698;
P(646, 6) = 1728*698+699;
P(646, 7) = 1728*699+688;
P(646, 8) = 1728*688+689;
P(646, 9) = 1728*689+406;
P(647, 0) = 1728*406+415;
P(647, 1) = 1728*415+650;
P(647, 2) = 1728*650+651;
P(647, 3) = 1728*651+700;
P(647, 4) = 1728*700+703;
P(647, 5) = 1728*703+694;
P(647, 6) = 1728*694+693;
P(647, 7) = 1728*693+688;
P(647, 8) = 1728*688+689;
P(647, 9) = 1728*689+406;
P(648, 0) = 1728*408+409;
P(648, 1) = 1728*409+410;
P(648, 2) = 1728*410+411;
P(648, 3) = 1728*411+460;
P(648, 4) = 1728*460+461;
P(648, 5) = 1728*461+462;
P(648, 6) = 1728*462+471;
P(648, 7) = 1728*471+468;
P(648, 8) = 1728*468+419;
P(648, 9) = 1728*419+408;
P(649, 0) = 1728*408+409;
P(649, 1) = 1728*409+410;
P(649, 2) = 1728*410+411;
P(649, 3) = 1728*411+460;
P(649, 4) = 1728*460+463;
P(649, 5) = 1728*463+698;
P(649, 6) = 1728*698+697;
P(649, 7) = 1728*697+414;
P(649, 8) = 1728*414+413;
P(649, 9) = 1728*413+408;
P(650, 0) = 1728*408+413;
P(650, 1) = 1728*413+414;
P(650, 2) = 1728*414+423;
P(650, 3) = 1728*423+420;
P(650, 4) = 1728*420+421;
P(650, 5) = 1728*421+416;
P(650, 6) = 1728*416+417;
P(650, 7) = 1728*417+418;
P(650, 8) = 1728*418+419;
P(650, 9) = 1728*419+408;
P(651, 0) = 1728*408+413;
P(651, 1) = 1728*413+414;
P(651, 2) = 1728*414+697;
P(651, 3) = 1728*697+696;
P(651, 4) = 1728*696+707;
P(651, 5) = 1728*707+706;
P(651, 6) = 1728*706+471;
P(651, 7) = 1728*471+468;
P(651, 8) = 1728*468+419;
P(651, 9) = 1728*419+408;
P(652, 0) = 1728*412+413;
P(652, 1) = 1728*413+414;
P(652, 2) = 1728*414+423;
P(652, 3) = 1728*423+658;
P(652, 4) = 1728*658+659;
P(652, 5) = 1728*659+648;
P(652, 6) = 1728*648+649;
P(652, 7) = 1728*649+650;
P(652, 8) = 1728*650+415;
P(652, 9) = 1728*415+412;
P(653, 0) = 1728*412+413;
P(653, 1) = 1728*413+414;
P(653, 2) = 1728*414+697;
P(653, 3) = 1728*697+696;
P(653, 4) = 1728*696+701;
P(653, 5) = 1728*701+700;
P(653, 6) = 1728*700+651;
P(653, 7) = 1728*651+650;
P(653, 8) = 1728*650+415;
P(653, 9) = 1728*415+412;
P(654, 0) = 1728*414+423;
P(654, 1) = 1728*423+420;
P(654, 2) = 1728*420+421;
P(654, 3) = 1728*421+422;
P(654, 4) = 1728*422+705;
P(654, 5) = 1728*705+706;
P(654, 6) = 1728*706+707;
P(654, 7) = 1728*707+696;
P(654, 8) = 1728*696+697;
P(654, 9) = 1728*697+414;
P(655, 0) = 1728*414+423;
P(655, 1) = 1728*423+658;
P(655, 2) = 1728*658+659;
P(655, 3) = 1728*659+708;
P(655, 4) = 1728*708+711;
P(655, 5) = 1728*711+702;
P(655, 6) = 1728*702+701;
P(655, 7) = 1728*701+696;
P(655, 8) = 1728*696+697;
P(655, 9) = 1728*697+414;
P(656, 0) = 1728*416+417;
P(656, 1) = 1728*417+418;
P(656, 2) = 1728*418+419;
P(656, 3) = 1728*419+468;
P(656, 4) = 1728*468+469;
P(656, 5) = 1728*469+470;
P(656, 6) = 1728*470+479;
P(656, 7) = 1728*479+476;
P(656, 8) = 1728*476+427;
P(656, 9) = 1728*427+416;
P(657, 0) = 1728*416+417;
P(657, 1) = 1728*417+418;
P(657, 2) = 1728*418+419;
P(657, 3) = 1728*419+468;
P(657, 4) = 1728*468+471;
P(657, 5) = 1728*471+706;
P(657, 6) = 1728*706+705;
P(657, 7) = 1728*705+422;
P(657, 8) = 1728*422+421;
P(657, 9) = 1728*421+416;
P(658, 0) = 1728*416+421;
P(658, 1) = 1728*421+422;
P(658, 2) = 1728*422+431;
P(658, 3) = 1728*431+428;
P(658, 4) = 1728*428+429;
P(658, 5) = 1728*429+424;
P(658, 6) = 1728*424+425;
P(658, 7) = 1728*425+426;
P(658, 8) = 1728*426+427;
P(658, 9) = 1728*427+416;
P(659, 0) = 1728*416+421;
P(659, 1) = 1728*421+422;
P(659, 2) = 1728*422+705;
P(659, 3) = 1728*705+704;
P(659, 4) = 1728*704+715;
P(659, 5) = 1728*715+714;
P(659, 6) = 1728*714+479;
P(659, 7) = 1728*479+476;
P(659, 8) = 1728*476+427;
P(659, 9) = 1728*427+416;
P(660, 0) = 1728*420+421;
P(660, 1) = 1728*421+422;
P(660, 2) = 1728*422+431;
P(660, 3) = 1728*431+666;
P(660, 4) = 1728*666+667;
P(660, 5) = 1728*667+656;
P(660, 6) = 1728*656+657;
P(660, 7) = 1728*657+658;
P(660, 8) = 1728*658+423;
P(660, 9) = 1728*423+420;
P(661, 0) = 1728*420+421;
P(661, 1) = 1728*421+422;
P(661, 2) = 1728*422+705;
P(661, 3) = 1728*705+704;
P(661, 4) = 1728*704+709;
P(661, 5) = 1728*709+708;
P(661, 6) = 1728*708+659;
P(661, 7) = 1728*659+658;
P(661, 8) = 1728*658+423;
P(661, 9) = 1728*423+420;
P(662, 0) = 1728*422+431;
P(662, 1) = 1728*431+428;
P(662, 2) = 1728*428+429;
P(662, 3) = 1728*429+430;
P(662, 4) = 1728*430+713;
P(662, 5) = 1728*713+714;
P(662, 6) = 1728*714+715;
P(662, 7) = 1728*715+704;
P(662, 8) = 1728*704+705;
P(662, 9) = 1728*705+422;
P(663, 0) = 1728*422+431;
P(663, 1) = 1728*431+666;
P(663, 2) = 1728*666+667;
P(663, 3) = 1728*667+716;
P(663, 4) = 1728*716+719;
P(663, 5) = 1728*719+710;
P(663, 6) = 1728*710+709;
P(663, 7) = 1728*709+704;
P(663, 8) = 1728*704+705;
P(663, 9) = 1728*705+422;
P(664, 0) = 1728*424+425;
P(664, 1) = 1728*425+426;
P(664, 2) = 1728*426+427;
P(664, 3) = 1728*427+476;
P(664, 4) = 1728*476+479;
P(664, 5) = 1728*479+714;
P(664, 6) = 1728*714+713;
P(664, 7) = 1728*713+430;
P(664, 8) = 1728*430+429;
P(664, 9) = 1728*429+424;
P(665, 0) = 1728*428+429;
P(665, 1) = 1728*429+430;
P(665, 2) = 1728*430+713;
P(665, 3) = 1728*713+712;
P(665, 4) = 1728*712+717;
P(665, 5) = 1728*717+716;
P(665, 6) = 1728*716+667;
P(665, 7) = 1728*667+666;
P(665, 8) = 1728*666+431;
P(665, 9) = 1728*431+428;
P(666, 0) = 1728*432+433;
P(666, 1) = 1728*433+434;
P(666, 2) = 1728*434+435;
P(666, 3) = 1728*435+484;
P(666, 4) = 1728*484+485;
P(666, 5) = 1728*485+486;
P(666, 6) = 1728*486+495;
P(666, 7) = 1728*495+492;
P(666, 8) = 1728*492+443;
P(666, 9) = 1728*443+432;
P(667, 0) = 1728*432+433;
P(667, 1) = 1728*433+434;
P(667, 2) = 1728*434+435;
P(667, 3) = 1728*435+484;
P(667, 4) = 1728*484+487;
P(667, 5) = 1728*487+722;
P(667, 6) = 1728*722+721;
P(667, 7) = 1728*721+438;
P(667, 8) = 1728*438+437;
P(667, 9) = 1728*437+432;
P(668, 0) = 1728*432+433;
P(668, 1) = 1728*433+434;
P(668, 2) = 1728*434+435;
P(668, 3) = 1728*435+472;
P(668, 4) = 1728*472+477;
P(668, 5) = 1728*477+478;
P(668, 6) = 1728*478+439;
P(668, 7) = 1728*439+436;
P(668, 8) = 1728*436+437;
P(668, 9) = 1728*437+432;
P(669, 0) = 1728*432+437;
P(669, 1) = 1728*437+438;
P(669, 2) = 1728*438+447;
P(669, 3) = 1728*447+444;
P(669, 4) = 1728*444+445;
P(669, 5) = 1728*445+440;
P(669, 6) = 1728*440+441;
P(669, 7) = 1728*441+442;
P(669, 8) = 1728*442+443;
P(669, 9) = 1728*443+432;
P(670, 0) = 1728*432+437;
P(670, 1) = 1728*437+438;
P(670, 2) = 1728*438+721;
P(670, 3) = 1728*721+720;
P(670, 4) = 1728*720+731;
P(670, 5) = 1728*731+730;
P(670, 6) = 1728*730+495;
P(670, 7) = 1728*495+492;
P(670, 8) = 1728*492+443;
P(670, 9) = 1728*443+432;
P(671, 0) = 1728*435+484;
P(671, 1) = 1728*484+487;
P(671, 2) = 1728*487+526;
P(671, 3) = 1728*526+525;
P(671, 4) = 1728*525+524;
P(671, 5) = 1728*524+475;
P(671, 6) = 1728*475+474;
P(671, 7) = 1728*474+473;
P(671, 8) = 1728*473+472;
P(671, 9) = 1728*472+435;
P(672, 0) = 1728*435+484;
P(672, 1) = 1728*484+487;
P(672, 2) = 1728*487+722;
P(672, 3) = 1728*722+723;
P(672, 4) = 1728*723+760;
P(672, 5) = 1728*760+761;
P(672, 6) = 1728*761+478;
P(672, 7) = 1728*478+477;
P(672, 8) = 1728*477+472;
P(672, 9) = 1728*472+435;
P(673, 0) = 1728*436+437;
P(673, 1) = 1728*437+438;
P(673, 2) = 1728*438+447;
P(673, 3) = 1728*447+682;
P(673, 4) = 1728*682+683;
P(673, 5) = 1728*683+672;
P(673, 6) = 1728*672+673;
P(673, 7) = 1728*673+674;
P(673, 8) = 1728*674+439;
P(673, 9) = 1728*439+436;
P(674, 0) = 1728*436+437;
P(674, 1) = 1728*437+438;
P(674, 2) = 1728*438+721;
P(674, 3) = 1728*721+720;
P(674, 4) = 1728*720+725;
P(674, 5) = 1728*725+724;
P(674, 6) = 1728*724+675;
P(674, 7) = 1728*675+674;
P(674, 8) = 1728*674+439;
P(674, 9) = 1728*439+436;
P(675, 0) = 1728*436+437;
P(675, 1) = 1728*437+438;
P(675, 2) = 1728*438+721;
P(675, 3) = 1728*721+722;
P(675, 4) = 1728*722+723;
P(675, 5) = 1728*723+760;
P(675, 6) = 1728*760+761;
P(675, 7) = 1728*761+478;
P(675, 8) = 1728*478+439;
P(675, 9) = 1728*439+436;
P(676, 0) = 1728*438+447;
P(676, 1) = 1728*447+444;
P(676, 2) = 1728*444+445;
P(676, 3) = 1728*445+446;
P(676, 4) = 1728*446+729;
P(676, 5) = 1728*729+730;
P(676, 6) = 1728*730+731;
P(676, 7) = 1728*731+720;
P(676, 8) = 1728*720+721;
P(676, 9) = 1728*721+438;
P(677, 0) = 1728*438+447;
P(677, 1) = 1728*447+682;
P(677, 2) = 1728*682+683;
P(677, 3) = 1728*683+732;
P(677, 4) = 1728*732+735;
P(677, 5) = 1728*735+726;
P(677, 6) = 1728*726+725;
P(677, 7) = 1728*725+720;
P(677, 8) = 1728*720+721;
P(677, 9) = 1728*721+438;
P(678, 0) = 1728*439+478;
P(678, 1) = 1728*478+477;
P(678, 2) = 1728*477+476;
P(678, 3) = 1728*476+479;
P(678, 4) = 1728*479+714;
P(678, 5) = 1728*714+713;
P(678, 6) = 1728*713+712;
P(678, 7) = 1728*712+675;
P(678, 8) = 1728*675+674;
P(678, 9) = 1728*674+439;
P(679, 0) = 1728*439+478;
P(679, 1) = 1728*478+761;
P(679, 2) = 1728*761+760;
P(679, 3) = 1728*760+765;
P(679, 4) = 1728*765+766;
P(679, 5) = 1728*766+727;
P(679, 6) = 1728*727+724;
P(679, 7) = 1728*724+675;
P(679, 8) = 1728*675+674;
P(679, 9) = 1728*674+439;
P(680, 0) = 1728*440+441;
P(680, 1) = 1728*441+442;
P(680, 2) = 1728*442+443;
P(680, 3) = 1728*443+492;
P(680, 4) = 1728*492+493;
P(680, 5) = 1728*493+494;
P(680, 6) = 1728*494+503;
P(680, 7) = 1728*503+500;
P(680, 8) = 1728*500+451;
P(680, 9) = 1728*451+440;
P(681, 0) = 1728*440+441;
P(681, 1) = 1728*441+442;
P(681, 2) = 1728*442+443;
P(681, 3) = 1728*443+492;
P(681, 4) = 1728*492+495;
P(681, 5) = 1728*495+730;
P(681, 6) = 1728*730+729;
P(681, 7) = 1728*729+446;
P(681, 8) = 1728*446+445;
P(681, 9) = 1728*445+440;
P(682, 0) = 1728*440+445;
P(682, 1) = 1728*445+446;
P(682, 2) = 1728*446+455;
P(682, 3) = 1728*455+452;
P(682, 4) = 1728*452+453;
P(682, 5) = 1728*453+448;
P(682, 6) = 1728*448+449;
P(682, 7) = 1728*449+450;
P(682, 8) = 1728*450+451;
P(682, 9) = 1728*451+440;
P(683, 0) = 1728*440+445;
P(683, 1) = 1728*445+446;
P(683, 2) = 1728*446+729;
P(683, 3) = 1728*729+728;
P(683, 4) = 1728*728+739;
P(683, 5) = 1728*739+738;
P(683, 6) = 1728*738+503;
P(683, 7) = 1728*503+500;
P(683, 8) = 1728*500+451;
P(683, 9) = 1728*451+440;
P(684, 0) = 1728*444+445;
P(684, 1) = 1728*445+446;
P(684, 2) = 1728*446+455;
P(684, 3) = 1728*455+690;
P(684, 4) = 1728*690+691;
P(684, 5) = 1728*691+680;
P(684, 6) = 1728*680+681;
P(684, 7) = 1728*681+682;
P(684, 8) = 1728*682+447;
P(684, 9) = 1728*447+444;
P(685, 0) = 1728*444+445;
P(685, 1) = 1728*445+446;
P(685, 2) = 1728*446+729;
P(685, 3) = 1728*729+728;
P(685, 4) = 1728*728+733;
P(685, 5) = 1728*733+732;
P(685, 6) = 1728*732+683;
P(685, 7) = 1728*683+682;
P(685, 8) = 1728*682+447;
P(685, 9) = 1728*447+444;
P(686, 0) = 1728*446+455;
P(686, 1) = 1728*455+452;
P(686, 2) = 1728*452+453;
P(686, 3) = 1728*453+454;
P(686, 4) = 1728*454+737;
P(686, 5) = 1728*737+738;
P(686, 6) = 1728*738+739;
P(686, 7) = 1728*739+728;
P(686, 8) = 1728*728+729;
P(686, 9) = 1728*729+446;
P(687, 0) = 1728*446+455;
P(687, 1) = 1728*455+690;
P(687, 2) = 1728*690+691;
P(687, 3) = 1728*691+740;
P(687, 4) = 1728*740+743;
P(687, 5) = 1728*743+734;
P(687, 6) = 1728*734+733;
P(687, 7) = 1728*733+728;
P(687, 8) = 1728*728+729;
P(687, 9) = 1728*729+446;
P(688, 0) = 1728*448+449;
P(688, 1) = 1728*449+450;
P(688, 2) = 1728*450+451;
P(688, 3) = 1728*451+500;
P(688, 4) = 1728*500+501;
P(688, 5) = 1728*501+502;
P(688, 6) = 1728*502+511;
P(688, 7) = 1728*511+508;
P(688, 8) = 1728*508+459;
P(688, 9) = 1728*459+448;
P(689, 0) = 1728*448+449;
P(689, 1) = 1728*449+450;
P(689, 2) = 1728*450+451;
P(689, 3) = 1728*451+500;
P(689, 4) = 1728*500+503;
P(689, 5) = 1728*503+738;
P(689, 6) = 1728*738+737;
P(689, 7) = 1728*737+454;
P(689, 8) = 1728*454+453;
P(689, 9) = 1728*453+448;
P(690, 0) = 1728*448+453;
P(690, 1) = 1728*453+454;
P(690, 2) = 1728*454+463;
P(690, 3) = 1728*463+460;
P(690, 4) = 1728*460+461;
P(690, 5) = 1728*461+456;
P(690, 6) = 1728*456+457;
P(690, 7) = 1728*457+458;
P(690, 8) = 1728*458+459;
P(690, 9) = 1728*459+448;
P(691, 0) = 1728*448+453;
P(691, 1) = 1728*453+454;
P(691, 2) = 1728*454+737;
P(691, 3) = 1728*737+736;
P(691, 4) = 1728*736+747;
P(691, 5) = 1728*747+746;
P(691, 6) = 1728*746+511;
P(691, 7) = 1728*511+508;
P(691, 8) = 1728*508+459;
P(691, 9) = 1728*459+448;
P(692, 0) = 1728*452+453;
P(692, 1) = 1728*453+454;
P(692, 2) = 1728*454+463;
P(692, 3) = 1728*463+698;
P(692, 4) = 1728*698+699;
P(692, 5) = 1728*699+688;
P(692, 6) = 1728*688+689;
P(692, 7) = 1728*689+690;
P(692, 8) = 1728*690+455;
P(692, 9) = 1728*455+452;
P(693, 0) = 1728*452+453;
P(693, 1) = 1728*453+454;
P(693, 2) = 1728*454+737;
P(693, 3) = 1728*737+736;
P(693, 4) = 1728*736+741;
P(693, 5) = 1728*741+740;
P(693, 6) = 1728*740+691;
P(693, 7) = 1728*691+690;
P(693, 8) = 1728*690+455;
P(693, 9) = 1728*455+452;
P(694, 0) = 1728*454+463;
P(694, 1) = 1728*463+460;
P(694, 2) = 1728*460+461;
P(694, 3) = 1728*461+462;
P(694, 4) = 1728*462+745;
P(694, 5) = 1728*745+746;
P(694, 6) = 1728*746+747;
P(694, 7) = 1728*747+736;
P(694, 8) = 1728*736+737;
P(694, 9) = 1728*737+454;
P(695, 0) = 1728*454+463;
P(695, 1) = 1728*463+698;
P(695, 2) = 1728*698+699;
P(695, 3) = 1728*699+748;
P(695, 4) = 1728*748+751;
P(695, 5) = 1728*751+742;
P(695, 6) = 1728*742+741;
P(695, 7) = 1728*741+736;
P(695, 8) = 1728*736+737;
P(695, 9) = 1728*737+454;
P(696, 0) = 1728*456+457;
P(696, 1) = 1728*457+458;
P(696, 2) = 1728*458+459;
P(696, 3) = 1728*459+508;
P(696, 4) = 1728*508+509;
P(696, 5) = 1728*509+510;
P(696, 6) = 1728*510+519;
P(696, 7) = 1728*519+516;
P(696, 8) = 1728*516+467;
P(696, 9) = 1728*467+456;
P(697, 0) = 1728*456+457;
P(697, 1) = 1728*457+458;
P(697, 2) = 1728*458+459;
P(697, 3) = 1728*459+508;
P(697, 4) = 1728*508+511;
P(697, 5) = 1728*511+746;
P(697, 6) = 1728*746+745;
P(697, 7) = 1728*745+462;
P(697, 8) = 1728*462+461;
P(697, 9) = 1728*461+456;
P(698, 0) = 1728*456+461;
P(698, 1) = 1728*461+462;
P(698, 2) = 1728*462+471;
P(698, 3) = 1728*471+468;
P(698, 4) = 1728*468+469;
P(698, 5) = 1728*469+464;
P(698, 6) = 1728*464+465;
P(698, 7) = 1728*465+466;
P(698, 8) = 1728*466+467;
P(698, 9) = 1728*467+456;
P(699, 0) = 1728*456+461;
P(699, 1) = 1728*461+462;
P(699, 2) = 1728*462+745;
P(699, 3) = 1728*745+744;
P(699, 4) = 1728*744+755;
P(699, 5) = 1728*755+754;
P(699, 6) = 1728*754+519;
P(699, 7) = 1728*519+516;
P(699, 8) = 1728*516+467;
P(699, 9) = 1728*467+456;
P(700, 0) = 1728*460+461;
P(700, 1) = 1728*461+462;
P(700, 2) = 1728*462+471;
P(700, 3) = 1728*471+706;
P(700, 4) = 1728*706+707;
P(700, 5) = 1728*707+696;
P(700, 6) = 1728*696+697;
P(700, 7) = 1728*697+698;
P(700, 8) = 1728*698+463;
P(700, 9) = 1728*463+460;
P(701, 0) = 1728*460+461;
P(701, 1) = 1728*461+462;
P(701, 2) = 1728*462+745;
P(701, 3) = 1728*745+744;
P(701, 4) = 1728*744+749;
P(701, 5) = 1728*749+748;
P(701, 6) = 1728*748+699;
P(701, 7) = 1728*699+698;
P(701, 8) = 1728*698+463;
P(701, 9) = 1728*463+460;
P(702, 0) = 1728*462+471;
P(702, 1) = 1728*471+468;
P(702, 2) = 1728*468+469;
P(702, 3) = 1728*469+470;
P(702, 4) = 1728*470+753;
P(702, 5) = 1728*753+754;
P(702, 6) = 1728*754+755;
P(702, 7) = 1728*755+744;
P(702, 8) = 1728*744+745;
P(702, 9) = 1728*745+462;
P(703, 0) = 1728*462+471;
P(703, 1) = 1728*471+706;
P(703, 2) = 1728*706+707;
P(703, 3) = 1728*707+756;
P(703, 4) = 1728*756+759;
P(703, 5) = 1728*759+750;
P(703, 6) = 1728*750+749;
P(703, 7) = 1728*749+744;
P(703, 8) = 1728*744+745;
P(703, 9) = 1728*745+462;
P(704, 0) = 1728*464+465;
P(704, 1) = 1728*465+466;
P(704, 2) = 1728*466+467;
P(704, 3) = 1728*467+516;
P(704, 4) = 1728*516+517;
P(704, 5) = 1728*517+518;
P(704, 6) = 1728*518+527;
P(704, 7) = 1728*527+524;
P(704, 8) = 1728*524+475;
P(704, 9) = 1728*475+464;
P(705, 0) = 1728*464+465;
P(705, 1) = 1728*465+466;
P(705, 2) = 1728*466+467;
P(705, 3) = 1728*467+516;
P(705, 4) = 1728*516+519;
P(705, 5) = 1728*519+754;
P(705, 6) = 1728*754+753;
P(705, 7) = 1728*753+470;
P(705, 8) = 1728*470+469;
P(705, 9) = 1728*469+464;
P(706, 0) = 1728*464+469;
P(706, 1) = 1728*469+470;
P(706, 2) = 1728*470+479;
P(706, 3) = 1728*479+476;
P(706, 4) = 1728*476+477;
P(706, 5) = 1728*477+472;
P(706, 6) = 1728*472+473;
P(706, 7) = 1728*473+474;
P(706, 8) = 1728*474+475;
P(706, 9) = 1728*475+464;
P(707, 0) = 1728*464+469;
P(707, 1) = 1728*469+470;
P(707, 2) = 1728*470+753;
P(707, 3) = 1728*753+752;
P(707, 4) = 1728*752+763;
P(707, 5) = 1728*763+762;
P(707, 6) = 1728*762+527;
P(707, 7) = 1728*527+524;
P(707, 8) = 1728*524+475;
P(707, 9) = 1728*475+464;
P(708, 0) = 1728*468+469;
P(708, 1) = 1728*469+470;
P(708, 2) = 1728*470+479;
P(708, 3) = 1728*479+714;
P(708, 4) = 1728*714+715;
P(708, 5) = 1728*715+704;
P(708, 6) = 1728*704+705;
P(708, 7) = 1728*705+706;
P(708, 8) = 1728*706+471;
P(708, 9) = 1728*471+468;
P(709, 0) = 1728*468+469;
P(709, 1) = 1728*469+470;
P(709, 2) = 1728*470+753;
P(709, 3) = 1728*753+752;
P(709, 4) = 1728*752+757;
P(709, 5) = 1728*757+756;
P(709, 6) = 1728*756+707;
P(709, 7) = 1728*707+706;
P(709, 8) = 1728*706+471;
P(709, 9) = 1728*471+468;
P(710, 0) = 1728*470+479;
P(710, 1) = 1728*479+476;
P(710, 2) = 1728*476+477;
P(710, 3) = 1728*477+478;
P(710, 4) = 1728*478+761;
P(710, 5) = 1728*761+762;
P(710, 6) = 1728*762+763;
P(710, 7) = 1728*763+752;
P(710, 8) = 1728*752+753;
P(710, 9) = 1728*753+470;
P(711, 0) = 1728*470+479;
P(711, 1) = 1728*479+714;
P(711, 2) = 1728*714+715;
P(711, 3) = 1728*715+764;
P(711, 4) = 1728*764+767;
P(711, 5) = 1728*767+758;
P(711, 6) = 1728*758+757;
P(711, 7) = 1728*757+752;
P(711, 8) = 1728*752+753;
P(711, 9) = 1728*753+470;
P(712, 0) = 1728*472+473;
P(712, 1) = 1728*473+474;
P(712, 2) = 1728*474+475;
P(712, 3) = 1728*475+524;
P(712, 4) = 1728*524+527;
P(712, 5) = 1728*527+762;
P(712, 6) = 1728*762+761;
P(712, 7) = 1728*761+478;
P(712, 8) = 1728*478+477;
P(712, 9) = 1728*477+472;
P(713, 0) = 1728*476+477;
P(713, 1) = 1728*477+478;
P(713, 2) = 1728*478+761;
P(713, 3) = 1728*761+760;
P(713, 4) = 1728*760+765;
P(713, 5) = 1728*765+764;
P(713, 6) = 1728*764+715;
P(713, 7) = 1728*715+714;
P(713, 8) = 1728*714+479;
P(713, 9) = 1728*479+476;
P(714, 0) = 1728*480+481;
P(714, 1) = 1728*481+482;
P(714, 2) = 1728*482+483;
P(714, 3) = 1728*483+532;
P(714, 4) = 1728*532+533;
P(714, 5) = 1728*533+534;
P(714, 6) = 1728*534+543;
P(714, 7) = 1728*543+540;
P(714, 8) = 1728*540+491;
P(714, 9) = 1728*491+480;
P(715, 0) = 1728*480+481;
P(715, 1) = 1728*481+482;
P(715, 2) = 1728*482+483;
P(715, 3) = 1728*483+532;
P(715, 4) = 1728*532+535;
P(715, 5) = 1728*535+770;
P(715, 6) = 1728*770+769;
P(715, 7) = 1728*769+486;
P(715, 8) = 1728*486+485;
P(715, 9) = 1728*485+480;
P(716, 0) = 1728*480+481;
P(716, 1) = 1728*481+482;
P(716, 2) = 1728*482+483;
P(716, 3) = 1728*483+520;
P(716, 4) = 1728*520+525;
P(716, 5) = 1728*525+526;
P(716, 6) = 1728*526+487;
P(716, 7) = 1728*487+484;
P(716, 8) = 1728*484+485;
P(716, 9) = 1728*485+480;
P(717, 0) = 1728*480+485;
P(717, 1) = 1728*485+486;
P(717, 2) = 1728*486+495;
P(717, 3) = 1728*495+492;
P(717, 4) = 1728*492+493;
P(717, 5) = 1728*493+488;
P(717, 6) = 1728*488+489;
P(717, 7) = 1728*489+490;
P(717, 8) = 1728*490+491;
P(717, 9) = 1728*491+480;
P(718, 0) = 1728*480+485;
P(718, 1) = 1728*485+486;
P(718, 2) = 1728*486+769;
P(718, 3) = 1728*769+768;
P(718, 4) = 1728*768+779;
P(718, 5) = 1728*779+778;
P(718, 6) = 1728*778+543;
P(718, 7) = 1728*543+540;
P(718, 8) = 1728*540+491;
P(718, 9) = 1728*491+480;
P(719, 0) = 1728*483+532;
P(719, 1) = 1728*532+535;
P(719, 2) = 1728*535+574;
P(719, 3) = 1728*574+573;
P(719, 4) = 1728*573+572;
P(719, 5) = 1728*572+523;
P(719, 6) = 1728*523+522;
P(719, 7) = 1728*522+521;
P(719, 8) = 1728*521+520;
P(719, 9) = 1728*520+483;
P(720, 0) = 1728*483+532;
P(720, 1) = 1728*532+535;
P(720, 2) = 1728*535+770;
P(720, 3) = 1728*770+771;
P(720, 4) = 1728*771+808;
P(720, 5) = 1728*808+809;
P(720, 6) = 1728*809+526;
P(720, 7) = 1728*526+525;
P(720, 8) = 1728*525+520;
P(720, 9) = 1728*520+483;
P(721, 0) = 1728*484+485;
P(721, 1) = 1728*485+486;
P(721, 2) = 1728*486+495;
P(721, 3) = 1728*495+730;
P(721, 4) = 1728*730+731;
P(721, 5) = 1728*731+720;
P(721, 6) = 1728*720+721;
P(721, 7) = 1728*721+722;
P(721, 8) = 1728*722+487;
P(721, 9) = 1728*487+484;
P(722, 0) = 1728*484+485;
P(722, 1) = 1728*485+486;
P(722, 2) = 1728*486+769;
P(722, 3) = 1728*769+768;
P(722, 4) = 1728*768+773;
P(722, 5) = 1728*773+772;
P(722, 6) = 1728*772+723;
P(722, 7) = 1728*723+722;
P(722, 8) = 1728*722+487;
P(722, 9) = 1728*487+484;
P(723, 0) = 1728*484+485;
P(723, 1) = 1728*485+486;
P(723, 2) = 1728*486+769;
P(723, 3) = 1728*769+770;
P(723, 4) = 1728*770+771;
P(723, 5) = 1728*771+808;
P(723, 6) = 1728*808+809;
P(723, 7) = 1728*809+526;
P(723, 8) = 1728*526+487;
P(723, 9) = 1728*487+484;
P(724, 0) = 1728*486+495;
P(724, 1) = 1728*495+492;
P(724, 2) = 1728*492+493;
P(724, 3) = 1728*493+494;
P(724, 4) = 1728*494+777;
P(724, 5) = 1728*777+778;
P(724, 6) = 1728*778+779;
P(724, 7) = 1728*779+768;
P(724, 8) = 1728*768+769;
P(724, 9) = 1728*769+486;
P(725, 0) = 1728*486+495;
P(725, 1) = 1728*495+730;
P(725, 2) = 1728*730+731;
P(725, 3) = 1728*731+780;
P(725, 4) = 1728*780+783;
P(725, 5) = 1728*783+774;
P(725, 6) = 1728*774+773;
P(725, 7) = 1728*773+768;
P(725, 8) = 1728*768+769;
P(725, 9) = 1728*769+486;
P(726, 0) = 1728*487+526;
P(726, 1) = 1728*526+525;
P(726, 2) = 1728*525+524;
P(726, 3) = 1728*524+527;
P(726, 4) = 1728*527+762;
P(726, 5) = 1728*762+761;
P(726, 6) = 1728*761+760;
P(726, 7) = 1728*760+723;
P(726, 8) = 1728*723+722;
P(726, 9) = 1728*722+487;
P(727, 0) = 1728*487+526;
P(727, 1) = 1728*526+809;
P(727, 2) = 1728*809+808;
P(727, 3) = 1728*808+813;
P(727, 4) = 1728*813+814;
P(727, 5) = 1728*814+775;
P(727, 6) = 1728*775+772;
P(727, 7) = 1728*772+723;
P(727, 8) = 1728*723+722;
P(727, 9) = 1728*722+487;
P(728, 0) = 1728*488+489;
P(728, 1) = 1728*489+490;
P(728, 2) = 1728*490+491;
P(728, 3) = 1728*491+540;
P(728, 4) = 1728*540+541;
P(728, 5) = 1728*541+542;
P(728, 6) = 1728*542+551;
P(728, 7) = 1728*551+548;
P(728, 8) = 1728*548+499;
P(728, 9) = 1728*499+488;
P(729, 0) = 1728*488+489;
P(729, 1) = 1728*489+490;
P(729, 2) = 1728*490+491;
P(729, 3) = 1728*491+540;
P(729, 4) = 1728*540+543;
P(729, 5) = 1728*543+778;
P(729, 6) = 1728*778+777;
P(729, 7) = 1728*777+494;
P(729, 8) = 1728*494+493;
P(729, 9) = 1728*493+488;
P(730, 0) = 1728*488+493;
P(730, 1) = 1728*493+494;
P(730, 2) = 1728*494+503;
P(730, 3) = 1728*503+500;
P(730, 4) = 1728*500+501;
P(730, 5) = 1728*501+496;
P(730, 6) = 1728*496+497;
P(730, 7) = 1728*497+498;
P(730, 8) = 1728*498+499;
P(730, 9) = 1728*499+488;
P(731, 0) = 1728*488+493;
P(731, 1) = 1728*493+494;
P(731, 2) = 1728*494+777;
P(731, 3) = 1728*777+776;
P(731, 4) = 1728*776+787;
P(731, 5) = 1728*787+786;
P(731, 6) = 1728*786+551;
P(731, 7) = 1728*551+548;
P(731, 8) = 1728*548+499;
P(731, 9) = 1728*499+488;
P(732, 0) = 1728*492+493;
P(732, 1) = 1728*493+494;
P(732, 2) = 1728*494+503;
P(732, 3) = 1728*503+738;
P(732, 4) = 1728*738+739;
P(732, 5) = 1728*739+728;
P(732, 6) = 1728*728+729;
P(732, 7) = 1728*729+730;
P(732, 8) = 1728*730+495;
P(732, 9) = 1728*495+492;
P(733, 0) = 1728*492+493;
P(733, 1) = 1728*493+494;
P(733, 2) = 1728*494+777;
P(733, 3) = 1728*777+776;
P(733, 4) = 1728*776+781;
P(733, 5) = 1728*781+780;
P(733, 6) = 1728*780+731;
P(733, 7) = 1728*731+730;
P(733, 8) = 1728*730+495;
P(733, 9) = 1728*495+492;
P(734, 0) = 1728*494+503;
P(734, 1) = 1728*503+500;
P(734, 2) = 1728*500+501;
P(734, 3) = 1728*501+502;
P(734, 4) = 1728*502+785;
P(734, 5) = 1728*785+786;
P(734, 6) = 1728*786+787;
P(734, 7) = 1728*787+776;
P(734, 8) = 1728*776+777;
P(734, 9) = 1728*777+494;
P(735, 0) = 1728*494+503;
P(735, 1) = 1728*503+738;
P(735, 2) = 1728*738+739;
P(735, 3) = 1728*739+788;
P(735, 4) = 1728*788+791;
P(735, 5) = 1728*791+782;
P(735, 6) = 1728*782+781;
P(735, 7) = 1728*781+776;
P(735, 8) = 1728*776+777;
P(735, 9) = 1728*777+494;
P(736, 0) = 1728*496+497;
P(736, 1) = 1728*497+498;
P(736, 2) = 1728*498+499;
P(736, 3) = 1728*499+548;
P(736, 4) = 1728*548+549;
P(736, 5) = 1728*549+550;
P(736, 6) = 1728*550+559;
P(736, 7) = 1728*559+556;
P(736, 8) = 1728*556+507;
P(736, 9) = 1728*507+496;
P(737, 0) = 1728*496+497;
P(737, 1) = 1728*497+498;
P(737, 2) = 1728*498+499;
P(737, 3) = 1728*499+548;
P(737, 4) = 1728*548+551;
P(737, 5) = 1728*551+786;
P(737, 6) = 1728*786+785;
P(737, 7) = 1728*785+502;
P(737, 8) = 1728*502+501;
P(737, 9) = 1728*501+496;
P(738, 0) = 1728*496+501;
P(738, 1) = 1728*501+502;
P(738, 2) = 1728*502+511;
P(738, 3) = 1728*511+508;
P(738, 4) = 1728*508+509;
P(738, 5) = 1728*509+504;
P(738, 6) = 1728*504+505;
P(738, 7) = 1728*505+506;
P(738, 8) = 1728*506+507;
P(738, 9) = 1728*507+496;
P(739, 0) = 1728*496+501;
P(739, 1) = 1728*501+502;
P(739, 2) = 1728*502+785;
P(739, 3) = 1728*785+784;
P(739, 4) = 1728*784+795;
P(739, 5) = 1728*795+794;
P(739, 6) = 1728*794+559;
P(739, 7) = 1728*559+556;
P(739, 8) = 1728*556+507;
P(739, 9) = 1728*507+496;
P(740, 0) = 1728*500+501;
P(740, 1) = 1728*501+502;
P(740, 2) = 1728*502+511;
P(740, 3) = 1728*511+746;
P(740, 4) = 1728*746+747;
P(740, 5) = 1728*747+736;
P(740, 6) = 1728*736+737;
P(740, 7) = 1728*737+738;
P(740, 8) = 1728*738+503;
P(740, 9) = 1728*503+500;
P(741, 0) = 1728*500+501;
P(741, 1) = 1728*501+502;
P(741, 2) = 1728*502+785;
P(741, 3) = 1728*785+784;
P(741, 4) = 1728*784+789;
P(741, 5) = 1728*789+788;
P(741, 6) = 1728*788+739;
P(741, 7) = 1728*739+738;
P(741, 8) = 1728*738+503;
P(741, 9) = 1728*503+500;
P(742, 0) = 1728*502+511;
P(742, 1) = 1728*511+508;
P(742, 2) = 1728*508+509;
P(742, 3) = 1728*509+510;
P(742, 4) = 1728*510+793;
P(742, 5) = 1728*793+794;
P(742, 6) = 1728*794+795;
P(742, 7) = 1728*795+784;
P(742, 8) = 1728*784+785;
P(742, 9) = 1728*785+502;
P(743, 0) = 1728*502+511;
P(743, 1) = 1728*511+746;
P(743, 2) = 1728*746+747;
P(743, 3) = 1728*747+796;
P(743, 4) = 1728*796+799;
P(743, 5) = 1728*799+790;
P(743, 6) = 1728*790+789;
P(743, 7) = 1728*789+784;
P(743, 8) = 1728*784+785;
P(743, 9) = 1728*785+502;
P(744, 0) = 1728*504+505;
P(744, 1) = 1728*505+506;
P(744, 2) = 1728*506+507;
P(744, 3) = 1728*507+556;
P(744, 4) = 1728*556+557;
P(744, 5) = 1728*557+558;
P(744, 6) = 1728*558+567;
P(744, 7) = 1728*567+564;
P(744, 8) = 1728*564+515;
P(744, 9) = 1728*515+504;
P(745, 0) = 1728*504+505;
P(745, 1) = 1728*505+506;
P(745, 2) = 1728*506+507;
P(745, 3) = 1728*507+556;
P(745, 4) = 1728*556+559;
P(745, 5) = 1728*559+794;
P(745, 6) = 1728*794+793;
P(745, 7) = 1728*793+510;
P(745, 8) = 1728*510+509;
P(745, 9) = 1728*509+504;
P(746, 0) = 1728*504+509;
P(746, 1) = 1728*509+510;
P(746, 2) = 1728*510+519;
P(746, 3) = 1728*519+516;
P(746, 4) = 1728*516+517;
P(746, 5) = 1728*517+512;
P(746, 6) = 1728*512+513;
P(746, 7) = 1728*513+514;
P(746, 8) = 1728*514+515;
P(746, 9) = 1728*515+504;
P(747, 0) = 1728*504+509;
P(747, 1) = 1728*509+510;
P(747, 2) = 1728*510+793;
P(747, 3) = 1728*793+792;
P(747, 4) = 1728*792+803;
P(747, 5) = 1728*803+802;
P(747, 6) = 1728*802+567;
P(747, 7) = 1728*567+564;
P(747, 8) = 1728*564+515;
P(747, 9) = 1728*515+504;
P(748, 0) = 1728*508+509;
P(748, 1) = 1728*509+510;
P(748, 2) = 1728*510+519;
P(748, 3) = 1728*519+754;
P(748, 4) = 1728*754+755;
P(748, 5) = 1728*755+744;
P(748, 6) = 1728*744+745;
P(748, 7) = 1728*745+746;
P(748, 8) = 1728*746+511;
P(748, 9) = 1728*511+508;
P(749, 0) = 1728*508+509;
P(749, 1) = 1728*509+510;
P(749, 2) = 1728*510+793;
P(749, 3) = 1728*793+792;
P(749, 4) = 1728*792+797;
P(749, 5) = 1728*797+796;
P(749, 6) = 1728*796+747;
P(749, 7) = 1728*747+746;
P(749, 8) = 1728*746+511;
P(749, 9) = 1728*511+508;
P(750, 0) = 1728*510+519;
P(750, 1) = 1728*519+516;
P(750, 2) = 1728*516+517;
P(750, 3) = 1728*517+518;
P(750, 4) = 1728*518+801;
P(750, 5) = 1728*801+802;
P(750, 6) = 1728*802+803;
P(750, 7) = 1728*803+792;
P(750, 8) = 1728*792+793;
P(750, 9) = 1728*793+510;
P(751, 0) = 1728*510+519;
P(751, 1) = 1728*519+754;
P(751, 2) = 1728*754+755;
P(751, 3) = 1728*755+804;
P(751, 4) = 1728*804+807;
P(751, 5) = 1728*807+798;
P(751, 6) = 1728*798+797;
P(751, 7) = 1728*797+792;
P(751, 8) = 1728*792+793;
P(751, 9) = 1728*793+510;
P(752, 0) = 1728*512+513;
P(752, 1) = 1728*513+514;
P(752, 2) = 1728*514+515;
P(752, 3) = 1728*515+564;
P(752, 4) = 1728*564+565;
P(752, 5) = 1728*565+566;
P(752, 6) = 1728*566+575;
P(752, 7) = 1728*575+572;
P(752, 8) = 1728*572+523;
P(752, 9) = 1728*523+512;
P(753, 0) = 1728*512+513;
P(753, 1) = 1728*513+514;
P(753, 2) = 1728*514+515;
P(753, 3) = 1728*515+564;
P(753, 4) = 1728*564+567;
P(753, 5) = 1728*567+802;
P(753, 6) = 1728*802+801;
P(753, 7) = 1728*801+518;
P(753, 8) = 1728*518+517;
P(753, 9) = 1728*517+512;
P(754, 0) = 1728*512+517;
P(754, 1) = 1728*517+518;
P(754, 2) = 1728*518+527;
P(754, 3) = 1728*527+524;
P(754, 4) = 1728*524+525;
P(754, 5) = 1728*525+520;
P(754, 6) = 1728*520+521;
P(754, 7) = 1728*521+522;
P(754, 8) = 1728*522+523;
P(754, 9) = 1728*523+512;
P(755, 0) = 1728*512+517;
P(755, 1) = 1728*517+518;
P(755, 2) = 1728*518+801;
P(755, 3) = 1728*801+800;
P(755, 4) = 1728*800+811;
P(755, 5) = 1728*811+810;
P(755, 6) = 1728*810+575;
P(755, 7) = 1728*575+572;
P(755, 8) = 1728*572+523;
P(755, 9) = 1728*523+512;
P(756, 0) = 1728*516+517;
P(756, 1) = 1728*517+518;
P(756, 2) = 1728*518+527;
P(756, 3) = 1728*527+762;
P(756, 4) = 1728*762+763;
P(756, 5) = 1728*763+752;
P(756, 6) = 1728*752+753;
P(756, 7) = 1728*753+754;
P(756, 8) = 1728*754+519;
P(756, 9) = 1728*519+516;
P(757, 0) = 1728*516+517;
P(757, 1) = 1728*517+518;
P(757, 2) = 1728*518+801;
P(757, 3) = 1728*801+800;
P(757, 4) = 1728*800+805;
P(757, 5) = 1728*805+804;
P(757, 6) = 1728*804+755;
P(757, 7) = 1728*755+754;
P(757, 8) = 1728*754+519;
P(757, 9) = 1728*519+516;
P(758, 0) = 1728*518+527;
P(758, 1) = 1728*527+524;
P(758, 2) = 1728*524+525;
P(758, 3) = 1728*525+526;
P(758, 4) = 1728*526+809;
P(758, 5) = 1728*809+810;
P(758, 6) = 1728*810+811;
P(758, 7) = 1728*811+800;
P(758, 8) = 1728*800+801;
P(758, 9) = 1728*801+518;
P(759, 0) = 1728*518+527;
P(759, 1) = 1728*527+762;
P(759, 2) = 1728*762+763;
P(759, 3) = 1728*763+812;
P(759, 4) = 1728*812+815;
P(759, 5) = 1728*815+806;
P(759, 6) = 1728*806+805;
P(759, 7) = 1728*805+800;
P(759, 8) = 1728*800+801;
P(759, 9) = 1728*801+518;
P(760, 0) = 1728*520+521;
P(760, 1) = 1728*521+522;
P(760, 2) = 1728*522+523;
P(760, 3) = 1728*523+572;
P(760, 4) = 1728*572+575;
P(760, 5) = 1728*575+810;
P(760, 6) = 1728*810+809;
P(760, 7) = 1728*809+526;
P(760, 8) = 1728*526+525;
P(760, 9) = 1728*525+520;
P(761, 0) = 1728*524+525;
P(761, 1) = 1728*525+526;
P(761, 2) = 1728*526+809;
P(761, 3) = 1728*809+808;
P(761, 4) = 1728*808+813;
P(761, 5) = 1728*813+812;
P(761, 6) = 1728*812+763;
P(761, 7) = 1728*763+762;
P(761, 8) = 1728*762+527;
P(761, 9) = 1728*527+524;
P(762, 0) = 1728*528+529;
P(762, 1) = 1728*529+530;
P(762, 2) = 1728*530+531;
P(762, 3) = 1728*531+568;
P(762, 4) = 1728*568+573;
P(762, 5) = 1728*573+574;
P(762, 6) = 1728*574+535;
P(762, 7) = 1728*535+532;
P(762, 8) = 1728*532+533;
P(762, 9) = 1728*533+528;
P(763, 0) = 1728*528+533;
P(763, 1) = 1728*533+534;
P(763, 2) = 1728*534+543;
P(763, 3) = 1728*543+540;
P(763, 4) = 1728*540+541;
P(763, 5) = 1728*541+536;
P(763, 6) = 1728*536+537;
P(763, 7) = 1728*537+538;
P(763, 8) = 1728*538+539;
P(763, 9) = 1728*539+528;
P(764, 0) = 1728*532+533;
P(764, 1) = 1728*533+534;
P(764, 2) = 1728*534+543;
P(764, 3) = 1728*543+778;
P(764, 4) = 1728*778+779;
P(764, 5) = 1728*779+768;
P(764, 6) = 1728*768+769;
P(764, 7) = 1728*769+770;
P(764, 8) = 1728*770+535;
P(764, 9) = 1728*535+532;
P(765, 0) = 1728*532+533;
P(765, 1) = 1728*533+534;
P(765, 2) = 1728*534+817;
P(765, 3) = 1728*817+816;
P(765, 4) = 1728*816+821;
P(765, 5) = 1728*821+820;
P(765, 6) = 1728*820+771;
P(765, 7) = 1728*771+770;
P(765, 8) = 1728*770+535;
P(765, 9) = 1728*535+532;
P(766, 0) = 1728*532+533;
P(766, 1) = 1728*533+534;
P(766, 2) = 1728*534+817;
P(766, 3) = 1728*817+818;
P(766, 4) = 1728*818+819;
P(766, 5) = 1728*819+856;
P(766, 6) = 1728*856+857;
P(766, 7) = 1728*857+574;
P(766, 8) = 1728*574+535;
P(766, 9) = 1728*535+532;
P(767, 0) = 1728*534+543;
P(767, 1) = 1728*543+540;
P(767, 2) = 1728*540+541;
P(767, 3) = 1728*541+542;
P(767, 4) = 1728*542+825;
P(767, 5) = 1728*825+826;
P(767, 6) = 1728*826+827;
P(767, 7) = 1728*827+816;
P(767, 8) = 1728*816+817;
P(767, 9) = 1728*817+534;
P(768, 0) = 1728*534+543;
P(768, 1) = 1728*543+778;
P(768, 2) = 1728*778+779;
P(768, 3) = 1728*779+828;
P(768, 4) = 1728*828+831;
P(768, 5) = 1728*831+822;
P(768, 6) = 1728*822+821;
P(768, 7) = 1728*821+816;
P(768, 8) = 1728*816+817;
P(768, 9) = 1728*817+534;
P(769, 0) = 1728*535+574;
P(769, 1) = 1728*574+573;
P(769, 2) = 1728*573+572;
P(769, 3) = 1728*572+575;
P(769, 4) = 1728*575+810;
P(769, 5) = 1728*810+809;
P(769, 6) = 1728*809+808;
P(769, 7) = 1728*808+771;
P(769, 8) = 1728*771+770;
P(769, 9) = 1728*770+535;
P(770, 0) = 1728*535+574;
P(770, 1) = 1728*574+857;
P(770, 2) = 1728*857+856;
P(770, 3) = 1728*856+861;
P(770, 4) = 1728*861+862;
P(770, 5) = 1728*862+823;
P(770, 6) = 1728*823+820;
P(770, 7) = 1728*820+771;
P(770, 8) = 1728*771+770;
P(770, 9) = 1728*770+535;
P(771, 0) = 1728*536+541;
P(771, 1) = 1728*541+542;
P(771, 2) = 1728*542+551;
P(771, 3) = 1728*551+548;
P(771, 4) = 1728*548+549;
P(771, 5) = 1728*549+544;
P(771, 6) = 1728*544+545;
P(771, 7) = 1728*545+546;
P(771, 8) = 1728*546+547;
P(771, 9) = 1728*547+536;
P(772, 0) = 1728*540+541;
P(772, 1) = 1728*541+542;
P(772, 2) = 1728*542+551;
P(772, 3) = 1728*551+786;
P(772, 4) = 1728*786+787;
P(772, 5) = 1728*787+776;
P(772, 6) = 1728*776+777;
P(772, 7) = 1728*777+778;
P(772, 8) = 1728*778+543;
P(772, 9) = 1728*543+540;
P(773, 0) = 1728*540+541;
P(773, 1) = 1728*541+542;
P(773, 2) = 1728*542+825;
P(773, 3) = 1728*825+824;
P(773, 4) = 1728*824+829;
P(773, 5) = 1728*829+828;
P(773, 6) = 1728*828+779;
P(773, 7) = 1728*779+778;
P(773, 8) = 1728*778+543;
P(773, 9) = 1728*543+540;
P(774, 0) = 1728*542+551;
P(774, 1) = 1728*551+548;
P(774, 2) = 1728*548+549;
P(774, 3) = 1728*549+550;
P(774, 4) = 1728*550+833;
P(774, 5) = 1728*833+834;
P(774, 6) = 1728*834+835;
P(774, 7) = 1728*835+824;
P(774, 8) = 1728*824+825;
P(774, 9) = 1728*825+542;
P(775, 0) = 1728*542+551;
P(775, 1) = 1728*551+786;
P(775, 2) = 1728*786+787;
P(775, 3) = 1728*787+836;
P(775, 4) = 1728*836+839;
P(775, 5) = 1728*839+830;
P(775, 6) = 1728*830+829;
P(775, 7) = 1728*829+824;
P(775, 8) = 1728*824+825;
P(775, 9) = 1728*825+542;
P(776, 0) = 1728*544+549;
P(776, 1) = 1728*549+550;
P(776, 2) = 1728*550+559;
P(776, 3) = 1728*559+556;
P(776, 4) = 1728*556+557;
P(776, 5) = 1728*557+552;
P(776, 6) = 1728*552+553;
P(776, 7) = 1728*553+554;
P(776, 8) = 1728*554+555;
P(776, 9) = 1728*555+544;
P(777, 0) = 1728*548+549;
P(777, 1) = 1728*549+550;
P(777, 2) = 1728*550+559;
P(777, 3) = 1728*559+794;
P(777, 4) = 1728*794+795;
P(777, 5) = 1728*795+784;
P(777, 6) = 1728*784+785;
P(777, 7) = 1728*785+786;
P(777, 8) = 1728*786+551;
P(777, 9) = 1728*551+548;
P(778, 0) = 1728*548+549;
P(778, 1) = 1728*549+550;
P(778, 2) = 1728*550+833;
P(778, 3) = 1728*833+832;
P(778, 4) = 1728*832+837;
P(778, 5) = 1728*837+836;
P(778, 6) = 1728*836+787;
P(778, 7) = 1728*787+786;
P(778, 8) = 1728*786+551;
P(778, 9) = 1728*551+548;
P(779, 0) = 1728*550+559;
P(779, 1) = 1728*559+556;
P(779, 2) = 1728*556+557;
P(779, 3) = 1728*557+558;
P(779, 4) = 1728*558+841;
P(779, 5) = 1728*841+842;
P(779, 6) = 1728*842+843;
P(779, 7) = 1728*843+832;
P(779, 8) = 1728*832+833;
P(779, 9) = 1728*833+550;
P(780, 0) = 1728*550+559;
P(780, 1) = 1728*559+794;
P(780, 2) = 1728*794+795;
P(780, 3) = 1728*795+844;
P(780, 4) = 1728*844+847;
P(780, 5) = 1728*847+838;
P(780, 6) = 1728*838+837;
P(780, 7) = 1728*837+832;
P(780, 8) = 1728*832+833;
P(780, 9) = 1728*833+550;
P(781, 0) = 1728*552+557;
P(781, 1) = 1728*557+558;
P(781, 2) = 1728*558+567;
P(781, 3) = 1728*567+564;
P(781, 4) = 1728*564+565;
P(781, 5) = 1728*565+560;
P(781, 6) = 1728*560+561;
P(781, 7) = 1728*561+562;
P(781, 8) = 1728*562+563;
P(781, 9) = 1728*563+552;
P(782, 0) = 1728*556+557;
P(782, 1) = 1728*557+558;
P(782, 2) = 1728*558+567;
P(782, 3) = 1728*567+802;
P(782, 4) = 1728*802+803;
P(782, 5) = 1728*803+792;
P(782, 6) = 1728*792+793;
P(782, 7) = 1728*793+794;
P(782, 8) = 1728*794+559;
P(782, 9) = 1728*559+556;
P(783, 0) = 1728*556+557;
P(783, 1) = 1728*557+558;
P(783, 2) = 1728*558+841;
P(783, 3) = 1728*841+840;
P(783, 4) = 1728*840+845;
P(783, 5) = 1728*845+844;
P(783, 6) = 1728*844+795;
P(783, 7) = 1728*795+794;
P(783, 8) = 1728*794+559;
P(783, 9) = 1728*559+556;
P(784, 0) = 1728*558+567;
P(784, 1) = 1728*567+564;
P(784, 2) = 1728*564+565;
P(784, 3) = 1728*565+566;
P(784, 4) = 1728*566+849;
P(784, 5) = 1728*849+850;
P(784, 6) = 1728*850+851;
P(784, 7) = 1728*851+840;
P(784, 8) = 1728*840+841;
P(784, 9) = 1728*841+558;
P(785, 0) = 1728*558+567;
P(785, 1) = 1728*567+802;
P(785, 2) = 1728*802+803;
P(785, 3) = 1728*803+852;
P(785, 4) = 1728*852+855;
P(785, 5) = 1728*855+846;
P(785, 6) = 1728*846+845;
P(785, 7) = 1728*845+840;
P(785, 8) = 1728*840+841;
P(785, 9) = 1728*841+558;
P(786, 0) = 1728*560+565;
P(786, 1) = 1728*565+566;
P(786, 2) = 1728*566+575;
P(786, 3) = 1728*575+572;
P(786, 4) = 1728*572+573;
P(786, 5) = 1728*573+568;
P(786, 6) = 1728*568+569;
P(786, 7) = 1728*569+570;
P(786, 8) = 1728*570+571;
P(786, 9) = 1728*571+560;
P(787, 0) = 1728*564+565;
P(787, 1) = 1728*565+566;
P(787, 2) = 1728*566+575;
P(787, 3) = 1728*575+810;
P(787, 4) = 1728*810+811;
P(787, 5) = 1728*811+800;
P(787, 6) = 1728*800+801;
P(787, 7) = 1728*801+802;
P(787, 8) = 1728*802+567;
P(787, 9) = 1728*567+564;
P(788, 0) = 1728*564+565;
P(788, 1) = 1728*565+566;
P(788, 2) = 1728*566+849;
P(788, 3) = 1728*849+848;
P(788, 4) = 1728*848+853;
P(788, 5) = 1728*853+852;
P(788, 6) = 1728*852+803;
P(788, 7) = 1728*803+802;
P(788, 8) = 1728*802+567;
P(788, 9) = 1728*567+564;
P(789, 0) = 1728*566+575;
P(789, 1) = 1728*575+572;
P(789, 2) = 1728*572+573;
P(789, 3) = 1728*573+574;
P(789, 4) = 1728*574+857;
P(789, 5) = 1728*857+858;
P(789, 6) = 1728*858+859;
P(789, 7) = 1728*859+848;
P(789, 8) = 1728*848+849;
P(789, 9) = 1728*849+566;
P(790, 0) = 1728*566+575;
P(790, 1) = 1728*575+810;
P(790, 2) = 1728*810+811;
P(790, 3) = 1728*811+860;
P(790, 4) = 1728*860+863;
P(790, 5) = 1728*863+854;
P(790, 6) = 1728*854+853;
P(790, 7) = 1728*853+848;
P(790, 8) = 1728*848+849;
P(790, 9) = 1728*849+566;
P(791, 0) = 1728*572+573;
P(791, 1) = 1728*573+574;
P(791, 2) = 1728*574+857;
P(791, 3) = 1728*857+856;
P(791, 4) = 1728*856+861;
P(791, 5) = 1728*861+860;
P(791, 6) = 1728*860+811;
P(791, 7) = 1728*811+810;
P(791, 8) = 1728*810+575;
P(791, 9) = 1728*575+572;
P(792, 0) = 1728*576+577;
P(792, 1) = 1728*577+578;
P(792, 2) = 1728*578+579;
P(792, 3) = 1728*579+628;
P(792, 4) = 1728*628+629;
P(792, 5) = 1728*629+630;
P(792, 6) = 1728*630+639;
P(792, 7) = 1728*639+636;
P(792, 8) = 1728*636+587;
P(792, 9) = 1728*587+576;
P(793, 0) = 1728*576+577;
P(793, 1) = 1728*577+578;
P(793, 2) = 1728*578+579;
P(793, 3) = 1728*579+628;
P(793, 4) = 1728*628+631;
P(793, 5) = 1728*631+866;
P(793, 6) = 1728*866+865;
P(793, 7) = 1728*865+582;
P(793, 8) = 1728*582+581;
P(793, 9) = 1728*581+576;
P(794, 0) = 1728*576+577;
P(794, 1) = 1728*577+578;
P(794, 2) = 1728*578+579;
P(794, 3) = 1728*579+616;
P(794, 4) = 1728*616+621;
P(794, 5) = 1728*621+622;
P(794, 6) = 1728*622+583;
P(794, 7) = 1728*583+580;
P(794, 8) = 1728*580+581;
P(794, 9) = 1728*581+576;
P(795, 0) = 1728*576+581;
P(795, 1) = 1728*581+582;
P(795, 2) = 1728*582+591;
P(795, 3) = 1728*591+588;
P(795, 4) = 1728*588+589;
P(795, 5) = 1728*589+584;
P(795, 6) = 1728*584+585;
P(795, 7) = 1728*585+586;
P(795, 8) = 1728*586+587;
P(795, 9) = 1728*587+576;
P(796, 0) = 1728*576+581;
P(796, 1) = 1728*581+582;
P(796, 2) = 1728*582+865;
P(796, 3) = 1728*865+864;
P(796, 4) = 1728*864+875;
P(796, 5) = 1728*875+874;
P(796, 6) = 1728*874+639;
P(796, 7) = 1728*639+636;
P(796, 8) = 1728*636+587;
P(796, 9) = 1728*587+576;
P(797, 0) = 1728*579+628;
P(797, 1) = 1728*628+631;
P(797, 2) = 1728*631+670;
P(797, 3) = 1728*670+669;
P(797, 4) = 1728*669+668;
P(797, 5) = 1728*668+619;
P(797, 6) = 1728*619+618;
P(797, 7) = 1728*618+617;
P(797, 8) = 1728*617+616;
P(797, 9) = 1728*616+579;
P(798, 0) = 1728*579+628;
P(798, 1) = 1728*628+631;
P(798, 2) = 1728*631+866;
P(798, 3) = 1728*866+867;
P(798, 4) = 1728*867+904;
P(798, 5) = 1728*904+905;
P(798, 6) = 1728*905+622;
P(798, 7) = 1728*622+621;
P(798, 8) = 1728*621+616;
P(798, 9) = 1728*616+579;
P(799, 0) = 1728*580+581;
P(799, 1) = 1728*581+582;
P(799, 2) = 1728*582+591;
P(799, 3) = 1728*591+588;
P(799, 4) = 1728*588+827;
P(799, 5) = 1728*827+816;
P(799, 6) = 1728*816+817;
P(799, 7) = 1728*817+818;
P(799, 8) = 1728*818+819;
P(799, 9) = 1728*819+580;
P(800, 0) = 1728*580+581;
P(800, 1) = 1728*581+582;
P(800, 2) = 1728*582+591;
P(800, 3) = 1728*591+1114;
P(800, 4) = 1728*1114+1115;
P(800, 5) = 1728*1115+1104;
P(800, 6) = 1728*1104+1105;
P(800, 7) = 1728*1105+1106;
P(800, 8) = 1728*1106+583;
P(800, 9) = 1728*583+580;
P(801, 0) = 1728*580+581;
P(801, 1) = 1728*581+582;
P(801, 2) = 1728*582+865;
P(801, 3) = 1728*865+864;
P(801, 4) = 1728*864+869;
P(801, 5) = 1728*869+868;
P(801, 6) = 1728*868+1107;
P(801, 7) = 1728*1107+1106;
P(801, 8) = 1728*1106+583;
P(801, 9) = 1728*583+580;
P(802, 0) = 1728*580+581;
P(802, 1) = 1728*581+582;
P(802, 2) = 1728*582+865;
P(802, 3) = 1728*865+866;
P(802, 4) = 1728*866+867;
P(802, 5) = 1728*867+904;
P(802, 6) = 1728*904+905;
P(802, 7) = 1728*905+622;
P(802, 8) = 1728*622+583;
P(802, 9) = 1728*583+580;
P(803, 0) = 1728*580+819;
P(803, 1) = 1728*819+818;
P(803, 2) = 1728*818+817;
P(803, 3) = 1728*817+816;
P(803, 4) = 1728*816+821;
P(803, 5) = 1728*821+822;
P(803, 6) = 1728*822+1105;
P(803, 7) = 1728*1105+1106;
P(803, 8) = 1728*1106+583;
P(803, 9) = 1728*583+580;
P(804, 0) = 1728*580+819;
P(804, 1) = 1728*819+856;
P(804, 2) = 1728*856+857;
P(804, 3) = 1728*857+858;
P(804, 4) = 1728*858+859;
P(804, 5) = 1728*859+620;
P(804, 6) = 1728*620+621;
P(804, 7) = 1728*621+622;
P(804, 8) = 1728*622+583;
P(804, 9) = 1728*583+580;
P(805, 0) = 1728*580+819;
P(805, 1) = 1728*819+856;
P(805, 2) = 1728*856+861;
P(805, 3) = 1728*861+862;
P(805, 4) = 1728*862+1145;
P(805, 5) = 1728*1145+1144;
P(805, 6) = 1728*1144+1107;
P(805, 7) = 1728*1107+1106;
P(805, 8) = 1728*1106+583;
P(805, 9) = 1728*583+580;
P(806, 0) = 1728*582+591;
P(806, 1) = 1728*591+588;
P(806, 2) = 1728*588+589;
P(806, 3) = 1728*589+590;
P(806, 4) = 1728*590+873;
P(806, 5) = 1728*873+874;
P(806, 6) = 1728*874+875;
P(806, 7) = 1728*875+864;
P(806, 8) = 1728*864+865;
P(806, 9) = 1728*865+582;
P(807, 0) = 1728*582+591;
P(807, 1) = 1728*591+1114;
P(807, 2) = 1728*1114+1115;
P(807, 3) = 1728*1115+876;
P(807, 4) = 1728*876+879;
P(807, 5) = 1728*879+870;
P(807, 6) = 1728*870+869;
P(807, 7) = 1728*869+864;
P(807, 8) = 1728*864+865;
P(807, 9) = 1728*865+582;
P(808, 0) = 1728*583+622;
P(808, 1) = 1728*622+621;
P(808, 2) = 1728*621+620;
P(808, 3) = 1728*620+623;
P(808, 4) = 1728*623+1146;
P(808, 5) = 1728*1146+1145;
P(808, 6) = 1728*1145+1144;
P(808, 7) = 1728*1144+1107;
P(808, 8) = 1728*1107+1106;
P(808, 9) = 1728*1106+583;
P(809, 0) = 1728*583+622;
P(809, 1) = 1728*622+905;
P(809, 2) = 1728*905+904;
P(809, 3) = 1728*904+909;
P(809, 4) = 1728*909+910;
P(809, 5) = 1728*910+871;
P(809, 6) = 1728*871+868;
P(809, 7) = 1728*868+1107;
P(809, 8) = 1728*1107+1106;
P(809, 9) = 1728*1106+583;
P(810, 0) = 1728*584+585;
P(810, 1) = 1728*585+586;
P(810, 2) = 1728*586+587;
P(810, 3) = 1728*587+636;
P(810, 4) = 1728*636+637;
P(810, 5) = 1728*637+638;
P(810, 6) = 1728*638+647;
P(810, 7) = 1728*647+644;
P(810, 8) = 1728*644+595;
P(810, 9) = 1728*595+584;
P(811, 0) = 1728*584+585;
P(811, 1) = 1728*585+586;
P(811, 2) = 1728*586+587;
P(811, 3) = 1728*587+636;
P(811, 4) = 1728*636+639;
P(811, 5) = 1728*639+874;
P(811, 6) = 1728*874+873;
P(811, 7) = 1728*873+590;
P(811, 8) = 1728*590+589;
P(811, 9) = 1728*589+584;
P(812, 0) = 1728*584+589;
P(812, 1) = 1728*589+590;
P(812, 2) = 1728*590+599;
P(812, 3) = 1728*599+596;
P(812, 4) = 1728*596+597;
P(812, 5) = 1728*597+592;
P(812, 6) = 1728*592+593;
P(812, 7) = 1728*593+594;
P(812, 8) = 1728*594+595;
P(812, 9) = 1728*595+584;
P(813, 0) = 1728*584+589;
P(813, 1) = 1728*589+590;
P(813, 2) = 1728*590+873;
P(813, 3) = 1728*873+872;
P(813, 4) = 1728*872+883;
P(813, 5) = 1728*883+882;
P(813, 6) = 1728*882+647;
P(813, 7) = 1728*647+644;
P(813, 8) = 1728*644+595;
P(813, 9) = 1728*595+584;
P(814, 0) = 1728*588+589;
P(814, 1) = 1728*589+590;
P(814, 2) = 1728*590+599;
P(814, 3) = 1728*599+596;
P(814, 4) = 1728*596+835;
P(814, 5) = 1728*835+824;
P(814, 6) = 1728*824+825;
P(814, 7) = 1728*825+826;
P(814, 8) = 1728*826+827;
P(814, 9) = 1728*827+588;
P(815, 0) = 1728*588+589;
P(815, 1) = 1728*589+590;
P(815, 2) = 1728*590+599;
P(815, 3) = 1728*599+1122;
P(815, 4) = 1728*1122+1123;
P(815, 5) = 1728*1123+1112;
P(815, 6) = 1728*1112+1113;
P(815, 7) = 1728*1113+1114;
P(815, 8) = 1728*1114+591;
P(815, 9) = 1728*591+588;
P(816, 0) = 1728*588+589;
P(816, 1) = 1728*589+590;
P(816, 2) = 1728*590+873;
P(816, 3) = 1728*873+872;
P(816, 4) = 1728*872+877;
P(816, 5) = 1728*877+876;
P(816, 6) = 1728*876+1115;
P(816, 7) = 1728*1115+1114;
P(816, 8) = 1728*1114+591;
P(816, 9) = 1728*591+588;
P(817, 0) = 1728*588+827;
P(817, 1) = 1728*827+826;
P(817, 2) = 1728*826+825;
P(817, 3) = 1728*825+824;
P(817, 4) = 1728*824+829;
P(817, 5) = 1728*829+830;
P(817, 6) = 1728*830+1113;
P(817, 7) = 1728*1113+1114;
P(817, 8) = 1728*1114+591;
P(817, 9) = 1728*591+588;
P(818, 0) = 1728*588+827;
P(818, 1) = 1728*827+816;
P(818, 2) = 1728*816+821;
P(818, 3) = 1728*821+822;
P(818, 4) = 1728*822+1105;
P(818, 5) = 1728*1105+1104;
P(818, 6) = 1728*1104+1115;
P(818, 7) = 1728*1115+1114;
P(818, 8) = 1728*1114+591;
P(818, 9) = 1728*591+588;
P(819, 0) = 1728*590+599;
P(819, 1) = 1728*599+596;
P(819, 2) = 1728*596+597;
P(819, 3) = 1728*597+598;
P(819, 4) = 1728*598+881;
P(819, 5) = 1728*881+882;
P(819, 6) = 1728*882+883;
P(819, 7) = 1728*883+872;
P(819, 8) = 1728*872+873;
P(819, 9) = 1728*873+590;
P(820, 0) = 1728*590+599;
P(820, 1) = 1728*599+1122;
P(820, 2) = 1728*1122+1123;
P(820, 3) = 1728*1123+884;
P(820, 4) = 1728*884+887;
P(820, 5) = 1728*887+878;
P(820, 6) = 1728*878+877;
P(820, 7) = 1728*877+872;
P(820, 8) = 1728*872+873;
P(820, 9) = 1728*873+590;
P(821, 0) = 1728*592+593;
P(821, 1) = 1728*593+594;
P(821, 2) = 1728*594+595;
P(821, 3) = 1728*595+644;
P(821, 4) = 1728*644+645;
P(821, 5) = 1728*645+646;
P(821, 6) = 1728*646+655;
P(821, 7) = 1728*655+652;
P(821, 8) = 1728*652+603;
P(821, 9) = 1728*603+592;
P(822, 0) = 1728*592+593;
P(822, 1) = 1728*593+594;
P(822, 2) = 1728*594+595;
P(822, 3) = 1728*595+644;
P(822, 4) = 1728*644+647;
P(822, 5) = 1728*647+882;
P(822, 6) = 1728*882+881;
P(822, 7) = 1728*881+598;
P(822, 8) = 1728*598+597;
P(822, 9) = 1728*597+592;
P(823, 0) = 1728*592+597;
P(823, 1) = 1728*597+598;
P(823, 2) = 1728*598+607;
P(823, 3) = 1728*607+604;
P(823, 4) = 1728*604+605;
P(823, 5) = 1728*605+600;
P(823, 6) = 1728*600+601;
P(823, 7) = 1728*601+602;
P(823, 8) = 1728*602+603;
P(823, 9) = 1728*603+592;
P(824, 0) = 1728*592+597;
P(824, 1) = 1728*597+598;
P(824, 2) = 1728*598+881;
P(824, 3) = 1728*881+880;
P(824, 4) = 1728*880+891;
P(824, 5) = 1728*891+890;
P(824, 6) = 1728*890+655;
P(824, 7) = 1728*655+652;
P(824, 8) = 1728*652+603;
P(824, 9) = 1728*603+592;
P(825, 0) = 1728*596+597;
P(825, 1) = 1728*597+598;
P(825, 2) = 1728*598+607;
P(825, 3) = 1728*607+604;
P(825, 4) = 1728*604+843;
P(825, 5) = 1728*843+832;
P(825, 6) = 1728*832+833;
P(825, 7) = 1728*833+834;
P(825, 8) = 1728*834+835;
P(825, 9) = 1728*835+596;
P(826, 0) = 1728*596+597;
P(826, 1) = 1728*597+598;
P(826, 2) = 1728*598+607;
P(826, 3) = 1728*607+1130;
P(826, 4) = 1728*1130+1131;
P(826, 5) = 1728*1131+1120;
P(826, 6) = 1728*1120+1121;
P(826, 7) = 1728*1121+1122;
P(826, 8) = 1728*1122+599;
P(826, 9) = 1728*599+596;
P(827, 0) = 1728*596+597;
P(827, 1) = 1728*597+598;
P(827, 2) = 1728*598+881;
P(827, 3) = 1728*881+880;
P(827, 4) = 1728*880+885;
P(827, 5) = 1728*885+884;
P(827, 6) = 1728*884+1123;
P(827, 7) = 1728*1123+1122;
P(827, 8) = 1728*1122+599;
P(827, 9) = 1728*599+596;
P(828, 0) = 1728*596+835;
P(828, 1) = 1728*835+834;
P(828, 2) = 1728*834+833;
P(828, 3) = 1728*833+832;
P(828, 4) = 1728*832+837;
P(828, 5) = 1728*837+838;
P(828, 6) = 1728*838+1121;
P(828, 7) = 1728*1121+1122;
P(828, 8) = 1728*1122+599;
P(828, 9) = 1728*599+596;
P(829, 0) = 1728*596+835;
P(829, 1) = 1728*835+824;
P(829, 2) = 1728*824+829;
P(829, 3) = 1728*829+830;
P(829, 4) = 1728*830+1113;
P(829, 5) = 1728*1113+1112;
P(829, 6) = 1728*1112+1123;
P(829, 7) = 1728*1123+1122;
P(829, 8) = 1728*1122+599;
P(829, 9) = 1728*599+596;
P(830, 0) = 1728*598+607;
P(830, 1) = 1728*607+604;
P(830, 2) = 1728*604+605;
P(830, 3) = 1728*605+606;
P(830, 4) = 1728*606+889;
P(830, 5) = 1728*889+890;
P(830, 6) = 1728*890+891;
P(830, 7) = 1728*891+880;
P(830, 8) = 1728*880+881;
P(830, 9) = 1728*881+598;
P(831, 0) = 1728*598+607;
P(831, 1) = 1728*607+1130;
P(831, 2) = 1728*1130+1131;
P(831, 3) = 1728*1131+892;
P(831, 4) = 1728*892+895;
P(831, 5) = 1728*895+886;
P(831, 6) = 1728*886+885;
P(831, 7) = 1728*885+880;
P(831, 8) = 1728*880+881;
P(831, 9) = 1728*881+598;
P(832, 0) = 1728*600+601;
P(832, 1) = 1728*601+602;
P(832, 2) = 1728*602+603;
P(832, 3) = 1728*603+652;
P(832, 4) = 1728*652+653;
P(832, 5) = 1728*653+654;
P(832, 6) = 1728*654+663;
P(832, 7) = 1728*663+660;
P(832, 8) = 1728*660+611;
P(832, 9) = 1728*611+600;
P(833, 0) = 1728*600+601;
P(833, 1) = 1728*601+602;
P(833, 2) = 1728*602+603;
P(833, 3) = 1728*603+652;
P(833, 4) = 1728*652+655;
P(833, 5) = 1728*655+890;
P(833, 6) = 1728*890+889;
P(833, 7) = 1728*889+606;
P(833, 8) = 1728*606+605;
P(833, 9) = 1728*605+600;
P(834, 0) = 1728*600+605;
P(834, 1) = 1728*605+606;
P(834, 2) = 1728*606+615;
P(834, 3) = 1728*615+612;
P(834, 4) = 1728*612+613;
P(834, 5) = 1728*613+608;
P(834, 6) = 1728*608+609;
P(834, 7) = 1728*609+610;
P(834, 8) = 1728*610+611;
P(834, 9) = 1728*611+600;
P(835, 0) = 1728*600+605;
P(835, 1) = 1728*605+606;
P(835, 2) = 1728*606+889;
P(835, 3) = 1728*889+888;
P(835, 4) = 1728*888+899;
P(835, 5) = 1728*899+898;
P(835, 6) = 1728*898+663;
P(835, 7) = 1728*663+660;
P(835, 8) = 1728*660+611;
P(835, 9) = 1728*611+600;
P(836, 0) = 1728*604+605;
P(836, 1) = 1728*605+606;
P(836, 2) = 1728*606+615;
P(836, 3) = 1728*615+612;
P(836, 4) = 1728*612+851;
P(836, 5) = 1728*851+840;
P(836, 6) = 1728*840+841;
P(836, 7) = 1728*841+842;
P(836, 8) = 1728*842+843;
P(836, 9) = 1728*843+604;
P(837, 0) = 1728*604+605;
P(837, 1) = 1728*605+606;
P(837, 2) = 1728*606+615;
P(837, 3) = 1728*615+1138;
P(837, 4) = 1728*1138+1139;
P(837, 5) = 1728*1139+1128;
P(837, 6) = 1728*1128+1129;
P(837, 7) = 1728*1129+1130;
P(837, 8) = 1728*1130+607;
P(837, 9) = 1728*607+604;
P(838, 0) = 1728*604+605;
P(838, 1) = 1728*605+606;
P(838, 2) = 1728*606+889;
P(838, 3) = 1728*889+888;
P(838, 4) = 1728*888+893;
P(838, 5) = 1728*893+892;
P(838, 6) = 1728*892+1131;
P(838, 7) = 1728*1131+1130;
P(838, 8) = 1728*1130+607;
P(838, 9) = 1728*607+604;
P(839, 0) = 1728*604+843;
P(839, 1) = 1728*843+842;
P(839, 2) = 1728*842+841;
P(839, 3) = 1728*841+840;
P(839, 4) = 1728*840+845;
P(839, 5) = 1728*845+846;
P(839, 6) = 1728*846+1129;
P(839, 7) = 1728*1129+1130;
P(839, 8) = 1728*1130+607;
P(839, 9) = 1728*607+604;
P(840, 0) = 1728*604+843;
P(840, 1) = 1728*843+832;
P(840, 2) = 1728*832+837;
P(840, 3) = 1728*837+838;
P(840, 4) = 1728*838+1121;
P(840, 5) = 1728*1121+1120;
P(840, 6) = 1728*1120+1131;
P(840, 7) = 1728*1131+1130;
P(840, 8) = 1728*1130+607;
P(840, 9) = 1728*607+604;
P(841, 0) = 1728*606+615;
P(841, 1) = 1728*615+612;
P(841, 2) = 1728*612+613;
P(841, 3) = 1728*613+614;
P(841, 4) = 1728*614+897;
P(841, 5) = 1728*897+898;
P(841, 6) = 1728*898+899;
P(841, 7) = 1728*899+888;
P(841, 8) = 1728*888+889;
P(841, 9) = 1728*889+606;
P(842, 0) = 1728*606+615;
P(842, 1) = 1728*615+1138;
P(842, 2) = 1728*1138+1139;
P(842, 3) = 1728*1139+900;
P(842, 4) = 1728*900+903;
P(842, 5) = 1728*903+894;
P(842, 6) = 1728*894+893;
P(842, 7) = 1728*893+888;
P(842, 8) = 1728*888+889;
P(842, 9) = 1728*889+606;
P(843, 0) = 1728*608+609;
P(843, 1) = 1728*609+610;
P(843, 2) = 1728*610+611;
P(843, 3) = 1728*611+660;
P(843, 4) = 1728*660+661;
P(843, 5) = 1728*661+662;
P(843, 6) = 1728*662+671;
P(843, 7) = 1728*671+668;
P(843, 8) = 1728*668+619;
P(843, 9) = 1728*619+608;
P(844, 0) = 1728*608+609;
P(844, 1) = 1728*609+610;
P(844, 2) = 1728*610+611;
P(844, 3) = 1728*611+660;
P(844, 4) = 1728*660+663;
P(844, 5) = 1728*663+898;
P(844, 6) = 1728*898+897;
P(844, 7) = 1728*897+614;
P(844, 8) = 1728*614+613;
P(844, 9) = 1728*613+608;
P(845, 0) = 1728*608+613;
P(845, 1) = 1728*613+614;
P(845, 2) = 1728*614+623;
P(845, 3) = 1728*623+620;
P(845, 4) = 1728*620+621;
P(845, 5) = 1728*621+616;
P(845, 6) = 1728*616+617;
P(845, 7) = 1728*617+618;
P(845, 8) = 1728*618+619;
P(845, 9) = 1728*619+608;
P(846, 0) = 1728*608+613;
P(846, 1) = 1728*613+614;
P(846, 2) = 1728*614+897;
P(846, 3) = 1728*897+896;
P(846, 4) = 1728*896+907;
P(846, 5) = 1728*907+906;
P(846, 6) = 1728*906+671;
P(846, 7) = 1728*671+668;
P(846, 8) = 1728*668+619;
P(846, 9) = 1728*619+608;
P(847, 0) = 1728*612+613;
P(847, 1) = 1728*613+614;
P(847, 2) = 1728*614+623;
P(847, 3) = 1728*623+620;
P(847, 4) = 1728*620+859;
P(847, 5) = 1728*859+848;
P(847, 6) = 1728*848+849;
P(847, 7) = 1728*849+850;
P(847, 8) = 1728*850+851;
P(847, 9) = 1728*851+612;
P(848, 0) = 1728*612+613;
P(848, 1) = 1728*613+614;
P(848, 2) = 1728*614+623;
P(848, 3) = 1728*623+1146;
P(848, 4) = 1728*1146+1147;
P(848, 5) = 1728*1147+1136;
P(848, 6) = 1728*1136+1137;
P(848, 7) = 1728*1137+1138;
P(848, 8) = 1728*1138+615;
P(848, 9) = 1728*615+612;
P(849, 0) = 1728*612+613;
P(849, 1) = 1728*613+614;
P(849, 2) = 1728*614+897;
P(849, 3) = 1728*897+896;
P(849, 4) = 1728*896+901;
P(849, 5) = 1728*901+900;
P(849, 6) = 1728*900+1139;
P(849, 7) = 1728*1139+1138;
P(849, 8) = 1728*1138+615;
P(849, 9) = 1728*615+612;
P(850, 0) = 1728*612+851;
P(850, 1) = 1728*851+850;
P(850, 2) = 1728*850+849;
P(850, 3) = 1728*849+848;
P(850, 4) = 1728*848+853;
P(850, 5) = 1728*853+854;
P(850, 6) = 1728*854+1137;
P(850, 7) = 1728*1137+1138;
P(850, 8) = 1728*1138+615;
P(850, 9) = 1728*615+612;
P(851, 0) = 1728*612+851;
P(851, 1) = 1728*851+840;
P(851, 2) = 1728*840+845;
P(851, 3) = 1728*845+846;
P(851, 4) = 1728*846+1129;
P(851, 5) = 1728*1129+1128;
P(851, 6) = 1728*1128+1139;
P(851, 7) = 1728*1139+1138;
P(851, 8) = 1728*1138+615;
P(851, 9) = 1728*615+612;
P(852, 0) = 1728*614+623;
P(852, 1) = 1728*623+620;
P(852, 2) = 1728*620+621;
P(852, 3) = 1728*621+622;
P(852, 4) = 1728*622+905;
P(852, 5) = 1728*905+906;
P(852, 6) = 1728*906+907;
P(852, 7) = 1728*907+896;
P(852, 8) = 1728*896+897;
P(852, 9) = 1728*897+614;
P(853, 0) = 1728*614+623;
P(853, 1) = 1728*623+1146;
P(853, 2) = 1728*1146+1147;
P(853, 3) = 1728*1147+908;
P(853, 4) = 1728*908+911;
P(853, 5) = 1728*911+902;
P(853, 6) = 1728*902+901;
P(853, 7) = 1728*901+896;
P(853, 8) = 1728*896+897;
P(853, 9) = 1728*897+614;
P(854, 0) = 1728*616+617;
P(854, 1) = 1728*617+618;
P(854, 2) = 1728*618+619;
P(854, 3) = 1728*619+668;
P(854, 4) = 1728*668+671;
P(854, 5) = 1728*671+906;
P(854, 6) = 1728*906+905;
P(854, 7) = 1728*905+622;
P(854, 8) = 1728*622+621;
P(854, 9) = 1728*621+616;
P(855, 0) = 1728*620+621;
P(855, 1) = 1728*621+622;
P(855, 2) = 1728*622+905;
P(855, 3) = 1728*905+904;
P(855, 4) = 1728*904+909;
P(855, 5) = 1728*909+908;
P(855, 6) = 1728*908+1147;
P(855, 7) = 1728*1147+1146;
P(855, 8) = 1728*1146+623;
P(855, 9) = 1728*623+620;
P(856, 0) = 1728*620+859;
P(856, 1) = 1728*859+858;
P(856, 2) = 1728*858+857;
P(856, 3) = 1728*857+856;
P(856, 4) = 1728*856+861;
P(856, 5) = 1728*861+862;
P(856, 6) = 1728*862+1145;
P(856, 7) = 1728*1145+1146;
P(856, 8) = 1728*1146+623;
P(856, 9) = 1728*623+620;
P(857, 0) = 1728*620+859;
P(857, 1) = 1728*859+848;
P(857, 2) = 1728*848+853;
P(857, 3) = 1728*853+854;
P(857, 4) = 1728*854+1137;
P(857, 5) = 1728*1137+1136;
P(857, 6) = 1728*1136+1147;
P(857, 7) = 1728*1147+1146;
P(857, 8) = 1728*1146+623;
P(857, 9) = 1728*623+620;
P(858, 0) = 1728*624+625;
P(858, 1) = 1728*625+626;
P(858, 2) = 1728*626+627;
P(858, 3) = 1728*627+676;
P(858, 4) = 1728*676+677;
P(858, 5) = 1728*677+678;
P(858, 6) = 1728*678+687;
P(858, 7) = 1728*687+684;
P(858, 8) = 1728*684+635;
P(858, 9) = 1728*635+624;
P(859, 0) = 1728*624+625;
P(859, 1) = 1728*625+626;
P(859, 2) = 1728*626+627;
P(859, 3) = 1728*627+676;
P(859, 4) = 1728*676+679;
P(859, 5) = 1728*679+914;
P(859, 6) = 1728*914+913;
P(859, 7) = 1728*913+630;
P(859, 8) = 1728*630+629;
P(859, 9) = 1728*629+624;
P(860, 0) = 1728*624+625;
P(860, 1) = 1728*625+626;
P(860, 2) = 1728*626+627;
P(860, 3) = 1728*627+664;
P(860, 4) = 1728*664+669;
P(860, 5) = 1728*669+670;
P(860, 6) = 1728*670+631;
P(860, 7) = 1728*631+628;
P(860, 8) = 1728*628+629;
P(860, 9) = 1728*629+624;
P(861, 0) = 1728*624+629;
P(861, 1) = 1728*629+630;
P(861, 2) = 1728*630+639;
P(861, 3) = 1728*639+636;
P(861, 4) = 1728*636+637;
P(861, 5) = 1728*637+632;
P(861, 6) = 1728*632+633;
P(861, 7) = 1728*633+634;
P(861, 8) = 1728*634+635;
P(861, 9) = 1728*635+624;
P(862, 0) = 1728*624+629;
P(862, 1) = 1728*629+630;
P(862, 2) = 1728*630+913;
P(862, 3) = 1728*913+912;
P(862, 4) = 1728*912+923;
P(862, 5) = 1728*923+922;
P(862, 6) = 1728*922+687;
P(862, 7) = 1728*687+684;
P(862, 8) = 1728*684+635;
P(862, 9) = 1728*635+624;
P(863, 0) = 1728*627+676;
P(863, 1) = 1728*676+679;
P(863, 2) = 1728*679+718;
P(863, 3) = 1728*718+717;
P(863, 4) = 1728*717+716;
P(863, 5) = 1728*716+667;
P(863, 6) = 1728*667+666;
P(863, 7) = 1728*666+665;
P(863, 8) = 1728*665+664;
P(863, 9) = 1728*664+627;
P(864, 0) = 1728*627+676;
P(864, 1) = 1728*676+679;
P(864, 2) = 1728*679+914;
P(864, 3) = 1728*914+915;
P(864, 4) = 1728*915+952;
P(864, 5) = 1728*952+953;
P(864, 6) = 1728*953+670;
P(864, 7) = 1728*670+669;
P(864, 8) = 1728*669+664;
P(864, 9) = 1728*664+627;
P(865, 0) = 1728*628+629;
P(865, 1) = 1728*629+630;
P(865, 2) = 1728*630+639;
P(865, 3) = 1728*639+874;
P(865, 4) = 1728*874+875;
P(865, 5) = 1728*875+864;
P(865, 6) = 1728*864+865;
P(865, 7) = 1728*865+866;
P(865, 8) = 1728*866+631;
P(865, 9) = 1728*631+628;
P(866, 0) = 1728*628+629;
P(866, 1) = 1728*629+630;
P(866, 2) = 1728*630+913;
P(866, 3) = 1728*913+912;
P(866, 4) = 1728*912+917;
P(866, 5) = 1728*917+916;
P(866, 6) = 1728*916+867;
P(866, 7) = 1728*867+866;
P(866, 8) = 1728*866+631;
P(866, 9) = 1728*631+628;
P(867, 0) = 1728*628+629;
P(867, 1) = 1728*629+630;
P(867, 2) = 1728*630+913;
P(867, 3) = 1728*913+914;
P(867, 4) = 1728*914+915;
P(867, 5) = 1728*915+952;
P(867, 6) = 1728*952+953;
P(867, 7) = 1728*953+670;
P(867, 8) = 1728*670+631;
P(867, 9) = 1728*631+628;
P(868, 0) = 1728*630+639;
P(868, 1) = 1728*639+636;
P(868, 2) = 1728*636+637;
P(868, 3) = 1728*637+638;
P(868, 4) = 1728*638+921;
P(868, 5) = 1728*921+922;
P(868, 6) = 1728*922+923;
P(868, 7) = 1728*923+912;
P(868, 8) = 1728*912+913;
P(868, 9) = 1728*913+630;
P(869, 0) = 1728*630+639;
P(869, 1) = 1728*639+874;
P(869, 2) = 1728*874+875;
P(869, 3) = 1728*875+924;
P(869, 4) = 1728*924+927;
P(869, 5) = 1728*927+918;
P(869, 6) = 1728*918+917;
P(869, 7) = 1728*917+912;
P(869, 8) = 1728*912+913;
P(869, 9) = 1728*913+630;
P(870, 0) = 1728*631+670;
P(870, 1) = 1728*670+669;
P(870, 2) = 1728*669+668;
P(870, 3) = 1728*668+671;
P(870, 4) = 1728*671+906;
P(870, 5) = 1728*906+905;
P(870, 6) = 1728*905+904;
P(870, 7) = 1728*904+867;
P(870, 8) = 1728*867+866;
P(870, 9) = 1728*866+631;
P(871, 0) = 1728*631+670;
P(871, 1) = 1728*670+953;
P(871, 2) = 1728*953+952;
P(871, 3) = 1728*952+957;
P(871, 4) = 1728*957+958;
P(871, 5) = 1728*958+919;
P(871, 6) = 1728*919+916;
P(871, 7) = 1728*916+867;
P(871, 8) = 1728*867+866;
P(871, 9) = 1728*866+631;
P(872, 0) = 1728*632+633;
P(872, 1) = 1728*633+634;
P(872, 2) = 1728*634+635;
P(872, 3) = 1728*635+684;
P(872, 4) = 1728*684+685;
P(872, 5) = 1728*685+686;
P(872, 6) = 1728*686+695;
P(872, 7) = 1728*695+692;
P(872, 8) = 1728*692+643;
P(872, 9) = 1728*643+632;
P(873, 0) = 1728*632+633;
P(873, 1) = 1728*633+634;
P(873, 2) = 1728*634+635;
P(873, 3) = 1728*635+684;
P(873, 4) = 1728*684+687;
P(873, 5) = 1728*687+922;
P(873, 6) = 1728*922+921;
P(873, 7) = 1728*921+638;
P(873, 8) = 1728*638+637;
P(873, 9) = 1728*637+632;
P(874, 0) = 1728*632+637;
P(874, 1) = 1728*637+638;
P(874, 2) = 1728*638+647;
P(874, 3) = 1728*647+644;
P(874, 4) = 1728*644+645;
P(874, 5) = 1728*645+640;
P(874, 6) = 1728*640+641;
P(874, 7) = 1728*641+642;
P(874, 8) = 1728*642+643;
P(874, 9) = 1728*643+632;
P(875, 0) = 1728*632+637;
P(875, 1) = 1728*637+638;
P(875, 2) = 1728*638+921;
P(875, 3) = 1728*921+920;
P(875, 4) = 1728*920+931;
P(875, 5) = 1728*931+930;
P(875, 6) = 1728*930+695;
P(875, 7) = 1728*695+692;
P(875, 8) = 1728*692+643;
P(875, 9) = 1728*643+632;
P(876, 0) = 1728*636+637;
P(876, 1) = 1728*637+638;
P(876, 2) = 1728*638+647;
P(876, 3) = 1728*647+882;
P(876, 4) = 1728*882+883;
P(876, 5) = 1728*883+872;
P(876, 6) = 1728*872+873;
P(876, 7) = 1728*873+874;
P(876, 8) = 1728*874+639;
P(876, 9) = 1728*639+636;
P(877, 0) = 1728*636+637;
P(877, 1) = 1728*637+638;
P(877, 2) = 1728*638+921;
P(877, 3) = 1728*921+920;
P(877, 4) = 1728*920+925;
P(877, 5) = 1728*925+924;
P(877, 6) = 1728*924+875;
P(877, 7) = 1728*875+874;
P(877, 8) = 1728*874+639;
P(877, 9) = 1728*639+636;
P(878, 0) = 1728*638+647;
P(878, 1) = 1728*647+644;
P(878, 2) = 1728*644+645;
P(878, 3) = 1728*645+646;
P(878, 4) = 1728*646+929;
P(878, 5) = 1728*929+930;
P(878, 6) = 1728*930+931;
P(878, 7) = 1728*931+920;
P(878, 8) = 1728*920+921;
P(878, 9) = 1728*921+638;
P(879, 0) = 1728*638+647;
P(879, 1) = 1728*647+882;
P(879, 2) = 1728*882+883;
P(879, 3) = 1728*883+932;
P(879, 4) = 1728*932+935;
P(879, 5) = 1728*935+926;
P(879, 6) = 1728*926+925;
P(879, 7) = 1728*925+920;
P(879, 8) = 1728*920+921;
P(879, 9) = 1728*921+638;
P(880, 0) = 1728*640+641;
P(880, 1) = 1728*641+642;
P(880, 2) = 1728*642+643;
P(880, 3) = 1728*643+692;
P(880, 4) = 1728*692+693;
P(880, 5) = 1728*693+694;
P(880, 6) = 1728*694+703;
P(880, 7) = 1728*703+700;
P(880, 8) = 1728*700+651;
P(880, 9) = 1728*651+640;
P(881, 0) = 1728*640+641;
P(881, 1) = 1728*641+642;
P(881, 2) = 1728*642+643;
P(881, 3) = 1728*643+692;
P(881, 4) = 1728*692+695;
P(881, 5) = 1728*695+930;
P(881, 6) = 1728*930+929;
P(881, 7) = 1728*929+646;
P(881, 8) = 1728*646+645;
P(881, 9) = 1728*645+640;
P(882, 0) = 1728*640+645;
P(882, 1) = 1728*645+646;
P(882, 2) = 1728*646+655;
P(882, 3) = 1728*655+652;
P(882, 4) = 1728*652+653;
P(882, 5) = 1728*653+648;
P(882, 6) = 1728*648+649;
P(882, 7) = 1728*649+650;
P(882, 8) = 1728*650+651;
P(882, 9) = 1728*651+640;
P(883, 0) = 1728*640+645;
P(883, 1) = 1728*645+646;
P(883, 2) = 1728*646+929;
P(883, 3) = 1728*929+928;
P(883, 4) = 1728*928+939;
P(883, 5) = 1728*939+938;
P(883, 6) = 1728*938+703;
P(883, 7) = 1728*703+700;
P(883, 8) = 1728*700+651;
P(883, 9) = 1728*651+640;
P(884, 0) = 1728*644+645;
P(884, 1) = 1728*645+646;
P(884, 2) = 1728*646+655;
P(884, 3) = 1728*655+890;
P(884, 4) = 1728*890+891;
P(884, 5) = 1728*891+880;
P(884, 6) = 1728*880+881;
P(884, 7) = 1728*881+882;
P(884, 8) = 1728*882+647;
P(884, 9) = 1728*647+644;
P(885, 0) = 1728*644+645;
P(885, 1) = 1728*645+646;
P(885, 2) = 1728*646+929;
P(885, 3) = 1728*929+928;
P(885, 4) = 1728*928+933;
P(885, 5) = 1728*933+932;
P(885, 6) = 1728*932+883;
P(885, 7) = 1728*883+882;
P(885, 8) = 1728*882+647;
P(885, 9) = 1728*647+644;
P(886, 0) = 1728*646+655;
P(886, 1) = 1728*655+652;
P(886, 2) = 1728*652+653;
P(886, 3) = 1728*653+654;
P(886, 4) = 1728*654+937;
P(886, 5) = 1728*937+938;
P(886, 6) = 1728*938+939;
P(886, 7) = 1728*939+928;
P(886, 8) = 1728*928+929;
P(886, 9) = 1728*929+646;
P(887, 0) = 1728*646+655;
P(887, 1) = 1728*655+890;
P(887, 2) = 1728*890+891;
P(887, 3) = 1728*891+940;
P(887, 4) = 1728*940+943;
P(887, 5) = 1728*943+934;
P(887, 6) = 1728*934+933;
P(887, 7) = 1728*933+928;
P(887, 8) = 1728*928+929;
P(887, 9) = 1728*929+646;
P(888, 0) = 1728*648+649;
P(888, 1) = 1728*649+650;
P(888, 2) = 1728*650+651;
P(888, 3) = 1728*651+700;
P(888, 4) = 1728*700+701;
P(888, 5) = 1728*701+702;
P(888, 6) = 1728*702+711;
P(888, 7) = 1728*711+708;
P(888, 8) = 1728*708+659;
P(888, 9) = 1728*659+648;
P(889, 0) = 1728*648+649;
P(889, 1) = 1728*649+650;
P(889, 2) = 1728*650+651;
P(889, 3) = 1728*651+700;
P(889, 4) = 1728*700+703;
P(889, 5) = 1728*703+938;
P(889, 6) = 1728*938+937;
P(889, 7) = 1728*937+654;
P(889, 8) = 1728*654+653;
P(889, 9) = 1728*653+648;
P(890, 0) = 1728*648+653;
P(890, 1) = 1728*653+654;
P(890, 2) = 1728*654+663;
P(890, 3) = 1728*663+660;
P(890, 4) = 1728*660+661;
P(890, 5) = 1728*661+656;
P(890, 6) = 1728*656+657;
P(890, 7) = 1728*657+658;
P(890, 8) = 1728*658+659;
P(890, 9) = 1728*659+648;
P(891, 0) = 1728*648+653;
P(891, 1) = 1728*653+654;
P(891, 2) = 1728*654+937;
P(891, 3) = 1728*937+936;
P(891, 4) = 1728*936+947;
P(891, 5) = 1728*947+946;
P(891, 6) = 1728*946+711;
P(891, 7) = 1728*711+708;
P(891, 8) = 1728*708+659;
P(891, 9) = 1728*659+648;
P(892, 0) = 1728*652+653;
P(892, 1) = 1728*653+654;
P(892, 2) = 1728*654+663;
P(892, 3) = 1728*663+898;
P(892, 4) = 1728*898+899;
P(892, 5) = 1728*899+888;
P(892, 6) = 1728*888+889;
P(892, 7) = 1728*889+890;
P(892, 8) = 1728*890+655;
P(892, 9) = 1728*655+652;
P(893, 0) = 1728*652+653;
P(893, 1) = 1728*653+654;
P(893, 2) = 1728*654+937;
P(893, 3) = 1728*937+936;
P(893, 4) = 1728*936+941;
P(893, 5) = 1728*941+940;
P(893, 6) = 1728*940+891;
P(893, 7) = 1728*891+890;
P(893, 8) = 1728*890+655;
P(893, 9) = 1728*655+652;
P(894, 0) = 1728*654+663;
P(894, 1) = 1728*663+660;
P(894, 2) = 1728*660+661;
P(894, 3) = 1728*661+662;
P(894, 4) = 1728*662+945;
P(894, 5) = 1728*945+946;
P(894, 6) = 1728*946+947;
P(894, 7) = 1728*947+936;
P(894, 8) = 1728*936+937;
P(894, 9) = 1728*937+654;
P(895, 0) = 1728*654+663;
P(895, 1) = 1728*663+898;
P(895, 2) = 1728*898+899;
P(895, 3) = 1728*899+948;
P(895, 4) = 1728*948+951;
P(895, 5) = 1728*951+942;
P(895, 6) = 1728*942+941;
P(895, 7) = 1728*941+936;
P(895, 8) = 1728*936+937;
P(895, 9) = 1728*937+654;
P(896, 0) = 1728*656+657;
P(896, 1) = 1728*657+658;
P(896, 2) = 1728*658+659;
P(896, 3) = 1728*659+708;
P(896, 4) = 1728*708+709;
P(896, 5) = 1728*709+710;
P(896, 6) = 1728*710+719;
P(896, 7) = 1728*719+716;
P(896, 8) = 1728*716+667;
P(896, 9) = 1728*667+656;
P(897, 0) = 1728*656+657;
P(897, 1) = 1728*657+658;
P(897, 2) = 1728*658+659;
P(897, 3) = 1728*659+708;
P(897, 4) = 1728*708+711;
P(897, 5) = 1728*711+946;
P(897, 6) = 1728*946+945;
P(897, 7) = 1728*945+662;
P(897, 8) = 1728*662+661;
P(897, 9) = 1728*661+656;
P(898, 0) = 1728*656+661;
P(898, 1) = 1728*661+662;
P(898, 2) = 1728*662+671;
P(898, 3) = 1728*671+668;
P(898, 4) = 1728*668+669;
P(898, 5) = 1728*669+664;
P(898, 6) = 1728*664+665;
P(898, 7) = 1728*665+666;
P(898, 8) = 1728*666+667;
P(898, 9) = 1728*667+656;
P(899, 0) = 1728*656+661;
P(899, 1) = 1728*661+662;
P(899, 2) = 1728*662+945;
P(899, 3) = 1728*945+944;
P(899, 4) = 1728*944+955;
P(899, 5) = 1728*955+954;
P(899, 6) = 1728*954+719;
P(899, 7) = 1728*719+716;
P(899, 8) = 1728*716+667;
P(899, 9) = 1728*667+656;
P(900, 0) = 1728*660+661;
P(900, 1) = 1728*661+662;
P(900, 2) = 1728*662+671;
P(900, 3) = 1728*671+906;
P(900, 4) = 1728*906+907;
P(900, 5) = 1728*907+896;
P(900, 6) = 1728*896+897;
P(900, 7) = 1728*897+898;
P(900, 8) = 1728*898+663;
P(900, 9) = 1728*663+660;
P(901, 0) = 1728*660+661;
P(901, 1) = 1728*661+662;
P(901, 2) = 1728*662+945;
P(901, 3) = 1728*945+944;
P(901, 4) = 1728*944+949;
P(901, 5) = 1728*949+948;
P(901, 6) = 1728*948+899;
P(901, 7) = 1728*899+898;
P(901, 8) = 1728*898+663;
P(901, 9) = 1728*663+660;
P(902, 0) = 1728*662+671;
P(902, 1) = 1728*671+668;
P(902, 2) = 1728*668+669;
P(902, 3) = 1728*669+670;
P(902, 4) = 1728*670+953;
P(902, 5) = 1728*953+954;
P(902, 6) = 1728*954+955;
P(902, 7) = 1728*955+944;
P(902, 8) = 1728*944+945;
P(902, 9) = 1728*945+662;
P(903, 0) = 1728*662+671;
P(903, 1) = 1728*671+906;
P(903, 2) = 1728*906+907;
P(903, 3) = 1728*907+956;
P(903, 4) = 1728*956+959;
P(903, 5) = 1728*959+950;
P(903, 6) = 1728*950+949;
P(903, 7) = 1728*949+944;
P(903, 8) = 1728*944+945;
P(903, 9) = 1728*945+662;
P(904, 0) = 1728*664+665;
P(904, 1) = 1728*665+666;
P(904, 2) = 1728*666+667;
P(904, 3) = 1728*667+716;
P(904, 4) = 1728*716+719;
P(904, 5) = 1728*719+954;
P(904, 6) = 1728*954+953;
P(904, 7) = 1728*953+670;
P(904, 8) = 1728*670+669;
P(904, 9) = 1728*669+664;
P(905, 0) = 1728*668+669;
P(905, 1) = 1728*669+670;
P(905, 2) = 1728*670+953;
P(905, 3) = 1728*953+952;
P(905, 4) = 1728*952+957;
P(905, 5) = 1728*957+956;
P(905, 6) = 1728*956+907;
P(905, 7) = 1728*907+906;
P(905, 8) = 1728*906+671;
P(905, 9) = 1728*671+668;
P(906, 0) = 1728*672+673;
P(906, 1) = 1728*673+674;
P(906, 2) = 1728*674+675;
P(906, 3) = 1728*675+724;
P(906, 4) = 1728*724+725;
P(906, 5) = 1728*725+726;
P(906, 6) = 1728*726+735;
P(906, 7) = 1728*735+732;
P(906, 8) = 1728*732+683;
P(906, 9) = 1728*683+672;
P(907, 0) = 1728*672+673;
P(907, 1) = 1728*673+674;
P(907, 2) = 1728*674+675;
P(907, 3) = 1728*675+724;
P(907, 4) = 1728*724+727;
P(907, 5) = 1728*727+962;
P(907, 6) = 1728*962+961;
P(907, 7) = 1728*961+678;
P(907, 8) = 1728*678+677;
P(907, 9) = 1728*677+672;
P(908, 0) = 1728*672+673;
P(908, 1) = 1728*673+674;
P(908, 2) = 1728*674+675;
P(908, 3) = 1728*675+712;
P(908, 4) = 1728*712+717;
P(908, 5) = 1728*717+718;
P(908, 6) = 1728*718+679;
P(908, 7) = 1728*679+676;
P(908, 8) = 1728*676+677;
P(908, 9) = 1728*677+672;
P(909, 0) = 1728*672+677;
P(909, 1) = 1728*677+678;
P(909, 2) = 1728*678+687;
P(909, 3) = 1728*687+684;
P(909, 4) = 1728*684+685;
P(909, 5) = 1728*685+680;
P(909, 6) = 1728*680+681;
P(909, 7) = 1728*681+682;
P(909, 8) = 1728*682+683;
P(909, 9) = 1728*683+672;
P(910, 0) = 1728*672+677;
P(910, 1) = 1728*677+678;
P(910, 2) = 1728*678+961;
P(910, 3) = 1728*961+960;
P(910, 4) = 1728*960+971;
P(910, 5) = 1728*971+970;
P(910, 6) = 1728*970+735;
P(910, 7) = 1728*735+732;
P(910, 8) = 1728*732+683;
P(910, 9) = 1728*683+672;
P(911, 0) = 1728*675+724;
P(911, 1) = 1728*724+727;
P(911, 2) = 1728*727+766;
P(911, 3) = 1728*766+765;
P(911, 4) = 1728*765+764;
P(911, 5) = 1728*764+715;
P(911, 6) = 1728*715+714;
P(911, 7) = 1728*714+713;
P(911, 8) = 1728*713+712;
P(911, 9) = 1728*712+675;
P(912, 0) = 1728*675+724;
P(912, 1) = 1728*724+727;
P(912, 2) = 1728*727+962;
P(912, 3) = 1728*962+963;
P(912, 4) = 1728*963+1000;
P(912, 5) = 1728*1000+1001;
P(912, 6) = 1728*1001+718;
P(912, 7) = 1728*718+717;
P(912, 8) = 1728*717+712;
P(912, 9) = 1728*712+675;
P(913, 0) = 1728*676+677;
P(913, 1) = 1728*677+678;
P(913, 2) = 1728*678+687;
P(913, 3) = 1728*687+922;
P(913, 4) = 1728*922+923;
P(913, 5) = 1728*923+912;
P(913, 6) = 1728*912+913;
P(913, 7) = 1728*913+914;
P(913, 8) = 1728*914+679;
P(913, 9) = 1728*679+676;
P(914, 0) = 1728*676+677;
P(914, 1) = 1728*677+678;
P(914, 2) = 1728*678+961;
P(914, 3) = 1728*961+960;
P(914, 4) = 1728*960+965;
P(914, 5) = 1728*965+964;
P(914, 6) = 1728*964+915;
P(914, 7) = 1728*915+914;
P(914, 8) = 1728*914+679;
P(914, 9) = 1728*679+676;
P(915, 0) = 1728*676+677;
P(915, 1) = 1728*677+678;
P(915, 2) = 1728*678+961;
P(915, 3) = 1728*961+962;
P(915, 4) = 1728*962+963;
P(915, 5) = 1728*963+1000;
P(915, 6) = 1728*1000+1001;
P(915, 7) = 1728*1001+718;
P(915, 8) = 1728*718+679;
P(915, 9) = 1728*679+676;
P(916, 0) = 1728*678+687;
P(916, 1) = 1728*687+684;
P(916, 2) = 1728*684+685;
P(916, 3) = 1728*685+686;
P(916, 4) = 1728*686+969;
P(916, 5) = 1728*969+970;
P(916, 6) = 1728*970+971;
P(916, 7) = 1728*971+960;
P(916, 8) = 1728*960+961;
P(916, 9) = 1728*961+678;
P(917, 0) = 1728*678+687;
P(917, 1) = 1728*687+922;
P(917, 2) = 1728*922+923;
P(917, 3) = 1728*923+972;
P(917, 4) = 1728*972+975;
P(917, 5) = 1728*975+966;
P(917, 6) = 1728*966+965;
P(917, 7) = 1728*965+960;
P(917, 8) = 1728*960+961;
P(917, 9) = 1728*961+678;
P(918, 0) = 1728*679+718;
P(918, 1) = 1728*718+717;
P(918, 2) = 1728*717+716;
P(918, 3) = 1728*716+719;
P(918, 4) = 1728*719+954;
P(918, 5) = 1728*954+953;
P(918, 6) = 1728*953+952;
P(918, 7) = 1728*952+915;
P(918, 8) = 1728*915+914;
P(918, 9) = 1728*914+679;
P(919, 0) = 1728*679+718;
P(919, 1) = 1728*718+1001;
P(919, 2) = 1728*1001+1000;
P(919, 3) = 1728*1000+1005;
P(919, 4) = 1728*1005+1006;
P(919, 5) = 1728*1006+967;
P(919, 6) = 1728*967+964;
P(919, 7) = 1728*964+915;
P(919, 8) = 1728*915+914;
P(919, 9) = 1728*914+679;
P(920, 0) = 1728*680+681;
P(920, 1) = 1728*681+682;
P(920, 2) = 1728*682+683;
P(920, 3) = 1728*683+732;
P(920, 4) = 1728*732+733;
P(920, 5) = 1728*733+734;
P(920, 6) = 1728*734+743;
P(920, 7) = 1728*743+740;
P(920, 8) = 1728*740+691;
P(920, 9) = 1728*691+680;
P(921, 0) = 1728*680+681;
P(921, 1) = 1728*681+682;
P(921, 2) = 1728*682+683;
P(921, 3) = 1728*683+732;
P(921, 4) = 1728*732+735;
P(921, 5) = 1728*735+970;
P(921, 6) = 1728*970+969;
P(921, 7) = 1728*969+686;
P(921, 8) = 1728*686+685;
P(921, 9) = 1728*685+680;
P(922, 0) = 1728*680+685;
P(922, 1) = 1728*685+686;
P(922, 2) = 1728*686+695;
P(922, 3) = 1728*695+692;
P(922, 4) = 1728*692+693;
P(922, 5) = 1728*693+688;
P(922, 6) = 1728*688+689;
P(922, 7) = 1728*689+690;
P(922, 8) = 1728*690+691;
P(922, 9) = 1728*691+680;
P(923, 0) = 1728*680+685;
P(923, 1) = 1728*685+686;
P(923, 2) = 1728*686+969;
P(923, 3) = 1728*969+968;
P(923, 4) = 1728*968+979;
P(923, 5) = 1728*979+978;
P(923, 6) = 1728*978+743;
P(923, 7) = 1728*743+740;
P(923, 8) = 1728*740+691;
P(923, 9) = 1728*691+680;
P(924, 0) = 1728*684+685;
P(924, 1) = 1728*685+686;
P(924, 2) = 1728*686+695;
P(924, 3) = 1728*695+930;
P(924, 4) = 1728*930+931;
P(924, 5) = 1728*931+920;
P(924, 6) = 1728*920+921;
P(924, 7) = 1728*921+922;
P(924, 8) = 1728*922+687;
P(924, 9) = 1728*687+684;
P(925, 0) = 1728*684+685;
P(925, 1) = 1728*685+686;
P(925, 2) = 1728*686+969;
P(925, 3) = 1728*969+968;
P(925, 4) = 1728*968+973;
P(925, 5) = 1728*973+972;
P(925, 6) = 1728*972+923;
P(925, 7) = 1728*923+922;
P(925, 8) = 1728*922+687;
P(925, 9) = 1728*687+684;
P(926, 0) = 1728*686+695;
P(926, 1) = 1728*695+692;
P(926, 2) = 1728*692+693;
P(926, 3) = 1728*693+694;
P(926, 4) = 1728*694+977;
P(926, 5) = 1728*977+978;
P(926, 6) = 1728*978+979;
P(926, 7) = 1728*979+968;
P(926, 8) = 1728*968+969;
P(926, 9) = 1728*969+686;
P(927, 0) = 1728*686+695;
P(927, 1) = 1728*695+930;
P(927, 2) = 1728*930+931;
P(927, 3) = 1728*931+980;
P(927, 4) = 1728*980+983;
P(927, 5) = 1728*983+974;
P(927, 6) = 1728*974+973;
P(927, 7) = 1728*973+968;
P(927, 8) = 1728*968+969;
P(927, 9) = 1728*969+686;
P(928, 0) = 1728*688+689;
P(928, 1) = 1728*689+690;
P(928, 2) = 1728*690+691;
P(928, 3) = 1728*691+740;
P(928, 4) = 1728*740+741;
P(928, 5) = 1728*741+742;
P(928, 6) = 1728*742+751;
P(928, 7) = 1728*751+748;
P(928, 8) = 1728*748+699;
P(928, 9) = 1728*699+688;
P(929, 0) = 1728*688+689;
P(929, 1) = 1728*689+690;
P(929, 2) = 1728*690+691;
P(929, 3) = 1728*691+740;
P(929, 4) = 1728*740+743;
P(929, 5) = 1728*743+978;
P(929, 6) = 1728*978+977;
P(929, 7) = 1728*977+694;
P(929, 8) = 1728*694+693;
P(929, 9) = 1728*693+688;
P(930, 0) = 1728*688+693;
P(930, 1) = 1728*693+694;
P(930, 2) = 1728*694+703;
P(930, 3) = 1728*703+700;
P(930, 4) = 1728*700+701;
P(930, 5) = 1728*701+696;
P(930, 6) = 1728*696+697;
P(930, 7) = 1728*697+698;
P(930, 8) = 1728*698+699;
P(930, 9) = 1728*699+688;
P(931, 0) = 1728*688+693;
P(931, 1) = 1728*693+694;
P(931, 2) = 1728*694+977;
P(931, 3) = 1728*977+976;
P(931, 4) = 1728*976+987;
P(931, 5) = 1728*987+986;
P(931, 6) = 1728*986+751;
P(931, 7) = 1728*751+748;
P(931, 8) = 1728*748+699;
P(931, 9) = 1728*699+688;
P(932, 0) = 1728*692+693;
P(932, 1) = 1728*693+694;
P(932, 2) = 1728*694+703;
P(932, 3) = 1728*703+938;
P(932, 4) = 1728*938+939;
P(932, 5) = 1728*939+928;
P(932, 6) = 1728*928+929;
P(932, 7) = 1728*929+930;
P(932, 8) = 1728*930+695;
P(932, 9) = 1728*695+692;
P(933, 0) = 1728*692+693;
P(933, 1) = 1728*693+694;
P(933, 2) = 1728*694+977;
P(933, 3) = 1728*977+976;
P(933, 4) = 1728*976+981;
P(933, 5) = 1728*981+980;
P(933, 6) = 1728*980+931;
P(933, 7) = 1728*931+930;
P(933, 8) = 1728*930+695;
P(933, 9) = 1728*695+692;
P(934, 0) = 1728*694+703;
P(934, 1) = 1728*703+700;
P(934, 2) = 1728*700+701;
P(934, 3) = 1728*701+702;
P(934, 4) = 1728*702+985;
P(934, 5) = 1728*985+986;
P(934, 6) = 1728*986+987;
P(934, 7) = 1728*987+976;
P(934, 8) = 1728*976+977;
P(934, 9) = 1728*977+694;
P(935, 0) = 1728*694+703;
P(935, 1) = 1728*703+938;
P(935, 2) = 1728*938+939;
P(935, 3) = 1728*939+988;
P(935, 4) = 1728*988+991;
P(935, 5) = 1728*991+982;
P(935, 6) = 1728*982+981;
P(935, 7) = 1728*981+976;
P(935, 8) = 1728*976+977;
P(935, 9) = 1728*977+694;
P(936, 0) = 1728*696+697;
P(936, 1) = 1728*697+698;
P(936, 2) = 1728*698+699;
P(936, 3) = 1728*699+748;
P(936, 4) = 1728*748+749;
P(936, 5) = 1728*749+750;
P(936, 6) = 1728*750+759;
P(936, 7) = 1728*759+756;
P(936, 8) = 1728*756+707;
P(936, 9) = 1728*707+696;
P(937, 0) = 1728*696+697;
P(937, 1) = 1728*697+698;
P(937, 2) = 1728*698+699;
P(937, 3) = 1728*699+748;
P(937, 4) = 1728*748+751;
P(937, 5) = 1728*751+986;
P(937, 6) = 1728*986+985;
P(937, 7) = 1728*985+702;
P(937, 8) = 1728*702+701;
P(937, 9) = 1728*701+696;
P(938, 0) = 1728*696+701;
P(938, 1) = 1728*701+702;
P(938, 2) = 1728*702+711;
P(938, 3) = 1728*711+708;
P(938, 4) = 1728*708+709;
P(938, 5) = 1728*709+704;
P(938, 6) = 1728*704+705;
P(938, 7) = 1728*705+706;
P(938, 8) = 1728*706+707;
P(938, 9) = 1728*707+696;
P(939, 0) = 1728*696+701;
P(939, 1) = 1728*701+702;
P(939, 2) = 1728*702+985;
P(939, 3) = 1728*985+984;
P(939, 4) = 1728*984+995;
P(939, 5) = 1728*995+994;
P(939, 6) = 1728*994+759;
P(939, 7) = 1728*759+756;
P(939, 8) = 1728*756+707;
P(939, 9) = 1728*707+696;
P(940, 0) = 1728*700+701;
P(940, 1) = 1728*701+702;
P(940, 2) = 1728*702+711;
P(940, 3) = 1728*711+946;
P(940, 4) = 1728*946+947;
P(940, 5) = 1728*947+936;
P(940, 6) = 1728*936+937;
P(940, 7) = 1728*937+938;
P(940, 8) = 1728*938+703;
P(940, 9) = 1728*703+700;
P(941, 0) = 1728*700+701;
P(941, 1) = 1728*701+702;
P(941, 2) = 1728*702+985;
P(941, 3) = 1728*985+984;
P(941, 4) = 1728*984+989;
P(941, 5) = 1728*989+988;
P(941, 6) = 1728*988+939;
P(941, 7) = 1728*939+938;
P(941, 8) = 1728*938+703;
P(941, 9) = 1728*703+700;
P(942, 0) = 1728*702+711;
P(942, 1) = 1728*711+708;
P(942, 2) = 1728*708+709;
P(942, 3) = 1728*709+710;
P(942, 4) = 1728*710+993;
P(942, 5) = 1728*993+994;
P(942, 6) = 1728*994+995;
P(942, 7) = 1728*995+984;
P(942, 8) = 1728*984+985;
P(942, 9) = 1728*985+702;
P(943, 0) = 1728*702+711;
P(943, 1) = 1728*711+946;
P(943, 2) = 1728*946+947;
P(943, 3) = 1728*947+996;
P(943, 4) = 1728*996+999;
P(943, 5) = 1728*999+990;
P(943, 6) = 1728*990+989;
P(943, 7) = 1728*989+984;
P(943, 8) = 1728*984+985;
P(943, 9) = 1728*985+702;
P(944, 0) = 1728*704+705;
P(944, 1) = 1728*705+706;
P(944, 2) = 1728*706+707;
P(944, 3) = 1728*707+756;
P(944, 4) = 1728*756+757;
P(944, 5) = 1728*757+758;
P(944, 6) = 1728*758+767;
P(944, 7) = 1728*767+764;
P(944, 8) = 1728*764+715;
P(944, 9) = 1728*715+704;
P(945, 0) = 1728*704+705;
P(945, 1) = 1728*705+706;
P(945, 2) = 1728*706+707;
P(945, 3) = 1728*707+756;
P(945, 4) = 1728*756+759;
P(945, 5) = 1728*759+994;
P(945, 6) = 1728*994+993;
P(945, 7) = 1728*993+710;
P(945, 8) = 1728*710+709;
P(945, 9) = 1728*709+704;
P(946, 0) = 1728*704+709;
P(946, 1) = 1728*709+710;
P(946, 2) = 1728*710+719;
P(946, 3) = 1728*719+716;
P(946, 4) = 1728*716+717;
P(946, 5) = 1728*717+712;
P(946, 6) = 1728*712+713;
P(946, 7) = 1728*713+714;
P(946, 8) = 1728*714+715;
P(946, 9) = 1728*715+704;
P(947, 0) = 1728*704+709;
P(947, 1) = 1728*709+710;
P(947, 2) = 1728*710+993;
P(947, 3) = 1728*993+992;
P(947, 4) = 1728*992+1003;
P(947, 5) = 1728*1003+1002;
P(947, 6) = 1728*1002+767;
P(947, 7) = 1728*767+764;
P(947, 8) = 1728*764+715;
P(947, 9) = 1728*715+704;
P(948, 0) = 1728*708+709;
P(948, 1) = 1728*709+710;
P(948, 2) = 1728*710+719;
P(948, 3) = 1728*719+954;
P(948, 4) = 1728*954+955;
P(948, 5) = 1728*955+944;
P(948, 6) = 1728*944+945;
P(948, 7) = 1728*945+946;
P(948, 8) = 1728*946+711;
P(948, 9) = 1728*711+708;
P(949, 0) = 1728*708+709;
P(949, 1) = 1728*709+710;
P(949, 2) = 1728*710+993;
P(949, 3) = 1728*993+992;
P(949, 4) = 1728*992+997;
P(949, 5) = 1728*997+996;
P(949, 6) = 1728*996+947;
P(949, 7) = 1728*947+946;
P(949, 8) = 1728*946+711;
P(949, 9) = 1728*711+708;
P(950, 0) = 1728*710+719;
P(950, 1) = 1728*719+716;
P(950, 2) = 1728*716+717;
P(950, 3) = 1728*717+718;
P(950, 4) = 1728*718+1001;
P(950, 5) = 1728*1001+1002;
P(950, 6) = 1728*1002+1003;
P(950, 7) = 1728*1003+992;
P(950, 8) = 1728*992+993;
P(950, 9) = 1728*993+710;
P(951, 0) = 1728*710+719;
P(951, 1) = 1728*719+954;
P(951, 2) = 1728*954+955;
P(951, 3) = 1728*955+1004;
P(951, 4) = 1728*1004+1007;
P(951, 5) = 1728*1007+998;
P(951, 6) = 1728*998+997;
P(951, 7) = 1728*997+992;
P(951, 8) = 1728*992+993;
P(951, 9) = 1728*993+710;
P(952, 0) = 1728*712+713;
P(952, 1) = 1728*713+714;
P(952, 2) = 1728*714+715;
P(952, 3) = 1728*715+764;
P(952, 4) = 1728*764+767;
P(952, 5) = 1728*767+1002;
P(952, 6) = 1728*1002+1001;
P(952, 7) = 1728*1001+718;
P(952, 8) = 1728*718+717;
P(952, 9) = 1728*717+712;
P(953, 0) = 1728*716+717;
P(953, 1) = 1728*717+718;
P(953, 2) = 1728*718+1001;
P(953, 3) = 1728*1001+1000;
P(953, 4) = 1728*1000+1005;
P(953, 5) = 1728*1005+1004;
P(953, 6) = 1728*1004+955;
P(953, 7) = 1728*955+954;
P(953, 8) = 1728*954+719;
P(953, 9) = 1728*719+716;
P(954, 0) = 1728*720+721;
P(954, 1) = 1728*721+722;
P(954, 2) = 1728*722+723;
P(954, 3) = 1728*723+772;
P(954, 4) = 1728*772+773;
P(954, 5) = 1728*773+774;
P(954, 6) = 1728*774+783;
P(954, 7) = 1728*783+780;
P(954, 8) = 1728*780+731;
P(954, 9) = 1728*731+720;
P(955, 0) = 1728*720+721;
P(955, 1) = 1728*721+722;
P(955, 2) = 1728*722+723;
P(955, 3) = 1728*723+772;
P(955, 4) = 1728*772+775;
P(955, 5) = 1728*775+1010;
P(955, 6) = 1728*1010+1009;
P(955, 7) = 1728*1009+726;
P(955, 8) = 1728*726+725;
P(955, 9) = 1728*725+720;
P(956, 0) = 1728*720+721;
P(956, 1) = 1728*721+722;
P(956, 2) = 1728*722+723;
P(956, 3) = 1728*723+760;
P(956, 4) = 1728*760+765;
P(956, 5) = 1728*765+766;
P(956, 6) = 1728*766+727;
P(956, 7) = 1728*727+724;
P(956, 8) = 1728*724+725;
P(956, 9) = 1728*725+720;
P(957, 0) = 1728*720+725;
P(957, 1) = 1728*725+726;
P(957, 2) = 1728*726+735;
P(957, 3) = 1728*735+732;
P(957, 4) = 1728*732+733;
P(957, 5) = 1728*733+728;
P(957, 6) = 1728*728+729;
P(957, 7) = 1728*729+730;
P(957, 8) = 1728*730+731;
P(957, 9) = 1728*731+720;
P(958, 0) = 1728*720+725;
P(958, 1) = 1728*725+726;
P(958, 2) = 1728*726+1009;
P(958, 3) = 1728*1009+1008;
P(958, 4) = 1728*1008+1019;
P(958, 5) = 1728*1019+1018;
P(958, 6) = 1728*1018+783;
P(958, 7) = 1728*783+780;
P(958, 8) = 1728*780+731;
P(958, 9) = 1728*731+720;
P(959, 0) = 1728*723+772;
P(959, 1) = 1728*772+775;
P(959, 2) = 1728*775+814;
P(959, 3) = 1728*814+813;
P(959, 4) = 1728*813+812;
P(959, 5) = 1728*812+763;
P(959, 6) = 1728*763+762;
P(959, 7) = 1728*762+761;
P(959, 8) = 1728*761+760;
P(959, 9) = 1728*760+723;
P(960, 0) = 1728*723+772;
P(960, 1) = 1728*772+775;
P(960, 2) = 1728*775+1010;
P(960, 3) = 1728*1010+1011;
P(960, 4) = 1728*1011+1048;
P(960, 5) = 1728*1048+1049;
P(960, 6) = 1728*1049+766;
P(960, 7) = 1728*766+765;
P(960, 8) = 1728*765+760;
P(960, 9) = 1728*760+723;
P(961, 0) = 1728*724+725;
P(961, 1) = 1728*725+726;
P(961, 2) = 1728*726+735;
P(961, 3) = 1728*735+970;
P(961, 4) = 1728*970+971;
P(961, 5) = 1728*971+960;
P(961, 6) = 1728*960+961;
P(961, 7) = 1728*961+962;
P(961, 8) = 1728*962+727;
P(961, 9) = 1728*727+724;
P(962, 0) = 1728*724+725;
P(962, 1) = 1728*725+726;
P(962, 2) = 1728*726+1009;
P(962, 3) = 1728*1009+1008;
P(962, 4) = 1728*1008+1013;
P(962, 5) = 1728*1013+1012;
P(962, 6) = 1728*1012+963;
P(962, 7) = 1728*963+962;
P(962, 8) = 1728*962+727;
P(962, 9) = 1728*727+724;
P(963, 0) = 1728*724+725;
P(963, 1) = 1728*725+726;
P(963, 2) = 1728*726+1009;
P(963, 3) = 1728*1009+1010;
P(963, 4) = 1728*1010+1011;
P(963, 5) = 1728*1011+1048;
P(963, 6) = 1728*1048+1049;
P(963, 7) = 1728*1049+766;
P(963, 8) = 1728*766+727;
P(963, 9) = 1728*727+724;
P(964, 0) = 1728*726+735;
P(964, 1) = 1728*735+732;
P(964, 2) = 1728*732+733;
P(964, 3) = 1728*733+734;
P(964, 4) = 1728*734+1017;
P(964, 5) = 1728*1017+1018;
P(964, 6) = 1728*1018+1019;
P(964, 7) = 1728*1019+1008;
P(964, 8) = 1728*1008+1009;
P(964, 9) = 1728*1009+726;
P(965, 0) = 1728*726+735;
P(965, 1) = 1728*735+970;
P(965, 2) = 1728*970+971;
P(965, 3) = 1728*971+1020;
P(965, 4) = 1728*1020+1023;
P(965, 5) = 1728*1023+1014;
P(965, 6) = 1728*1014+1013;
P(965, 7) = 1728*1013+1008;
P(965, 8) = 1728*1008+1009;
P(965, 9) = 1728*1009+726;
P(966, 0) = 1728*727+766;
P(966, 1) = 1728*766+765;
P(966, 2) = 1728*765+764;
P(966, 3) = 1728*764+767;
P(966, 4) = 1728*767+1002;
P(966, 5) = 1728*1002+1001;
P(966, 6) = 1728*1001+1000;
P(966, 7) = 1728*1000+963;
P(966, 8) = 1728*963+962;
P(966, 9) = 1728*962+727;
P(967, 0) = 1728*727+766;
P(967, 1) = 1728*766+1049;
P(967, 2) = 1728*1049+1048;
P(967, 3) = 1728*1048+1053;
P(967, 4) = 1728*1053+1054;
P(967, 5) = 1728*1054+1015;
P(967, 6) = 1728*1015+1012;
P(967, 7) = 1728*1012+963;
P(967, 8) = 1728*963+962;
P(967, 9) = 1728*962+727;
P(968, 0) = 1728*728+729;
P(968, 1) = 1728*729+730;
P(968, 2) = 1728*730+731;
P(968, 3) = 1728*731+780;
P(968, 4) = 1728*780+781;
P(968, 5) = 1728*781+782;
P(968, 6) = 1728*782+791;
P(968, 7) = 1728*791+788;
P(968, 8) = 1728*788+739;
P(968, 9) = 1728*739+728;
P(969, 0) = 1728*728+729;
P(969, 1) = 1728*729+730;
P(969, 2) = 1728*730+731;
P(969, 3) = 1728*731+780;
P(969, 4) = 1728*780+783;
P(969, 5) = 1728*783+1018;
P(969, 6) = 1728*1018+1017;
P(969, 7) = 1728*1017+734;
P(969, 8) = 1728*734+733;
P(969, 9) = 1728*733+728;
P(970, 0) = 1728*728+733;
P(970, 1) = 1728*733+734;
P(970, 2) = 1728*734+743;
P(970, 3) = 1728*743+740;
P(970, 4) = 1728*740+741;
P(970, 5) = 1728*741+736;
P(970, 6) = 1728*736+737;
P(970, 7) = 1728*737+738;
P(970, 8) = 1728*738+739;
P(970, 9) = 1728*739+728;
P(971, 0) = 1728*728+733;
P(971, 1) = 1728*733+734;
P(971, 2) = 1728*734+1017;
P(971, 3) = 1728*1017+1016;
P(971, 4) = 1728*1016+1027;
P(971, 5) = 1728*1027+1026;
P(971, 6) = 1728*1026+791;
P(971, 7) = 1728*791+788;
P(971, 8) = 1728*788+739;
P(971, 9) = 1728*739+728;
P(972, 0) = 1728*732+733;
P(972, 1) = 1728*733+734;
P(972, 2) = 1728*734+743;
P(972, 3) = 1728*743+978;
P(972, 4) = 1728*978+979;
P(972, 5) = 1728*979+968;
P(972, 6) = 1728*968+969;
P(972, 7) = 1728*969+970;
P(972, 8) = 1728*970+735;
P(972, 9) = 1728*735+732;
P(973, 0) = 1728*732+733;
P(973, 1) = 1728*733+734;
P(973, 2) = 1728*734+1017;
P(973, 3) = 1728*1017+1016;
P(973, 4) = 1728*1016+1021;
P(973, 5) = 1728*1021+1020;
P(973, 6) = 1728*1020+971;
P(973, 7) = 1728*971+970;
P(973, 8) = 1728*970+735;
P(973, 9) = 1728*735+732;
P(974, 0) = 1728*734+743;
P(974, 1) = 1728*743+740;
P(974, 2) = 1728*740+741;
P(974, 3) = 1728*741+742;
P(974, 4) = 1728*742+1025;
P(974, 5) = 1728*1025+1026;
P(974, 6) = 1728*1026+1027;
P(974, 7) = 1728*1027+1016;
P(974, 8) = 1728*1016+1017;
P(974, 9) = 1728*1017+734;
P(975, 0) = 1728*734+743;
P(975, 1) = 1728*743+978;
P(975, 2) = 1728*978+979;
P(975, 3) = 1728*979+1028;
P(975, 4) = 1728*1028+1031;
P(975, 5) = 1728*1031+1022;
P(975, 6) = 1728*1022+1021;
P(975, 7) = 1728*1021+1016;
P(975, 8) = 1728*1016+1017;
P(975, 9) = 1728*1017+734;
P(976, 0) = 1728*736+737;
P(976, 1) = 1728*737+738;
P(976, 2) = 1728*738+739;
P(976, 3) = 1728*739+788;
P(976, 4) = 1728*788+789;
P(976, 5) = 1728*789+790;
P(976, 6) = 1728*790+799;
P(976, 7) = 1728*799+796;
P(976, 8) = 1728*796+747;
P(976, 9) = 1728*747+736;
P(977, 0) = 1728*736+737;
P(977, 1) = 1728*737+738;
P(977, 2) = 1728*738+739;
P(977, 3) = 1728*739+788;
P(977, 4) = 1728*788+791;
P(977, 5) = 1728*791+1026;
P(977, 6) = 1728*1026+1025;
P(977, 7) = 1728*1025+742;
P(977, 8) = 1728*742+741;
P(977, 9) = 1728*741+736;
P(978, 0) = 1728*736+741;
P(978, 1) = 1728*741+742;
P(978, 2) = 1728*742+751;
P(978, 3) = 1728*751+748;
P(978, 4) = 1728*748+749;
P(978, 5) = 1728*749+744;
P(978, 6) = 1728*744+745;
P(978, 7) = 1728*745+746;
P(978, 8) = 1728*746+747;
P(978, 9) = 1728*747+736;
P(979, 0) = 1728*736+741;
P(979, 1) = 1728*741+742;
P(979, 2) = 1728*742+1025;
P(979, 3) = 1728*1025+1024;
P(979, 4) = 1728*1024+1035;
P(979, 5) = 1728*1035+1034;
P(979, 6) = 1728*1034+799;
P(979, 7) = 1728*799+796;
P(979, 8) = 1728*796+747;
P(979, 9) = 1728*747+736;
P(980, 0) = 1728*740+741;
P(980, 1) = 1728*741+742;
P(980, 2) = 1728*742+751;
P(980, 3) = 1728*751+986;
P(980, 4) = 1728*986+987;
P(980, 5) = 1728*987+976;
P(980, 6) = 1728*976+977;
P(980, 7) = 1728*977+978;
P(980, 8) = 1728*978+743;
P(980, 9) = 1728*743+740;
P(981, 0) = 1728*740+741;
P(981, 1) = 1728*741+742;
P(981, 2) = 1728*742+1025;
P(981, 3) = 1728*1025+1024;
P(981, 4) = 1728*1024+1029;
P(981, 5) = 1728*1029+1028;
P(981, 6) = 1728*1028+979;
P(981, 7) = 1728*979+978;
P(981, 8) = 1728*978+743;
P(981, 9) = 1728*743+740;
P(982, 0) = 1728*742+751;
P(982, 1) = 1728*751+748;
P(982, 2) = 1728*748+749;
P(982, 3) = 1728*749+750;
P(982, 4) = 1728*750+1033;
P(982, 5) = 1728*1033+1034;
P(982, 6) = 1728*1034+1035;
P(982, 7) = 1728*1035+1024;
P(982, 8) = 1728*1024+1025;
P(982, 9) = 1728*1025+742;
P(983, 0) = 1728*742+751;
P(983, 1) = 1728*751+986;
P(983, 2) = 1728*986+987;
P(983, 3) = 1728*987+1036;
P(983, 4) = 1728*1036+1039;
P(983, 5) = 1728*1039+1030;
P(983, 6) = 1728*1030+1029;
P(983, 7) = 1728*1029+1024;
P(983, 8) = 1728*1024+1025;
P(983, 9) = 1728*1025+742;
P(984, 0) = 1728*744+745;
P(984, 1) = 1728*745+746;
P(984, 2) = 1728*746+747;
P(984, 3) = 1728*747+796;
P(984, 4) = 1728*796+797;
P(984, 5) = 1728*797+798;
P(984, 6) = 1728*798+807;
P(984, 7) = 1728*807+804;
P(984, 8) = 1728*804+755;
P(984, 9) = 1728*755+744;
P(985, 0) = 1728*744+745;
P(985, 1) = 1728*745+746;
P(985, 2) = 1728*746+747;
P(985, 3) = 1728*747+796;
P(985, 4) = 1728*796+799;
P(985, 5) = 1728*799+1034;
P(985, 6) = 1728*1034+1033;
P(985, 7) = 1728*1033+750;
P(985, 8) = 1728*750+749;
P(985, 9) = 1728*749+744;
P(986, 0) = 1728*744+749;
P(986, 1) = 1728*749+750;
P(986, 2) = 1728*750+759;
P(986, 3) = 1728*759+756;
P(986, 4) = 1728*756+757;
P(986, 5) = 1728*757+752;
P(986, 6) = 1728*752+753;
P(986, 7) = 1728*753+754;
P(986, 8) = 1728*754+755;
P(986, 9) = 1728*755+744;
P(987, 0) = 1728*744+749;
P(987, 1) = 1728*749+750;
P(987, 2) = 1728*750+1033;
P(987, 3) = 1728*1033+1032;
P(987, 4) = 1728*1032+1043;
P(987, 5) = 1728*1043+1042;
P(987, 6) = 1728*1042+807;
P(987, 7) = 1728*807+804;
P(987, 8) = 1728*804+755;
P(987, 9) = 1728*755+744;
P(988, 0) = 1728*748+749;
P(988, 1) = 1728*749+750;
P(988, 2) = 1728*750+759;
P(988, 3) = 1728*759+994;
P(988, 4) = 1728*994+995;
P(988, 5) = 1728*995+984;
P(988, 6) = 1728*984+985;
P(988, 7) = 1728*985+986;
P(988, 8) = 1728*986+751;
P(988, 9) = 1728*751+748;
P(989, 0) = 1728*748+749;
P(989, 1) = 1728*749+750;
P(989, 2) = 1728*750+1033;
P(989, 3) = 1728*1033+1032;
P(989, 4) = 1728*1032+1037;
P(989, 5) = 1728*1037+1036;
P(989, 6) = 1728*1036+987;
P(989, 7) = 1728*987+986;
P(989, 8) = 1728*986+751;
P(989, 9) = 1728*751+748;
P(990, 0) = 1728*750+759;
P(990, 1) = 1728*759+756;
P(990, 2) = 1728*756+757;
P(990, 3) = 1728*757+758;
P(990, 4) = 1728*758+1041;
P(990, 5) = 1728*1041+1042;
P(990, 6) = 1728*1042+1043;
P(990, 7) = 1728*1043+1032;
P(990, 8) = 1728*1032+1033;
P(990, 9) = 1728*1033+750;
P(991, 0) = 1728*750+759;
P(991, 1) = 1728*759+994;
P(991, 2) = 1728*994+995;
P(991, 3) = 1728*995+1044;
P(991, 4) = 1728*1044+1047;
P(991, 5) = 1728*1047+1038;
P(991, 6) = 1728*1038+1037;
P(991, 7) = 1728*1037+1032;
P(991, 8) = 1728*1032+1033;
P(991, 9) = 1728*1033+750;
P(992, 0) = 1728*752+753;
P(992, 1) = 1728*753+754;
P(992, 2) = 1728*754+755;
P(992, 3) = 1728*755+804;
P(992, 4) = 1728*804+805;
P(992, 5) = 1728*805+806;
P(992, 6) = 1728*806+815;
P(992, 7) = 1728*815+812;
P(992, 8) = 1728*812+763;
P(992, 9) = 1728*763+752;
P(993, 0) = 1728*752+753;
P(993, 1) = 1728*753+754;
P(993, 2) = 1728*754+755;
P(993, 3) = 1728*755+804;
P(993, 4) = 1728*804+807;
P(993, 5) = 1728*807+1042;
P(993, 6) = 1728*1042+1041;
P(993, 7) = 1728*1041+758;
P(993, 8) = 1728*758+757;
P(993, 9) = 1728*757+752;
P(994, 0) = 1728*752+757;
P(994, 1) = 1728*757+758;
P(994, 2) = 1728*758+767;
P(994, 3) = 1728*767+764;
P(994, 4) = 1728*764+765;
P(994, 5) = 1728*765+760;
P(994, 6) = 1728*760+761;
P(994, 7) = 1728*761+762;
P(994, 8) = 1728*762+763;
P(994, 9) = 1728*763+752;
P(995, 0) = 1728*752+757;
P(995, 1) = 1728*757+758;
P(995, 2) = 1728*758+1041;
P(995, 3) = 1728*1041+1040;
P(995, 4) = 1728*1040+1051;
P(995, 5) = 1728*1051+1050;
P(995, 6) = 1728*1050+815;
P(995, 7) = 1728*815+812;
P(995, 8) = 1728*812+763;
P(995, 9) = 1728*763+752;
P(996, 0) = 1728*756+757;
P(996, 1) = 1728*757+758;
P(996, 2) = 1728*758+767;
P(996, 3) = 1728*767+1002;
P(996, 4) = 1728*1002+1003;
P(996, 5) = 1728*1003+992;
P(996, 6) = 1728*992+993;
P(996, 7) = 1728*993+994;
P(996, 8) = 1728*994+759;
P(996, 9) = 1728*759+756;
P(997, 0) = 1728*756+757;
P(997, 1) = 1728*757+758;
P(997, 2) = 1728*758+1041;
P(997, 3) = 1728*1041+1040;
P(997, 4) = 1728*1040+1045;
P(997, 5) = 1728*1045+1044;
P(997, 6) = 1728*1044+995;
P(997, 7) = 1728*995+994;
P(997, 8) = 1728*994+759;
P(997, 9) = 1728*759+756;
P(998, 0) = 1728*758+767;
P(998, 1) = 1728*767+764;
P(998, 2) = 1728*764+765;
P(998, 3) = 1728*765+766;
P(998, 4) = 1728*766+1049;
P(998, 5) = 1728*1049+1050;
P(998, 6) = 1728*1050+1051;
P(998, 7) = 1728*1051+1040;
P(998, 8) = 1728*1040+1041;
P(998, 9) = 1728*1041+758;
P(999, 0) = 1728*758+767;
P(999, 1) = 1728*767+1002;
P(999, 2) = 1728*1002+1003;
P(999, 3) = 1728*1003+1052;
P(999, 4) = 1728*1052+1055;
P(999, 5) = 1728*1055+1046;
P(999, 6) = 1728*1046+1045;
P(999, 7) = 1728*1045+1040;
P(999, 8) = 1728*1040+1041;
P(999, 9) = 1728*1041+758;
P(1000, 0) = 1728*760+761;
P(1000, 1) = 1728*761+762;
P(1000, 2) = 1728*762+763;
P(1000, 3) = 1728*763+812;
P(1000, 4) = 1728*812+815;
P(1000, 5) = 1728*815+1050;
P(1000, 6) = 1728*1050+1049;
P(1000, 7) = 1728*1049+766;
P(1000, 8) = 1728*766+765;
P(1000, 9) = 1728*765+760;
P(1001, 0) = 1728*764+765;
P(1001, 1) = 1728*765+766;
P(1001, 2) = 1728*766+1049;
P(1001, 3) = 1728*1049+1048;
P(1001, 4) = 1728*1048+1053;
P(1001, 5) = 1728*1053+1052;
P(1001, 6) = 1728*1052+1003;
P(1001, 7) = 1728*1003+1002;
P(1001, 8) = 1728*1002+767;
P(1001, 9) = 1728*767+764;
P(1002, 0) = 1728*768+769;
P(1002, 1) = 1728*769+770;
P(1002, 2) = 1728*770+771;
P(1002, 3) = 1728*771+820;
P(1002, 4) = 1728*820+821;
P(1002, 5) = 1728*821+822;
P(1002, 6) = 1728*822+831;
P(1002, 7) = 1728*831+828;
P(1002, 8) = 1728*828+779;
P(1002, 9) = 1728*779+768;
P(1003, 0) = 1728*768+769;
P(1003, 1) = 1728*769+770;
P(1003, 2) = 1728*770+771;
P(1003, 3) = 1728*771+820;
P(1003, 4) = 1728*820+823;
P(1003, 5) = 1728*823+1058;
P(1003, 6) = 1728*1058+1057;
P(1003, 7) = 1728*1057+774;
P(1003, 8) = 1728*774+773;
P(1003, 9) = 1728*773+768;
P(1004, 0) = 1728*768+769;
P(1004, 1) = 1728*769+770;
P(1004, 2) = 1728*770+771;
P(1004, 3) = 1728*771+808;
P(1004, 4) = 1728*808+813;
P(1004, 5) = 1728*813+814;
P(1004, 6) = 1728*814+775;
P(1004, 7) = 1728*775+772;
P(1004, 8) = 1728*772+773;
P(1004, 9) = 1728*773+768;
P(1005, 0) = 1728*768+773;
P(1005, 1) = 1728*773+774;
P(1005, 2) = 1728*774+783;
P(1005, 3) = 1728*783+780;
P(1005, 4) = 1728*780+781;
P(1005, 5) = 1728*781+776;
P(1005, 6) = 1728*776+777;
P(1005, 7) = 1728*777+778;
P(1005, 8) = 1728*778+779;
P(1005, 9) = 1728*779+768;
P(1006, 0) = 1728*768+773;
P(1006, 1) = 1728*773+774;
P(1006, 2) = 1728*774+1057;
P(1006, 3) = 1728*1057+1056;
P(1006, 4) = 1728*1056+1067;
P(1006, 5) = 1728*1067+1066;
P(1006, 6) = 1728*1066+831;
P(1006, 7) = 1728*831+828;
P(1006, 8) = 1728*828+779;
P(1006, 9) = 1728*779+768;
P(1007, 0) = 1728*771+820;
P(1007, 1) = 1728*820+823;
P(1007, 2) = 1728*823+862;
P(1007, 3) = 1728*862+861;
P(1007, 4) = 1728*861+860;
P(1007, 5) = 1728*860+811;
P(1007, 6) = 1728*811+810;
P(1007, 7) = 1728*810+809;
P(1007, 8) = 1728*809+808;
P(1007, 9) = 1728*808+771;
P(1008, 0) = 1728*771+820;
P(1008, 1) = 1728*820+823;
P(1008, 2) = 1728*823+1058;
P(1008, 3) = 1728*1058+1059;
P(1008, 4) = 1728*1059+1096;
P(1008, 5) = 1728*1096+1097;
P(1008, 6) = 1728*1097+814;
P(1008, 7) = 1728*814+813;
P(1008, 8) = 1728*813+808;
P(1008, 9) = 1728*808+771;
P(1009, 0) = 1728*772+773;
P(1009, 1) = 1728*773+774;
P(1009, 2) = 1728*774+783;
P(1009, 3) = 1728*783+1018;
P(1009, 4) = 1728*1018+1019;
P(1009, 5) = 1728*1019+1008;
P(1009, 6) = 1728*1008+1009;
P(1009, 7) = 1728*1009+1010;
P(1009, 8) = 1728*1010+775;
P(1009, 9) = 1728*775+772;
P(1010, 0) = 1728*772+773;
P(1010, 1) = 1728*773+774;
P(1010, 2) = 1728*774+1057;
P(1010, 3) = 1728*1057+1056;
P(1010, 4) = 1728*1056+1061;
P(1010, 5) = 1728*1061+1060;
P(1010, 6) = 1728*1060+1011;
P(1010, 7) = 1728*1011+1010;
P(1010, 8) = 1728*1010+775;
P(1010, 9) = 1728*775+772;
P(1011, 0) = 1728*772+773;
P(1011, 1) = 1728*773+774;
P(1011, 2) = 1728*774+1057;
P(1011, 3) = 1728*1057+1058;
P(1011, 4) = 1728*1058+1059;
P(1011, 5) = 1728*1059+1096;
P(1011, 6) = 1728*1096+1097;
P(1011, 7) = 1728*1097+814;
P(1011, 8) = 1728*814+775;
P(1011, 9) = 1728*775+772;
P(1012, 0) = 1728*774+783;
P(1012, 1) = 1728*783+780;
P(1012, 2) = 1728*780+781;
P(1012, 3) = 1728*781+782;
P(1012, 4) = 1728*782+1065;
P(1012, 5) = 1728*1065+1066;
P(1012, 6) = 1728*1066+1067;
P(1012, 7) = 1728*1067+1056;
P(1012, 8) = 1728*1056+1057;
P(1012, 9) = 1728*1057+774;
P(1013, 0) = 1728*774+783;
P(1013, 1) = 1728*783+1018;
P(1013, 2) = 1728*1018+1019;
P(1013, 3) = 1728*1019+1068;
P(1013, 4) = 1728*1068+1071;
P(1013, 5) = 1728*1071+1062;
P(1013, 6) = 1728*1062+1061;
P(1013, 7) = 1728*1061+1056;
P(1013, 8) = 1728*1056+1057;
P(1013, 9) = 1728*1057+774;
P(1014, 0) = 1728*775+814;
P(1014, 1) = 1728*814+813;
P(1014, 2) = 1728*813+812;
P(1014, 3) = 1728*812+815;
P(1014, 4) = 1728*815+1050;
P(1014, 5) = 1728*1050+1049;
P(1014, 6) = 1728*1049+1048;
P(1014, 7) = 1728*1048+1011;
P(1014, 8) = 1728*1011+1010;
P(1014, 9) = 1728*1010+775;
P(1015, 0) = 1728*775+814;
P(1015, 1) = 1728*814+1097;
P(1015, 2) = 1728*1097+1096;
P(1015, 3) = 1728*1096+1101;
P(1015, 4) = 1728*1101+1102;
P(1015, 5) = 1728*1102+1063;
P(1015, 6) = 1728*1063+1060;
P(1015, 7) = 1728*1060+1011;
P(1015, 8) = 1728*1011+1010;
P(1015, 9) = 1728*1010+775;
P(1016, 0) = 1728*776+777;
P(1016, 1) = 1728*777+778;
P(1016, 2) = 1728*778+779;
P(1016, 3) = 1728*779+828;
P(1016, 4) = 1728*828+829;
P(1016, 5) = 1728*829+830;
P(1016, 6) = 1728*830+839;
P(1016, 7) = 1728*839+836;
P(1016, 8) = 1728*836+787;
P(1016, 9) = 1728*787+776;
P(1017, 0) = 1728*776+777;
P(1017, 1) = 1728*777+778;
P(1017, 2) = 1728*778+779;
P(1017, 3) = 1728*779+828;
P(1017, 4) = 1728*828+831;
P(1017, 5) = 1728*831+1066;
P(1017, 6) = 1728*1066+1065;
P(1017, 7) = 1728*1065+782;
P(1017, 8) = 1728*782+781;
P(1017, 9) = 1728*781+776;
P(1018, 0) = 1728*776+781;
P(1018, 1) = 1728*781+782;
P(1018, 2) = 1728*782+791;
P(1018, 3) = 1728*791+788;
P(1018, 4) = 1728*788+789;
P(1018, 5) = 1728*789+784;
P(1018, 6) = 1728*784+785;
P(1018, 7) = 1728*785+786;
P(1018, 8) = 1728*786+787;
P(1018, 9) = 1728*787+776;
P(1019, 0) = 1728*776+781;
P(1019, 1) = 1728*781+782;
P(1019, 2) = 1728*782+1065;
P(1019, 3) = 1728*1065+1064;
P(1019, 4) = 1728*1064+1075;
P(1019, 5) = 1728*1075+1074;
P(1019, 6) = 1728*1074+839;
P(1019, 7) = 1728*839+836;
P(1019, 8) = 1728*836+787;
P(1019, 9) = 1728*787+776;
P(1020, 0) = 1728*780+781;
P(1020, 1) = 1728*781+782;
P(1020, 2) = 1728*782+791;
P(1020, 3) = 1728*791+1026;
P(1020, 4) = 1728*1026+1027;
P(1020, 5) = 1728*1027+1016;
P(1020, 6) = 1728*1016+1017;
P(1020, 7) = 1728*1017+1018;
P(1020, 8) = 1728*1018+783;
P(1020, 9) = 1728*783+780;
P(1021, 0) = 1728*780+781;
P(1021, 1) = 1728*781+782;
P(1021, 2) = 1728*782+1065;
P(1021, 3) = 1728*1065+1064;
P(1021, 4) = 1728*1064+1069;
P(1021, 5) = 1728*1069+1068;
P(1021, 6) = 1728*1068+1019;
P(1021, 7) = 1728*1019+1018;
P(1021, 8) = 1728*1018+783;
P(1021, 9) = 1728*783+780;
P(1022, 0) = 1728*782+791;
P(1022, 1) = 1728*791+788;
P(1022, 2) = 1728*788+789;
P(1022, 3) = 1728*789+790;
P(1022, 4) = 1728*790+1073;
P(1022, 5) = 1728*1073+1074;
P(1022, 6) = 1728*1074+1075;
P(1022, 7) = 1728*1075+1064;
P(1022, 8) = 1728*1064+1065;
P(1022, 9) = 1728*1065+782;
P(1023, 0) = 1728*782+791;
P(1023, 1) = 1728*791+1026;
P(1023, 2) = 1728*1026+1027;
P(1023, 3) = 1728*1027+1076;
P(1023, 4) = 1728*1076+1079;
P(1023, 5) = 1728*1079+1070;
P(1023, 6) = 1728*1070+1069;
P(1023, 7) = 1728*1069+1064;
P(1023, 8) = 1728*1064+1065;
P(1023, 9) = 1728*1065+782;
P(1024, 0) = 1728*784+785;
P(1024, 1) = 1728*785+786;
P(1024, 2) = 1728*786+787;
P(1024, 3) = 1728*787+836;
P(1024, 4) = 1728*836+837;
P(1024, 5) = 1728*837+838;
P(1024, 6) = 1728*838+847;
P(1024, 7) = 1728*847+844;
P(1024, 8) = 1728*844+795;
P(1024, 9) = 1728*795+784;
P(1025, 0) = 1728*784+785;
P(1025, 1) = 1728*785+786;
P(1025, 2) = 1728*786+787;
P(1025, 3) = 1728*787+836;
P(1025, 4) = 1728*836+839;
P(1025, 5) = 1728*839+1074;
P(1025, 6) = 1728*1074+1073;
P(1025, 7) = 1728*1073+790;
P(1025, 8) = 1728*790+789;
P(1025, 9) = 1728*789+784;
P(1026, 0) = 1728*784+789;
P(1026, 1) = 1728*789+790;
P(1026, 2) = 1728*790+799;
P(1026, 3) = 1728*799+796;
P(1026, 4) = 1728*796+797;
P(1026, 5) = 1728*797+792;
P(1026, 6) = 1728*792+793;
P(1026, 7) = 1728*793+794;
P(1026, 8) = 1728*794+795;
P(1026, 9) = 1728*795+784;
P(1027, 0) = 1728*784+789;
P(1027, 1) = 1728*789+790;
P(1027, 2) = 1728*790+1073;
P(1027, 3) = 1728*1073+1072;
P(1027, 4) = 1728*1072+1083;
P(1027, 5) = 1728*1083+1082;
P(1027, 6) = 1728*1082+847;
P(1027, 7) = 1728*847+844;
P(1027, 8) = 1728*844+795;
P(1027, 9) = 1728*795+784;
P(1028, 0) = 1728*788+789;
P(1028, 1) = 1728*789+790;
P(1028, 2) = 1728*790+799;
P(1028, 3) = 1728*799+1034;
P(1028, 4) = 1728*1034+1035;
P(1028, 5) = 1728*1035+1024;
P(1028, 6) = 1728*1024+1025;
P(1028, 7) = 1728*1025+1026;
P(1028, 8) = 1728*1026+791;
P(1028, 9) = 1728*791+788;
P(1029, 0) = 1728*788+789;
P(1029, 1) = 1728*789+790;
P(1029, 2) = 1728*790+1073;
P(1029, 3) = 1728*1073+1072;
P(1029, 4) = 1728*1072+1077;
P(1029, 5) = 1728*1077+1076;
P(1029, 6) = 1728*1076+1027;
P(1029, 7) = 1728*1027+1026;
P(1029, 8) = 1728*1026+791;
P(1029, 9) = 1728*791+788;
P(1030, 0) = 1728*790+799;
P(1030, 1) = 1728*799+796;
P(1030, 2) = 1728*796+797;
P(1030, 3) = 1728*797+798;
P(1030, 4) = 1728*798+1081;
P(1030, 5) = 1728*1081+1082;
P(1030, 6) = 1728*1082+1083;
P(1030, 7) = 1728*1083+1072;
P(1030, 8) = 1728*1072+1073;
P(1030, 9) = 1728*1073+790;
P(1031, 0) = 1728*790+799;
P(1031, 1) = 1728*799+1034;
P(1031, 2) = 1728*1034+1035;
P(1031, 3) = 1728*1035+1084;
P(1031, 4) = 1728*1084+1087;
P(1031, 5) = 1728*1087+1078;
P(1031, 6) = 1728*1078+1077;
P(1031, 7) = 1728*1077+1072;
P(1031, 8) = 1728*1072+1073;
P(1031, 9) = 1728*1073+790;
P(1032, 0) = 1728*792+793;
P(1032, 1) = 1728*793+794;
P(1032, 2) = 1728*794+795;
P(1032, 3) = 1728*795+844;
P(1032, 4) = 1728*844+845;
P(1032, 5) = 1728*845+846;
P(1032, 6) = 1728*846+855;
P(1032, 7) = 1728*855+852;
P(1032, 8) = 1728*852+803;
P(1032, 9) = 1728*803+792;
P(1033, 0) = 1728*792+793;
P(1033, 1) = 1728*793+794;
P(1033, 2) = 1728*794+795;
P(1033, 3) = 1728*795+844;
P(1033, 4) = 1728*844+847;
P(1033, 5) = 1728*847+1082;
P(1033, 6) = 1728*1082+1081;
P(1033, 7) = 1728*1081+798;
P(1033, 8) = 1728*798+797;
P(1033, 9) = 1728*797+792;
P(1034, 0) = 1728*792+797;
P(1034, 1) = 1728*797+798;
P(1034, 2) = 1728*798+807;
P(1034, 3) = 1728*807+804;
P(1034, 4) = 1728*804+805;
P(1034, 5) = 1728*805+800;
P(1034, 6) = 1728*800+801;
P(1034, 7) = 1728*801+802;
P(1034, 8) = 1728*802+803;
P(1034, 9) = 1728*803+792;
P(1035, 0) = 1728*792+797;
P(1035, 1) = 1728*797+798;
P(1035, 2) = 1728*798+1081;
P(1035, 3) = 1728*1081+1080;
P(1035, 4) = 1728*1080+1091;
P(1035, 5) = 1728*1091+1090;
P(1035, 6) = 1728*1090+855;
P(1035, 7) = 1728*855+852;
P(1035, 8) = 1728*852+803;
P(1035, 9) = 1728*803+792;
P(1036, 0) = 1728*796+797;
P(1036, 1) = 1728*797+798;
P(1036, 2) = 1728*798+807;
P(1036, 3) = 1728*807+1042;
P(1036, 4) = 1728*1042+1043;
P(1036, 5) = 1728*1043+1032;
P(1036, 6) = 1728*1032+1033;
P(1036, 7) = 1728*1033+1034;
P(1036, 8) = 1728*1034+799;
P(1036, 9) = 1728*799+796;
P(1037, 0) = 1728*796+797;
P(1037, 1) = 1728*797+798;
P(1037, 2) = 1728*798+1081;
P(1037, 3) = 1728*1081+1080;
P(1037, 4) = 1728*1080+1085;
P(1037, 5) = 1728*1085+1084;
P(1037, 6) = 1728*1084+1035;
P(1037, 7) = 1728*1035+1034;
P(1037, 8) = 1728*1034+799;
P(1037, 9) = 1728*799+796;
P(1038, 0) = 1728*798+807;
P(1038, 1) = 1728*807+804;
P(1038, 2) = 1728*804+805;
P(1038, 3) = 1728*805+806;
P(1038, 4) = 1728*806+1089;
P(1038, 5) = 1728*1089+1090;
P(1038, 6) = 1728*1090+1091;
P(1038, 7) = 1728*1091+1080;
P(1038, 8) = 1728*1080+1081;
P(1038, 9) = 1728*1081+798;
P(1039, 0) = 1728*798+807;
P(1039, 1) = 1728*807+1042;
P(1039, 2) = 1728*1042+1043;
P(1039, 3) = 1728*1043+1092;
P(1039, 4) = 1728*1092+1095;
P(1039, 5) = 1728*1095+1086;
P(1039, 6) = 1728*1086+1085;
P(1039, 7) = 1728*1085+1080;
P(1039, 8) = 1728*1080+1081;
P(1039, 9) = 1728*1081+798;
P(1040, 0) = 1728*800+801;
P(1040, 1) = 1728*801+802;
P(1040, 2) = 1728*802+803;
P(1040, 3) = 1728*803+852;
P(1040, 4) = 1728*852+853;
P(1040, 5) = 1728*853+854;
P(1040, 6) = 1728*854+863;
P(1040, 7) = 1728*863+860;
P(1040, 8) = 1728*860+811;
P(1040, 9) = 1728*811+800;
P(1041, 0) = 1728*800+801;
P(1041, 1) = 1728*801+802;
P(1041, 2) = 1728*802+803;
P(1041, 3) = 1728*803+852;
P(1041, 4) = 1728*852+855;
P(1041, 5) = 1728*855+1090;
P(1041, 6) = 1728*1090+1089;
P(1041, 7) = 1728*1089+806;
P(1041, 8) = 1728*806+805;
P(1041, 9) = 1728*805+800;
P(1042, 0) = 1728*800+805;
P(1042, 1) = 1728*805+806;
P(1042, 2) = 1728*806+815;
P(1042, 3) = 1728*815+812;
P(1042, 4) = 1728*812+813;
P(1042, 5) = 1728*813+808;
P(1042, 6) = 1728*808+809;
P(1042, 7) = 1728*809+810;
P(1042, 8) = 1728*810+811;
P(1042, 9) = 1728*811+800;
P(1043, 0) = 1728*800+805;
P(1043, 1) = 1728*805+806;
P(1043, 2) = 1728*806+1089;
P(1043, 3) = 1728*1089+1088;
P(1043, 4) = 1728*1088+1099;
P(1043, 5) = 1728*1099+1098;
P(1043, 6) = 1728*1098+863;
P(1043, 7) = 1728*863+860;
P(1043, 8) = 1728*860+811;
P(1043, 9) = 1728*811+800;
P(1044, 0) = 1728*804+805;
P(1044, 1) = 1728*805+806;
P(1044, 2) = 1728*806+815;
P(1044, 3) = 1728*815+1050;
P(1044, 4) = 1728*1050+1051;
P(1044, 5) = 1728*1051+1040;
P(1044, 6) = 1728*1040+1041;
P(1044, 7) = 1728*1041+1042;
P(1044, 8) = 1728*1042+807;
P(1044, 9) = 1728*807+804;
P(1045, 0) = 1728*804+805;
P(1045, 1) = 1728*805+806;
P(1045, 2) = 1728*806+1089;
P(1045, 3) = 1728*1089+1088;
P(1045, 4) = 1728*1088+1093;
P(1045, 5) = 1728*1093+1092;
P(1045, 6) = 1728*1092+1043;
P(1045, 7) = 1728*1043+1042;
P(1045, 8) = 1728*1042+807;
P(1045, 9) = 1728*807+804;
P(1046, 0) = 1728*806+815;
P(1046, 1) = 1728*815+812;
P(1046, 2) = 1728*812+813;
P(1046, 3) = 1728*813+814;
P(1046, 4) = 1728*814+1097;
P(1046, 5) = 1728*1097+1098;
P(1046, 6) = 1728*1098+1099;
P(1046, 7) = 1728*1099+1088;
P(1046, 8) = 1728*1088+1089;
P(1046, 9) = 1728*1089+806;
P(1047, 0) = 1728*806+815;
P(1047, 1) = 1728*815+1050;
P(1047, 2) = 1728*1050+1051;
P(1047, 3) = 1728*1051+1100;
P(1047, 4) = 1728*1100+1103;
P(1047, 5) = 1728*1103+1094;
P(1047, 6) = 1728*1094+1093;
P(1047, 7) = 1728*1093+1088;
P(1047, 8) = 1728*1088+1089;
P(1047, 9) = 1728*1089+806;
P(1048, 0) = 1728*808+809;
P(1048, 1) = 1728*809+810;
P(1048, 2) = 1728*810+811;
P(1048, 3) = 1728*811+860;
P(1048, 4) = 1728*860+863;
P(1048, 5) = 1728*863+1098;
P(1048, 6) = 1728*1098+1097;
P(1048, 7) = 1728*1097+814;
P(1048, 8) = 1728*814+813;
P(1048, 9) = 1728*813+808;
P(1049, 0) = 1728*812+813;
P(1049, 1) = 1728*813+814;
P(1049, 2) = 1728*814+1097;
P(1049, 3) = 1728*1097+1096;
P(1049, 4) = 1728*1096+1101;
P(1049, 5) = 1728*1101+1100;
P(1049, 6) = 1728*1100+1051;
P(1049, 7) = 1728*1051+1050;
P(1049, 8) = 1728*1050+815;
P(1049, 9) = 1728*815+812;
P(1050, 0) = 1728*816+817;
P(1050, 1) = 1728*817+818;
P(1050, 2) = 1728*818+819;
P(1050, 3) = 1728*819+856;
P(1050, 4) = 1728*856+861;
P(1050, 5) = 1728*861+862;
P(1050, 6) = 1728*862+823;
P(1050, 7) = 1728*823+820;
P(1050, 8) = 1728*820+821;
P(1050, 9) = 1728*821+816;
P(1051, 0) = 1728*816+821;
P(1051, 1) = 1728*821+822;
P(1051, 2) = 1728*822+831;
P(1051, 3) = 1728*831+828;
P(1051, 4) = 1728*828+829;
P(1051, 5) = 1728*829+824;
P(1051, 6) = 1728*824+825;
P(1051, 7) = 1728*825+826;
P(1051, 8) = 1728*826+827;
P(1051, 9) = 1728*827+816;
P(1052, 0) = 1728*820+821;
P(1052, 1) = 1728*821+822;
P(1052, 2) = 1728*822+831;
P(1052, 3) = 1728*831+1066;
P(1052, 4) = 1728*1066+1067;
P(1052, 5) = 1728*1067+1056;
P(1052, 6) = 1728*1056+1057;
P(1052, 7) = 1728*1057+1058;
P(1052, 8) = 1728*1058+823;
P(1052, 9) = 1728*823+820;
P(1053, 0) = 1728*820+821;
P(1053, 1) = 1728*821+822;
P(1053, 2) = 1728*822+1105;
P(1053, 3) = 1728*1105+1104;
P(1053, 4) = 1728*1104+1109;
P(1053, 5) = 1728*1109+1108;
P(1053, 6) = 1728*1108+1059;
P(1053, 7) = 1728*1059+1058;
P(1053, 8) = 1728*1058+823;
P(1053, 9) = 1728*823+820;
P(1054, 0) = 1728*820+821;
P(1054, 1) = 1728*821+822;
P(1054, 2) = 1728*822+1105;
P(1054, 3) = 1728*1105+1106;
P(1054, 4) = 1728*1106+1107;
P(1054, 5) = 1728*1107+1144;
P(1054, 6) = 1728*1144+1145;
P(1054, 7) = 1728*1145+862;
P(1054, 8) = 1728*862+823;
P(1054, 9) = 1728*823+820;
P(1055, 0) = 1728*822+831;
P(1055, 1) = 1728*831+828;
P(1055, 2) = 1728*828+829;
P(1055, 3) = 1728*829+830;
P(1055, 4) = 1728*830+1113;
P(1055, 5) = 1728*1113+1114;
P(1055, 6) = 1728*1114+1115;
P(1055, 7) = 1728*1115+1104;
P(1055, 8) = 1728*1104+1105;
P(1055, 9) = 1728*1105+822;
P(1056, 0) = 1728*822+831;
P(1056, 1) = 1728*831+1066;
P(1056, 2) = 1728*1066+1067;
P(1056, 3) = 1728*1067+1116;
P(1056, 4) = 1728*1116+1119;
P(1056, 5) = 1728*1119+1110;
P(1056, 6) = 1728*1110+1109;
P(1056, 7) = 1728*1109+1104;
P(1056, 8) = 1728*1104+1105;
P(1056, 9) = 1728*1105+822;
P(1057, 0) = 1728*823+862;
P(1057, 1) = 1728*862+861;
P(1057, 2) = 1728*861+860;
P(1057, 3) = 1728*860+863;
P(1057, 4) = 1728*863+1098;
P(1057, 5) = 1728*1098+1097;
P(1057, 6) = 1728*1097+1096;
P(1057, 7) = 1728*1096+1059;
P(1057, 8) = 1728*1059+1058;
P(1057, 9) = 1728*1058+823;
P(1058, 0) = 1728*823+862;
P(1058, 1) = 1728*862+1145;
P(1058, 2) = 1728*1145+1144;
P(1058, 3) = 1728*1144+1149;
P(1058, 4) = 1728*1149+1150;
P(1058, 5) = 1728*1150+1111;
P(1058, 6) = 1728*1111+1108;
P(1058, 7) = 1728*1108+1059;
P(1058, 8) = 1728*1059+1058;
P(1058, 9) = 1728*1058+823;
P(1059, 0) = 1728*824+829;
P(1059, 1) = 1728*829+830;
P(1059, 2) = 1728*830+839;
P(1059, 3) = 1728*839+836;
P(1059, 4) = 1728*836+837;
P(1059, 5) = 1728*837+832;
P(1059, 6) = 1728*832+833;
P(1059, 7) = 1728*833+834;
P(1059, 8) = 1728*834+835;
P(1059, 9) = 1728*835+824;
P(1060, 0) = 1728*828+829;
P(1060, 1) = 1728*829+830;
P(1060, 2) = 1728*830+839;
P(1060, 3) = 1728*839+1074;
P(1060, 4) = 1728*1074+1075;
P(1060, 5) = 1728*1075+1064;
P(1060, 6) = 1728*1064+1065;
P(1060, 7) = 1728*1065+1066;
P(1060, 8) = 1728*1066+831;
P(1060, 9) = 1728*831+828;
P(1061, 0) = 1728*828+829;
P(1061, 1) = 1728*829+830;
P(1061, 2) = 1728*830+1113;
P(1061, 3) = 1728*1113+1112;
P(1061, 4) = 1728*1112+1117;
P(1061, 5) = 1728*1117+1116;
P(1061, 6) = 1728*1116+1067;
P(1061, 7) = 1728*1067+1066;
P(1061, 8) = 1728*1066+831;
P(1061, 9) = 1728*831+828;
P(1062, 0) = 1728*830+839;
P(1062, 1) = 1728*839+836;
P(1062, 2) = 1728*836+837;
P(1062, 3) = 1728*837+838;
P(1062, 4) = 1728*838+1121;
P(1062, 5) = 1728*1121+1122;
P(1062, 6) = 1728*1122+1123;
P(1062, 7) = 1728*1123+1112;
P(1062, 8) = 1728*1112+1113;
P(1062, 9) = 1728*1113+830;
P(1063, 0) = 1728*830+839;
P(1063, 1) = 1728*839+1074;
P(1063, 2) = 1728*1074+1075;
P(1063, 3) = 1728*1075+1124;
P(1063, 4) = 1728*1124+1127;
P(1063, 5) = 1728*1127+1118;
P(1063, 6) = 1728*1118+1117;
P(1063, 7) = 1728*1117+1112;
P(1063, 8) = 1728*1112+1113;
P(1063, 9) = 1728*1113+830;
P(1064, 0) = 1728*832+837;
P(1064, 1) = 1728*837+838;
P(1064, 2) = 1728*838+847;
P(1064, 3) = 1728*847+844;
P(1064, 4) = 1728*844+845;
P(1064, 5) = 1728*845+840;
P(1064, 6) = 1728*840+841;
P(1064, 7) = 1728*841+842;
P(1064, 8) = 1728*842+843;
P(1064, 9) = 1728*843+832;
P(1065, 0) = 1728*836+837;
P(1065, 1) = 1728*837+838;
P(1065, 2) = 1728*838+847;
P(1065, 3) = 1728*847+1082;
P(1065, 4) = 1728*1082+1083;
P(1065, 5) = 1728*1083+1072;
P(1065, 6) = 1728*1072+1073;
P(1065, 7) = 1728*1073+1074;
P(1065, 8) = 1728*1074+839;
P(1065, 9) = 1728*839+836;
P(1066, 0) = 1728*836+837;
P(1066, 1) = 1728*837+838;
P(1066, 2) = 1728*838+1121;
P(1066, 3) = 1728*1121+1120;
P(1066, 4) = 1728*1120+1125;
P(1066, 5) = 1728*1125+1124;
P(1066, 6) = 1728*1124+1075;
P(1066, 7) = 1728*1075+1074;
P(1066, 8) = 1728*1074+839;
P(1066, 9) = 1728*839+836;
P(1067, 0) = 1728*838+847;
P(1067, 1) = 1728*847+844;
P(1067, 2) = 1728*844+845;
P(1067, 3) = 1728*845+846;
P(1067, 4) = 1728*846+1129;
P(1067, 5) = 1728*1129+1130;
P(1067, 6) = 1728*1130+1131;
P(1067, 7) = 1728*1131+1120;
P(1067, 8) = 1728*1120+1121;
P(1067, 9) = 1728*1121+838;
P(1068, 0) = 1728*838+847;
P(1068, 1) = 1728*847+1082;
P(1068, 2) = 1728*1082+1083;
P(1068, 3) = 1728*1083+1132;
P(1068, 4) = 1728*1132+1135;
P(1068, 5) = 1728*1135+1126;
P(1068, 6) = 1728*1126+1125;
P(1068, 7) = 1728*1125+1120;
P(1068, 8) = 1728*1120+1121;
P(1068, 9) = 1728*1121+838;
P(1069, 0) = 1728*840+845;
P(1069, 1) = 1728*845+846;
P(1069, 2) = 1728*846+855;
P(1069, 3) = 1728*855+852;
P(1069, 4) = 1728*852+853;
P(1069, 5) = 1728*853+848;
P(1069, 6) = 1728*848+849;
P(1069, 7) = 1728*849+850;
P(1069, 8) = 1728*850+851;
P(1069, 9) = 1728*851+840;
P(1070, 0) = 1728*844+845;
P(1070, 1) = 1728*845+846;
P(1070, 2) = 1728*846+855;
P(1070, 3) = 1728*855+1090;
P(1070, 4) = 1728*1090+1091;
P(1070, 5) = 1728*1091+1080;
P(1070, 6) = 1728*1080+1081;
P(1070, 7) = 1728*1081+1082;
P(1070, 8) = 1728*1082+847;
P(1070, 9) = 1728*847+844;
P(1071, 0) = 1728*844+845;
P(1071, 1) = 1728*845+846;
P(1071, 2) = 1728*846+1129;
P(1071, 3) = 1728*1129+1128;
P(1071, 4) = 1728*1128+1133;
P(1071, 5) = 1728*1133+1132;
P(1071, 6) = 1728*1132+1083;
P(1071, 7) = 1728*1083+1082;
P(1071, 8) = 1728*1082+847;
P(1071, 9) = 1728*847+844;
P(1072, 0) = 1728*846+855;
P(1072, 1) = 1728*855+852;
P(1072, 2) = 1728*852+853;
P(1072, 3) = 1728*853+854;
P(1072, 4) = 1728*854+1137;
P(1072, 5) = 1728*1137+1138;
P(1072, 6) = 1728*1138+1139;
P(1072, 7) = 1728*1139+1128;
P(1072, 8) = 1728*1128+1129;
P(1072, 9) = 1728*1129+846;
P(1073, 0) = 1728*846+855;
P(1073, 1) = 1728*855+1090;
P(1073, 2) = 1728*1090+1091;
P(1073, 3) = 1728*1091+1140;
P(1073, 4) = 1728*1140+1143;
P(1073, 5) = 1728*1143+1134;
P(1073, 6) = 1728*1134+1133;
P(1073, 7) = 1728*1133+1128;
P(1073, 8) = 1728*1128+1129;
P(1073, 9) = 1728*1129+846;
P(1074, 0) = 1728*848+853;
P(1074, 1) = 1728*853+854;
P(1074, 2) = 1728*854+863;
P(1074, 3) = 1728*863+860;
P(1074, 4) = 1728*860+861;
P(1074, 5) = 1728*861+856;
P(1074, 6) = 1728*856+857;
P(1074, 7) = 1728*857+858;
P(1074, 8) = 1728*858+859;
P(1074, 9) = 1728*859+848;
P(1075, 0) = 1728*852+853;
P(1075, 1) = 1728*853+854;
P(1075, 2) = 1728*854+863;
P(1075, 3) = 1728*863+1098;
P(1075, 4) = 1728*1098+1099;
P(1075, 5) = 1728*1099+1088;
P(1075, 6) = 1728*1088+1089;
P(1075, 7) = 1728*1089+1090;
P(1075, 8) = 1728*1090+855;
P(1075, 9) = 1728*855+852;
P(1076, 0) = 1728*852+853;
P(1076, 1) = 1728*853+854;
P(1076, 2) = 1728*854+1137;
P(1076, 3) = 1728*1137+1136;
P(1076, 4) = 1728*1136+1141;
P(1076, 5) = 1728*1141+1140;
P(1076, 6) = 1728*1140+1091;
P(1076, 7) = 1728*1091+1090;
P(1076, 8) = 1728*1090+855;
P(1076, 9) = 1728*855+852;
P(1077, 0) = 1728*854+863;
P(1077, 1) = 1728*863+860;
P(1077, 2) = 1728*860+861;
P(1077, 3) = 1728*861+862;
P(1077, 4) = 1728*862+1145;
P(1077, 5) = 1728*1145+1146;
P(1077, 6) = 1728*1146+1147;
P(1077, 7) = 1728*1147+1136;
P(1077, 8) = 1728*1136+1137;
P(1077, 9) = 1728*1137+854;
P(1078, 0) = 1728*854+863;
P(1078, 1) = 1728*863+1098;
P(1078, 2) = 1728*1098+1099;
P(1078, 3) = 1728*1099+1148;
P(1078, 4) = 1728*1148+1151;
P(1078, 5) = 1728*1151+1142;
P(1078, 6) = 1728*1142+1141;
P(1078, 7) = 1728*1141+1136;
P(1078, 8) = 1728*1136+1137;
P(1078, 9) = 1728*1137+854;
P(1079, 0) = 1728*860+861;
P(1079, 1) = 1728*861+862;
P(1079, 2) = 1728*862+1145;
P(1079, 3) = 1728*1145+1144;
P(1079, 4) = 1728*1144+1149;
P(1079, 5) = 1728*1149+1148;
P(1079, 6) = 1728*1148+1099;
P(1079, 7) = 1728*1099+1098;
P(1079, 8) = 1728*1098+863;
P(1079, 9) = 1728*863+860;
P(1080, 0) = 1728*864+865;
P(1080, 1) = 1728*865+866;
P(1080, 2) = 1728*866+867;
P(1080, 3) = 1728*867+916;
P(1080, 4) = 1728*916+917;
P(1080, 5) = 1728*917+918;
P(1080, 6) = 1728*918+927;
P(1080, 7) = 1728*927+924;
P(1080, 8) = 1728*924+875;
P(1080, 9) = 1728*875+864;
P(1081, 0) = 1728*864+865;
P(1081, 1) = 1728*865+866;
P(1081, 2) = 1728*866+867;
P(1081, 3) = 1728*867+916;
P(1081, 4) = 1728*916+919;
P(1081, 5) = 1728*919+1154;
P(1081, 6) = 1728*1154+1153;
P(1081, 7) = 1728*1153+870;
P(1081, 8) = 1728*870+869;
P(1081, 9) = 1728*869+864;
P(1082, 0) = 1728*864+865;
P(1082, 1) = 1728*865+866;
P(1082, 2) = 1728*866+867;
P(1082, 3) = 1728*867+904;
P(1082, 4) = 1728*904+909;
P(1082, 5) = 1728*909+910;
P(1082, 6) = 1728*910+871;
P(1082, 7) = 1728*871+868;
P(1082, 8) = 1728*868+869;
P(1082, 9) = 1728*869+864;
P(1083, 0) = 1728*864+869;
P(1083, 1) = 1728*869+870;
P(1083, 2) = 1728*870+879;
P(1083, 3) = 1728*879+876;
P(1083, 4) = 1728*876+877;
P(1083, 5) = 1728*877+872;
P(1083, 6) = 1728*872+873;
P(1083, 7) = 1728*873+874;
P(1083, 8) = 1728*874+875;
P(1083, 9) = 1728*875+864;
P(1084, 0) = 1728*864+869;
P(1084, 1) = 1728*869+870;
P(1084, 2) = 1728*870+1153;
P(1084, 3) = 1728*1153+1152;
P(1084, 4) = 1728*1152+1163;
P(1084, 5) = 1728*1163+1162;
P(1084, 6) = 1728*1162+927;
P(1084, 7) = 1728*927+924;
P(1084, 8) = 1728*924+875;
P(1084, 9) = 1728*875+864;
P(1085, 0) = 1728*867+916;
P(1085, 1) = 1728*916+919;
P(1085, 2) = 1728*919+958;
P(1085, 3) = 1728*958+957;
P(1085, 4) = 1728*957+956;
P(1085, 5) = 1728*956+907;
P(1085, 6) = 1728*907+906;
P(1085, 7) = 1728*906+905;
P(1085, 8) = 1728*905+904;
P(1085, 9) = 1728*904+867;
P(1086, 0) = 1728*867+916;
P(1086, 1) = 1728*916+919;
P(1086, 2) = 1728*919+1154;
P(1086, 3) = 1728*1154+1155;
P(1086, 4) = 1728*1155+1192;
P(1086, 5) = 1728*1192+1193;
P(1086, 6) = 1728*1193+910;
P(1086, 7) = 1728*910+909;
P(1086, 8) = 1728*909+904;
P(1086, 9) = 1728*904+867;
P(1087, 0) = 1728*868+869;
P(1087, 1) = 1728*869+870;
P(1087, 2) = 1728*870+879;
P(1087, 3) = 1728*879+876;
P(1087, 4) = 1728*876+1115;
P(1087, 5) = 1728*1115+1104;
P(1087, 6) = 1728*1104+1105;
P(1087, 7) = 1728*1105+1106;
P(1087, 8) = 1728*1106+1107;
P(1087, 9) = 1728*1107+868;
P(1088, 0) = 1728*868+869;
P(1088, 1) = 1728*869+870;
P(1088, 2) = 1728*870+879;
P(1088, 3) = 1728*879+1402;
P(1088, 4) = 1728*1402+1403;
P(1088, 5) = 1728*1403+1392;
P(1088, 6) = 1728*1392+1393;
P(1088, 7) = 1728*1393+1394;
P(1088, 8) = 1728*1394+871;
P(1088, 9) = 1728*871+868;
P(1089, 0) = 1728*868+869;
P(1089, 1) = 1728*869+870;
P(1089, 2) = 1728*870+1153;
P(1089, 3) = 1728*1153+1152;
P(1089, 4) = 1728*1152+1157;
P(1089, 5) = 1728*1157+1156;
P(1089, 6) = 1728*1156+1395;
P(1089, 7) = 1728*1395+1394;
P(1089, 8) = 1728*1394+871;
P(1089, 9) = 1728*871+868;
P(1090, 0) = 1728*868+869;
P(1090, 1) = 1728*869+870;
P(1090, 2) = 1728*870+1153;
P(1090, 3) = 1728*1153+1154;
P(1090, 4) = 1728*1154+1155;
P(1090, 5) = 1728*1155+1192;
P(1090, 6) = 1728*1192+1193;
P(1090, 7) = 1728*1193+910;
P(1090, 8) = 1728*910+871;
P(1090, 9) = 1728*871+868;
P(1091, 0) = 1728*868+1107;
P(1091, 1) = 1728*1107+1106;
P(1091, 2) = 1728*1106+1105;
P(1091, 3) = 1728*1105+1104;
P(1091, 4) = 1728*1104+1109;
P(1091, 5) = 1728*1109+1110;
P(1091, 6) = 1728*1110+1393;
P(1091, 7) = 1728*1393+1394;
P(1091, 8) = 1728*1394+871;
P(1091, 9) = 1728*871+868;
P(1092, 0) = 1728*868+1107;
P(1092, 1) = 1728*1107+1144;
P(1092, 2) = 1728*1144+1145;
P(1092, 3) = 1728*1145+1146;
P(1092, 4) = 1728*1146+1147;
P(1092, 5) = 1728*1147+908;
P(1092, 6) = 1728*908+909;
P(1092, 7) = 1728*909+910;
P(1092, 8) = 1728*910+871;
P(1092, 9) = 1728*871+868;
P(1093, 0) = 1728*868+1107;
P(1093, 1) = 1728*1107+1144;
P(1093, 2) = 1728*1144+1149;
P(1093, 3) = 1728*1149+1150;
P(1093, 4) = 1728*1150+1433;
P(1093, 5) = 1728*1433+1432;
P(1093, 6) = 1728*1432+1395;
P(1093, 7) = 1728*1395+1394;
P(1093, 8) = 1728*1394+871;
P(1093, 9) = 1728*871+868;
P(1094, 0) = 1728*870+879;
P(1094, 1) = 1728*879+876;
P(1094, 2) = 1728*876+877;
P(1094, 3) = 1728*877+878;
P(1094, 4) = 1728*878+1161;
P(1094, 5) = 1728*1161+1162;
P(1094, 6) = 1728*1162+1163;
P(1094, 7) = 1728*1163+1152;
P(1094, 8) = 1728*1152+1153;
P(1094, 9) = 1728*1153+870;
P(1095, 0) = 1728*870+879;
P(1095, 1) = 1728*879+1402;
P(1095, 2) = 1728*1402+1403;
P(1095, 3) = 1728*1403+1164;
P(1095, 4) = 1728*1164+1167;
P(1095, 5) = 1728*1167+1158;
P(1095, 6) = 1728*1158+1157;
P(1095, 7) = 1728*1157+1152;
P(1095, 8) = 1728*1152+1153;
P(1095, 9) = 1728*1153+870;
P(1096, 0) = 1728*871+910;
P(1096, 1) = 1728*910+909;
P(1096, 2) = 1728*909+908;
P(1096, 3) = 1728*908+911;
P(1096, 4) = 1728*911+1434;
P(1096, 5) = 1728*1434+1433;
P(1096, 6) = 1728*1433+1432;
P(1096, 7) = 1728*1432+1395;
P(1096, 8) = 1728*1395+1394;
P(1096, 9) = 1728*1394+871;
P(1097, 0) = 1728*871+910;
P(1097, 1) = 1728*910+1193;
P(1097, 2) = 1728*1193+1192;
P(1097, 3) = 1728*1192+1197;
P(1097, 4) = 1728*1197+1198;
P(1097, 5) = 1728*1198+1159;
P(1097, 6) = 1728*1159+1156;
P(1097, 7) = 1728*1156+1395;
P(1097, 8) = 1728*1395+1394;
P(1097, 9) = 1728*1394+871;
P(1098, 0) = 1728*872+873;
P(1098, 1) = 1728*873+874;
P(1098, 2) = 1728*874+875;
P(1098, 3) = 1728*875+924;
P(1098, 4) = 1728*924+925;
P(1098, 5) = 1728*925+926;
P(1098, 6) = 1728*926+935;
P(1098, 7) = 1728*935+932;
P(1098, 8) = 1728*932+883;
P(1098, 9) = 1728*883+872;
P(1099, 0) = 1728*872+873;
P(1099, 1) = 1728*873+874;
P(1099, 2) = 1728*874+875;
P(1099, 3) = 1728*875+924;
P(1099, 4) = 1728*924+927;
P(1099, 5) = 1728*927+1162;
P(1099, 6) = 1728*1162+1161;
P(1099, 7) = 1728*1161+878;
P(1099, 8) = 1728*878+877;
P(1099, 9) = 1728*877+872;
P(1100, 0) = 1728*872+877;
P(1100, 1) = 1728*877+878;
P(1100, 2) = 1728*878+887;
P(1100, 3) = 1728*887+884;
P(1100, 4) = 1728*884+885;
P(1100, 5) = 1728*885+880;
P(1100, 6) = 1728*880+881;
P(1100, 7) = 1728*881+882;
P(1100, 8) = 1728*882+883;
P(1100, 9) = 1728*883+872;
P(1101, 0) = 1728*872+877;
P(1101, 1) = 1728*877+878;
P(1101, 2) = 1728*878+1161;
P(1101, 3) = 1728*1161+1160;
P(1101, 4) = 1728*1160+1171;
P(1101, 5) = 1728*1171+1170;
P(1101, 6) = 1728*1170+935;
P(1101, 7) = 1728*935+932;
P(1101, 8) = 1728*932+883;
P(1101, 9) = 1728*883+872;
P(1102, 0) = 1728*876+877;
P(1102, 1) = 1728*877+878;
P(1102, 2) = 1728*878+887;
P(1102, 3) = 1728*887+884;
P(1102, 4) = 1728*884+1123;
P(1102, 5) = 1728*1123+1112;
P(1102, 6) = 1728*1112+1113;
P(1102, 7) = 1728*1113+1114;
P(1102, 8) = 1728*1114+1115;
P(1102, 9) = 1728*1115+876;
P(1103, 0) = 1728*876+877;
P(1103, 1) = 1728*877+878;
P(1103, 2) = 1728*878+887;
P(1103, 3) = 1728*887+1410;
P(1103, 4) = 1728*1410+1411;
P(1103, 5) = 1728*1411+1400;
P(1103, 6) = 1728*1400+1401;
P(1103, 7) = 1728*1401+1402;
P(1103, 8) = 1728*1402+879;
P(1103, 9) = 1728*879+876;
P(1104, 0) = 1728*876+877;
P(1104, 1) = 1728*877+878;
P(1104, 2) = 1728*878+1161;
P(1104, 3) = 1728*1161+1160;
P(1104, 4) = 1728*1160+1165;
P(1104, 5) = 1728*1165+1164;
P(1104, 6) = 1728*1164+1403;
P(1104, 7) = 1728*1403+1402;
P(1104, 8) = 1728*1402+879;
P(1104, 9) = 1728*879+876;
P(1105, 0) = 1728*876+1115;
P(1105, 1) = 1728*1115+1114;
P(1105, 2) = 1728*1114+1113;
P(1105, 3) = 1728*1113+1112;
P(1105, 4) = 1728*1112+1117;
P(1105, 5) = 1728*1117+1118;
P(1105, 6) = 1728*1118+1401;
P(1105, 7) = 1728*1401+1402;
P(1105, 8) = 1728*1402+879;
P(1105, 9) = 1728*879+876;
P(1106, 0) = 1728*876+1115;
P(1106, 1) = 1728*1115+1104;
P(1106, 2) = 1728*1104+1109;
P(1106, 3) = 1728*1109+1110;
P(1106, 4) = 1728*1110+1393;
P(1106, 5) = 1728*1393+1392;
P(1106, 6) = 1728*1392+1403;
P(1106, 7) = 1728*1403+1402;
P(1106, 8) = 1728*1402+879;
P(1106, 9) = 1728*879+876;
P(1107, 0) = 1728*878+887;
P(1107, 1) = 1728*887+884;
P(1107, 2) = 1728*884+885;
P(1107, 3) = 1728*885+886;
P(1107, 4) = 1728*886+1169;
P(1107, 5) = 1728*1169+1170;
P(1107, 6) = 1728*1170+1171;
P(1107, 7) = 1728*1171+1160;
P(1107, 8) = 1728*1160+1161;
P(1107, 9) = 1728*1161+878;
P(1108, 0) = 1728*878+887;
P(1108, 1) = 1728*887+1410;
P(1108, 2) = 1728*1410+1411;
P(1108, 3) = 1728*1411+1172;
P(1108, 4) = 1728*1172+1175;
P(1108, 5) = 1728*1175+1166;
P(1108, 6) = 1728*1166+1165;
P(1108, 7) = 1728*1165+1160;
P(1108, 8) = 1728*1160+1161;
P(1108, 9) = 1728*1161+878;
P(1109, 0) = 1728*880+881;
P(1109, 1) = 1728*881+882;
P(1109, 2) = 1728*882+883;
P(1109, 3) = 1728*883+932;
P(1109, 4) = 1728*932+933;
P(1109, 5) = 1728*933+934;
P(1109, 6) = 1728*934+943;
P(1109, 7) = 1728*943+940;
P(1109, 8) = 1728*940+891;
P(1109, 9) = 1728*891+880;
P(1110, 0) = 1728*880+881;
P(1110, 1) = 1728*881+882;
P(1110, 2) = 1728*882+883;
P(1110, 3) = 1728*883+932;
P(1110, 4) = 1728*932+935;
P(1110, 5) = 1728*935+1170;
P(1110, 6) = 1728*1170+1169;
P(1110, 7) = 1728*1169+886;
P(1110, 8) = 1728*886+885;
P(1110, 9) = 1728*885+880;
P(1111, 0) = 1728*880+885;
P(1111, 1) = 1728*885+886;
P(1111, 2) = 1728*886+895;
P(1111, 3) = 1728*895+892;
P(1111, 4) = 1728*892+893;
P(1111, 5) = 1728*893+888;
P(1111, 6) = 1728*888+889;
P(1111, 7) = 1728*889+890;
P(1111, 8) = 1728*890+891;
P(1111, 9) = 1728*891+880;
P(1112, 0) = 1728*880+885;
P(1112, 1) = 1728*885+886;
P(1112, 2) = 1728*886+1169;
P(1112, 3) = 1728*1169+1168;
P(1112, 4) = 1728*1168+1179;
P(1112, 5) = 1728*1179+1178;
P(1112, 6) = 1728*1178+943;
P(1112, 7) = 1728*943+940;
P(1112, 8) = 1728*940+891;
P(1112, 9) = 1728*891+880;
P(1113, 0) = 1728*884+885;
P(1113, 1) = 1728*885+886;
P(1113, 2) = 1728*886+895;
P(1113, 3) = 1728*895+892;
P(1113, 4) = 1728*892+1131;
P(1113, 5) = 1728*1131+1120;
P(1113, 6) = 1728*1120+1121;
P(1113, 7) = 1728*1121+1122;
P(1113, 8) = 1728*1122+1123;
P(1113, 9) = 1728*1123+884;
P(1114, 0) = 1728*884+885;
P(1114, 1) = 1728*885+886;
P(1114, 2) = 1728*886+895;
P(1114, 3) = 1728*895+1418;
P(1114, 4) = 1728*1418+1419;
P(1114, 5) = 1728*1419+1408;
P(1114, 6) = 1728*1408+1409;
P(1114, 7) = 1728*1409+1410;
P(1114, 8) = 1728*1410+887;
P(1114, 9) = 1728*887+884;
P(1115, 0) = 1728*884+885;
P(1115, 1) = 1728*885+886;
P(1115, 2) = 1728*886+1169;
P(1115, 3) = 1728*1169+1168;
P(1115, 4) = 1728*1168+1173;
P(1115, 5) = 1728*1173+1172;
P(1115, 6) = 1728*1172+1411;
P(1115, 7) = 1728*1411+1410;
P(1115, 8) = 1728*1410+887;
P(1115, 9) = 1728*887+884;
P(1116, 0) = 1728*884+1123;
P(1116, 1) = 1728*1123+1122;
P(1116, 2) = 1728*1122+1121;
P(1116, 3) = 1728*1121+1120;
P(1116, 4) = 1728*1120+1125;
P(1116, 5) = 1728*1125+1126;
P(1116, 6) = 1728*1126+1409;
P(1116, 7) = 1728*1409+1410;
P(1116, 8) = 1728*1410+887;
P(1116, 9) = 1728*887+884;
P(1117, 0) = 1728*884+1123;
P(1117, 1) = 1728*1123+1112;
P(1117, 2) = 1728*1112+1117;
P(1117, 3) = 1728*1117+1118;
P(1117, 4) = 1728*1118+1401;
P(1117, 5) = 1728*1401+1400;
P(1117, 6) = 1728*1400+1411;
P(1117, 7) = 1728*1411+1410;
P(1117, 8) = 1728*1410+887;
P(1117, 9) = 1728*887+884;
P(1118, 0) = 1728*886+895;
P(1118, 1) = 1728*895+892;
P(1118, 2) = 1728*892+893;
P(1118, 3) = 1728*893+894;
P(1118, 4) = 1728*894+1177;
P(1118, 5) = 1728*1177+1178;
P(1118, 6) = 1728*1178+1179;
P(1118, 7) = 1728*1179+1168;
P(1118, 8) = 1728*1168+1169;
P(1118, 9) = 1728*1169+886;
P(1119, 0) = 1728*886+895;
P(1119, 1) = 1728*895+1418;
P(1119, 2) = 1728*1418+1419;
P(1119, 3) = 1728*1419+1180;
P(1119, 4) = 1728*1180+1183;
P(1119, 5) = 1728*1183+1174;
P(1119, 6) = 1728*1174+1173;
P(1119, 7) = 1728*1173+1168;
P(1119, 8) = 1728*1168+1169;
P(1119, 9) = 1728*1169+886;
P(1120, 0) = 1728*888+889;
P(1120, 1) = 1728*889+890;
P(1120, 2) = 1728*890+891;
P(1120, 3) = 1728*891+940;
P(1120, 4) = 1728*940+941;
P(1120, 5) = 1728*941+942;
P(1120, 6) = 1728*942+951;
P(1120, 7) = 1728*951+948;
P(1120, 8) = 1728*948+899;
P(1120, 9) = 1728*899+888;
P(1121, 0) = 1728*888+889;
P(1121, 1) = 1728*889+890;
P(1121, 2) = 1728*890+891;
P(1121, 3) = 1728*891+940;
P(1121, 4) = 1728*940+943;
P(1121, 5) = 1728*943+1178;
P(1121, 6) = 1728*1178+1177;
P(1121, 7) = 1728*1177+894;
P(1121, 8) = 1728*894+893;
P(1121, 9) = 1728*893+888;
P(1122, 0) = 1728*888+893;
P(1122, 1) = 1728*893+894;
P(1122, 2) = 1728*894+903;
P(1122, 3) = 1728*903+900;
P(1122, 4) = 1728*900+901;
P(1122, 5) = 1728*901+896;
P(1122, 6) = 1728*896+897;
P(1122, 7) = 1728*897+898;
P(1122, 8) = 1728*898+899;
P(1122, 9) = 1728*899+888;
P(1123, 0) = 1728*888+893;
P(1123, 1) = 1728*893+894;
P(1123, 2) = 1728*894+1177;
P(1123, 3) = 1728*1177+1176;
P(1123, 4) = 1728*1176+1187;
P(1123, 5) = 1728*1187+1186;
P(1123, 6) = 1728*1186+951;
P(1123, 7) = 1728*951+948;
P(1123, 8) = 1728*948+899;
P(1123, 9) = 1728*899+888;
P(1124, 0) = 1728*892+893;
P(1124, 1) = 1728*893+894;
P(1124, 2) = 1728*894+903;
P(1124, 3) = 1728*903+900;
P(1124, 4) = 1728*900+1139;
P(1124, 5) = 1728*1139+1128;
P(1124, 6) = 1728*1128+1129;
P(1124, 7) = 1728*1129+1130;
P(1124, 8) = 1728*1130+1131;
P(1124, 9) = 1728*1131+892;
P(1125, 0) = 1728*892+893;
P(1125, 1) = 1728*893+894;
P(1125, 2) = 1728*894+903;
P(1125, 3) = 1728*903+1426;
P(1125, 4) = 1728*1426+1427;
P(1125, 5) = 1728*1427+1416;
P(1125, 6) = 1728*1416+1417;
P(1125, 7) = 1728*1417+1418;
P(1125, 8) = 1728*1418+895;
P(1125, 9) = 1728*895+892;
P(1126, 0) = 1728*892+893;
P(1126, 1) = 1728*893+894;
P(1126, 2) = 1728*894+1177;
P(1126, 3) = 1728*1177+1176;
P(1126, 4) = 1728*1176+1181;
P(1126, 5) = 1728*1181+1180;
P(1126, 6) = 1728*1180+1419;
P(1126, 7) = 1728*1419+1418;
P(1126, 8) = 1728*1418+895;
P(1126, 9) = 1728*895+892;
P(1127, 0) = 1728*892+1131;
P(1127, 1) = 1728*1131+1130;
P(1127, 2) = 1728*1130+1129;
P(1127, 3) = 1728*1129+1128;
P(1127, 4) = 1728*1128+1133;
P(1127, 5) = 1728*1133+1134;
P(1127, 6) = 1728*1134+1417;
P(1127, 7) = 1728*1417+1418;
P(1127, 8) = 1728*1418+895;
P(1127, 9) = 1728*895+892;
P(1128, 0) = 1728*892+1131;
P(1128, 1) = 1728*1131+1120;
P(1128, 2) = 1728*1120+1125;
P(1128, 3) = 1728*1125+1126;
P(1128, 4) = 1728*1126+1409;
P(1128, 5) = 1728*1409+1408;
P(1128, 6) = 1728*1408+1419;
P(1128, 7) = 1728*1419+1418;
P(1128, 8) = 1728*1418+895;
P(1128, 9) = 1728*895+892;
P(1129, 0) = 1728*894+903;
P(1129, 1) = 1728*903+900;
P(1129, 2) = 1728*900+901;
P(1129, 3) = 1728*901+902;
P(1129, 4) = 1728*902+1185;
P(1129, 5) = 1728*1185+1186;
P(1129, 6) = 1728*1186+1187;
P(1129, 7) = 1728*1187+1176;
P(1129, 8) = 1728*1176+1177;
P(1129, 9) = 1728*1177+894;
P(1130, 0) = 1728*894+903;
P(1130, 1) = 1728*903+1426;
P(1130, 2) = 1728*1426+1427;
P(1130, 3) = 1728*1427+1188;
P(1130, 4) = 1728*1188+1191;
P(1130, 5) = 1728*1191+1182;
P(1130, 6) = 1728*1182+1181;
P(1130, 7) = 1728*1181+1176;
P(1130, 8) = 1728*1176+1177;
P(1130, 9) = 1728*1177+894;
P(1131, 0) = 1728*896+897;
P(1131, 1) = 1728*897+898;
P(1131, 2) = 1728*898+899;
P(1131, 3) = 1728*899+948;
P(1131, 4) = 1728*948+949;
P(1131, 5) = 1728*949+950;
P(1131, 6) = 1728*950+959;
P(1131, 7) = 1728*959+956;
P(1131, 8) = 1728*956+907;
P(1131, 9) = 1728*907+896;
P(1132, 0) = 1728*896+897;
P(1132, 1) = 1728*897+898;
P(1132, 2) = 1728*898+899;
P(1132, 3) = 1728*899+948;
P(1132, 4) = 1728*948+951;
P(1132, 5) = 1728*951+1186;
P(1132, 6) = 1728*1186+1185;
P(1132, 7) = 1728*1185+902;
P(1132, 8) = 1728*902+901;
P(1132, 9) = 1728*901+896;
P(1133, 0) = 1728*896+901;
P(1133, 1) = 1728*901+902;
P(1133, 2) = 1728*902+911;
P(1133, 3) = 1728*911+908;
P(1133, 4) = 1728*908+909;
P(1133, 5) = 1728*909+904;
P(1133, 6) = 1728*904+905;
P(1133, 7) = 1728*905+906;
P(1133, 8) = 1728*906+907;
P(1133, 9) = 1728*907+896;
P(1134, 0) = 1728*896+901;
P(1134, 1) = 1728*901+902;
P(1134, 2) = 1728*902+1185;
P(1134, 3) = 1728*1185+1184;
P(1134, 4) = 1728*1184+1195;
P(1134, 5) = 1728*1195+1194;
P(1134, 6) = 1728*1194+959;
P(1134, 7) = 1728*959+956;
P(1134, 8) = 1728*956+907;
P(1134, 9) = 1728*907+896;
P(1135, 0) = 1728*900+901;
P(1135, 1) = 1728*901+902;
P(1135, 2) = 1728*902+911;
P(1135, 3) = 1728*911+908;
P(1135, 4) = 1728*908+1147;
P(1135, 5) = 1728*1147+1136;
P(1135, 6) = 1728*1136+1137;
P(1135, 7) = 1728*1137+1138;
P(1135, 8) = 1728*1138+1139;
P(1135, 9) = 1728*1139+900;
P(1136, 0) = 1728*900+901;
P(1136, 1) = 1728*901+902;
P(1136, 2) = 1728*902+911;
P(1136, 3) = 1728*911+1434;
P(1136, 4) = 1728*1434+1435;
P(1136, 5) = 1728*1435+1424;
P(1136, 6) = 1728*1424+1425;
P(1136, 7) = 1728*1425+1426;
P(1136, 8) = 1728*1426+903;
P(1136, 9) = 1728*903+900;
P(1137, 0) = 1728*900+901;
P(1137, 1) = 1728*901+902;
P(1137, 2) = 1728*902+1185;
P(1137, 3) = 1728*1185+1184;
P(1137, 4) = 1728*1184+1189;
P(1137, 5) = 1728*1189+1188;
P(1137, 6) = 1728*1188+1427;
P(1137, 7) = 1728*1427+1426;
P(1137, 8) = 1728*1426+903;
P(1137, 9) = 1728*903+900;
P(1138, 0) = 1728*900+1139;
P(1138, 1) = 1728*1139+1138;
P(1138, 2) = 1728*1138+1137;
P(1138, 3) = 1728*1137+1136;
P(1138, 4) = 1728*1136+1141;
P(1138, 5) = 1728*1141+1142;
P(1138, 6) = 1728*1142+1425;
P(1138, 7) = 1728*1425+1426;
P(1138, 8) = 1728*1426+903;
P(1138, 9) = 1728*903+900;
P(1139, 0) = 1728*900+1139;
P(1139, 1) = 1728*1139+1128;
P(1139, 2) = 1728*1128+1133;
P(1139, 3) = 1728*1133+1134;
P(1139, 4) = 1728*1134+1417;
P(1139, 5) = 1728*1417+1416;
P(1139, 6) = 1728*1416+1427;
P(1139, 7) = 1728*1427+1426;
P(1139, 8) = 1728*1426+903;
P(1139, 9) = 1728*903+900;
P(1140, 0) = 1728*902+911;
P(1140, 1) = 1728*911+908;
P(1140, 2) = 1728*908+909;
P(1140, 3) = 1728*909+910;
P(1140, 4) = 1728*910+1193;
P(1140, 5) = 1728*1193+1194;
P(1140, 6) = 1728*1194+1195;
P(1140, 7) = 1728*1195+1184;
P(1140, 8) = 1728*1184+1185;
P(1140, 9) = 1728*1185+902;
P(1141, 0) = 1728*902+911;
P(1141, 1) = 1728*911+1434;
P(1141, 2) = 1728*1434+1435;
P(1141, 3) = 1728*1435+1196;
P(1141, 4) = 1728*1196+1199;
P(1141, 5) = 1728*1199+1190;
P(1141, 6) = 1728*1190+1189;
P(1141, 7) = 1728*1189+1184;
P(1141, 8) = 1728*1184+1185;
P(1141, 9) = 1728*1185+902;
P(1142, 0) = 1728*904+905;
P(1142, 1) = 1728*905+906;
P(1142, 2) = 1728*906+907;
P(1142, 3) = 1728*907+956;
P(1142, 4) = 1728*956+959;
P(1142, 5) = 1728*959+1194;
P(1142, 6) = 1728*1194+1193;
P(1142, 7) = 1728*1193+910;
P(1142, 8) = 1728*910+909;
P(1142, 9) = 1728*909+904;
P(1143, 0) = 1728*908+909;
P(1143, 1) = 1728*909+910;
P(1143, 2) = 1728*910+1193;
P(1143, 3) = 1728*1193+1192;
P(1143, 4) = 1728*1192+1197;
P(1143, 5) = 1728*1197+1196;
P(1143, 6) = 1728*1196+1435;
P(1143, 7) = 1728*1435+1434;
P(1143, 8) = 1728*1434+911;
P(1143, 9) = 1728*911+908;
P(1144, 0) = 1728*908+1147;
P(1144, 1) = 1728*1147+1146;
P(1144, 2) = 1728*1146+1145;
P(1144, 3) = 1728*1145+1144;
P(1144, 4) = 1728*1144+1149;
P(1144, 5) = 1728*1149+1150;
P(1144, 6) = 1728*1150+1433;
P(1144, 7) = 1728*1433+1434;
P(1144, 8) = 1728*1434+911;
P(1144, 9) = 1728*911+908;
P(1145, 0) = 1728*908+1147;
P(1145, 1) = 1728*1147+1136;
P(1145, 2) = 1728*1136+1141;
P(1145, 3) = 1728*1141+1142;
P(1145, 4) = 1728*1142+1425;
P(1145, 5) = 1728*1425+1424;
P(1145, 6) = 1728*1424+1435;
P(1145, 7) = 1728*1435+1434;
P(1145, 8) = 1728*1434+911;
P(1145, 9) = 1728*911+908;
P(1146, 0) = 1728*912+913;
P(1146, 1) = 1728*913+914;
P(1146, 2) = 1728*914+915;
P(1146, 3) = 1728*915+964;
P(1146, 4) = 1728*964+965;
P(1146, 5) = 1728*965+966;
P(1146, 6) = 1728*966+975;
P(1146, 7) = 1728*975+972;
P(1146, 8) = 1728*972+923;
P(1146, 9) = 1728*923+912;
P(1147, 0) = 1728*912+913;
P(1147, 1) = 1728*913+914;
P(1147, 2) = 1728*914+915;
P(1147, 3) = 1728*915+964;
P(1147, 4) = 1728*964+967;
P(1147, 5) = 1728*967+1202;
P(1147, 6) = 1728*1202+1201;
P(1147, 7) = 1728*1201+918;
P(1147, 8) = 1728*918+917;
P(1147, 9) = 1728*917+912;
P(1148, 0) = 1728*912+913;
P(1148, 1) = 1728*913+914;
P(1148, 2) = 1728*914+915;
P(1148, 3) = 1728*915+952;
P(1148, 4) = 1728*952+957;
P(1148, 5) = 1728*957+958;
P(1148, 6) = 1728*958+919;
P(1148, 7) = 1728*919+916;
P(1148, 8) = 1728*916+917;
P(1148, 9) = 1728*917+912;
P(1149, 0) = 1728*912+917;
P(1149, 1) = 1728*917+918;
P(1149, 2) = 1728*918+927;
P(1149, 3) = 1728*927+924;
P(1149, 4) = 1728*924+925;
P(1149, 5) = 1728*925+920;
P(1149, 6) = 1728*920+921;
P(1149, 7) = 1728*921+922;
P(1149, 8) = 1728*922+923;
P(1149, 9) = 1728*923+912;
P(1150, 0) = 1728*912+917;
P(1150, 1) = 1728*917+918;
P(1150, 2) = 1728*918+1201;
P(1150, 3) = 1728*1201+1200;
P(1150, 4) = 1728*1200+1211;
P(1150, 5) = 1728*1211+1210;
P(1150, 6) = 1728*1210+975;
P(1150, 7) = 1728*975+972;
P(1150, 8) = 1728*972+923;
P(1150, 9) = 1728*923+912;
P(1151, 0) = 1728*915+964;
P(1151, 1) = 1728*964+967;
P(1151, 2) = 1728*967+1006;
P(1151, 3) = 1728*1006+1005;
P(1151, 4) = 1728*1005+1004;
P(1151, 5) = 1728*1004+955;
P(1151, 6) = 1728*955+954;
P(1151, 7) = 1728*954+953;
P(1151, 8) = 1728*953+952;
P(1151, 9) = 1728*952+915;
P(1152, 0) = 1728*915+964;
P(1152, 1) = 1728*964+967;
P(1152, 2) = 1728*967+1202;
P(1152, 3) = 1728*1202+1203;
P(1152, 4) = 1728*1203+1240;
P(1152, 5) = 1728*1240+1241;
P(1152, 6) = 1728*1241+958;
P(1152, 7) = 1728*958+957;
P(1152, 8) = 1728*957+952;
P(1152, 9) = 1728*952+915;
P(1153, 0) = 1728*916+917;
P(1153, 1) = 1728*917+918;
P(1153, 2) = 1728*918+927;
P(1153, 3) = 1728*927+1162;
P(1153, 4) = 1728*1162+1163;
P(1153, 5) = 1728*1163+1152;
P(1153, 6) = 1728*1152+1153;
P(1153, 7) = 1728*1153+1154;
P(1153, 8) = 1728*1154+919;
P(1153, 9) = 1728*919+916;
P(1154, 0) = 1728*916+917;
P(1154, 1) = 1728*917+918;
P(1154, 2) = 1728*918+1201;
P(1154, 3) = 1728*1201+1200;
P(1154, 4) = 1728*1200+1205;
P(1154, 5) = 1728*1205+1204;
P(1154, 6) = 1728*1204+1155;
P(1154, 7) = 1728*1155+1154;
P(1154, 8) = 1728*1154+919;
P(1154, 9) = 1728*919+916;
P(1155, 0) = 1728*916+917;
P(1155, 1) = 1728*917+918;
P(1155, 2) = 1728*918+1201;
P(1155, 3) = 1728*1201+1202;
P(1155, 4) = 1728*1202+1203;
P(1155, 5) = 1728*1203+1240;
P(1155, 6) = 1728*1240+1241;
P(1155, 7) = 1728*1241+958;
P(1155, 8) = 1728*958+919;
P(1155, 9) = 1728*919+916;
P(1156, 0) = 1728*918+927;
P(1156, 1) = 1728*927+924;
P(1156, 2) = 1728*924+925;
P(1156, 3) = 1728*925+926;
P(1156, 4) = 1728*926+1209;
P(1156, 5) = 1728*1209+1210;
P(1156, 6) = 1728*1210+1211;
P(1156, 7) = 1728*1211+1200;
P(1156, 8) = 1728*1200+1201;
P(1156, 9) = 1728*1201+918;
P(1157, 0) = 1728*918+927;
P(1157, 1) = 1728*927+1162;
P(1157, 2) = 1728*1162+1163;
P(1157, 3) = 1728*1163+1212;
P(1157, 4) = 1728*1212+1215;
P(1157, 5) = 1728*1215+1206;
P(1157, 6) = 1728*1206+1205;
P(1157, 7) = 1728*1205+1200;
P(1157, 8) = 1728*1200+1201;
P(1157, 9) = 1728*1201+918;
P(1158, 0) = 1728*919+958;
P(1158, 1) = 1728*958+957;
P(1158, 2) = 1728*957+956;
P(1158, 3) = 1728*956+959;
P(1158, 4) = 1728*959+1194;
P(1158, 5) = 1728*1194+1193;
P(1158, 6) = 1728*1193+1192;
P(1158, 7) = 1728*1192+1155;
P(1158, 8) = 1728*1155+1154;
P(1158, 9) = 1728*1154+919;
P(1159, 0) = 1728*919+958;
P(1159, 1) = 1728*958+1241;
P(1159, 2) = 1728*1241+1240;
P(1159, 3) = 1728*1240+1245;
P(1159, 4) = 1728*1245+1246;
P(1159, 5) = 1728*1246+1207;
P(1159, 6) = 1728*1207+1204;
P(1159, 7) = 1728*1204+1155;
P(1159, 8) = 1728*1155+1154;
P(1159, 9) = 1728*1154+919;
P(1160, 0) = 1728*920+921;
P(1160, 1) = 1728*921+922;
P(1160, 2) = 1728*922+923;
P(1160, 3) = 1728*923+972;
P(1160, 4) = 1728*972+973;
P(1160, 5) = 1728*973+974;
P(1160, 6) = 1728*974+983;
P(1160, 7) = 1728*983+980;
P(1160, 8) = 1728*980+931;
P(1160, 9) = 1728*931+920;
P(1161, 0) = 1728*920+921;
P(1161, 1) = 1728*921+922;
P(1161, 2) = 1728*922+923;
P(1161, 3) = 1728*923+972;
P(1161, 4) = 1728*972+975;
P(1161, 5) = 1728*975+1210;
P(1161, 6) = 1728*1210+1209;
P(1161, 7) = 1728*1209+926;
P(1161, 8) = 1728*926+925;
P(1161, 9) = 1728*925+920;
P(1162, 0) = 1728*920+925;
P(1162, 1) = 1728*925+926;
P(1162, 2) = 1728*926+935;
P(1162, 3) = 1728*935+932;
P(1162, 4) = 1728*932+933;
P(1162, 5) = 1728*933+928;
P(1162, 6) = 1728*928+929;
P(1162, 7) = 1728*929+930;
P(1162, 8) = 1728*930+931;
P(1162, 9) = 1728*931+920;
P(1163, 0) = 1728*920+925;
P(1163, 1) = 1728*925+926;
P(1163, 2) = 1728*926+1209;
P(1163, 3) = 1728*1209+1208;
P(1163, 4) = 1728*1208+1219;
P(1163, 5) = 1728*1219+1218;
P(1163, 6) = 1728*1218+983;
P(1163, 7) = 1728*983+980;
P(1163, 8) = 1728*980+931;
P(1163, 9) = 1728*931+920;
P(1164, 0) = 1728*924+925;
P(1164, 1) = 1728*925+926;
P(1164, 2) = 1728*926+935;
P(1164, 3) = 1728*935+1170;
P(1164, 4) = 1728*1170+1171;
P(1164, 5) = 1728*1171+1160;
P(1164, 6) = 1728*1160+1161;
P(1164, 7) = 1728*1161+1162;
P(1164, 8) = 1728*1162+927;
P(1164, 9) = 1728*927+924;
P(1165, 0) = 1728*924+925;
P(1165, 1) = 1728*925+926;
P(1165, 2) = 1728*926+1209;
P(1165, 3) = 1728*1209+1208;
P(1165, 4) = 1728*1208+1213;
P(1165, 5) = 1728*1213+1212;
P(1165, 6) = 1728*1212+1163;
P(1165, 7) = 1728*1163+1162;
P(1165, 8) = 1728*1162+927;
P(1165, 9) = 1728*927+924;
P(1166, 0) = 1728*926+935;
P(1166, 1) = 1728*935+932;
P(1166, 2) = 1728*932+933;
P(1166, 3) = 1728*933+934;
P(1166, 4) = 1728*934+1217;
P(1166, 5) = 1728*1217+1218;
P(1166, 6) = 1728*1218+1219;
P(1166, 7) = 1728*1219+1208;
P(1166, 8) = 1728*1208+1209;
P(1166, 9) = 1728*1209+926;
P(1167, 0) = 1728*926+935;
P(1167, 1) = 1728*935+1170;
P(1167, 2) = 1728*1170+1171;
P(1167, 3) = 1728*1171+1220;
P(1167, 4) = 1728*1220+1223;
P(1167, 5) = 1728*1223+1214;
P(1167, 6) = 1728*1214+1213;
P(1167, 7) = 1728*1213+1208;
P(1167, 8) = 1728*1208+1209;
P(1167, 9) = 1728*1209+926;
P(1168, 0) = 1728*928+929;
P(1168, 1) = 1728*929+930;
P(1168, 2) = 1728*930+931;
P(1168, 3) = 1728*931+980;
P(1168, 4) = 1728*980+981;
P(1168, 5) = 1728*981+982;
P(1168, 6) = 1728*982+991;
P(1168, 7) = 1728*991+988;
P(1168, 8) = 1728*988+939;
P(1168, 9) = 1728*939+928;
P(1169, 0) = 1728*928+929;
P(1169, 1) = 1728*929+930;
P(1169, 2) = 1728*930+931;
P(1169, 3) = 1728*931+980;
P(1169, 4) = 1728*980+983;
P(1169, 5) = 1728*983+1218;
P(1169, 6) = 1728*1218+1217;
P(1169, 7) = 1728*1217+934;
P(1169, 8) = 1728*934+933;
P(1169, 9) = 1728*933+928;
P(1170, 0) = 1728*928+933;
P(1170, 1) = 1728*933+934;
P(1170, 2) = 1728*934+943;
P(1170, 3) = 1728*943+940;
P(1170, 4) = 1728*940+941;
P(1170, 5) = 1728*941+936;
P(1170, 6) = 1728*936+937;
P(1170, 7) = 1728*937+938;
P(1170, 8) = 1728*938+939;
P(1170, 9) = 1728*939+928;
P(1171, 0) = 1728*928+933;
P(1171, 1) = 1728*933+934;
P(1171, 2) = 1728*934+1217;
P(1171, 3) = 1728*1217+1216;
P(1171, 4) = 1728*1216+1227;
P(1171, 5) = 1728*1227+1226;
P(1171, 6) = 1728*1226+991;
P(1171, 7) = 1728*991+988;
P(1171, 8) = 1728*988+939;
P(1171, 9) = 1728*939+928;
P(1172, 0) = 1728*932+933;
P(1172, 1) = 1728*933+934;
P(1172, 2) = 1728*934+943;
P(1172, 3) = 1728*943+1178;
P(1172, 4) = 1728*1178+1179;
P(1172, 5) = 1728*1179+1168;
P(1172, 6) = 1728*1168+1169;
P(1172, 7) = 1728*1169+1170;
P(1172, 8) = 1728*1170+935;
P(1172, 9) = 1728*935+932;
P(1173, 0) = 1728*932+933;
P(1173, 1) = 1728*933+934;
P(1173, 2) = 1728*934+1217;
P(1173, 3) = 1728*1217+1216;
P(1173, 4) = 1728*1216+1221;
P(1173, 5) = 1728*1221+1220;
P(1173, 6) = 1728*1220+1171;
P(1173, 7) = 1728*1171+1170;
P(1173, 8) = 1728*1170+935;
P(1173, 9) = 1728*935+932;
P(1174, 0) = 1728*934+943;
P(1174, 1) = 1728*943+940;
P(1174, 2) = 1728*940+941;
P(1174, 3) = 1728*941+942;
P(1174, 4) = 1728*942+1225;
P(1174, 5) = 1728*1225+1226;
P(1174, 6) = 1728*1226+1227;
P(1174, 7) = 1728*1227+1216;
P(1174, 8) = 1728*1216+1217;
P(1174, 9) = 1728*1217+934;
P(1175, 0) = 1728*934+943;
P(1175, 1) = 1728*943+1178;
P(1175, 2) = 1728*1178+1179;
P(1175, 3) = 1728*1179+1228;
P(1175, 4) = 1728*1228+1231;
P(1175, 5) = 1728*1231+1222;
P(1175, 6) = 1728*1222+1221;
P(1175, 7) = 1728*1221+1216;
P(1175, 8) = 1728*1216+1217;
P(1175, 9) = 1728*1217+934;
P(1176, 0) = 1728*936+937;
P(1176, 1) = 1728*937+938;
P(1176, 2) = 1728*938+939;
P(1176, 3) = 1728*939+988;
P(1176, 4) = 1728*988+989;
P(1176, 5) = 1728*989+990;
P(1176, 6) = 1728*990+999;
P(1176, 7) = 1728*999+996;
P(1176, 8) = 1728*996+947;
P(1176, 9) = 1728*947+936;
P(1177, 0) = 1728*936+937;
P(1177, 1) = 1728*937+938;
P(1177, 2) = 1728*938+939;
P(1177, 3) = 1728*939+988;
P(1177, 4) = 1728*988+991;
P(1177, 5) = 1728*991+1226;
P(1177, 6) = 1728*1226+1225;
P(1177, 7) = 1728*1225+942;
P(1177, 8) = 1728*942+941;
P(1177, 9) = 1728*941+936;
P(1178, 0) = 1728*936+941;
P(1178, 1) = 1728*941+942;
P(1178, 2) = 1728*942+951;
P(1178, 3) = 1728*951+948;
P(1178, 4) = 1728*948+949;
P(1178, 5) = 1728*949+944;
P(1178, 6) = 1728*944+945;
P(1178, 7) = 1728*945+946;
P(1178, 8) = 1728*946+947;
P(1178, 9) = 1728*947+936;
P(1179, 0) = 1728*936+941;
P(1179, 1) = 1728*941+942;
P(1179, 2) = 1728*942+1225;
P(1179, 3) = 1728*1225+1224;
P(1179, 4) = 1728*1224+1235;
P(1179, 5) = 1728*1235+1234;
P(1179, 6) = 1728*1234+999;
P(1179, 7) = 1728*999+996;
P(1179, 8) = 1728*996+947;
P(1179, 9) = 1728*947+936;
P(1180, 0) = 1728*940+941;
P(1180, 1) = 1728*941+942;
P(1180, 2) = 1728*942+951;
P(1180, 3) = 1728*951+1186;
P(1180, 4) = 1728*1186+1187;
P(1180, 5) = 1728*1187+1176;
P(1180, 6) = 1728*1176+1177;
P(1180, 7) = 1728*1177+1178;
P(1180, 8) = 1728*1178+943;
P(1180, 9) = 1728*943+940;
P(1181, 0) = 1728*940+941;
P(1181, 1) = 1728*941+942;
P(1181, 2) = 1728*942+1225;
P(1181, 3) = 1728*1225+1224;
P(1181, 4) = 1728*1224+1229;
P(1181, 5) = 1728*1229+1228;
P(1181, 6) = 1728*1228+1179;
P(1181, 7) = 1728*1179+1178;
P(1181, 8) = 1728*1178+943;
P(1181, 9) = 1728*943+940;
P(1182, 0) = 1728*942+951;
P(1182, 1) = 1728*951+948;
P(1182, 2) = 1728*948+949;
P(1182, 3) = 1728*949+950;
P(1182, 4) = 1728*950+1233;
P(1182, 5) = 1728*1233+1234;
P(1182, 6) = 1728*1234+1235;
P(1182, 7) = 1728*1235+1224;
P(1182, 8) = 1728*1224+1225;
P(1182, 9) = 1728*1225+942;
P(1183, 0) = 1728*942+951;
P(1183, 1) = 1728*951+1186;
P(1183, 2) = 1728*1186+1187;
P(1183, 3) = 1728*1187+1236;
P(1183, 4) = 1728*1236+1239;
P(1183, 5) = 1728*1239+1230;
P(1183, 6) = 1728*1230+1229;
P(1183, 7) = 1728*1229+1224;
P(1183, 8) = 1728*1224+1225;
P(1183, 9) = 1728*1225+942;
P(1184, 0) = 1728*944+945;
P(1184, 1) = 1728*945+946;
P(1184, 2) = 1728*946+947;
P(1184, 3) = 1728*947+996;
P(1184, 4) = 1728*996+997;
P(1184, 5) = 1728*997+998;
P(1184, 6) = 1728*998+1007;
P(1184, 7) = 1728*1007+1004;
P(1184, 8) = 1728*1004+955;
P(1184, 9) = 1728*955+944;
P(1185, 0) = 1728*944+945;
P(1185, 1) = 1728*945+946;
P(1185, 2) = 1728*946+947;
P(1185, 3) = 1728*947+996;
P(1185, 4) = 1728*996+999;
P(1185, 5) = 1728*999+1234;
P(1185, 6) = 1728*1234+1233;
P(1185, 7) = 1728*1233+950;
P(1185, 8) = 1728*950+949;
P(1185, 9) = 1728*949+944;
P(1186, 0) = 1728*944+949;
P(1186, 1) = 1728*949+950;
P(1186, 2) = 1728*950+959;
P(1186, 3) = 1728*959+956;
P(1186, 4) = 1728*956+957;
P(1186, 5) = 1728*957+952;
P(1186, 6) = 1728*952+953;
P(1186, 7) = 1728*953+954;
P(1186, 8) = 1728*954+955;
P(1186, 9) = 1728*955+944;
P(1187, 0) = 1728*944+949;
P(1187, 1) = 1728*949+950;
P(1187, 2) = 1728*950+1233;
P(1187, 3) = 1728*1233+1232;
P(1187, 4) = 1728*1232+1243;
P(1187, 5) = 1728*1243+1242;
P(1187, 6) = 1728*1242+1007;
P(1187, 7) = 1728*1007+1004;
P(1187, 8) = 1728*1004+955;
P(1187, 9) = 1728*955+944;
P(1188, 0) = 1728*948+949;
P(1188, 1) = 1728*949+950;
P(1188, 2) = 1728*950+959;
P(1188, 3) = 1728*959+1194;
P(1188, 4) = 1728*1194+1195;
P(1188, 5) = 1728*1195+1184;
P(1188, 6) = 1728*1184+1185;
P(1188, 7) = 1728*1185+1186;
P(1188, 8) = 1728*1186+951;
P(1188, 9) = 1728*951+948;
P(1189, 0) = 1728*948+949;
P(1189, 1) = 1728*949+950;
P(1189, 2) = 1728*950+1233;
P(1189, 3) = 1728*1233+1232;
P(1189, 4) = 1728*1232+1237;
P(1189, 5) = 1728*1237+1236;
P(1189, 6) = 1728*1236+1187;
P(1189, 7) = 1728*1187+1186;
P(1189, 8) = 1728*1186+951;
P(1189, 9) = 1728*951+948;
P(1190, 0) = 1728*950+959;
P(1190, 1) = 1728*959+956;
P(1190, 2) = 1728*956+957;
P(1190, 3) = 1728*957+958;
P(1190, 4) = 1728*958+1241;
P(1190, 5) = 1728*1241+1242;
P(1190, 6) = 1728*1242+1243;
P(1190, 7) = 1728*1243+1232;
P(1190, 8) = 1728*1232+1233;
P(1190, 9) = 1728*1233+950;
P(1191, 0) = 1728*950+959;
P(1191, 1) = 1728*959+1194;
P(1191, 2) = 1728*1194+1195;
P(1191, 3) = 1728*1195+1244;
P(1191, 4) = 1728*1244+1247;
P(1191, 5) = 1728*1247+1238;
P(1191, 6) = 1728*1238+1237;
P(1191, 7) = 1728*1237+1232;
P(1191, 8) = 1728*1232+1233;
P(1191, 9) = 1728*1233+950;
P(1192, 0) = 1728*952+953;
P(1192, 1) = 1728*953+954;
P(1192, 2) = 1728*954+955;
P(1192, 3) = 1728*955+1004;
P(1192, 4) = 1728*1004+1007;
P(1192, 5) = 1728*1007+1242;
P(1192, 6) = 1728*1242+1241;
P(1192, 7) = 1728*1241+958;
P(1192, 8) = 1728*958+957;
P(1192, 9) = 1728*957+952;
P(1193, 0) = 1728*956+957;
P(1193, 1) = 1728*957+958;
P(1193, 2) = 1728*958+1241;
P(1193, 3) = 1728*1241+1240;
P(1193, 4) = 1728*1240+1245;
P(1193, 5) = 1728*1245+1244;
P(1193, 6) = 1728*1244+1195;
P(1193, 7) = 1728*1195+1194;
P(1193, 8) = 1728*1194+959;
P(1193, 9) = 1728*959+956;
P(1194, 0) = 1728*960+961;
P(1194, 1) = 1728*961+962;
P(1194, 2) = 1728*962+963;
P(1194, 3) = 1728*963+1012;
P(1194, 4) = 1728*1012+1013;
P(1194, 5) = 1728*1013+1014;
P(1194, 6) = 1728*1014+1023;
P(1194, 7) = 1728*1023+1020;
P(1194, 8) = 1728*1020+971;
P(1194, 9) = 1728*971+960;
P(1195, 0) = 1728*960+961;
P(1195, 1) = 1728*961+962;
P(1195, 2) = 1728*962+963;
P(1195, 3) = 1728*963+1012;
P(1195, 4) = 1728*1012+1015;
P(1195, 5) = 1728*1015+1250;
P(1195, 6) = 1728*1250+1249;
P(1195, 7) = 1728*1249+966;
P(1195, 8) = 1728*966+965;
P(1195, 9) = 1728*965+960;
P(1196, 0) = 1728*960+961;
P(1196, 1) = 1728*961+962;
P(1196, 2) = 1728*962+963;
P(1196, 3) = 1728*963+1000;
P(1196, 4) = 1728*1000+1005;
P(1196, 5) = 1728*1005+1006;
P(1196, 6) = 1728*1006+967;
P(1196, 7) = 1728*967+964;
P(1196, 8) = 1728*964+965;
P(1196, 9) = 1728*965+960;
P(1197, 0) = 1728*960+965;
P(1197, 1) = 1728*965+966;
P(1197, 2) = 1728*966+975;
P(1197, 3) = 1728*975+972;
P(1197, 4) = 1728*972+973;
P(1197, 5) = 1728*973+968;
P(1197, 6) = 1728*968+969;
P(1197, 7) = 1728*969+970;
P(1197, 8) = 1728*970+971;
P(1197, 9) = 1728*971+960;
P(1198, 0) = 1728*960+965;
P(1198, 1) = 1728*965+966;
P(1198, 2) = 1728*966+1249;
P(1198, 3) = 1728*1249+1248;
P(1198, 4) = 1728*1248+1259;
P(1198, 5) = 1728*1259+1258;
P(1198, 6) = 1728*1258+1023;
P(1198, 7) = 1728*1023+1020;
P(1198, 8) = 1728*1020+971;
P(1198, 9) = 1728*971+960;
P(1199, 0) = 1728*963+1012;
P(1199, 1) = 1728*1012+1015;
P(1199, 2) = 1728*1015+1054;
P(1199, 3) = 1728*1054+1053;
P(1199, 4) = 1728*1053+1052;
P(1199, 5) = 1728*1052+1003;
P(1199, 6) = 1728*1003+1002;
P(1199, 7) = 1728*1002+1001;
P(1199, 8) = 1728*1001+1000;
P(1199, 9) = 1728*1000+963;
P(1200, 0) = 1728*963+1012;
P(1200, 1) = 1728*1012+1015;
P(1200, 2) = 1728*1015+1250;
P(1200, 3) = 1728*1250+1251;
P(1200, 4) = 1728*1251+1288;
P(1200, 5) = 1728*1288+1289;
P(1200, 6) = 1728*1289+1006;
P(1200, 7) = 1728*1006+1005;
P(1200, 8) = 1728*1005+1000;
P(1200, 9) = 1728*1000+963;
P(1201, 0) = 1728*964+965;
P(1201, 1) = 1728*965+966;
P(1201, 2) = 1728*966+975;
P(1201, 3) = 1728*975+1210;
P(1201, 4) = 1728*1210+1211;
P(1201, 5) = 1728*1211+1200;
P(1201, 6) = 1728*1200+1201;
P(1201, 7) = 1728*1201+1202;
P(1201, 8) = 1728*1202+967;
P(1201, 9) = 1728*967+964;
P(1202, 0) = 1728*964+965;
P(1202, 1) = 1728*965+966;
P(1202, 2) = 1728*966+1249;
P(1202, 3) = 1728*1249+1248;
P(1202, 4) = 1728*1248+1253;
P(1202, 5) = 1728*1253+1252;
P(1202, 6) = 1728*1252+1203;
P(1202, 7) = 1728*1203+1202;
P(1202, 8) = 1728*1202+967;
P(1202, 9) = 1728*967+964;
P(1203, 0) = 1728*964+965;
P(1203, 1) = 1728*965+966;
P(1203, 2) = 1728*966+1249;
P(1203, 3) = 1728*1249+1250;
P(1203, 4) = 1728*1250+1251;
P(1203, 5) = 1728*1251+1288;
P(1203, 6) = 1728*1288+1289;
P(1203, 7) = 1728*1289+1006;
P(1203, 8) = 1728*1006+967;
P(1203, 9) = 1728*967+964;
P(1204, 0) = 1728*966+975;
P(1204, 1) = 1728*975+972;
P(1204, 2) = 1728*972+973;
P(1204, 3) = 1728*973+974;
P(1204, 4) = 1728*974+1257;
P(1204, 5) = 1728*1257+1258;
P(1204, 6) = 1728*1258+1259;
P(1204, 7) = 1728*1259+1248;
P(1204, 8) = 1728*1248+1249;
P(1204, 9) = 1728*1249+966;
P(1205, 0) = 1728*966+975;
P(1205, 1) = 1728*975+1210;
P(1205, 2) = 1728*1210+1211;
P(1205, 3) = 1728*1211+1260;
P(1205, 4) = 1728*1260+1263;
P(1205, 5) = 1728*1263+1254;
P(1205, 6) = 1728*1254+1253;
P(1205, 7) = 1728*1253+1248;
P(1205, 8) = 1728*1248+1249;
P(1205, 9) = 1728*1249+966;
P(1206, 0) = 1728*967+1006;
P(1206, 1) = 1728*1006+1005;
P(1206, 2) = 1728*1005+1004;
P(1206, 3) = 1728*1004+1007;
P(1206, 4) = 1728*1007+1242;
P(1206, 5) = 1728*1242+1241;
P(1206, 6) = 1728*1241+1240;
P(1206, 7) = 1728*1240+1203;
P(1206, 8) = 1728*1203+1202;
P(1206, 9) = 1728*1202+967;
P(1207, 0) = 1728*967+1006;
P(1207, 1) = 1728*1006+1289;
P(1207, 2) = 1728*1289+1288;
P(1207, 3) = 1728*1288+1293;
P(1207, 4) = 1728*1293+1294;
P(1207, 5) = 1728*1294+1255;
P(1207, 6) = 1728*1255+1252;
P(1207, 7) = 1728*1252+1203;
P(1207, 8) = 1728*1203+1202;
P(1207, 9) = 1728*1202+967;
P(1208, 0) = 1728*968+969;
P(1208, 1) = 1728*969+970;
P(1208, 2) = 1728*970+971;
P(1208, 3) = 1728*971+1020;
P(1208, 4) = 1728*1020+1021;
P(1208, 5) = 1728*1021+1022;
P(1208, 6) = 1728*1022+1031;
P(1208, 7) = 1728*1031+1028;
P(1208, 8) = 1728*1028+979;
P(1208, 9) = 1728*979+968;
P(1209, 0) = 1728*968+969;
P(1209, 1) = 1728*969+970;
P(1209, 2) = 1728*970+971;
P(1209, 3) = 1728*971+1020;
P(1209, 4) = 1728*1020+1023;
P(1209, 5) = 1728*1023+1258;
P(1209, 6) = 1728*1258+1257;
P(1209, 7) = 1728*1257+974;
P(1209, 8) = 1728*974+973;
P(1209, 9) = 1728*973+968;
P(1210, 0) = 1728*968+973;
P(1210, 1) = 1728*973+974;
P(1210, 2) = 1728*974+983;
P(1210, 3) = 1728*983+980;
P(1210, 4) = 1728*980+981;
P(1210, 5) = 1728*981+976;
P(1210, 6) = 1728*976+977;
P(1210, 7) = 1728*977+978;
P(1210, 8) = 1728*978+979;
P(1210, 9) = 1728*979+968;
P(1211, 0) = 1728*968+973;
P(1211, 1) = 1728*973+974;
P(1211, 2) = 1728*974+1257;
P(1211, 3) = 1728*1257+1256;
P(1211, 4) = 1728*1256+1267;
P(1211, 5) = 1728*1267+1266;
P(1211, 6) = 1728*1266+1031;
P(1211, 7) = 1728*1031+1028;
P(1211, 8) = 1728*1028+979;
P(1211, 9) = 1728*979+968;
P(1212, 0) = 1728*972+973;
P(1212, 1) = 1728*973+974;
P(1212, 2) = 1728*974+983;
P(1212, 3) = 1728*983+1218;
P(1212, 4) = 1728*1218+1219;
P(1212, 5) = 1728*1219+1208;
P(1212, 6) = 1728*1208+1209;
P(1212, 7) = 1728*1209+1210;
P(1212, 8) = 1728*1210+975;
P(1212, 9) = 1728*975+972;
P(1213, 0) = 1728*972+973;
P(1213, 1) = 1728*973+974;
P(1213, 2) = 1728*974+1257;
P(1213, 3) = 1728*1257+1256;
P(1213, 4) = 1728*1256+1261;
P(1213, 5) = 1728*1261+1260;
P(1213, 6) = 1728*1260+1211;
P(1213, 7) = 1728*1211+1210;
P(1213, 8) = 1728*1210+975;
P(1213, 9) = 1728*975+972;
P(1214, 0) = 1728*974+983;
P(1214, 1) = 1728*983+980;
P(1214, 2) = 1728*980+981;
P(1214, 3) = 1728*981+982;
P(1214, 4) = 1728*982+1265;
P(1214, 5) = 1728*1265+1266;
P(1214, 6) = 1728*1266+1267;
P(1214, 7) = 1728*1267+1256;
P(1214, 8) = 1728*1256+1257;
P(1214, 9) = 1728*1257+974;
P(1215, 0) = 1728*974+983;
P(1215, 1) = 1728*983+1218;
P(1215, 2) = 1728*1218+1219;
P(1215, 3) = 1728*1219+1268;
P(1215, 4) = 1728*1268+1271;
P(1215, 5) = 1728*1271+1262;
P(1215, 6) = 1728*1262+1261;
P(1215, 7) = 1728*1261+1256;
P(1215, 8) = 1728*1256+1257;
P(1215, 9) = 1728*1257+974;
P(1216, 0) = 1728*976+977;
P(1216, 1) = 1728*977+978;
P(1216, 2) = 1728*978+979;
P(1216, 3) = 1728*979+1028;
P(1216, 4) = 1728*1028+1029;
P(1216, 5) = 1728*1029+1030;
P(1216, 6) = 1728*1030+1039;
P(1216, 7) = 1728*1039+1036;
P(1216, 8) = 1728*1036+987;
P(1216, 9) = 1728*987+976;
P(1217, 0) = 1728*976+977;
P(1217, 1) = 1728*977+978;
P(1217, 2) = 1728*978+979;
P(1217, 3) = 1728*979+1028;
P(1217, 4) = 1728*1028+1031;
P(1217, 5) = 1728*1031+1266;
P(1217, 6) = 1728*1266+1265;
P(1217, 7) = 1728*1265+982;
P(1217, 8) = 1728*982+981;
P(1217, 9) = 1728*981+976;
P(1218, 0) = 1728*976+981;
P(1218, 1) = 1728*981+982;
P(1218, 2) = 1728*982+991;
P(1218, 3) = 1728*991+988;
P(1218, 4) = 1728*988+989;
P(1218, 5) = 1728*989+984;
P(1218, 6) = 1728*984+985;
P(1218, 7) = 1728*985+986;
P(1218, 8) = 1728*986+987;
P(1218, 9) = 1728*987+976;
P(1219, 0) = 1728*976+981;
P(1219, 1) = 1728*981+982;
P(1219, 2) = 1728*982+1265;
P(1219, 3) = 1728*1265+1264;
P(1219, 4) = 1728*1264+1275;
P(1219, 5) = 1728*1275+1274;
P(1219, 6) = 1728*1274+1039;
P(1219, 7) = 1728*1039+1036;
P(1219, 8) = 1728*1036+987;
P(1219, 9) = 1728*987+976;
P(1220, 0) = 1728*980+981;
P(1220, 1) = 1728*981+982;
P(1220, 2) = 1728*982+991;
P(1220, 3) = 1728*991+1226;
P(1220, 4) = 1728*1226+1227;
P(1220, 5) = 1728*1227+1216;
P(1220, 6) = 1728*1216+1217;
P(1220, 7) = 1728*1217+1218;
P(1220, 8) = 1728*1218+983;
P(1220, 9) = 1728*983+980;
P(1221, 0) = 1728*980+981;
P(1221, 1) = 1728*981+982;
P(1221, 2) = 1728*982+1265;
P(1221, 3) = 1728*1265+1264;
P(1221, 4) = 1728*1264+1269;
P(1221, 5) = 1728*1269+1268;
P(1221, 6) = 1728*1268+1219;
P(1221, 7) = 1728*1219+1218;
P(1221, 8) = 1728*1218+983;
P(1221, 9) = 1728*983+980;
P(1222, 0) = 1728*982+991;
P(1222, 1) = 1728*991+988;
P(1222, 2) = 1728*988+989;
P(1222, 3) = 1728*989+990;
P(1222, 4) = 1728*990+1273;
P(1222, 5) = 1728*1273+1274;
P(1222, 6) = 1728*1274+1275;
P(1222, 7) = 1728*1275+1264;
P(1222, 8) = 1728*1264+1265;
P(1222, 9) = 1728*1265+982;
P(1223, 0) = 1728*982+991;
P(1223, 1) = 1728*991+1226;
P(1223, 2) = 1728*1226+1227;
P(1223, 3) = 1728*1227+1276;
P(1223, 4) = 1728*1276+1279;
P(1223, 5) = 1728*1279+1270;
P(1223, 6) = 1728*1270+1269;
P(1223, 7) = 1728*1269+1264;
P(1223, 8) = 1728*1264+1265;
P(1223, 9) = 1728*1265+982;
P(1224, 0) = 1728*984+985;
P(1224, 1) = 1728*985+986;
P(1224, 2) = 1728*986+987;
P(1224, 3) = 1728*987+1036;
P(1224, 4) = 1728*1036+1037;
P(1224, 5) = 1728*1037+1038;
P(1224, 6) = 1728*1038+1047;
P(1224, 7) = 1728*1047+1044;
P(1224, 8) = 1728*1044+995;
P(1224, 9) = 1728*995+984;
P(1225, 0) = 1728*984+985;
P(1225, 1) = 1728*985+986;
P(1225, 2) = 1728*986+987;
P(1225, 3) = 1728*987+1036;
P(1225, 4) = 1728*1036+1039;
P(1225, 5) = 1728*1039+1274;
P(1225, 6) = 1728*1274+1273;
P(1225, 7) = 1728*1273+990;
P(1225, 8) = 1728*990+989;
P(1225, 9) = 1728*989+984;
P(1226, 0) = 1728*984+989;
P(1226, 1) = 1728*989+990;
P(1226, 2) = 1728*990+999;
P(1226, 3) = 1728*999+996;
P(1226, 4) = 1728*996+997;
P(1226, 5) = 1728*997+992;
P(1226, 6) = 1728*992+993;
P(1226, 7) = 1728*993+994;
P(1226, 8) = 1728*994+995;
P(1226, 9) = 1728*995+984;
P(1227, 0) = 1728*984+989;
P(1227, 1) = 1728*989+990;
P(1227, 2) = 1728*990+1273;
P(1227, 3) = 1728*1273+1272;
P(1227, 4) = 1728*1272+1283;
P(1227, 5) = 1728*1283+1282;
P(1227, 6) = 1728*1282+1047;
P(1227, 7) = 1728*1047+1044;
P(1227, 8) = 1728*1044+995;
P(1227, 9) = 1728*995+984;
P(1228, 0) = 1728*988+989;
P(1228, 1) = 1728*989+990;
P(1228, 2) = 1728*990+999;
P(1228, 3) = 1728*999+1234;
P(1228, 4) = 1728*1234+1235;
P(1228, 5) = 1728*1235+1224;
P(1228, 6) = 1728*1224+1225;
P(1228, 7) = 1728*1225+1226;
P(1228, 8) = 1728*1226+991;
P(1228, 9) = 1728*991+988;
P(1229, 0) = 1728*988+989;
P(1229, 1) = 1728*989+990;
P(1229, 2) = 1728*990+1273;
P(1229, 3) = 1728*1273+1272;
P(1229, 4) = 1728*1272+1277;
P(1229, 5) = 1728*1277+1276;
P(1229, 6) = 1728*1276+1227;
P(1229, 7) = 1728*1227+1226;
P(1229, 8) = 1728*1226+991;
P(1229, 9) = 1728*991+988;
P(1230, 0) = 1728*990+999;
P(1230, 1) = 1728*999+996;
P(1230, 2) = 1728*996+997;
P(1230, 3) = 1728*997+998;
P(1230, 4) = 1728*998+1281;
P(1230, 5) = 1728*1281+1282;
P(1230, 6) = 1728*1282+1283;
P(1230, 7) = 1728*1283+1272;
P(1230, 8) = 1728*1272+1273;
P(1230, 9) = 1728*1273+990;
P(1231, 0) = 1728*990+999;
P(1231, 1) = 1728*999+1234;
P(1231, 2) = 1728*1234+1235;
P(1231, 3) = 1728*1235+1284;
P(1231, 4) = 1728*1284+1287;
P(1231, 5) = 1728*1287+1278;
P(1231, 6) = 1728*1278+1277;
P(1231, 7) = 1728*1277+1272;
P(1231, 8) = 1728*1272+1273;
P(1231, 9) = 1728*1273+990;
P(1232, 0) = 1728*992+993;
P(1232, 1) = 1728*993+994;
P(1232, 2) = 1728*994+995;
P(1232, 3) = 1728*995+1044;
P(1232, 4) = 1728*1044+1045;
P(1232, 5) = 1728*1045+1046;
P(1232, 6) = 1728*1046+1055;
P(1232, 7) = 1728*1055+1052;
P(1232, 8) = 1728*1052+1003;
P(1232, 9) = 1728*1003+992;
P(1233, 0) = 1728*992+993;
P(1233, 1) = 1728*993+994;
P(1233, 2) = 1728*994+995;
P(1233, 3) = 1728*995+1044;
P(1233, 4) = 1728*1044+1047;
P(1233, 5) = 1728*1047+1282;
P(1233, 6) = 1728*1282+1281;
P(1233, 7) = 1728*1281+998;
P(1233, 8) = 1728*998+997;
P(1233, 9) = 1728*997+992;
P(1234, 0) = 1728*992+997;
P(1234, 1) = 1728*997+998;
P(1234, 2) = 1728*998+1007;
P(1234, 3) = 1728*1007+1004;
P(1234, 4) = 1728*1004+1005;
P(1234, 5) = 1728*1005+1000;
P(1234, 6) = 1728*1000+1001;
P(1234, 7) = 1728*1001+1002;
P(1234, 8) = 1728*1002+1003;
P(1234, 9) = 1728*1003+992;
P(1235, 0) = 1728*992+997;
P(1235, 1) = 1728*997+998;
P(1235, 2) = 1728*998+1281;
P(1235, 3) = 1728*1281+1280;
P(1235, 4) = 1728*1280+1291;
P(1235, 5) = 1728*1291+1290;
P(1235, 6) = 1728*1290+1055;
P(1235, 7) = 1728*1055+1052;
P(1235, 8) = 1728*1052+1003;
P(1235, 9) = 1728*1003+992;
P(1236, 0) = 1728*996+997;
P(1236, 1) = 1728*997+998;
P(1236, 2) = 1728*998+1007;
P(1236, 3) = 1728*1007+1242;
P(1236, 4) = 1728*1242+1243;
P(1236, 5) = 1728*1243+1232;
P(1236, 6) = 1728*1232+1233;
P(1236, 7) = 1728*1233+1234;
P(1236, 8) = 1728*1234+999;
P(1236, 9) = 1728*999+996;
P(1237, 0) = 1728*996+997;
P(1237, 1) = 1728*997+998;
P(1237, 2) = 1728*998+1281;
P(1237, 3) = 1728*1281+1280;
P(1237, 4) = 1728*1280+1285;
P(1237, 5) = 1728*1285+1284;
P(1237, 6) = 1728*1284+1235;
P(1237, 7) = 1728*1235+1234;
P(1237, 8) = 1728*1234+999;
P(1237, 9) = 1728*999+996;
P(1238, 0) = 1728*998+1007;
P(1238, 1) = 1728*1007+1004;
P(1238, 2) = 1728*1004+1005;
P(1238, 3) = 1728*1005+1006;
P(1238, 4) = 1728*1006+1289;
P(1238, 5) = 1728*1289+1290;
P(1238, 6) = 1728*1290+1291;
P(1238, 7) = 1728*1291+1280;
P(1238, 8) = 1728*1280+1281;
P(1238, 9) = 1728*1281+998;
P(1239, 0) = 1728*998+1007;
P(1239, 1) = 1728*1007+1242;
P(1239, 2) = 1728*1242+1243;
P(1239, 3) = 1728*1243+1292;
P(1239, 4) = 1728*1292+1295;
P(1239, 5) = 1728*1295+1286;
P(1239, 6) = 1728*1286+1285;
P(1239, 7) = 1728*1285+1280;
P(1239, 8) = 1728*1280+1281;
P(1239, 9) = 1728*1281+998;
P(1240, 0) = 1728*1000+1001;
P(1240, 1) = 1728*1001+1002;
P(1240, 2) = 1728*1002+1003;
P(1240, 3) = 1728*1003+1052;
P(1240, 4) = 1728*1052+1055;
P(1240, 5) = 1728*1055+1290;
P(1240, 6) = 1728*1290+1289;
P(1240, 7) = 1728*1289+1006;
P(1240, 8) = 1728*1006+1005;
P(1240, 9) = 1728*1005+1000;
P(1241, 0) = 1728*1004+1005;
P(1241, 1) = 1728*1005+1006;
P(1241, 2) = 1728*1006+1289;
P(1241, 3) = 1728*1289+1288;
P(1241, 4) = 1728*1288+1293;
P(1241, 5) = 1728*1293+1292;
P(1241, 6) = 1728*1292+1243;
P(1241, 7) = 1728*1243+1242;
P(1241, 8) = 1728*1242+1007;
P(1241, 9) = 1728*1007+1004;
P(1242, 0) = 1728*1008+1009;
P(1242, 1) = 1728*1009+1010;
P(1242, 2) = 1728*1010+1011;
P(1242, 3) = 1728*1011+1060;
P(1242, 4) = 1728*1060+1061;
P(1242, 5) = 1728*1061+1062;
P(1242, 6) = 1728*1062+1071;
P(1242, 7) = 1728*1071+1068;
P(1242, 8) = 1728*1068+1019;
P(1242, 9) = 1728*1019+1008;
P(1243, 0) = 1728*1008+1009;
P(1243, 1) = 1728*1009+1010;
P(1243, 2) = 1728*1010+1011;
P(1243, 3) = 1728*1011+1060;
P(1243, 4) = 1728*1060+1063;
P(1243, 5) = 1728*1063+1298;
P(1243, 6) = 1728*1298+1297;
P(1243, 7) = 1728*1297+1014;
P(1243, 8) = 1728*1014+1013;
P(1243, 9) = 1728*1013+1008;
P(1244, 0) = 1728*1008+1009;
P(1244, 1) = 1728*1009+1010;
P(1244, 2) = 1728*1010+1011;
P(1244, 3) = 1728*1011+1048;
P(1244, 4) = 1728*1048+1053;
P(1244, 5) = 1728*1053+1054;
P(1244, 6) = 1728*1054+1015;
P(1244, 7) = 1728*1015+1012;
P(1244, 8) = 1728*1012+1013;
P(1244, 9) = 1728*1013+1008;
P(1245, 0) = 1728*1008+1013;
P(1245, 1) = 1728*1013+1014;
P(1245, 2) = 1728*1014+1023;
P(1245, 3) = 1728*1023+1020;
P(1245, 4) = 1728*1020+1021;
P(1245, 5) = 1728*1021+1016;
P(1245, 6) = 1728*1016+1017;
P(1245, 7) = 1728*1017+1018;
P(1245, 8) = 1728*1018+1019;
P(1245, 9) = 1728*1019+1008;
P(1246, 0) = 1728*1008+1013;
P(1246, 1) = 1728*1013+1014;
P(1246, 2) = 1728*1014+1297;
P(1246, 3) = 1728*1297+1296;
P(1246, 4) = 1728*1296+1307;
P(1246, 5) = 1728*1307+1306;
P(1246, 6) = 1728*1306+1071;
P(1246, 7) = 1728*1071+1068;
P(1246, 8) = 1728*1068+1019;
P(1246, 9) = 1728*1019+1008;
P(1247, 0) = 1728*1011+1060;
P(1247, 1) = 1728*1060+1063;
P(1247, 2) = 1728*1063+1102;
P(1247, 3) = 1728*1102+1101;
P(1247, 4) = 1728*1101+1100;
P(1247, 5) = 1728*1100+1051;
P(1247, 6) = 1728*1051+1050;
P(1247, 7) = 1728*1050+1049;
P(1247, 8) = 1728*1049+1048;
P(1247, 9) = 1728*1048+1011;
P(1248, 0) = 1728*1011+1060;
P(1248, 1) = 1728*1060+1063;
P(1248, 2) = 1728*1063+1298;
P(1248, 3) = 1728*1298+1299;
P(1248, 4) = 1728*1299+1336;
P(1248, 5) = 1728*1336+1337;
P(1248, 6) = 1728*1337+1054;
P(1248, 7) = 1728*1054+1053;
P(1248, 8) = 1728*1053+1048;
P(1248, 9) = 1728*1048+1011;
P(1249, 0) = 1728*1012+1013;
P(1249, 1) = 1728*1013+1014;
P(1249, 2) = 1728*1014+1023;
P(1249, 3) = 1728*1023+1258;
P(1249, 4) = 1728*1258+1259;
P(1249, 5) = 1728*1259+1248;
P(1249, 6) = 1728*1248+1249;
P(1249, 7) = 1728*1249+1250;
P(1249, 8) = 1728*1250+1015;
P(1249, 9) = 1728*1015+1012;
P(1250, 0) = 1728*1012+1013;
P(1250, 1) = 1728*1013+1014;
P(1250, 2) = 1728*1014+1297;
P(1250, 3) = 1728*1297+1296;
P(1250, 4) = 1728*1296+1301;
P(1250, 5) = 1728*1301+1300;
P(1250, 6) = 1728*1300+1251;
P(1250, 7) = 1728*1251+1250;
P(1250, 8) = 1728*1250+1015;
P(1250, 9) = 1728*1015+1012;
P(1251, 0) = 1728*1012+1013;
P(1251, 1) = 1728*1013+1014;
P(1251, 2) = 1728*1014+1297;
P(1251, 3) = 1728*1297+1298;
P(1251, 4) = 1728*1298+1299;
P(1251, 5) = 1728*1299+1336;
P(1251, 6) = 1728*1336+1337;
P(1251, 7) = 1728*1337+1054;
P(1251, 8) = 1728*1054+1015;
P(1251, 9) = 1728*1015+1012;
P(1252, 0) = 1728*1014+1023;
P(1252, 1) = 1728*1023+1020;
P(1252, 2) = 1728*1020+1021;
P(1252, 3) = 1728*1021+1022;
P(1252, 4) = 1728*1022+1305;
P(1252, 5) = 1728*1305+1306;
P(1252, 6) = 1728*1306+1307;
P(1252, 7) = 1728*1307+1296;
P(1252, 8) = 1728*1296+1297;
P(1252, 9) = 1728*1297+1014;
P(1253, 0) = 1728*1014+1023;
P(1253, 1) = 1728*1023+1258;
P(1253, 2) = 1728*1258+1259;
P(1253, 3) = 1728*1259+1308;
P(1253, 4) = 1728*1308+1311;
P(1253, 5) = 1728*1311+1302;
P(1253, 6) = 1728*1302+1301;
P(1253, 7) = 1728*1301+1296;
P(1253, 8) = 1728*1296+1297;
P(1253, 9) = 1728*1297+1014;
P(1254, 0) = 1728*1015+1054;
P(1254, 1) = 1728*1054+1053;
P(1254, 2) = 1728*1053+1052;
P(1254, 3) = 1728*1052+1055;
P(1254, 4) = 1728*1055+1290;
P(1254, 5) = 1728*1290+1289;
P(1254, 6) = 1728*1289+1288;
P(1254, 7) = 1728*1288+1251;
P(1254, 8) = 1728*1251+1250;
P(1254, 9) = 1728*1250+1015;
P(1255, 0) = 1728*1015+1054;
P(1255, 1) = 1728*1054+1337;
P(1255, 2) = 1728*1337+1336;
P(1255, 3) = 1728*1336+1341;
P(1255, 4) = 1728*1341+1342;
P(1255, 5) = 1728*1342+1303;
P(1255, 6) = 1728*1303+1300;
P(1255, 7) = 1728*1300+1251;
P(1255, 8) = 1728*1251+1250;
P(1255, 9) = 1728*1250+1015;
P(1256, 0) = 1728*1016+1017;
P(1256, 1) = 1728*1017+1018;
P(1256, 2) = 1728*1018+1019;
P(1256, 3) = 1728*1019+1068;
P(1256, 4) = 1728*1068+1069;
P(1256, 5) = 1728*1069+1070;
P(1256, 6) = 1728*1070+1079;
P(1256, 7) = 1728*1079+1076;
P(1256, 8) = 1728*1076+1027;
P(1256, 9) = 1728*1027+1016;
P(1257, 0) = 1728*1016+1017;
P(1257, 1) = 1728*1017+1018;
P(1257, 2) = 1728*1018+1019;
P(1257, 3) = 1728*1019+1068;
P(1257, 4) = 1728*1068+1071;
P(1257, 5) = 1728*1071+1306;
P(1257, 6) = 1728*1306+1305;
P(1257, 7) = 1728*1305+1022;
P(1257, 8) = 1728*1022+1021;
P(1257, 9) = 1728*1021+1016;
P(1258, 0) = 1728*1016+1021;
P(1258, 1) = 1728*1021+1022;
P(1258, 2) = 1728*1022+1031;
P(1258, 3) = 1728*1031+1028;
P(1258, 4) = 1728*1028+1029;
P(1258, 5) = 1728*1029+1024;
P(1258, 6) = 1728*1024+1025;
P(1258, 7) = 1728*1025+1026;
P(1258, 8) = 1728*1026+1027;
P(1258, 9) = 1728*1027+1016;
P(1259, 0) = 1728*1016+1021;
P(1259, 1) = 1728*1021+1022;
P(1259, 2) = 1728*1022+1305;
P(1259, 3) = 1728*1305+1304;
P(1259, 4) = 1728*1304+1315;
P(1259, 5) = 1728*1315+1314;
P(1259, 6) = 1728*1314+1079;
P(1259, 7) = 1728*1079+1076;
P(1259, 8) = 1728*1076+1027;
P(1259, 9) = 1728*1027+1016;
P(1260, 0) = 1728*1020+1021;
P(1260, 1) = 1728*1021+1022;
P(1260, 2) = 1728*1022+1031;
P(1260, 3) = 1728*1031+1266;
P(1260, 4) = 1728*1266+1267;
P(1260, 5) = 1728*1267+1256;
P(1260, 6) = 1728*1256+1257;
P(1260, 7) = 1728*1257+1258;
P(1260, 8) = 1728*1258+1023;
P(1260, 9) = 1728*1023+1020;
P(1261, 0) = 1728*1020+1021;
P(1261, 1) = 1728*1021+1022;
P(1261, 2) = 1728*1022+1305;
P(1261, 3) = 1728*1305+1304;
P(1261, 4) = 1728*1304+1309;
P(1261, 5) = 1728*1309+1308;
P(1261, 6) = 1728*1308+1259;
P(1261, 7) = 1728*1259+1258;
P(1261, 8) = 1728*1258+1023;
P(1261, 9) = 1728*1023+1020;
P(1262, 0) = 1728*1022+1031;
P(1262, 1) = 1728*1031+1028;
P(1262, 2) = 1728*1028+1029;
P(1262, 3) = 1728*1029+1030;
P(1262, 4) = 1728*1030+1313;
P(1262, 5) = 1728*1313+1314;
P(1262, 6) = 1728*1314+1315;
P(1262, 7) = 1728*1315+1304;
P(1262, 8) = 1728*1304+1305;
P(1262, 9) = 1728*1305+1022;
P(1263, 0) = 1728*1022+1031;
P(1263, 1) = 1728*1031+1266;
P(1263, 2) = 1728*1266+1267;
P(1263, 3) = 1728*1267+1316;
P(1263, 4) = 1728*1316+1319;
P(1263, 5) = 1728*1319+1310;
P(1263, 6) = 1728*1310+1309;
P(1263, 7) = 1728*1309+1304;
P(1263, 8) = 1728*1304+1305;
P(1263, 9) = 1728*1305+1022;
P(1264, 0) = 1728*1024+1025;
P(1264, 1) = 1728*1025+1026;
P(1264, 2) = 1728*1026+1027;
P(1264, 3) = 1728*1027+1076;
P(1264, 4) = 1728*1076+1077;
P(1264, 5) = 1728*1077+1078;
P(1264, 6) = 1728*1078+1087;
P(1264, 7) = 1728*1087+1084;
P(1264, 8) = 1728*1084+1035;
P(1264, 9) = 1728*1035+1024;
P(1265, 0) = 1728*1024+1025;
P(1265, 1) = 1728*1025+1026;
P(1265, 2) = 1728*1026+1027;
P(1265, 3) = 1728*1027+1076;
P(1265, 4) = 1728*1076+1079;
P(1265, 5) = 1728*1079+1314;
P(1265, 6) = 1728*1314+1313;
P(1265, 7) = 1728*1313+1030;
P(1265, 8) = 1728*1030+1029;
P(1265, 9) = 1728*1029+1024;
P(1266, 0) = 1728*1024+1029;
P(1266, 1) = 1728*1029+1030;
P(1266, 2) = 1728*1030+1039;
P(1266, 3) = 1728*1039+1036;
P(1266, 4) = 1728*1036+1037;
P(1266, 5) = 1728*1037+1032;
P(1266, 6) = 1728*1032+1033;
P(1266, 7) = 1728*1033+1034;
P(1266, 8) = 1728*1034+1035;
P(1266, 9) = 1728*1035+1024;
P(1267, 0) = 1728*1024+1029;
P(1267, 1) = 1728*1029+1030;
P(1267, 2) = 1728*1030+1313;
P(1267, 3) = 1728*1313+1312;
P(1267, 4) = 1728*1312+1323;
P(1267, 5) = 1728*1323+1322;
P(1267, 6) = 1728*1322+1087;
P(1267, 7) = 1728*1087+1084;
P(1267, 8) = 1728*1084+1035;
P(1267, 9) = 1728*1035+1024;
P(1268, 0) = 1728*1028+1029;
P(1268, 1) = 1728*1029+1030;
P(1268, 2) = 1728*1030+1039;
P(1268, 3) = 1728*1039+1274;
P(1268, 4) = 1728*1274+1275;
P(1268, 5) = 1728*1275+1264;
P(1268, 6) = 1728*1264+1265;
P(1268, 7) = 1728*1265+1266;
P(1268, 8) = 1728*1266+1031;
P(1268, 9) = 1728*1031+1028;
P(1269, 0) = 1728*1028+1029;
P(1269, 1) = 1728*1029+1030;
P(1269, 2) = 1728*1030+1313;
P(1269, 3) = 1728*1313+1312;
P(1269, 4) = 1728*1312+1317;
P(1269, 5) = 1728*1317+1316;
P(1269, 6) = 1728*1316+1267;
P(1269, 7) = 1728*1267+1266;
P(1269, 8) = 1728*1266+1031;
P(1269, 9) = 1728*1031+1028;
P(1270, 0) = 1728*1030+1039;
P(1270, 1) = 1728*1039+1036;
P(1270, 2) = 1728*1036+1037;
P(1270, 3) = 1728*1037+1038;
P(1270, 4) = 1728*1038+1321;
P(1270, 5) = 1728*1321+1322;
P(1270, 6) = 1728*1322+1323;
P(1270, 7) = 1728*1323+1312;
P(1270, 8) = 1728*1312+1313;
P(1270, 9) = 1728*1313+1030;
P(1271, 0) = 1728*1030+1039;
P(1271, 1) = 1728*1039+1274;
P(1271, 2) = 1728*1274+1275;
P(1271, 3) = 1728*1275+1324;
P(1271, 4) = 1728*1324+1327;
P(1271, 5) = 1728*1327+1318;
P(1271, 6) = 1728*1318+1317;
P(1271, 7) = 1728*1317+1312;
P(1271, 8) = 1728*1312+1313;
P(1271, 9) = 1728*1313+1030;
P(1272, 0) = 1728*1032+1033;
P(1272, 1) = 1728*1033+1034;
P(1272, 2) = 1728*1034+1035;
P(1272, 3) = 1728*1035+1084;
P(1272, 4) = 1728*1084+1085;
P(1272, 5) = 1728*1085+1086;
P(1272, 6) = 1728*1086+1095;
P(1272, 7) = 1728*1095+1092;
P(1272, 8) = 1728*1092+1043;
P(1272, 9) = 1728*1043+1032;
P(1273, 0) = 1728*1032+1033;
P(1273, 1) = 1728*1033+1034;
P(1273, 2) = 1728*1034+1035;
P(1273, 3) = 1728*1035+1084;
P(1273, 4) = 1728*1084+1087;
P(1273, 5) = 1728*1087+1322;
P(1273, 6) = 1728*1322+1321;
P(1273, 7) = 1728*1321+1038;
P(1273, 8) = 1728*1038+1037;
P(1273, 9) = 1728*1037+1032;
P(1274, 0) = 1728*1032+1037;
P(1274, 1) = 1728*1037+1038;
P(1274, 2) = 1728*1038+1047;
P(1274, 3) = 1728*1047+1044;
P(1274, 4) = 1728*1044+1045;
P(1274, 5) = 1728*1045+1040;
P(1274, 6) = 1728*1040+1041;
P(1274, 7) = 1728*1041+1042;
P(1274, 8) = 1728*1042+1043;
P(1274, 9) = 1728*1043+1032;
P(1275, 0) = 1728*1032+1037;
P(1275, 1) = 1728*1037+1038;
P(1275, 2) = 1728*1038+1321;
P(1275, 3) = 1728*1321+1320;
P(1275, 4) = 1728*1320+1331;
P(1275, 5) = 1728*1331+1330;
P(1275, 6) = 1728*1330+1095;
P(1275, 7) = 1728*1095+1092;
P(1275, 8) = 1728*1092+1043;
P(1275, 9) = 1728*1043+1032;
P(1276, 0) = 1728*1036+1037;
P(1276, 1) = 1728*1037+1038;
P(1276, 2) = 1728*1038+1047;
P(1276, 3) = 1728*1047+1282;
P(1276, 4) = 1728*1282+1283;
P(1276, 5) = 1728*1283+1272;
P(1276, 6) = 1728*1272+1273;
P(1276, 7) = 1728*1273+1274;
P(1276, 8) = 1728*1274+1039;
P(1276, 9) = 1728*1039+1036;
P(1277, 0) = 1728*1036+1037;
P(1277, 1) = 1728*1037+1038;
P(1277, 2) = 1728*1038+1321;
P(1277, 3) = 1728*1321+1320;
P(1277, 4) = 1728*1320+1325;
P(1277, 5) = 1728*1325+1324;
P(1277, 6) = 1728*1324+1275;
P(1277, 7) = 1728*1275+1274;
P(1277, 8) = 1728*1274+1039;
P(1277, 9) = 1728*1039+1036;
P(1278, 0) = 1728*1038+1047;
P(1278, 1) = 1728*1047+1044;
P(1278, 2) = 1728*1044+1045;
P(1278, 3) = 1728*1045+1046;
P(1278, 4) = 1728*1046+1329;
P(1278, 5) = 1728*1329+1330;
P(1278, 6) = 1728*1330+1331;
P(1278, 7) = 1728*1331+1320;
P(1278, 8) = 1728*1320+1321;
P(1278, 9) = 1728*1321+1038;
P(1279, 0) = 1728*1038+1047;
P(1279, 1) = 1728*1047+1282;
P(1279, 2) = 1728*1282+1283;
P(1279, 3) = 1728*1283+1332;
P(1279, 4) = 1728*1332+1335;
P(1279, 5) = 1728*1335+1326;
P(1279, 6) = 1728*1326+1325;
P(1279, 7) = 1728*1325+1320;
P(1279, 8) = 1728*1320+1321;
P(1279, 9) = 1728*1321+1038;
P(1280, 0) = 1728*1040+1041;
P(1280, 1) = 1728*1041+1042;
P(1280, 2) = 1728*1042+1043;
P(1280, 3) = 1728*1043+1092;
P(1280, 4) = 1728*1092+1093;
P(1280, 5) = 1728*1093+1094;
P(1280, 6) = 1728*1094+1103;
P(1280, 7) = 1728*1103+1100;
P(1280, 8) = 1728*1100+1051;
P(1280, 9) = 1728*1051+1040;
P(1281, 0) = 1728*1040+1041;
P(1281, 1) = 1728*1041+1042;
P(1281, 2) = 1728*1042+1043;
P(1281, 3) = 1728*1043+1092;
P(1281, 4) = 1728*1092+1095;
P(1281, 5) = 1728*1095+1330;
P(1281, 6) = 1728*1330+1329;
P(1281, 7) = 1728*1329+1046;
P(1281, 8) = 1728*1046+1045;
P(1281, 9) = 1728*1045+1040;
P(1282, 0) = 1728*1040+1045;
P(1282, 1) = 1728*1045+1046;
P(1282, 2) = 1728*1046+1055;
P(1282, 3) = 1728*1055+1052;
P(1282, 4) = 1728*1052+1053;
P(1282, 5) = 1728*1053+1048;
P(1282, 6) = 1728*1048+1049;
P(1282, 7) = 1728*1049+1050;
P(1282, 8) = 1728*1050+1051;
P(1282, 9) = 1728*1051+1040;
P(1283, 0) = 1728*1040+1045;
P(1283, 1) = 1728*1045+1046;
P(1283, 2) = 1728*1046+1329;
P(1283, 3) = 1728*1329+1328;
P(1283, 4) = 1728*1328+1339;
P(1283, 5) = 1728*1339+1338;
P(1283, 6) = 1728*1338+1103;
P(1283, 7) = 1728*1103+1100;
P(1283, 8) = 1728*1100+1051;
P(1283, 9) = 1728*1051+1040;
P(1284, 0) = 1728*1044+1045;
P(1284, 1) = 1728*1045+1046;
P(1284, 2) = 1728*1046+1055;
P(1284, 3) = 1728*1055+1290;
P(1284, 4) = 1728*1290+1291;
P(1284, 5) = 1728*1291+1280;
P(1284, 6) = 1728*1280+1281;
P(1284, 7) = 1728*1281+1282;
P(1284, 8) = 1728*1282+1047;
P(1284, 9) = 1728*1047+1044;
P(1285, 0) = 1728*1044+1045;
P(1285, 1) = 1728*1045+1046;
P(1285, 2) = 1728*1046+1329;
P(1285, 3) = 1728*1329+1328;
P(1285, 4) = 1728*1328+1333;
P(1285, 5) = 1728*1333+1332;
P(1285, 6) = 1728*1332+1283;
P(1285, 7) = 1728*1283+1282;
P(1285, 8) = 1728*1282+1047;
P(1285, 9) = 1728*1047+1044;
P(1286, 0) = 1728*1046+1055;
P(1286, 1) = 1728*1055+1052;
P(1286, 2) = 1728*1052+1053;
P(1286, 3) = 1728*1053+1054;
P(1286, 4) = 1728*1054+1337;
P(1286, 5) = 1728*1337+1338;
P(1286, 6) = 1728*1338+1339;
P(1286, 7) = 1728*1339+1328;
P(1286, 8) = 1728*1328+1329;
P(1286, 9) = 1728*1329+1046;
P(1287, 0) = 1728*1046+1055;
P(1287, 1) = 1728*1055+1290;
P(1287, 2) = 1728*1290+1291;
P(1287, 3) = 1728*1291+1340;
P(1287, 4) = 1728*1340+1343;
P(1287, 5) = 1728*1343+1334;
P(1287, 6) = 1728*1334+1333;
P(1287, 7) = 1728*1333+1328;
P(1287, 8) = 1728*1328+1329;
P(1287, 9) = 1728*1329+1046;
P(1288, 0) = 1728*1048+1049;
P(1288, 1) = 1728*1049+1050;
P(1288, 2) = 1728*1050+1051;
P(1288, 3) = 1728*1051+1100;
P(1288, 4) = 1728*1100+1103;
P(1288, 5) = 1728*1103+1338;
P(1288, 6) = 1728*1338+1337;
P(1288, 7) = 1728*1337+1054;
P(1288, 8) = 1728*1054+1053;
P(1288, 9) = 1728*1053+1048;
P(1289, 0) = 1728*1052+1053;
P(1289, 1) = 1728*1053+1054;
P(1289, 2) = 1728*1054+1337;
P(1289, 3) = 1728*1337+1336;
P(1289, 4) = 1728*1336+1341;
P(1289, 5) = 1728*1341+1340;
P(1289, 6) = 1728*1340+1291;
P(1289, 7) = 1728*1291+1290;
P(1289, 8) = 1728*1290+1055;
P(1289, 9) = 1728*1055+1052;
P(1290, 0) = 1728*1056+1057;
P(1290, 1) = 1728*1057+1058;
P(1290, 2) = 1728*1058+1059;
P(1290, 3) = 1728*1059+1108;
P(1290, 4) = 1728*1108+1109;
P(1290, 5) = 1728*1109+1110;
P(1290, 6) = 1728*1110+1119;
P(1290, 7) = 1728*1119+1116;
P(1290, 8) = 1728*1116+1067;
P(1290, 9) = 1728*1067+1056;
P(1291, 0) = 1728*1056+1057;
P(1291, 1) = 1728*1057+1058;
P(1291, 2) = 1728*1058+1059;
P(1291, 3) = 1728*1059+1108;
P(1291, 4) = 1728*1108+1111;
P(1291, 5) = 1728*1111+1346;
P(1291, 6) = 1728*1346+1345;
P(1291, 7) = 1728*1345+1062;
P(1291, 8) = 1728*1062+1061;
P(1291, 9) = 1728*1061+1056;
P(1292, 0) = 1728*1056+1057;
P(1292, 1) = 1728*1057+1058;
P(1292, 2) = 1728*1058+1059;
P(1292, 3) = 1728*1059+1096;
P(1292, 4) = 1728*1096+1101;
P(1292, 5) = 1728*1101+1102;
P(1292, 6) = 1728*1102+1063;
P(1292, 7) = 1728*1063+1060;
P(1292, 8) = 1728*1060+1061;
P(1292, 9) = 1728*1061+1056;
P(1293, 0) = 1728*1056+1061;
P(1293, 1) = 1728*1061+1062;
P(1293, 2) = 1728*1062+1071;
P(1293, 3) = 1728*1071+1068;
P(1293, 4) = 1728*1068+1069;
P(1293, 5) = 1728*1069+1064;
P(1293, 6) = 1728*1064+1065;
P(1293, 7) = 1728*1065+1066;
P(1293, 8) = 1728*1066+1067;
P(1293, 9) = 1728*1067+1056;
P(1294, 0) = 1728*1056+1061;
P(1294, 1) = 1728*1061+1062;
P(1294, 2) = 1728*1062+1345;
P(1294, 3) = 1728*1345+1344;
P(1294, 4) = 1728*1344+1355;
P(1294, 5) = 1728*1355+1354;
P(1294, 6) = 1728*1354+1119;
P(1294, 7) = 1728*1119+1116;
P(1294, 8) = 1728*1116+1067;
P(1294, 9) = 1728*1067+1056;
P(1295, 0) = 1728*1059+1108;
P(1295, 1) = 1728*1108+1111;
P(1295, 2) = 1728*1111+1150;
P(1295, 3) = 1728*1150+1149;
P(1295, 4) = 1728*1149+1148;
P(1295, 5) = 1728*1148+1099;
P(1295, 6) = 1728*1099+1098;
P(1295, 7) = 1728*1098+1097;
P(1295, 8) = 1728*1097+1096;
P(1295, 9) = 1728*1096+1059;
P(1296, 0) = 1728*1059+1108;
P(1296, 1) = 1728*1108+1111;
P(1296, 2) = 1728*1111+1346;
P(1296, 3) = 1728*1346+1347;
P(1296, 4) = 1728*1347+1384;
P(1296, 5) = 1728*1384+1385;
P(1296, 6) = 1728*1385+1102;
P(1296, 7) = 1728*1102+1101;
P(1296, 8) = 1728*1101+1096;
P(1296, 9) = 1728*1096+1059;
P(1297, 0) = 1728*1060+1061;
P(1297, 1) = 1728*1061+1062;
P(1297, 2) = 1728*1062+1071;
P(1297, 3) = 1728*1071+1306;
P(1297, 4) = 1728*1306+1307;
P(1297, 5) = 1728*1307+1296;
P(1297, 6) = 1728*1296+1297;
P(1297, 7) = 1728*1297+1298;
P(1297, 8) = 1728*1298+1063;
P(1297, 9) = 1728*1063+1060;
P(1298, 0) = 1728*1060+1061;
P(1298, 1) = 1728*1061+1062;
P(1298, 2) = 1728*1062+1345;
P(1298, 3) = 1728*1345+1344;
P(1298, 4) = 1728*1344+1349;
P(1298, 5) = 1728*1349+1348;
P(1298, 6) = 1728*1348+1299;
P(1298, 7) = 1728*1299+1298;
P(1298, 8) = 1728*1298+1063;
P(1298, 9) = 1728*1063+1060;
P(1299, 0) = 1728*1060+1061;
P(1299, 1) = 1728*1061+1062;
P(1299, 2) = 1728*1062+1345;
P(1299, 3) = 1728*1345+1346;
P(1299, 4) = 1728*1346+1347;
P(1299, 5) = 1728*1347+1384;
P(1299, 6) = 1728*1384+1385;
P(1299, 7) = 1728*1385+1102;
P(1299, 8) = 1728*1102+1063;
P(1299, 9) = 1728*1063+1060;
P(1300, 0) = 1728*1062+1071;
P(1300, 1) = 1728*1071+1068;
P(1300, 2) = 1728*1068+1069;
P(1300, 3) = 1728*1069+1070;
P(1300, 4) = 1728*1070+1353;
P(1300, 5) = 1728*1353+1354;
P(1300, 6) = 1728*1354+1355;
P(1300, 7) = 1728*1355+1344;
P(1300, 8) = 1728*1344+1345;
P(1300, 9) = 1728*1345+1062;
P(1301, 0) = 1728*1062+1071;
P(1301, 1) = 1728*1071+1306;
P(1301, 2) = 1728*1306+1307;
P(1301, 3) = 1728*1307+1356;
P(1301, 4) = 1728*1356+1359;
P(1301, 5) = 1728*1359+1350;
P(1301, 6) = 1728*1350+1349;
P(1301, 7) = 1728*1349+1344;
P(1301, 8) = 1728*1344+1345;
P(1301, 9) = 1728*1345+1062;
P(1302, 0) = 1728*1063+1102;
P(1302, 1) = 1728*1102+1101;
P(1302, 2) = 1728*1101+1100;
P(1302, 3) = 1728*1100+1103;
P(1302, 4) = 1728*1103+1338;
P(1302, 5) = 1728*1338+1337;
P(1302, 6) = 1728*1337+1336;
P(1302, 7) = 1728*1336+1299;
P(1302, 8) = 1728*1299+1298;
P(1302, 9) = 1728*1298+1063;
P(1303, 0) = 1728*1063+1102;
P(1303, 1) = 1728*1102+1385;
P(1303, 2) = 1728*1385+1384;
P(1303, 3) = 1728*1384+1389;
P(1303, 4) = 1728*1389+1390;
P(1303, 5) = 1728*1390+1351;
P(1303, 6) = 1728*1351+1348;
P(1303, 7) = 1728*1348+1299;
P(1303, 8) = 1728*1299+1298;
P(1303, 9) = 1728*1298+1063;
P(1304, 0) = 1728*1064+1065;
P(1304, 1) = 1728*1065+1066;
P(1304, 2) = 1728*1066+1067;
P(1304, 3) = 1728*1067+1116;
P(1304, 4) = 1728*1116+1117;
P(1304, 5) = 1728*1117+1118;
P(1304, 6) = 1728*1118+1127;
P(1304, 7) = 1728*1127+1124;
P(1304, 8) = 1728*1124+1075;
P(1304, 9) = 1728*1075+1064;
P(1305, 0) = 1728*1064+1065;
P(1305, 1) = 1728*1065+1066;
P(1305, 2) = 1728*1066+1067;
P(1305, 3) = 1728*1067+1116;
P(1305, 4) = 1728*1116+1119;
P(1305, 5) = 1728*1119+1354;
P(1305, 6) = 1728*1354+1353;
P(1305, 7) = 1728*1353+1070;
P(1305, 8) = 1728*1070+1069;
P(1305, 9) = 1728*1069+1064;
P(1306, 0) = 1728*1064+1069;
P(1306, 1) = 1728*1069+1070;
P(1306, 2) = 1728*1070+1079;
P(1306, 3) = 1728*1079+1076;
P(1306, 4) = 1728*1076+1077;
P(1306, 5) = 1728*1077+1072;
P(1306, 6) = 1728*1072+1073;
P(1306, 7) = 1728*1073+1074;
P(1306, 8) = 1728*1074+1075;
P(1306, 9) = 1728*1075+1064;
P(1307, 0) = 1728*1064+1069;
P(1307, 1) = 1728*1069+1070;
P(1307, 2) = 1728*1070+1353;
P(1307, 3) = 1728*1353+1352;
P(1307, 4) = 1728*1352+1363;
P(1307, 5) = 1728*1363+1362;
P(1307, 6) = 1728*1362+1127;
P(1307, 7) = 1728*1127+1124;
P(1307, 8) = 1728*1124+1075;
P(1307, 9) = 1728*1075+1064;
P(1308, 0) = 1728*1068+1069;
P(1308, 1) = 1728*1069+1070;
P(1308, 2) = 1728*1070+1079;
P(1308, 3) = 1728*1079+1314;
P(1308, 4) = 1728*1314+1315;
P(1308, 5) = 1728*1315+1304;
P(1308, 6) = 1728*1304+1305;
P(1308, 7) = 1728*1305+1306;
P(1308, 8) = 1728*1306+1071;
P(1308, 9) = 1728*1071+1068;
P(1309, 0) = 1728*1068+1069;
P(1309, 1) = 1728*1069+1070;
P(1309, 2) = 1728*1070+1353;
P(1309, 3) = 1728*1353+1352;
P(1309, 4) = 1728*1352+1357;
P(1309, 5) = 1728*1357+1356;
P(1309, 6) = 1728*1356+1307;
P(1309, 7) = 1728*1307+1306;
P(1309, 8) = 1728*1306+1071;
P(1309, 9) = 1728*1071+1068;
P(1310, 0) = 1728*1070+1079;
P(1310, 1) = 1728*1079+1076;
P(1310, 2) = 1728*1076+1077;
P(1310, 3) = 1728*1077+1078;
P(1310, 4) = 1728*1078+1361;
P(1310, 5) = 1728*1361+1362;
P(1310, 6) = 1728*1362+1363;
P(1310, 7) = 1728*1363+1352;
P(1310, 8) = 1728*1352+1353;
P(1310, 9) = 1728*1353+1070;
P(1311, 0) = 1728*1070+1079;
P(1311, 1) = 1728*1079+1314;
P(1311, 2) = 1728*1314+1315;
P(1311, 3) = 1728*1315+1364;
P(1311, 4) = 1728*1364+1367;
P(1311, 5) = 1728*1367+1358;
P(1311, 6) = 1728*1358+1357;
P(1311, 7) = 1728*1357+1352;
P(1311, 8) = 1728*1352+1353;
P(1311, 9) = 1728*1353+1070;
P(1312, 0) = 1728*1072+1073;
P(1312, 1) = 1728*1073+1074;
P(1312, 2) = 1728*1074+1075;
P(1312, 3) = 1728*1075+1124;
P(1312, 4) = 1728*1124+1125;
P(1312, 5) = 1728*1125+1126;
P(1312, 6) = 1728*1126+1135;
P(1312, 7) = 1728*1135+1132;
P(1312, 8) = 1728*1132+1083;
P(1312, 9) = 1728*1083+1072;
P(1313, 0) = 1728*1072+1073;
P(1313, 1) = 1728*1073+1074;
P(1313, 2) = 1728*1074+1075;
P(1313, 3) = 1728*1075+1124;
P(1313, 4) = 1728*1124+1127;
P(1313, 5) = 1728*1127+1362;
P(1313, 6) = 1728*1362+1361;
P(1313, 7) = 1728*1361+1078;
P(1313, 8) = 1728*1078+1077;
P(1313, 9) = 1728*1077+1072;
P(1314, 0) = 1728*1072+1077;
P(1314, 1) = 1728*1077+1078;
P(1314, 2) = 1728*1078+1087;
P(1314, 3) = 1728*1087+1084;
P(1314, 4) = 1728*1084+1085;
P(1314, 5) = 1728*1085+1080;
P(1314, 6) = 1728*1080+1081;
P(1314, 7) = 1728*1081+1082;
P(1314, 8) = 1728*1082+1083;
P(1314, 9) = 1728*1083+1072;
P(1315, 0) = 1728*1072+1077;
P(1315, 1) = 1728*1077+1078;
P(1315, 2) = 1728*1078+1361;
P(1315, 3) = 1728*1361+1360;
P(1315, 4) = 1728*1360+1371;
P(1315, 5) = 1728*1371+1370;
P(1315, 6) = 1728*1370+1135;
P(1315, 7) = 1728*1135+1132;
P(1315, 8) = 1728*1132+1083;
P(1315, 9) = 1728*1083+1072;
P(1316, 0) = 1728*1076+1077;
P(1316, 1) = 1728*1077+1078;
P(1316, 2) = 1728*1078+1087;
P(1316, 3) = 1728*1087+1322;
P(1316, 4) = 1728*1322+1323;
P(1316, 5) = 1728*1323+1312;
P(1316, 6) = 1728*1312+1313;
P(1316, 7) = 1728*1313+1314;
P(1316, 8) = 1728*1314+1079;
P(1316, 9) = 1728*1079+1076;
P(1317, 0) = 1728*1076+1077;
P(1317, 1) = 1728*1077+1078;
P(1317, 2) = 1728*1078+1361;
P(1317, 3) = 1728*1361+1360;
P(1317, 4) = 1728*1360+1365;
P(1317, 5) = 1728*1365+1364;
P(1317, 6) = 1728*1364+1315;
P(1317, 7) = 1728*1315+1314;
P(1317, 8) = 1728*1314+1079;
P(1317, 9) = 1728*1079+1076;
P(1318, 0) = 1728*1078+1087;
P(1318, 1) = 1728*1087+1084;
P(1318, 2) = 1728*1084+1085;
P(1318, 3) = 1728*1085+1086;
P(1318, 4) = 1728*1086+1369;
P(1318, 5) = 1728*1369+1370;
P(1318, 6) = 1728*1370+1371;
P(1318, 7) = 1728*1371+1360;
P(1318, 8) = 1728*1360+1361;
P(1318, 9) = 1728*1361+1078;
P(1319, 0) = 1728*1078+1087;
P(1319, 1) = 1728*1087+1322;
P(1319, 2) = 1728*1322+1323;
P(1319, 3) = 1728*1323+1372;
P(1319, 4) = 1728*1372+1375;
P(1319, 5) = 1728*1375+1366;
P(1319, 6) = 1728*1366+1365;
P(1319, 7) = 1728*1365+1360;
P(1319, 8) = 1728*1360+1361;
P(1319, 9) = 1728*1361+1078;
P(1320, 0) = 1728*1080+1081;
P(1320, 1) = 1728*1081+1082;
P(1320, 2) = 1728*1082+1083;
P(1320, 3) = 1728*1083+1132;
P(1320, 4) = 1728*1132+1133;
P(1320, 5) = 1728*1133+1134;
P(1320, 6) = 1728*1134+1143;
P(1320, 7) = 1728*1143+1140;
P(1320, 8) = 1728*1140+1091;
P(1320, 9) = 1728*1091+1080;
P(1321, 0) = 1728*1080+1081;
P(1321, 1) = 1728*1081+1082;
P(1321, 2) = 1728*1082+1083;
P(1321, 3) = 1728*1083+1132;
P(1321, 4) = 1728*1132+1135;
P(1321, 5) = 1728*1135+1370;
P(1321, 6) = 1728*1370+1369;
P(1321, 7) = 1728*1369+1086;
P(1321, 8) = 1728*1086+1085;
P(1321, 9) = 1728*1085+1080;
P(1322, 0) = 1728*1080+1085;
P(1322, 1) = 1728*1085+1086;
P(1322, 2) = 1728*1086+1095;
P(1322, 3) = 1728*1095+1092;
P(1322, 4) = 1728*1092+1093;
P(1322, 5) = 1728*1093+1088;
P(1322, 6) = 1728*1088+1089;
P(1322, 7) = 1728*1089+1090;
P(1322, 8) = 1728*1090+1091;
P(1322, 9) = 1728*1091+1080;
P(1323, 0) = 1728*1080+1085;
P(1323, 1) = 1728*1085+1086;
P(1323, 2) = 1728*1086+1369;
P(1323, 3) = 1728*1369+1368;
P(1323, 4) = 1728*1368+1379;
P(1323, 5) = 1728*1379+1378;
P(1323, 6) = 1728*1378+1143;
P(1323, 7) = 1728*1143+1140;
P(1323, 8) = 1728*1140+1091;
P(1323, 9) = 1728*1091+1080;
P(1324, 0) = 1728*1084+1085;
P(1324, 1) = 1728*1085+1086;
P(1324, 2) = 1728*1086+1095;
P(1324, 3) = 1728*1095+1330;
P(1324, 4) = 1728*1330+1331;
P(1324, 5) = 1728*1331+1320;
P(1324, 6) = 1728*1320+1321;
P(1324, 7) = 1728*1321+1322;
P(1324, 8) = 1728*1322+1087;
P(1324, 9) = 1728*1087+1084;
P(1325, 0) = 1728*1084+1085;
P(1325, 1) = 1728*1085+1086;
P(1325, 2) = 1728*1086+1369;
P(1325, 3) = 1728*1369+1368;
P(1325, 4) = 1728*1368+1373;
P(1325, 5) = 1728*1373+1372;
P(1325, 6) = 1728*1372+1323;
P(1325, 7) = 1728*1323+1322;
P(1325, 8) = 1728*1322+1087;
P(1325, 9) = 1728*1087+1084;
P(1326, 0) = 1728*1086+1095;
P(1326, 1) = 1728*1095+1092;
P(1326, 2) = 1728*1092+1093;
P(1326, 3) = 1728*1093+1094;
P(1326, 4) = 1728*1094+1377;
P(1326, 5) = 1728*1377+1378;
P(1326, 6) = 1728*1378+1379;
P(1326, 7) = 1728*1379+1368;
P(1326, 8) = 1728*1368+1369;
P(1326, 9) = 1728*1369+1086;
P(1327, 0) = 1728*1086+1095;
P(1327, 1) = 1728*1095+1330;
P(1327, 2) = 1728*1330+1331;
P(1327, 3) = 1728*1331+1380;
P(1327, 4) = 1728*1380+1383;
P(1327, 5) = 1728*1383+1374;
P(1327, 6) = 1728*1374+1373;
P(1327, 7) = 1728*1373+1368;
P(1327, 8) = 1728*1368+1369;
P(1327, 9) = 1728*1369+1086;
P(1328, 0) = 1728*1088+1089;
P(1328, 1) = 1728*1089+1090;
P(1328, 2) = 1728*1090+1091;
P(1328, 3) = 1728*1091+1140;
P(1328, 4) = 1728*1140+1141;
P(1328, 5) = 1728*1141+1142;
P(1328, 6) = 1728*1142+1151;
P(1328, 7) = 1728*1151+1148;
P(1328, 8) = 1728*1148+1099;
P(1328, 9) = 1728*1099+1088;
P(1329, 0) = 1728*1088+1089;
P(1329, 1) = 1728*1089+1090;
P(1329, 2) = 1728*1090+1091;
P(1329, 3) = 1728*1091+1140;
P(1329, 4) = 1728*1140+1143;
P(1329, 5) = 1728*1143+1378;
P(1329, 6) = 1728*1378+1377;
P(1329, 7) = 1728*1377+1094;
P(1329, 8) = 1728*1094+1093;
P(1329, 9) = 1728*1093+1088;
P(1330, 0) = 1728*1088+1093;
P(1330, 1) = 1728*1093+1094;
P(1330, 2) = 1728*1094+1103;
P(1330, 3) = 1728*1103+1100;
P(1330, 4) = 1728*1100+1101;
P(1330, 5) = 1728*1101+1096;
P(1330, 6) = 1728*1096+1097;
P(1330, 7) = 1728*1097+1098;
P(1330, 8) = 1728*1098+1099;
P(1330, 9) = 1728*1099+1088;
P(1331, 0) = 1728*1088+1093;
P(1331, 1) = 1728*1093+1094;
P(1331, 2) = 1728*1094+1377;
P(1331, 3) = 1728*1377+1376;
P(1331, 4) = 1728*1376+1387;
P(1331, 5) = 1728*1387+1386;
P(1331, 6) = 1728*1386+1151;
P(1331, 7) = 1728*1151+1148;
P(1331, 8) = 1728*1148+1099;
P(1331, 9) = 1728*1099+1088;
P(1332, 0) = 1728*1092+1093;
P(1332, 1) = 1728*1093+1094;
P(1332, 2) = 1728*1094+1103;
P(1332, 3) = 1728*1103+1338;
P(1332, 4) = 1728*1338+1339;
P(1332, 5) = 1728*1339+1328;
P(1332, 6) = 1728*1328+1329;
P(1332, 7) = 1728*1329+1330;
P(1332, 8) = 1728*1330+1095;
P(1332, 9) = 1728*1095+1092;
P(1333, 0) = 1728*1092+1093;
P(1333, 1) = 1728*1093+1094;
P(1333, 2) = 1728*1094+1377;
P(1333, 3) = 1728*1377+1376;
P(1333, 4) = 1728*1376+1381;
P(1333, 5) = 1728*1381+1380;
P(1333, 6) = 1728*1380+1331;
P(1333, 7) = 1728*1331+1330;
P(1333, 8) = 1728*1330+1095;
P(1333, 9) = 1728*1095+1092;
P(1334, 0) = 1728*1094+1103;
P(1334, 1) = 1728*1103+1100;
P(1334, 2) = 1728*1100+1101;
P(1334, 3) = 1728*1101+1102;
P(1334, 4) = 1728*1102+1385;
P(1334, 5) = 1728*1385+1386;
P(1334, 6) = 1728*1386+1387;
P(1334, 7) = 1728*1387+1376;
P(1334, 8) = 1728*1376+1377;
P(1334, 9) = 1728*1377+1094;
P(1335, 0) = 1728*1094+1103;
P(1335, 1) = 1728*1103+1338;
P(1335, 2) = 1728*1338+1339;
P(1335, 3) = 1728*1339+1388;
P(1335, 4) = 1728*1388+1391;
P(1335, 5) = 1728*1391+1382;
P(1335, 6) = 1728*1382+1381;
P(1335, 7) = 1728*1381+1376;
P(1335, 8) = 1728*1376+1377;
P(1335, 9) = 1728*1377+1094;
P(1336, 0) = 1728*1096+1097;
P(1336, 1) = 1728*1097+1098;
P(1336, 2) = 1728*1098+1099;
P(1336, 3) = 1728*1099+1148;
P(1336, 4) = 1728*1148+1151;
P(1336, 5) = 1728*1151+1386;
P(1336, 6) = 1728*1386+1385;
P(1336, 7) = 1728*1385+1102;
P(1336, 8) = 1728*1102+1101;
P(1336, 9) = 1728*1101+1096;
P(1337, 0) = 1728*1100+1101;
P(1337, 1) = 1728*1101+1102;
P(1337, 2) = 1728*1102+1385;
P(1337, 3) = 1728*1385+1384;
P(1337, 4) = 1728*1384+1389;
P(1337, 5) = 1728*1389+1388;
P(1337, 6) = 1728*1388+1339;
P(1337, 7) = 1728*1339+1338;
P(1337, 8) = 1728*1338+1103;
P(1337, 9) = 1728*1103+1100;
P(1338, 0) = 1728*1104+1105;
P(1338, 1) = 1728*1105+1106;
P(1338, 2) = 1728*1106+1107;
P(1338, 3) = 1728*1107+1144;
P(1338, 4) = 1728*1144+1149;
P(1338, 5) = 1728*1149+1150;
P(1338, 6) = 1728*1150+1111;
P(1338, 7) = 1728*1111+1108;
P(1338, 8) = 1728*1108+1109;
P(1338, 9) = 1728*1109+1104;
P(1339, 0) = 1728*1104+1109;
P(1339, 1) = 1728*1109+1110;
P(1339, 2) = 1728*1110+1119;
P(1339, 3) = 1728*1119+1116;
P(1339, 4) = 1728*1116+1117;
P(1339, 5) = 1728*1117+1112;
P(1339, 6) = 1728*1112+1113;
P(1339, 7) = 1728*1113+1114;
P(1339, 8) = 1728*1114+1115;
P(1339, 9) = 1728*1115+1104;
P(1340, 0) = 1728*1108+1109;
P(1340, 1) = 1728*1109+1110;
P(1340, 2) = 1728*1110+1119;
P(1340, 3) = 1728*1119+1354;
P(1340, 4) = 1728*1354+1355;
P(1340, 5) = 1728*1355+1344;
P(1340, 6) = 1728*1344+1345;
P(1340, 7) = 1728*1345+1346;
P(1340, 8) = 1728*1346+1111;
P(1340, 9) = 1728*1111+1108;
P(1341, 0) = 1728*1108+1109;
P(1341, 1) = 1728*1109+1110;
P(1341, 2) = 1728*1110+1393;
P(1341, 3) = 1728*1393+1392;
P(1341, 4) = 1728*1392+1397;
P(1341, 5) = 1728*1397+1396;
P(1341, 6) = 1728*1396+1347;
P(1341, 7) = 1728*1347+1346;
P(1341, 8) = 1728*1346+1111;
P(1341, 9) = 1728*1111+1108;
P(1342, 0) = 1728*1108+1109;
P(1342, 1) = 1728*1109+1110;
P(1342, 2) = 1728*1110+1393;
P(1342, 3) = 1728*1393+1394;
P(1342, 4) = 1728*1394+1395;
P(1342, 5) = 1728*1395+1432;
P(1342, 6) = 1728*1432+1433;
P(1342, 7) = 1728*1433+1150;
P(1342, 8) = 1728*1150+1111;
P(1342, 9) = 1728*1111+1108;
P(1343, 0) = 1728*1110+1119;
P(1343, 1) = 1728*1119+1116;
P(1343, 2) = 1728*1116+1117;
P(1343, 3) = 1728*1117+1118;
P(1343, 4) = 1728*1118+1401;
P(1343, 5) = 1728*1401+1402;
P(1343, 6) = 1728*1402+1403;
P(1343, 7) = 1728*1403+1392;
P(1343, 8) = 1728*1392+1393;
P(1343, 9) = 1728*1393+1110;
P(1344, 0) = 1728*1110+1119;
P(1344, 1) = 1728*1119+1354;
P(1344, 2) = 1728*1354+1355;
P(1344, 3) = 1728*1355+1404;
P(1344, 4) = 1728*1404+1407;
P(1344, 5) = 1728*1407+1398;
P(1344, 6) = 1728*1398+1397;
P(1344, 7) = 1728*1397+1392;
P(1344, 8) = 1728*1392+1393;
P(1344, 9) = 1728*1393+1110;
P(1345, 0) = 1728*1111+1150;
P(1345, 1) = 1728*1150+1149;
P(1345, 2) = 1728*1149+1148;
P(1345, 3) = 1728*1148+1151;
P(1345, 4) = 1728*1151+1386;
P(1345, 5) = 1728*1386+1385;
P(1345, 6) = 1728*1385+1384;
P(1345, 7) = 1728*1384+1347;
P(1345, 8) = 1728*1347+1346;
P(1345, 9) = 1728*1346+1111;
P(1346, 0) = 1728*1111+1150;
P(1346, 1) = 1728*1150+1433;
P(1346, 2) = 1728*1433+1432;
P(1346, 3) = 1728*1432+1437;
P(1346, 4) = 1728*1437+1438;
P(1346, 5) = 1728*1438+1399;
P(1346, 6) = 1728*1399+1396;
P(1346, 7) = 1728*1396+1347;
P(1346, 8) = 1728*1347+1346;
P(1346, 9) = 1728*1346+1111;
P(1347, 0) = 1728*1112+1117;
P(1347, 1) = 1728*1117+1118;
P(1347, 2) = 1728*1118+1127;
P(1347, 3) = 1728*1127+1124;
P(1347, 4) = 1728*1124+1125;
P(1347, 5) = 1728*1125+1120;
P(1347, 6) = 1728*1120+1121;
P(1347, 7) = 1728*1121+1122;
P(1347, 8) = 1728*1122+1123;
P(1347, 9) = 1728*1123+1112;
P(1348, 0) = 1728*1116+1117;
P(1348, 1) = 1728*1117+1118;
P(1348, 2) = 1728*1118+1127;
P(1348, 3) = 1728*1127+1362;
P(1348, 4) = 1728*1362+1363;
P(1348, 5) = 1728*1363+1352;
P(1348, 6) = 1728*1352+1353;
P(1348, 7) = 1728*1353+1354;
P(1348, 8) = 1728*1354+1119;
P(1348, 9) = 1728*1119+1116;
P(1349, 0) = 1728*1116+1117;
P(1349, 1) = 1728*1117+1118;
P(1349, 2) = 1728*1118+1401;
P(1349, 3) = 1728*1401+1400;
P(1349, 4) = 1728*1400+1405;
P(1349, 5) = 1728*1405+1404;
P(1349, 6) = 1728*1404+1355;
P(1349, 7) = 1728*1355+1354;
P(1349, 8) = 1728*1354+1119;
P(1349, 9) = 1728*1119+1116;
P(1350, 0) = 1728*1118+1127;
P(1350, 1) = 1728*1127+1124;
P(1350, 2) = 1728*1124+1125;
P(1350, 3) = 1728*1125+1126;
P(1350, 4) = 1728*1126+1409;
P(1350, 5) = 1728*1409+1410;
P(1350, 6) = 1728*1410+1411;
P(1350, 7) = 1728*1411+1400;
P(1350, 8) = 1728*1400+1401;
P(1350, 9) = 1728*1401+1118;
P(1351, 0) = 1728*1118+1127;
P(1351, 1) = 1728*1127+1362;
P(1351, 2) = 1728*1362+1363;
P(1351, 3) = 1728*1363+1412;
P(1351, 4) = 1728*1412+1415;
P(1351, 5) = 1728*1415+1406;
P(1351, 6) = 1728*1406+1405;
P(1351, 7) = 1728*1405+1400;
P(1351, 8) = 1728*1400+1401;
P(1351, 9) = 1728*1401+1118;
P(1352, 0) = 1728*1120+1125;
P(1352, 1) = 1728*1125+1126;
P(1352, 2) = 1728*1126+1135;
P(1352, 3) = 1728*1135+1132;
P(1352, 4) = 1728*1132+1133;
P(1352, 5) = 1728*1133+1128;
P(1352, 6) = 1728*1128+1129;
P(1352, 7) = 1728*1129+1130;
P(1352, 8) = 1728*1130+1131;
P(1352, 9) = 1728*1131+1120;
P(1353, 0) = 1728*1124+1125;
P(1353, 1) = 1728*1125+1126;
P(1353, 2) = 1728*1126+1135;
P(1353, 3) = 1728*1135+1370;
P(1353, 4) = 1728*1370+1371;
P(1353, 5) = 1728*1371+1360;
P(1353, 6) = 1728*1360+1361;
P(1353, 7) = 1728*1361+1362;
P(1353, 8) = 1728*1362+1127;
P(1353, 9) = 1728*1127+1124;
P(1354, 0) = 1728*1124+1125;
P(1354, 1) = 1728*1125+1126;
P(1354, 2) = 1728*1126+1409;
P(1354, 3) = 1728*1409+1408;
P(1354, 4) = 1728*1408+1413;
P(1354, 5) = 1728*1413+1412;
P(1354, 6) = 1728*1412+1363;
P(1354, 7) = 1728*1363+1362;
P(1354, 8) = 1728*1362+1127;
P(1354, 9) = 1728*1127+1124;
P(1355, 0) = 1728*1126+1135;
P(1355, 1) = 1728*1135+1132;
P(1355, 2) = 1728*1132+1133;
P(1355, 3) = 1728*1133+1134;
P(1355, 4) = 1728*1134+1417;
P(1355, 5) = 1728*1417+1418;
P(1355, 6) = 1728*1418+1419;
P(1355, 7) = 1728*1419+1408;
P(1355, 8) = 1728*1408+1409;
P(1355, 9) = 1728*1409+1126;
P(1356, 0) = 1728*1126+1135;
P(1356, 1) = 1728*1135+1370;
P(1356, 2) = 1728*1370+1371;
P(1356, 3) = 1728*1371+1420;
P(1356, 4) = 1728*1420+1423;
P(1356, 5) = 1728*1423+1414;
P(1356, 6) = 1728*1414+1413;
P(1356, 7) = 1728*1413+1408;
P(1356, 8) = 1728*1408+1409;
P(1356, 9) = 1728*1409+1126;
P(1357, 0) = 1728*1128+1133;
P(1357, 1) = 1728*1133+1134;
P(1357, 2) = 1728*1134+1143;
P(1357, 3) = 1728*1143+1140;
P(1357, 4) = 1728*1140+1141;
P(1357, 5) = 1728*1141+1136;
P(1357, 6) = 1728*1136+1137;
P(1357, 7) = 1728*1137+1138;
P(1357, 8) = 1728*1138+1139;
P(1357, 9) = 1728*1139+1128;
P(1358, 0) = 1728*1132+1133;
P(1358, 1) = 1728*1133+1134;
P(1358, 2) = 1728*1134+1143;
P(1358, 3) = 1728*1143+1378;
P(1358, 4) = 1728*1378+1379;
P(1358, 5) = 1728*1379+1368;
P(1358, 6) = 1728*1368+1369;
P(1358, 7) = 1728*1369+1370;
P(1358, 8) = 1728*1370+1135;
P(1358, 9) = 1728*1135+1132;
P(1359, 0) = 1728*1132+1133;
P(1359, 1) = 1728*1133+1134;
P(1359, 2) = 1728*1134+1417;
P(1359, 3) = 1728*1417+1416;
P(1359, 4) = 1728*1416+1421;
P(1359, 5) = 1728*1421+1420;
P(1359, 6) = 1728*1420+1371;
P(1359, 7) = 1728*1371+1370;
P(1359, 8) = 1728*1370+1135;
P(1359, 9) = 1728*1135+1132;
P(1360, 0) = 1728*1134+1143;
P(1360, 1) = 1728*1143+1140;
P(1360, 2) = 1728*1140+1141;
P(1360, 3) = 1728*1141+1142;
P(1360, 4) = 1728*1142+1425;
P(1360, 5) = 1728*1425+1426;
P(1360, 6) = 1728*1426+1427;
P(1360, 7) = 1728*1427+1416;
P(1360, 8) = 1728*1416+1417;
P(1360, 9) = 1728*1417+1134;
P(1361, 0) = 1728*1134+1143;
P(1361, 1) = 1728*1143+1378;
P(1361, 2) = 1728*1378+1379;
P(1361, 3) = 1728*1379+1428;
P(1361, 4) = 1728*1428+1431;
P(1361, 5) = 1728*1431+1422;
P(1361, 6) = 1728*1422+1421;
P(1361, 7) = 1728*1421+1416;
P(1361, 8) = 1728*1416+1417;
P(1361, 9) = 1728*1417+1134;
P(1362, 0) = 1728*1136+1141;
P(1362, 1) = 1728*1141+1142;
P(1362, 2) = 1728*1142+1151;
P(1362, 3) = 1728*1151+1148;
P(1362, 4) = 1728*1148+1149;
P(1362, 5) = 1728*1149+1144;
P(1362, 6) = 1728*1144+1145;
P(1362, 7) = 1728*1145+1146;
P(1362, 8) = 1728*1146+1147;
P(1362, 9) = 1728*1147+1136;
P(1363, 0) = 1728*1140+1141;
P(1363, 1) = 1728*1141+1142;
P(1363, 2) = 1728*1142+1151;
P(1363, 3) = 1728*1151+1386;
P(1363, 4) = 1728*1386+1387;
P(1363, 5) = 1728*1387+1376;
P(1363, 6) = 1728*1376+1377;
P(1363, 7) = 1728*1377+1378;
P(1363, 8) = 1728*1378+1143;
P(1363, 9) = 1728*1143+1140;
P(1364, 0) = 1728*1140+1141;
P(1364, 1) = 1728*1141+1142;
P(1364, 2) = 1728*1142+1425;
P(1364, 3) = 1728*1425+1424;
P(1364, 4) = 1728*1424+1429;
P(1364, 5) = 1728*1429+1428;
P(1364, 6) = 1728*1428+1379;
P(1364, 7) = 1728*1379+1378;
P(1364, 8) = 1728*1378+1143;
P(1364, 9) = 1728*1143+1140;
P(1365, 0) = 1728*1142+1151;
P(1365, 1) = 1728*1151+1148;
P(1365, 2) = 1728*1148+1149;
P(1365, 3) = 1728*1149+1150;
P(1365, 4) = 1728*1150+1433;
P(1365, 5) = 1728*1433+1434;
P(1365, 6) = 1728*1434+1435;
P(1365, 7) = 1728*1435+1424;
P(1365, 8) = 1728*1424+1425;
P(1365, 9) = 1728*1425+1142;
P(1366, 0) = 1728*1142+1151;
P(1366, 1) = 1728*1151+1386;
P(1366, 2) = 1728*1386+1387;
P(1366, 3) = 1728*1387+1436;
P(1366, 4) = 1728*1436+1439;
P(1366, 5) = 1728*1439+1430;
P(1366, 6) = 1728*1430+1429;
P(1366, 7) = 1728*1429+1424;
P(1366, 8) = 1728*1424+1425;
P(1366, 9) = 1728*1425+1142;
P(1367, 0) = 1728*1148+1149;
P(1367, 1) = 1728*1149+1150;
P(1367, 2) = 1728*1150+1433;
P(1367, 3) = 1728*1433+1432;
P(1367, 4) = 1728*1432+1437;
P(1367, 5) = 1728*1437+1436;
P(1367, 6) = 1728*1436+1387;
P(1367, 7) = 1728*1387+1386;
P(1367, 8) = 1728*1386+1151;
P(1367, 9) = 1728*1151+1148;
P(1368, 0) = 1728*1152+1153;
P(1368, 1) = 1728*1153+1154;
P(1368, 2) = 1728*1154+1155;
P(1368, 3) = 1728*1155+1204;
P(1368, 4) = 1728*1204+1205;
P(1368, 5) = 1728*1205+1206;
P(1368, 6) = 1728*1206+1215;
P(1368, 7) = 1728*1215+1212;
P(1368, 8) = 1728*1212+1163;
P(1368, 9) = 1728*1163+1152;
P(1369, 0) = 1728*1152+1153;
P(1369, 1) = 1728*1153+1154;
P(1369, 2) = 1728*1154+1155;
P(1369, 3) = 1728*1155+1204;
P(1369, 4) = 1728*1204+1207;
P(1369, 5) = 1728*1207+1442;
P(1369, 6) = 1728*1442+1441;
P(1369, 7) = 1728*1441+1158;
P(1369, 8) = 1728*1158+1157;
P(1369, 9) = 1728*1157+1152;
P(1370, 0) = 1728*1152+1153;
P(1370, 1) = 1728*1153+1154;
P(1370, 2) = 1728*1154+1155;
P(1370, 3) = 1728*1155+1192;
P(1370, 4) = 1728*1192+1197;
P(1370, 5) = 1728*1197+1198;
P(1370, 6) = 1728*1198+1159;
P(1370, 7) = 1728*1159+1156;
P(1370, 8) = 1728*1156+1157;
P(1370, 9) = 1728*1157+1152;
P(1371, 0) = 1728*1152+1157;
P(1371, 1) = 1728*1157+1158;
P(1371, 2) = 1728*1158+1167;
P(1371, 3) = 1728*1167+1164;
P(1371, 4) = 1728*1164+1165;
P(1371, 5) = 1728*1165+1160;
P(1371, 6) = 1728*1160+1161;
P(1371, 7) = 1728*1161+1162;
P(1371, 8) = 1728*1162+1163;
P(1371, 9) = 1728*1163+1152;
P(1372, 0) = 1728*1152+1157;
P(1372, 1) = 1728*1157+1158;
P(1372, 2) = 1728*1158+1441;
P(1372, 3) = 1728*1441+1440;
P(1372, 4) = 1728*1440+1451;
P(1372, 5) = 1728*1451+1450;
P(1372, 6) = 1728*1450+1215;
P(1372, 7) = 1728*1215+1212;
P(1372, 8) = 1728*1212+1163;
P(1372, 9) = 1728*1163+1152;
P(1373, 0) = 1728*1155+1204;
P(1373, 1) = 1728*1204+1207;
P(1373, 2) = 1728*1207+1246;
P(1373, 3) = 1728*1246+1245;
P(1373, 4) = 1728*1245+1244;
P(1373, 5) = 1728*1244+1195;
P(1373, 6) = 1728*1195+1194;
P(1373, 7) = 1728*1194+1193;
P(1373, 8) = 1728*1193+1192;
P(1373, 9) = 1728*1192+1155;
P(1374, 0) = 1728*1155+1204;
P(1374, 1) = 1728*1204+1207;
P(1374, 2) = 1728*1207+1442;
P(1374, 3) = 1728*1442+1443;
P(1374, 4) = 1728*1443+1480;
P(1374, 5) = 1728*1480+1481;
P(1374, 6) = 1728*1481+1198;
P(1374, 7) = 1728*1198+1197;
P(1374, 8) = 1728*1197+1192;
P(1374, 9) = 1728*1192+1155;
P(1375, 0) = 1728*1156+1157;
P(1375, 1) = 1728*1157+1158;
P(1375, 2) = 1728*1158+1167;
P(1375, 3) = 1728*1167+1164;
P(1375, 4) = 1728*1164+1403;
P(1375, 5) = 1728*1403+1392;
P(1375, 6) = 1728*1392+1393;
P(1375, 7) = 1728*1393+1394;
P(1375, 8) = 1728*1394+1395;
P(1375, 9) = 1728*1395+1156;
P(1376, 0) = 1728*1156+1157;
P(1376, 1) = 1728*1157+1158;
P(1376, 2) = 1728*1158+1167;
P(1376, 3) = 1728*1167+1690;
P(1376, 4) = 1728*1690+1691;
P(1376, 5) = 1728*1691+1680;
P(1376, 6) = 1728*1680+1681;
P(1376, 7) = 1728*1681+1682;
P(1376, 8) = 1728*1682+1159;
P(1376, 9) = 1728*1159+1156;
P(1377, 0) = 1728*1156+1157;
P(1377, 1) = 1728*1157+1158;
P(1377, 2) = 1728*1158+1441;
P(1377, 3) = 1728*1441+1440;
P(1377, 4) = 1728*1440+1445;
P(1377, 5) = 1728*1445+1444;
P(1377, 6) = 1728*1444+1683;
P(1377, 7) = 1728*1683+1682;
P(1377, 8) = 1728*1682+1159;
P(1377, 9) = 1728*1159+1156;
P(1378, 0) = 1728*1156+1157;
P(1378, 1) = 1728*1157+1158;
P(1378, 2) = 1728*1158+1441;
P(1378, 3) = 1728*1441+1442;
P(1378, 4) = 1728*1442+1443;
P(1378, 5) = 1728*1443+1480;
P(1378, 6) = 1728*1480+1481;
P(1378, 7) = 1728*1481+1198;
P(1378, 8) = 1728*1198+1159;
P(1378, 9) = 1728*1159+1156;
P(1379, 0) = 1728*1156+1395;
P(1379, 1) = 1728*1395+1394;
P(1379, 2) = 1728*1394+1393;
P(1379, 3) = 1728*1393+1392;
P(1379, 4) = 1728*1392+1397;
P(1379, 5) = 1728*1397+1398;
P(1379, 6) = 1728*1398+1681;
P(1379, 7) = 1728*1681+1682;
P(1379, 8) = 1728*1682+1159;
P(1379, 9) = 1728*1159+1156;
P(1380, 0) = 1728*1156+1395;
P(1380, 1) = 1728*1395+1432;
P(1380, 2) = 1728*1432+1433;
P(1380, 3) = 1728*1433+1434;
P(1380, 4) = 1728*1434+1435;
P(1380, 5) = 1728*1435+1196;
P(1380, 6) = 1728*1196+1197;
P(1380, 7) = 1728*1197+1198;
P(1380, 8) = 1728*1198+1159;
P(1380, 9) = 1728*1159+1156;
P(1381, 0) = 1728*1156+1395;
P(1381, 1) = 1728*1395+1432;
P(1381, 2) = 1728*1432+1437;
P(1381, 3) = 1728*1437+1438;
P(1381, 4) = 1728*1438+1721;
P(1381, 5) = 1728*1721+1720;
P(1381, 6) = 1728*1720+1683;
P(1381, 7) = 1728*1683+1682;
P(1381, 8) = 1728*1682+1159;
P(1381, 9) = 1728*1159+1156;
P(1382, 0) = 1728*1158+1167;
P(1382, 1) = 1728*1167+1164;
P(1382, 2) = 1728*1164+1165;
P(1382, 3) = 1728*1165+1166;
P(1382, 4) = 1728*1166+1449;
P(1382, 5) = 1728*1449+1450;
P(1382, 6) = 1728*1450+1451;
P(1382, 7) = 1728*1451+1440;
P(1382, 8) = 1728*1440+1441;
P(1382, 9) = 1728*1441+1158;
P(1383, 0) = 1728*1158+1167;
P(1383, 1) = 1728*1167+1690;
P(1383, 2) = 1728*1690+1691;
P(1383, 3) = 1728*1691+1452;
P(1383, 4) = 1728*1452+1455;
P(1383, 5) = 1728*1455+1446;
P(1383, 6) = 1728*1446+1445;
P(1383, 7) = 1728*1445+1440;
P(1383, 8) = 1728*1440+1441;
P(1383, 9) = 1728*1441+1158;
P(1384, 0) = 1728*1159+1198;
P(1384, 1) = 1728*1198+1197;
P(1384, 2) = 1728*1197+1196;
P(1384, 3) = 1728*1196+1199;
P(1384, 4) = 1728*1199+1722;
P(1384, 5) = 1728*1722+1721;
P(1384, 6) = 1728*1721+1720;
P(1384, 7) = 1728*1720+1683;
P(1384, 8) = 1728*1683+1682;
P(1384, 9) = 1728*1682+1159;
P(1385, 0) = 1728*1159+1198;
P(1385, 1) = 1728*1198+1481;
P(1385, 2) = 1728*1481+1480;
P(1385, 3) = 1728*1480+1485;
P(1385, 4) = 1728*1485+1486;
P(1385, 5) = 1728*1486+1447;
P(1385, 6) = 1728*1447+1444;
P(1385, 7) = 1728*1444+1683;
P(1385, 8) = 1728*1683+1682;
P(1385, 9) = 1728*1682+1159;
P(1386, 0) = 1728*1160+1161;
P(1386, 1) = 1728*1161+1162;
P(1386, 2) = 1728*1162+1163;
P(1386, 3) = 1728*1163+1212;
P(1386, 4) = 1728*1212+1213;
P(1386, 5) = 1728*1213+1214;
P(1386, 6) = 1728*1214+1223;
P(1386, 7) = 1728*1223+1220;
P(1386, 8) = 1728*1220+1171;
P(1386, 9) = 1728*1171+1160;
P(1387, 0) = 1728*1160+1161;
P(1387, 1) = 1728*1161+1162;
P(1387, 2) = 1728*1162+1163;
P(1387, 3) = 1728*1163+1212;
P(1387, 4) = 1728*1212+1215;
P(1387, 5) = 1728*1215+1450;
P(1387, 6) = 1728*1450+1449;
P(1387, 7) = 1728*1449+1166;
P(1387, 8) = 1728*1166+1165;
P(1387, 9) = 1728*1165+1160;
P(1388, 0) = 1728*1160+1165;
P(1388, 1) = 1728*1165+1166;
P(1388, 2) = 1728*1166+1175;
P(1388, 3) = 1728*1175+1172;
P(1388, 4) = 1728*1172+1173;
P(1388, 5) = 1728*1173+1168;
P(1388, 6) = 1728*1168+1169;
P(1388, 7) = 1728*1169+1170;
P(1388, 8) = 1728*1170+1171;
P(1388, 9) = 1728*1171+1160;
P(1389, 0) = 1728*1160+1165;
P(1389, 1) = 1728*1165+1166;
P(1389, 2) = 1728*1166+1449;
P(1389, 3) = 1728*1449+1448;
P(1389, 4) = 1728*1448+1459;
P(1389, 5) = 1728*1459+1458;
P(1389, 6) = 1728*1458+1223;
P(1389, 7) = 1728*1223+1220;
P(1389, 8) = 1728*1220+1171;
P(1389, 9) = 1728*1171+1160;
P(1390, 0) = 1728*1164+1165;
P(1390, 1) = 1728*1165+1166;
P(1390, 2) = 1728*1166+1175;
P(1390, 3) = 1728*1175+1172;
P(1390, 4) = 1728*1172+1411;
P(1390, 5) = 1728*1411+1400;
P(1390, 6) = 1728*1400+1401;
P(1390, 7) = 1728*1401+1402;
P(1390, 8) = 1728*1402+1403;
P(1390, 9) = 1728*1403+1164;
P(1391, 0) = 1728*1164+1165;
P(1391, 1) = 1728*1165+1166;
P(1391, 2) = 1728*1166+1175;
P(1391, 3) = 1728*1175+1698;
P(1391, 4) = 1728*1698+1699;
P(1391, 5) = 1728*1699+1688;
P(1391, 6) = 1728*1688+1689;
P(1391, 7) = 1728*1689+1690;
P(1391, 8) = 1728*1690+1167;
P(1391, 9) = 1728*1167+1164;
P(1392, 0) = 1728*1164+1165;
P(1392, 1) = 1728*1165+1166;
P(1392, 2) = 1728*1166+1449;
P(1392, 3) = 1728*1449+1448;
P(1392, 4) = 1728*1448+1453;
P(1392, 5) = 1728*1453+1452;
P(1392, 6) = 1728*1452+1691;
P(1392, 7) = 1728*1691+1690;
P(1392, 8) = 1728*1690+1167;
P(1392, 9) = 1728*1167+1164;
P(1393, 0) = 1728*1164+1403;
P(1393, 1) = 1728*1403+1402;
P(1393, 2) = 1728*1402+1401;
P(1393, 3) = 1728*1401+1400;
P(1393, 4) = 1728*1400+1405;
P(1393, 5) = 1728*1405+1406;
P(1393, 6) = 1728*1406+1689;
P(1393, 7) = 1728*1689+1690;
P(1393, 8) = 1728*1690+1167;
P(1393, 9) = 1728*1167+1164;
P(1394, 0) = 1728*1164+1403;
P(1394, 1) = 1728*1403+1392;
P(1394, 2) = 1728*1392+1397;
P(1394, 3) = 1728*1397+1398;
P(1394, 4) = 1728*1398+1681;
P(1394, 5) = 1728*1681+1680;
P(1394, 6) = 1728*1680+1691;
P(1394, 7) = 1728*1691+1690;
P(1394, 8) = 1728*1690+1167;
P(1394, 9) = 1728*1167+1164;
P(1395, 0) = 1728*1166+1175;
P(1395, 1) = 1728*1175+1172;
P(1395, 2) = 1728*1172+1173;
P(1395, 3) = 1728*1173+1174;
P(1395, 4) = 1728*1174+1457;
P(1395, 5) = 1728*1457+1458;
P(1395, 6) = 1728*1458+1459;
P(1395, 7) = 1728*1459+1448;
P(1395, 8) = 1728*1448+1449;
P(1395, 9) = 1728*1449+1166;
P(1396, 0) = 1728*1166+1175;
P(1396, 1) = 1728*1175+1698;
P(1396, 2) = 1728*1698+1699;
P(1396, 3) = 1728*1699+1460;
P(1396, 4) = 1728*1460+1463;
P(1396, 5) = 1728*1463+1454;
P(1396, 6) = 1728*1454+1453;
P(1396, 7) = 1728*1453+1448;
P(1396, 8) = 1728*1448+1449;
P(1396, 9) = 1728*1449+1166;
P(1397, 0) = 1728*1168+1169;
P(1397, 1) = 1728*1169+1170;
P(1397, 2) = 1728*1170+1171;
P(1397, 3) = 1728*1171+1220;
P(1397, 4) = 1728*1220+1221;
P(1397, 5) = 1728*1221+1222;
P(1397, 6) = 1728*1222+1231;
P(1397, 7) = 1728*1231+1228;
P(1397, 8) = 1728*1228+1179;
P(1397, 9) = 1728*1179+1168;
P(1398, 0) = 1728*1168+1169;
P(1398, 1) = 1728*1169+1170;
P(1398, 2) = 1728*1170+1171;
P(1398, 3) = 1728*1171+1220;
P(1398, 4) = 1728*1220+1223;
P(1398, 5) = 1728*1223+1458;
P(1398, 6) = 1728*1458+1457;
P(1398, 7) = 1728*1457+1174;
P(1398, 8) = 1728*1174+1173;
P(1398, 9) = 1728*1173+1168;
P(1399, 0) = 1728*1168+1173;
P(1399, 1) = 1728*1173+1174;
P(1399, 2) = 1728*1174+1183;
P(1399, 3) = 1728*1183+1180;
P(1399, 4) = 1728*1180+1181;
P(1399, 5) = 1728*1181+1176;
P(1399, 6) = 1728*1176+1177;
P(1399, 7) = 1728*1177+1178;
P(1399, 8) = 1728*1178+1179;
P(1399, 9) = 1728*1179+1168;
P(1400, 0) = 1728*1168+1173;
P(1400, 1) = 1728*1173+1174;
P(1400, 2) = 1728*1174+1457;
P(1400, 3) = 1728*1457+1456;
P(1400, 4) = 1728*1456+1467;
P(1400, 5) = 1728*1467+1466;
P(1400, 6) = 1728*1466+1231;
P(1400, 7) = 1728*1231+1228;
P(1400, 8) = 1728*1228+1179;
P(1400, 9) = 1728*1179+1168;
P(1401, 0) = 1728*1172+1173;
P(1401, 1) = 1728*1173+1174;
P(1401, 2) = 1728*1174+1183;
P(1401, 3) = 1728*1183+1180;
P(1401, 4) = 1728*1180+1419;
P(1401, 5) = 1728*1419+1408;
P(1401, 6) = 1728*1408+1409;
P(1401, 7) = 1728*1409+1410;
P(1401, 8) = 1728*1410+1411;
P(1401, 9) = 1728*1411+1172;
P(1402, 0) = 1728*1172+1173;
P(1402, 1) = 1728*1173+1174;
P(1402, 2) = 1728*1174+1183;
P(1402, 3) = 1728*1183+1706;
P(1402, 4) = 1728*1706+1707;
P(1402, 5) = 1728*1707+1696;
P(1402, 6) = 1728*1696+1697;
P(1402, 7) = 1728*1697+1698;
P(1402, 8) = 1728*1698+1175;
P(1402, 9) = 1728*1175+1172;
P(1403, 0) = 1728*1172+1173;
P(1403, 1) = 1728*1173+1174;
P(1403, 2) = 1728*1174+1457;
P(1403, 3) = 1728*1457+1456;
P(1403, 4) = 1728*1456+1461;
P(1403, 5) = 1728*1461+1460;
P(1403, 6) = 1728*1460+1699;
P(1403, 7) = 1728*1699+1698;
P(1403, 8) = 1728*1698+1175;
P(1403, 9) = 1728*1175+1172;
P(1404, 0) = 1728*1172+1411;
P(1404, 1) = 1728*1411+1410;
P(1404, 2) = 1728*1410+1409;
P(1404, 3) = 1728*1409+1408;
P(1404, 4) = 1728*1408+1413;
P(1404, 5) = 1728*1413+1414;
P(1404, 6) = 1728*1414+1697;
P(1404, 7) = 1728*1697+1698;
P(1404, 8) = 1728*1698+1175;
P(1404, 9) = 1728*1175+1172;
P(1405, 0) = 1728*1172+1411;
P(1405, 1) = 1728*1411+1400;
P(1405, 2) = 1728*1400+1405;
P(1405, 3) = 1728*1405+1406;
P(1405, 4) = 1728*1406+1689;
P(1405, 5) = 1728*1689+1688;
P(1405, 6) = 1728*1688+1699;
P(1405, 7) = 1728*1699+1698;
P(1405, 8) = 1728*1698+1175;
P(1405, 9) = 1728*1175+1172;
P(1406, 0) = 1728*1174+1183;
P(1406, 1) = 1728*1183+1180;
P(1406, 2) = 1728*1180+1181;
P(1406, 3) = 1728*1181+1182;
P(1406, 4) = 1728*1182+1465;
P(1406, 5) = 1728*1465+1466;
P(1406, 6) = 1728*1466+1467;
P(1406, 7) = 1728*1467+1456;
P(1406, 8) = 1728*1456+1457;
P(1406, 9) = 1728*1457+1174;
P(1407, 0) = 1728*1174+1183;
P(1407, 1) = 1728*1183+1706;
P(1407, 2) = 1728*1706+1707;
P(1407, 3) = 1728*1707+1468;
P(1407, 4) = 1728*1468+1471;
P(1407, 5) = 1728*1471+1462;
P(1407, 6) = 1728*1462+1461;
P(1407, 7) = 1728*1461+1456;
P(1407, 8) = 1728*1456+1457;
P(1407, 9) = 1728*1457+1174;
P(1408, 0) = 1728*1176+1177;
P(1408, 1) = 1728*1177+1178;
P(1408, 2) = 1728*1178+1179;
P(1408, 3) = 1728*1179+1228;
P(1408, 4) = 1728*1228+1229;
P(1408, 5) = 1728*1229+1230;
P(1408, 6) = 1728*1230+1239;
P(1408, 7) = 1728*1239+1236;
P(1408, 8) = 1728*1236+1187;
P(1408, 9) = 1728*1187+1176;
P(1409, 0) = 1728*1176+1177;
P(1409, 1) = 1728*1177+1178;
P(1409, 2) = 1728*1178+1179;
P(1409, 3) = 1728*1179+1228;
P(1409, 4) = 1728*1228+1231;
P(1409, 5) = 1728*1231+1466;
P(1409, 6) = 1728*1466+1465;
P(1409, 7) = 1728*1465+1182;
P(1409, 8) = 1728*1182+1181;
P(1409, 9) = 1728*1181+1176;
P(1410, 0) = 1728*1176+1181;
P(1410, 1) = 1728*1181+1182;
P(1410, 2) = 1728*1182+1191;
P(1410, 3) = 1728*1191+1188;
P(1410, 4) = 1728*1188+1189;
P(1410, 5) = 1728*1189+1184;
P(1410, 6) = 1728*1184+1185;
P(1410, 7) = 1728*1185+1186;
P(1410, 8) = 1728*1186+1187;
P(1410, 9) = 1728*1187+1176;
P(1411, 0) = 1728*1176+1181;
P(1411, 1) = 1728*1181+1182;
P(1411, 2) = 1728*1182+1465;
P(1411, 3) = 1728*1465+1464;
P(1411, 4) = 1728*1464+1475;
P(1411, 5) = 1728*1475+1474;
P(1411, 6) = 1728*1474+1239;
P(1411, 7) = 1728*1239+1236;
P(1411, 8) = 1728*1236+1187;
P(1411, 9) = 1728*1187+1176;
P(1412, 0) = 1728*1180+1181;
P(1412, 1) = 1728*1181+1182;
P(1412, 2) = 1728*1182+1191;
P(1412, 3) = 1728*1191+1188;
P(1412, 4) = 1728*1188+1427;
P(1412, 5) = 1728*1427+1416;
P(1412, 6) = 1728*1416+1417;
P(1412, 7) = 1728*1417+1418;
P(1412, 8) = 1728*1418+1419;
P(1412, 9) = 1728*1419+1180;
P(1413, 0) = 1728*1180+1181;
P(1413, 1) = 1728*1181+1182;
P(1413, 2) = 1728*1182+1191;
P(1413, 3) = 1728*1191+1714;
P(1413, 4) = 1728*1714+1715;
P(1413, 5) = 1728*1715+1704;
P(1413, 6) = 1728*1704+1705;
P(1413, 7) = 1728*1705+1706;
P(1413, 8) = 1728*1706+1183;
P(1413, 9) = 1728*1183+1180;
P(1414, 0) = 1728*1180+1181;
P(1414, 1) = 1728*1181+1182;
P(1414, 2) = 1728*1182+1465;
P(1414, 3) = 1728*1465+1464;
P(1414, 4) = 1728*1464+1469;
P(1414, 5) = 1728*1469+1468;
P(1414, 6) = 1728*1468+1707;
P(1414, 7) = 1728*1707+1706;
P(1414, 8) = 1728*1706+1183;
P(1414, 9) = 1728*1183+1180;
P(1415, 0) = 1728*1180+1419;
P(1415, 1) = 1728*1419+1418;
P(1415, 2) = 1728*1418+1417;
P(1415, 3) = 1728*1417+1416;
P(1415, 4) = 1728*1416+1421;
P(1415, 5) = 1728*1421+1422;
P(1415, 6) = 1728*1422+1705;
P(1415, 7) = 1728*1705+1706;
P(1415, 8) = 1728*1706+1183;
P(1415, 9) = 1728*1183+1180;
P(1416, 0) = 1728*1180+1419;
P(1416, 1) = 1728*1419+1408;
P(1416, 2) = 1728*1408+1413;
P(1416, 3) = 1728*1413+1414;
P(1416, 4) = 1728*1414+1697;
P(1416, 5) = 1728*1697+1696;
P(1416, 6) = 1728*1696+1707;
P(1416, 7) = 1728*1707+1706;
P(1416, 8) = 1728*1706+1183;
P(1416, 9) = 1728*1183+1180;
P(1417, 0) = 1728*1182+1191;
P(1417, 1) = 1728*1191+1188;
P(1417, 2) = 1728*1188+1189;
P(1417, 3) = 1728*1189+1190;
P(1417, 4) = 1728*1190+1473;
P(1417, 5) = 1728*1473+1474;
P(1417, 6) = 1728*1474+1475;
P(1417, 7) = 1728*1475+1464;
P(1417, 8) = 1728*1464+1465;
P(1417, 9) = 1728*1465+1182;
P(1418, 0) = 1728*1182+1191;
P(1418, 1) = 1728*1191+1714;
P(1418, 2) = 1728*1714+1715;
P(1418, 3) = 1728*1715+1476;
P(1418, 4) = 1728*1476+1479;
P(1418, 5) = 1728*1479+1470;
P(1418, 6) = 1728*1470+1469;
P(1418, 7) = 1728*1469+1464;
P(1418, 8) = 1728*1464+1465;
P(1418, 9) = 1728*1465+1182;
P(1419, 0) = 1728*1184+1185;
P(1419, 1) = 1728*1185+1186;
P(1419, 2) = 1728*1186+1187;
P(1419, 3) = 1728*1187+1236;
P(1419, 4) = 1728*1236+1237;
P(1419, 5) = 1728*1237+1238;
P(1419, 6) = 1728*1238+1247;
P(1419, 7) = 1728*1247+1244;
P(1419, 8) = 1728*1244+1195;
P(1419, 9) = 1728*1195+1184;
P(1420, 0) = 1728*1184+1185;
P(1420, 1) = 1728*1185+1186;
P(1420, 2) = 1728*1186+1187;
P(1420, 3) = 1728*1187+1236;
P(1420, 4) = 1728*1236+1239;
P(1420, 5) = 1728*1239+1474;
P(1420, 6) = 1728*1474+1473;
P(1420, 7) = 1728*1473+1190;
P(1420, 8) = 1728*1190+1189;
P(1420, 9) = 1728*1189+1184;
P(1421, 0) = 1728*1184+1189;
P(1421, 1) = 1728*1189+1190;
P(1421, 2) = 1728*1190+1199;
P(1421, 3) = 1728*1199+1196;
P(1421, 4) = 1728*1196+1197;
P(1421, 5) = 1728*1197+1192;
P(1421, 6) = 1728*1192+1193;
P(1421, 7) = 1728*1193+1194;
P(1421, 8) = 1728*1194+1195;
P(1421, 9) = 1728*1195+1184;
P(1422, 0) = 1728*1184+1189;
P(1422, 1) = 1728*1189+1190;
P(1422, 2) = 1728*1190+1473;
P(1422, 3) = 1728*1473+1472;
P(1422, 4) = 1728*1472+1483;
P(1422, 5) = 1728*1483+1482;
P(1422, 6) = 1728*1482+1247;
P(1422, 7) = 1728*1247+1244;
P(1422, 8) = 1728*1244+1195;
P(1422, 9) = 1728*1195+1184;
P(1423, 0) = 1728*1188+1189;
P(1423, 1) = 1728*1189+1190;
P(1423, 2) = 1728*1190+1199;
P(1423, 3) = 1728*1199+1196;
P(1423, 4) = 1728*1196+1435;
P(1423, 5) = 1728*1435+1424;
P(1423, 6) = 1728*1424+1425;
P(1423, 7) = 1728*1425+1426;
P(1423, 8) = 1728*1426+1427;
P(1423, 9) = 1728*1427+1188;
P(1424, 0) = 1728*1188+1189;
P(1424, 1) = 1728*1189+1190;
P(1424, 2) = 1728*1190+1199;
P(1424, 3) = 1728*1199+1722;
P(1424, 4) = 1728*1722+1723;
P(1424, 5) = 1728*1723+1712;
P(1424, 6) = 1728*1712+1713;
P(1424, 7) = 1728*1713+1714;
P(1424, 8) = 1728*1714+1191;
P(1424, 9) = 1728*1191+1188;
P(1425, 0) = 1728*1188+1189;
P(1425, 1) = 1728*1189+1190;
P(1425, 2) = 1728*1190+1473;
P(1425, 3) = 1728*1473+1472;
P(1425, 4) = 1728*1472+1477;
P(1425, 5) = 1728*1477+1476;
P(1425, 6) = 1728*1476+1715;
P(1425, 7) = 1728*1715+1714;
P(1425, 8) = 1728*1714+1191;
P(1425, 9) = 1728*1191+1188;
P(1426, 0) = 1728*1188+1427;
P(1426, 1) = 1728*1427+1426;
P(1426, 2) = 1728*1426+1425;
P(1426, 3) = 1728*1425+1424;
P(1426, 4) = 1728*1424+1429;
P(1426, 5) = 1728*1429+1430;
P(1426, 6) = 1728*1430+1713;
P(1426, 7) = 1728*1713+1714;
P(1426, 8) = 1728*1714+1191;
P(1426, 9) = 1728*1191+1188;
P(1427, 0) = 1728*1188+1427;
P(1427, 1) = 1728*1427+1416;
P(1427, 2) = 1728*1416+1421;
P(1427, 3) = 1728*1421+1422;
P(1427, 4) = 1728*1422+1705;
P(1427, 5) = 1728*1705+1704;
P(1427, 6) = 1728*1704+1715;
P(1427, 7) = 1728*1715+1714;
P(1427, 8) = 1728*1714+1191;
P(1427, 9) = 1728*1191+1188;
P(1428, 0) = 1728*1190+1199;
P(1428, 1) = 1728*1199+1196;
P(1428, 2) = 1728*1196+1197;
P(1428, 3) = 1728*1197+1198;
P(1428, 4) = 1728*1198+1481;
P(1428, 5) = 1728*1481+1482;
P(1428, 6) = 1728*1482+1483;
P(1428, 7) = 1728*1483+1472;
P(1428, 8) = 1728*1472+1473;
P(1428, 9) = 1728*1473+1190;
P(1429, 0) = 1728*1190+1199;
P(1429, 1) = 1728*1199+1722;
P(1429, 2) = 1728*1722+1723;
P(1429, 3) = 1728*1723+1484;
P(1429, 4) = 1728*1484+1487;
P(1429, 5) = 1728*1487+1478;
P(1429, 6) = 1728*1478+1477;
P(1429, 7) = 1728*1477+1472;
P(1429, 8) = 1728*1472+1473;
P(1429, 9) = 1728*1473+1190;
P(1430, 0) = 1728*1192+1193;
P(1430, 1) = 1728*1193+1194;
P(1430, 2) = 1728*1194+1195;
P(1430, 3) = 1728*1195+1244;
P(1430, 4) = 1728*1244+1247;
P(1430, 5) = 1728*1247+1482;
P(1430, 6) = 1728*1482+1481;
P(1430, 7) = 1728*1481+1198;
P(1430, 8) = 1728*1198+1197;
P(1430, 9) = 1728*1197+1192;
P(1431, 0) = 1728*1196+1197;
P(1431, 1) = 1728*1197+1198;
P(1431, 2) = 1728*1198+1481;
P(1431, 3) = 1728*1481+1480;
P(1431, 4) = 1728*1480+1485;
P(1431, 5) = 1728*1485+1484;
P(1431, 6) = 1728*1484+1723;
P(1431, 7) = 1728*1723+1722;
P(1431, 8) = 1728*1722+1199;
P(1431, 9) = 1728*1199+1196;
P(1432, 0) = 1728*1196+1435;
P(1432, 1) = 1728*1435+1434;
P(1432, 2) = 1728*1434+1433;
P(1432, 3) = 1728*1433+1432;
P(1432, 4) = 1728*1432+1437;
P(1432, 5) = 1728*1437+1438;
P(1432, 6) = 1728*1438+1721;
P(1432, 7) = 1728*1721+1722;
P(1432, 8) = 1728*1722+1199;
P(1432, 9) = 1728*1199+1196;
P(1433, 0) = 1728*1196+1435;
P(1433, 1) = 1728*1435+1424;
P(1433, 2) = 1728*1424+1429;
P(1433, 3) = 1728*1429+1430;
P(1433, 4) = 1728*1430+1713;
P(1433, 5) = 1728*1713+1712;
P(1433, 6) = 1728*1712+1723;
P(1433, 7) = 1728*1723+1722;
P(1433, 8) = 1728*1722+1199;
P(1433, 9) = 1728*1199+1196;
P(1434, 0) = 1728*1200+1201;
P(1434, 1) = 1728*1201+1202;
P(1434, 2) = 1728*1202+1203;
P(1434, 3) = 1728*1203+1252;
P(1434, 4) = 1728*1252+1253;
P(1434, 5) = 1728*1253+1254;
P(1434, 6) = 1728*1254+1263;
P(1434, 7) = 1728*1263+1260;
P(1434, 8) = 1728*1260+1211;
P(1434, 9) = 1728*1211+1200;
P(1435, 0) = 1728*1200+1201;
P(1435, 1) = 1728*1201+1202;
P(1435, 2) = 1728*1202+1203;
P(1435, 3) = 1728*1203+1252;
P(1435, 4) = 1728*1252+1255;
P(1435, 5) = 1728*1255+1490;
P(1435, 6) = 1728*1490+1489;
P(1435, 7) = 1728*1489+1206;
P(1435, 8) = 1728*1206+1205;
P(1435, 9) = 1728*1205+1200;
P(1436, 0) = 1728*1200+1201;
P(1436, 1) = 1728*1201+1202;
P(1436, 2) = 1728*1202+1203;
P(1436, 3) = 1728*1203+1240;
P(1436, 4) = 1728*1240+1245;
P(1436, 5) = 1728*1245+1246;
P(1436, 6) = 1728*1246+1207;
P(1436, 7) = 1728*1207+1204;
P(1436, 8) = 1728*1204+1205;
P(1436, 9) = 1728*1205+1200;
P(1437, 0) = 1728*1200+1205;
P(1437, 1) = 1728*1205+1206;
P(1437, 2) = 1728*1206+1215;
P(1437, 3) = 1728*1215+1212;
P(1437, 4) = 1728*1212+1213;
P(1437, 5) = 1728*1213+1208;
P(1437, 6) = 1728*1208+1209;
P(1437, 7) = 1728*1209+1210;
P(1437, 8) = 1728*1210+1211;
P(1437, 9) = 1728*1211+1200;
P(1438, 0) = 1728*1200+1205;
P(1438, 1) = 1728*1205+1206;
P(1438, 2) = 1728*1206+1489;
P(1438, 3) = 1728*1489+1488;
P(1438, 4) = 1728*1488+1499;
P(1438, 5) = 1728*1499+1498;
P(1438, 6) = 1728*1498+1263;
P(1438, 7) = 1728*1263+1260;
P(1438, 8) = 1728*1260+1211;
P(1438, 9) = 1728*1211+1200;
P(1439, 0) = 1728*1203+1252;
P(1439, 1) = 1728*1252+1255;
P(1439, 2) = 1728*1255+1294;
P(1439, 3) = 1728*1294+1293;
P(1439, 4) = 1728*1293+1292;
P(1439, 5) = 1728*1292+1243;
P(1439, 6) = 1728*1243+1242;
P(1439, 7) = 1728*1242+1241;
P(1439, 8) = 1728*1241+1240;
P(1439, 9) = 1728*1240+1203;
P(1440, 0) = 1728*1203+1252;
P(1440, 1) = 1728*1252+1255;
P(1440, 2) = 1728*1255+1490;
P(1440, 3) = 1728*1490+1491;
P(1440, 4) = 1728*1491+1528;
P(1440, 5) = 1728*1528+1529;
P(1440, 6) = 1728*1529+1246;
P(1440, 7) = 1728*1246+1245;
P(1440, 8) = 1728*1245+1240;
P(1440, 9) = 1728*1240+1203;
P(1441, 0) = 1728*1204+1205;
P(1441, 1) = 1728*1205+1206;
P(1441, 2) = 1728*1206+1215;
P(1441, 3) = 1728*1215+1450;
P(1441, 4) = 1728*1450+1451;
P(1441, 5) = 1728*1451+1440;
P(1441, 6) = 1728*1440+1441;
P(1441, 7) = 1728*1441+1442;
P(1441, 8) = 1728*1442+1207;
P(1441, 9) = 1728*1207+1204;
P(1442, 0) = 1728*1204+1205;
P(1442, 1) = 1728*1205+1206;
P(1442, 2) = 1728*1206+1489;
P(1442, 3) = 1728*1489+1488;
P(1442, 4) = 1728*1488+1493;
P(1442, 5) = 1728*1493+1492;
P(1442, 6) = 1728*1492+1443;
P(1442, 7) = 1728*1443+1442;
P(1442, 8) = 1728*1442+1207;
P(1442, 9) = 1728*1207+1204;
P(1443, 0) = 1728*1204+1205;
P(1443, 1) = 1728*1205+1206;
P(1443, 2) = 1728*1206+1489;
P(1443, 3) = 1728*1489+1490;
P(1443, 4) = 1728*1490+1491;
P(1443, 5) = 1728*1491+1528;
P(1443, 6) = 1728*1528+1529;
P(1443, 7) = 1728*1529+1246;
P(1443, 8) = 1728*1246+1207;
P(1443, 9) = 1728*1207+1204;
P(1444, 0) = 1728*1206+1215;
P(1444, 1) = 1728*1215+1212;
P(1444, 2) = 1728*1212+1213;
P(1444, 3) = 1728*1213+1214;
P(1444, 4) = 1728*1214+1497;
P(1444, 5) = 1728*1497+1498;
P(1444, 6) = 1728*1498+1499;
P(1444, 7) = 1728*1499+1488;
P(1444, 8) = 1728*1488+1489;
P(1444, 9) = 1728*1489+1206;
P(1445, 0) = 1728*1206+1215;
P(1445, 1) = 1728*1215+1450;
P(1445, 2) = 1728*1450+1451;
P(1445, 3) = 1728*1451+1500;
P(1445, 4) = 1728*1500+1503;
P(1445, 5) = 1728*1503+1494;
P(1445, 6) = 1728*1494+1493;
P(1445, 7) = 1728*1493+1488;
P(1445, 8) = 1728*1488+1489;
P(1445, 9) = 1728*1489+1206;
P(1446, 0) = 1728*1207+1246;
P(1446, 1) = 1728*1246+1245;
P(1446, 2) = 1728*1245+1244;
P(1446, 3) = 1728*1244+1247;
P(1446, 4) = 1728*1247+1482;
P(1446, 5) = 1728*1482+1481;
P(1446, 6) = 1728*1481+1480;
P(1446, 7) = 1728*1480+1443;
P(1446, 8) = 1728*1443+1442;
P(1446, 9) = 1728*1442+1207;
P(1447, 0) = 1728*1207+1246;
P(1447, 1) = 1728*1246+1529;
P(1447, 2) = 1728*1529+1528;
P(1447, 3) = 1728*1528+1533;
P(1447, 4) = 1728*1533+1534;
P(1447, 5) = 1728*1534+1495;
P(1447, 6) = 1728*1495+1492;
P(1447, 7) = 1728*1492+1443;
P(1447, 8) = 1728*1443+1442;
P(1447, 9) = 1728*1442+1207;
P(1448, 0) = 1728*1208+1209;
P(1448, 1) = 1728*1209+1210;
P(1448, 2) = 1728*1210+1211;
P(1448, 3) = 1728*1211+1260;
P(1448, 4) = 1728*1260+1261;
P(1448, 5) = 1728*1261+1262;
P(1448, 6) = 1728*1262+1271;
P(1448, 7) = 1728*1271+1268;
P(1448, 8) = 1728*1268+1219;
P(1448, 9) = 1728*1219+1208;
P(1449, 0) = 1728*1208+1209;
P(1449, 1) = 1728*1209+1210;
P(1449, 2) = 1728*1210+1211;
P(1449, 3) = 1728*1211+1260;
P(1449, 4) = 1728*1260+1263;
P(1449, 5) = 1728*1263+1498;
P(1449, 6) = 1728*1498+1497;
P(1449, 7) = 1728*1497+1214;
P(1449, 8) = 1728*1214+1213;
P(1449, 9) = 1728*1213+1208;
P(1450, 0) = 1728*1208+1213;
P(1450, 1) = 1728*1213+1214;
P(1450, 2) = 1728*1214+1223;
P(1450, 3) = 1728*1223+1220;
P(1450, 4) = 1728*1220+1221;
P(1450, 5) = 1728*1221+1216;
P(1450, 6) = 1728*1216+1217;
P(1450, 7) = 1728*1217+1218;
P(1450, 8) = 1728*1218+1219;
P(1450, 9) = 1728*1219+1208;
P(1451, 0) = 1728*1208+1213;
P(1451, 1) = 1728*1213+1214;
P(1451, 2) = 1728*1214+1497;
P(1451, 3) = 1728*1497+1496;
P(1451, 4) = 1728*1496+1507;
P(1451, 5) = 1728*1507+1506;
P(1451, 6) = 1728*1506+1271;
P(1451, 7) = 1728*1271+1268;
P(1451, 8) = 1728*1268+1219;
P(1451, 9) = 1728*1219+1208;
P(1452, 0) = 1728*1212+1213;
P(1452, 1) = 1728*1213+1214;
P(1452, 2) = 1728*1214+1223;
P(1452, 3) = 1728*1223+1458;
P(1452, 4) = 1728*1458+1459;
P(1452, 5) = 1728*1459+1448;
P(1452, 6) = 1728*1448+1449;
P(1452, 7) = 1728*1449+1450;
P(1452, 8) = 1728*1450+1215;
P(1452, 9) = 1728*1215+1212;
P(1453, 0) = 1728*1212+1213;
P(1453, 1) = 1728*1213+1214;
P(1453, 2) = 1728*1214+1497;
P(1453, 3) = 1728*1497+1496;
P(1453, 4) = 1728*1496+1501;
P(1453, 5) = 1728*1501+1500;
P(1453, 6) = 1728*1500+1451;
P(1453, 7) = 1728*1451+1450;
P(1453, 8) = 1728*1450+1215;
P(1453, 9) = 1728*1215+1212;
P(1454, 0) = 1728*1214+1223;
P(1454, 1) = 1728*1223+1220;
P(1454, 2) = 1728*1220+1221;
P(1454, 3) = 1728*1221+1222;
P(1454, 4) = 1728*1222+1505;
P(1454, 5) = 1728*1505+1506;
P(1454, 6) = 1728*1506+1507;
P(1454, 7) = 1728*1507+1496;
P(1454, 8) = 1728*1496+1497;
P(1454, 9) = 1728*1497+1214;
P(1455, 0) = 1728*1214+1223;
P(1455, 1) = 1728*1223+1458;
P(1455, 2) = 1728*1458+1459;
P(1455, 3) = 1728*1459+1508;
P(1455, 4) = 1728*1508+1511;
P(1455, 5) = 1728*1511+1502;
P(1455, 6) = 1728*1502+1501;
P(1455, 7) = 1728*1501+1496;
P(1455, 8) = 1728*1496+1497;
P(1455, 9) = 1728*1497+1214;
P(1456, 0) = 1728*1216+1217;
P(1456, 1) = 1728*1217+1218;
P(1456, 2) = 1728*1218+1219;
P(1456, 3) = 1728*1219+1268;
P(1456, 4) = 1728*1268+1269;
P(1456, 5) = 1728*1269+1270;
P(1456, 6) = 1728*1270+1279;
P(1456, 7) = 1728*1279+1276;
P(1456, 8) = 1728*1276+1227;
P(1456, 9) = 1728*1227+1216;
P(1457, 0) = 1728*1216+1217;
P(1457, 1) = 1728*1217+1218;
P(1457, 2) = 1728*1218+1219;
P(1457, 3) = 1728*1219+1268;
P(1457, 4) = 1728*1268+1271;
P(1457, 5) = 1728*1271+1506;
P(1457, 6) = 1728*1506+1505;
P(1457, 7) = 1728*1505+1222;
P(1457, 8) = 1728*1222+1221;
P(1457, 9) = 1728*1221+1216;
P(1458, 0) = 1728*1216+1221;
P(1458, 1) = 1728*1221+1222;
P(1458, 2) = 1728*1222+1231;
P(1458, 3) = 1728*1231+1228;
P(1458, 4) = 1728*1228+1229;
P(1458, 5) = 1728*1229+1224;
P(1458, 6) = 1728*1224+1225;
P(1458, 7) = 1728*1225+1226;
P(1458, 8) = 1728*1226+1227;
P(1458, 9) = 1728*1227+1216;
P(1459, 0) = 1728*1216+1221;
P(1459, 1) = 1728*1221+1222;
P(1459, 2) = 1728*1222+1505;
P(1459, 3) = 1728*1505+1504;
P(1459, 4) = 1728*1504+1515;
P(1459, 5) = 1728*1515+1514;
P(1459, 6) = 1728*1514+1279;
P(1459, 7) = 1728*1279+1276;
P(1459, 8) = 1728*1276+1227;
P(1459, 9) = 1728*1227+1216;
P(1460, 0) = 1728*1220+1221;
P(1460, 1) = 1728*1221+1222;
P(1460, 2) = 1728*1222+1231;
P(1460, 3) = 1728*1231+1466;
P(1460, 4) = 1728*1466+1467;
P(1460, 5) = 1728*1467+1456;
P(1460, 6) = 1728*1456+1457;
P(1460, 7) = 1728*1457+1458;
P(1460, 8) = 1728*1458+1223;
P(1460, 9) = 1728*1223+1220;
P(1461, 0) = 1728*1220+1221;
P(1461, 1) = 1728*1221+1222;
P(1461, 2) = 1728*1222+1505;
P(1461, 3) = 1728*1505+1504;
P(1461, 4) = 1728*1504+1509;
P(1461, 5) = 1728*1509+1508;
P(1461, 6) = 1728*1508+1459;
P(1461, 7) = 1728*1459+1458;
P(1461, 8) = 1728*1458+1223;
P(1461, 9) = 1728*1223+1220;
P(1462, 0) = 1728*1222+1231;
P(1462, 1) = 1728*1231+1228;
P(1462, 2) = 1728*1228+1229;
P(1462, 3) = 1728*1229+1230;
P(1462, 4) = 1728*1230+1513;
P(1462, 5) = 1728*1513+1514;
P(1462, 6) = 1728*1514+1515;
P(1462, 7) = 1728*1515+1504;
P(1462, 8) = 1728*1504+1505;
P(1462, 9) = 1728*1505+1222;
P(1463, 0) = 1728*1222+1231;
P(1463, 1) = 1728*1231+1466;
P(1463, 2) = 1728*1466+1467;
P(1463, 3) = 1728*1467+1516;
P(1463, 4) = 1728*1516+1519;
P(1463, 5) = 1728*1519+1510;
P(1463, 6) = 1728*1510+1509;
P(1463, 7) = 1728*1509+1504;
P(1463, 8) = 1728*1504+1505;
P(1463, 9) = 1728*1505+1222;
P(1464, 0) = 1728*1224+1225;
P(1464, 1) = 1728*1225+1226;
P(1464, 2) = 1728*1226+1227;
P(1464, 3) = 1728*1227+1276;
P(1464, 4) = 1728*1276+1277;
P(1464, 5) = 1728*1277+1278;
P(1464, 6) = 1728*1278+1287;
P(1464, 7) = 1728*1287+1284;
P(1464, 8) = 1728*1284+1235;
P(1464, 9) = 1728*1235+1224;
P(1465, 0) = 1728*1224+1225;
P(1465, 1) = 1728*1225+1226;
P(1465, 2) = 1728*1226+1227;
P(1465, 3) = 1728*1227+1276;
P(1465, 4) = 1728*1276+1279;
P(1465, 5) = 1728*1279+1514;
P(1465, 6) = 1728*1514+1513;
P(1465, 7) = 1728*1513+1230;
P(1465, 8) = 1728*1230+1229;
P(1465, 9) = 1728*1229+1224;
P(1466, 0) = 1728*1224+1229;
P(1466, 1) = 1728*1229+1230;
P(1466, 2) = 1728*1230+1239;
P(1466, 3) = 1728*1239+1236;
P(1466, 4) = 1728*1236+1237;
P(1466, 5) = 1728*1237+1232;
P(1466, 6) = 1728*1232+1233;
P(1466, 7) = 1728*1233+1234;
P(1466, 8) = 1728*1234+1235;
P(1466, 9) = 1728*1235+1224;
P(1467, 0) = 1728*1224+1229;
P(1467, 1) = 1728*1229+1230;
P(1467, 2) = 1728*1230+1513;
P(1467, 3) = 1728*1513+1512;
P(1467, 4) = 1728*1512+1523;
P(1467, 5) = 1728*1523+1522;
P(1467, 6) = 1728*1522+1287;
P(1467, 7) = 1728*1287+1284;
P(1467, 8) = 1728*1284+1235;
P(1467, 9) = 1728*1235+1224;
P(1468, 0) = 1728*1228+1229;
P(1468, 1) = 1728*1229+1230;
P(1468, 2) = 1728*1230+1239;
P(1468, 3) = 1728*1239+1474;
P(1468, 4) = 1728*1474+1475;
P(1468, 5) = 1728*1475+1464;
P(1468, 6) = 1728*1464+1465;
P(1468, 7) = 1728*1465+1466;
P(1468, 8) = 1728*1466+1231;
P(1468, 9) = 1728*1231+1228;
P(1469, 0) = 1728*1228+1229;
P(1469, 1) = 1728*1229+1230;
P(1469, 2) = 1728*1230+1513;
P(1469, 3) = 1728*1513+1512;
P(1469, 4) = 1728*1512+1517;
P(1469, 5) = 1728*1517+1516;
P(1469, 6) = 1728*1516+1467;
P(1469, 7) = 1728*1467+1466;
P(1469, 8) = 1728*1466+1231;
P(1469, 9) = 1728*1231+1228;
P(1470, 0) = 1728*1230+1239;
P(1470, 1) = 1728*1239+1236;
P(1470, 2) = 1728*1236+1237;
P(1470, 3) = 1728*1237+1238;
P(1470, 4) = 1728*1238+1521;
P(1470, 5) = 1728*1521+1522;
P(1470, 6) = 1728*1522+1523;
P(1470, 7) = 1728*1523+1512;
P(1470, 8) = 1728*1512+1513;
P(1470, 9) = 1728*1513+1230;
P(1471, 0) = 1728*1230+1239;
P(1471, 1) = 1728*1239+1474;
P(1471, 2) = 1728*1474+1475;
P(1471, 3) = 1728*1475+1524;
P(1471, 4) = 1728*1524+1527;
P(1471, 5) = 1728*1527+1518;
P(1471, 6) = 1728*1518+1517;
P(1471, 7) = 1728*1517+1512;
P(1471, 8) = 1728*1512+1513;
P(1471, 9) = 1728*1513+1230;
P(1472, 0) = 1728*1232+1233;
P(1472, 1) = 1728*1233+1234;
P(1472, 2) = 1728*1234+1235;
P(1472, 3) = 1728*1235+1284;
P(1472, 4) = 1728*1284+1285;
P(1472, 5) = 1728*1285+1286;
P(1472, 6) = 1728*1286+1295;
P(1472, 7) = 1728*1295+1292;
P(1472, 8) = 1728*1292+1243;
P(1472, 9) = 1728*1243+1232;
P(1473, 0) = 1728*1232+1233;
P(1473, 1) = 1728*1233+1234;
P(1473, 2) = 1728*1234+1235;
P(1473, 3) = 1728*1235+1284;
P(1473, 4) = 1728*1284+1287;
P(1473, 5) = 1728*1287+1522;
P(1473, 6) = 1728*1522+1521;
P(1473, 7) = 1728*1521+1238;
P(1473, 8) = 1728*1238+1237;
P(1473, 9) = 1728*1237+1232;
P(1474, 0) = 1728*1232+1237;
P(1474, 1) = 1728*1237+1238;
P(1474, 2) = 1728*1238+1247;
P(1474, 3) = 1728*1247+1244;
P(1474, 4) = 1728*1244+1245;
P(1474, 5) = 1728*1245+1240;
P(1474, 6) = 1728*1240+1241;
P(1474, 7) = 1728*1241+1242;
P(1474, 8) = 1728*1242+1243;
P(1474, 9) = 1728*1243+1232;
P(1475, 0) = 1728*1232+1237;
P(1475, 1) = 1728*1237+1238;
P(1475, 2) = 1728*1238+1521;
P(1475, 3) = 1728*1521+1520;
P(1475, 4) = 1728*1520+1531;
P(1475, 5) = 1728*1531+1530;
P(1475, 6) = 1728*1530+1295;
P(1475, 7) = 1728*1295+1292;
P(1475, 8) = 1728*1292+1243;
P(1475, 9) = 1728*1243+1232;
P(1476, 0) = 1728*1236+1237;
P(1476, 1) = 1728*1237+1238;
P(1476, 2) = 1728*1238+1247;
P(1476, 3) = 1728*1247+1482;
P(1476, 4) = 1728*1482+1483;
P(1476, 5) = 1728*1483+1472;
P(1476, 6) = 1728*1472+1473;
P(1476, 7) = 1728*1473+1474;
P(1476, 8) = 1728*1474+1239;
P(1476, 9) = 1728*1239+1236;
P(1477, 0) = 1728*1236+1237;
P(1477, 1) = 1728*1237+1238;
P(1477, 2) = 1728*1238+1521;
P(1477, 3) = 1728*1521+1520;
P(1477, 4) = 1728*1520+1525;
P(1477, 5) = 1728*1525+1524;
P(1477, 6) = 1728*1524+1475;
P(1477, 7) = 1728*1475+1474;
P(1477, 8) = 1728*1474+1239;
P(1477, 9) = 1728*1239+1236;
P(1478, 0) = 1728*1238+1247;
P(1478, 1) = 1728*1247+1244;
P(1478, 2) = 1728*1244+1245;
P(1478, 3) = 1728*1245+1246;
P(1478, 4) = 1728*1246+1529;
P(1478, 5) = 1728*1529+1530;
P(1478, 6) = 1728*1530+1531;
P(1478, 7) = 1728*1531+1520;
P(1478, 8) = 1728*1520+1521;
P(1478, 9) = 1728*1521+1238;
P(1479, 0) = 1728*1238+1247;
P(1479, 1) = 1728*1247+1482;
P(1479, 2) = 1728*1482+1483;
P(1479, 3) = 1728*1483+1532;
P(1479, 4) = 1728*1532+1535;
P(1479, 5) = 1728*1535+1526;
P(1479, 6) = 1728*1526+1525;
P(1479, 7) = 1728*1525+1520;
P(1479, 8) = 1728*1520+1521;
P(1479, 9) = 1728*1521+1238;
P(1480, 0) = 1728*1240+1241;
P(1480, 1) = 1728*1241+1242;
P(1480, 2) = 1728*1242+1243;
P(1480, 3) = 1728*1243+1292;
P(1480, 4) = 1728*1292+1295;
P(1480, 5) = 1728*1295+1530;
P(1480, 6) = 1728*1530+1529;
P(1480, 7) = 1728*1529+1246;
P(1480, 8) = 1728*1246+1245;
P(1480, 9) = 1728*1245+1240;
P(1481, 0) = 1728*1244+1245;
P(1481, 1) = 1728*1245+1246;
P(1481, 2) = 1728*1246+1529;
P(1481, 3) = 1728*1529+1528;
P(1481, 4) = 1728*1528+1533;
P(1481, 5) = 1728*1533+1532;
P(1481, 6) = 1728*1532+1483;
P(1481, 7) = 1728*1483+1482;
P(1481, 8) = 1728*1482+1247;
P(1481, 9) = 1728*1247+1244;
P(1482, 0) = 1728*1248+1249;
P(1482, 1) = 1728*1249+1250;
P(1482, 2) = 1728*1250+1251;
P(1482, 3) = 1728*1251+1300;
P(1482, 4) = 1728*1300+1301;
P(1482, 5) = 1728*1301+1302;
P(1482, 6) = 1728*1302+1311;
P(1482, 7) = 1728*1311+1308;
P(1482, 8) = 1728*1308+1259;
P(1482, 9) = 1728*1259+1248;
P(1483, 0) = 1728*1248+1249;
P(1483, 1) = 1728*1249+1250;
P(1483, 2) = 1728*1250+1251;
P(1483, 3) = 1728*1251+1300;
P(1483, 4) = 1728*1300+1303;
P(1483, 5) = 1728*1303+1538;
P(1483, 6) = 1728*1538+1537;
P(1483, 7) = 1728*1537+1254;
P(1483, 8) = 1728*1254+1253;
P(1483, 9) = 1728*1253+1248;
P(1484, 0) = 1728*1248+1249;
P(1484, 1) = 1728*1249+1250;
P(1484, 2) = 1728*1250+1251;
P(1484, 3) = 1728*1251+1288;
P(1484, 4) = 1728*1288+1293;
P(1484, 5) = 1728*1293+1294;
P(1484, 6) = 1728*1294+1255;
P(1484, 7) = 1728*1255+1252;
P(1484, 8) = 1728*1252+1253;
P(1484, 9) = 1728*1253+1248;
P(1485, 0) = 1728*1248+1253;
P(1485, 1) = 1728*1253+1254;
P(1485, 2) = 1728*1254+1263;
P(1485, 3) = 1728*1263+1260;
P(1485, 4) = 1728*1260+1261;
P(1485, 5) = 1728*1261+1256;
P(1485, 6) = 1728*1256+1257;
P(1485, 7) = 1728*1257+1258;
P(1485, 8) = 1728*1258+1259;
P(1485, 9) = 1728*1259+1248;
P(1486, 0) = 1728*1248+1253;
P(1486, 1) = 1728*1253+1254;
P(1486, 2) = 1728*1254+1537;
P(1486, 3) = 1728*1537+1536;
P(1486, 4) = 1728*1536+1547;
P(1486, 5) = 1728*1547+1546;
P(1486, 6) = 1728*1546+1311;
P(1486, 7) = 1728*1311+1308;
P(1486, 8) = 1728*1308+1259;
P(1486, 9) = 1728*1259+1248;
P(1487, 0) = 1728*1251+1300;
P(1487, 1) = 1728*1300+1303;
P(1487, 2) = 1728*1303+1342;
P(1487, 3) = 1728*1342+1341;
P(1487, 4) = 1728*1341+1340;
P(1487, 5) = 1728*1340+1291;
P(1487, 6) = 1728*1291+1290;
P(1487, 7) = 1728*1290+1289;
P(1487, 8) = 1728*1289+1288;
P(1487, 9) = 1728*1288+1251;
P(1488, 0) = 1728*1251+1300;
P(1488, 1) = 1728*1300+1303;
P(1488, 2) = 1728*1303+1538;
P(1488, 3) = 1728*1538+1539;
P(1488, 4) = 1728*1539+1576;
P(1488, 5) = 1728*1576+1577;
P(1488, 6) = 1728*1577+1294;
P(1488, 7) = 1728*1294+1293;
P(1488, 8) = 1728*1293+1288;
P(1488, 9) = 1728*1288+1251;
P(1489, 0) = 1728*1252+1253;
P(1489, 1) = 1728*1253+1254;
P(1489, 2) = 1728*1254+1263;
P(1489, 3) = 1728*1263+1498;
P(1489, 4) = 1728*1498+1499;
P(1489, 5) = 1728*1499+1488;
P(1489, 6) = 1728*1488+1489;
P(1489, 7) = 1728*1489+1490;
P(1489, 8) = 1728*1490+1255;
P(1489, 9) = 1728*1255+1252;
P(1490, 0) = 1728*1252+1253;
P(1490, 1) = 1728*1253+1254;
P(1490, 2) = 1728*1254+1537;
P(1490, 3) = 1728*1537+1536;
P(1490, 4) = 1728*1536+1541;
P(1490, 5) = 1728*1541+1540;
P(1490, 6) = 1728*1540+1491;
P(1490, 7) = 1728*1491+1490;
P(1490, 8) = 1728*1490+1255;
P(1490, 9) = 1728*1255+1252;
P(1491, 0) = 1728*1252+1253;
P(1491, 1) = 1728*1253+1254;
P(1491, 2) = 1728*1254+1537;
P(1491, 3) = 1728*1537+1538;
P(1491, 4) = 1728*1538+1539;
P(1491, 5) = 1728*1539+1576;
P(1491, 6) = 1728*1576+1577;
P(1491, 7) = 1728*1577+1294;
P(1491, 8) = 1728*1294+1255;
P(1491, 9) = 1728*1255+1252;
P(1492, 0) = 1728*1254+1263;
P(1492, 1) = 1728*1263+1260;
P(1492, 2) = 1728*1260+1261;
P(1492, 3) = 1728*1261+1262;
P(1492, 4) = 1728*1262+1545;
P(1492, 5) = 1728*1545+1546;
P(1492, 6) = 1728*1546+1547;
P(1492, 7) = 1728*1547+1536;
P(1492, 8) = 1728*1536+1537;
P(1492, 9) = 1728*1537+1254;
P(1493, 0) = 1728*1254+1263;
P(1493, 1) = 1728*1263+1498;
P(1493, 2) = 1728*1498+1499;
P(1493, 3) = 1728*1499+1548;
P(1493, 4) = 1728*1548+1551;
P(1493, 5) = 1728*1551+1542;
P(1493, 6) = 1728*1542+1541;
P(1493, 7) = 1728*1541+1536;
P(1493, 8) = 1728*1536+1537;
P(1493, 9) = 1728*1537+1254;
P(1494, 0) = 1728*1255+1294;
P(1494, 1) = 1728*1294+1293;
P(1494, 2) = 1728*1293+1292;
P(1494, 3) = 1728*1292+1295;
P(1494, 4) = 1728*1295+1530;
P(1494, 5) = 1728*1530+1529;
P(1494, 6) = 1728*1529+1528;
P(1494, 7) = 1728*1528+1491;
P(1494, 8) = 1728*1491+1490;
P(1494, 9) = 1728*1490+1255;
P(1495, 0) = 1728*1255+1294;
P(1495, 1) = 1728*1294+1577;
P(1495, 2) = 1728*1577+1576;
P(1495, 3) = 1728*1576+1581;
P(1495, 4) = 1728*1581+1582;
P(1495, 5) = 1728*1582+1543;
P(1495, 6) = 1728*1543+1540;
P(1495, 7) = 1728*1540+1491;
P(1495, 8) = 1728*1491+1490;
P(1495, 9) = 1728*1490+1255;
P(1496, 0) = 1728*1256+1257;
P(1496, 1) = 1728*1257+1258;
P(1496, 2) = 1728*1258+1259;
P(1496, 3) = 1728*1259+1308;
P(1496, 4) = 1728*1308+1309;
P(1496, 5) = 1728*1309+1310;
P(1496, 6) = 1728*1310+1319;
P(1496, 7) = 1728*1319+1316;
P(1496, 8) = 1728*1316+1267;
P(1496, 9) = 1728*1267+1256;
P(1497, 0) = 1728*1256+1257;
P(1497, 1) = 1728*1257+1258;
P(1497, 2) = 1728*1258+1259;
P(1497, 3) = 1728*1259+1308;
P(1497, 4) = 1728*1308+1311;
P(1497, 5) = 1728*1311+1546;
P(1497, 6) = 1728*1546+1545;
P(1497, 7) = 1728*1545+1262;
P(1497, 8) = 1728*1262+1261;
P(1497, 9) = 1728*1261+1256;
P(1498, 0) = 1728*1256+1261;
P(1498, 1) = 1728*1261+1262;
P(1498, 2) = 1728*1262+1271;
P(1498, 3) = 1728*1271+1268;
P(1498, 4) = 1728*1268+1269;
P(1498, 5) = 1728*1269+1264;
P(1498, 6) = 1728*1264+1265;
P(1498, 7) = 1728*1265+1266;
P(1498, 8) = 1728*1266+1267;
P(1498, 9) = 1728*1267+1256;
P(1499, 0) = 1728*1256+1261;
P(1499, 1) = 1728*1261+1262;
P(1499, 2) = 1728*1262+1545;
P(1499, 3) = 1728*1545+1544;
P(1499, 4) = 1728*1544+1555;
P(1499, 5) = 1728*1555+1554;
P(1499, 6) = 1728*1554+1319;
P(1499, 7) = 1728*1319+1316;
P(1499, 8) = 1728*1316+1267;
P(1499, 9) = 1728*1267+1256;
P(1500, 0) = 1728*1260+1261;
P(1500, 1) = 1728*1261+1262;
P(1500, 2) = 1728*1262+1271;
P(1500, 3) = 1728*1271+1506;
P(1500, 4) = 1728*1506+1507;
P(1500, 5) = 1728*1507+1496;
P(1500, 6) = 1728*1496+1497;
P(1500, 7) = 1728*1497+1498;
P(1500, 8) = 1728*1498+1263;
P(1500, 9) = 1728*1263+1260;
P(1501, 0) = 1728*1260+1261;
P(1501, 1) = 1728*1261+1262;
P(1501, 2) = 1728*1262+1545;
P(1501, 3) = 1728*1545+1544;
P(1501, 4) = 1728*1544+1549;
P(1501, 5) = 1728*1549+1548;
P(1501, 6) = 1728*1548+1499;
P(1501, 7) = 1728*1499+1498;
P(1501, 8) = 1728*1498+1263;
P(1501, 9) = 1728*1263+1260;
P(1502, 0) = 1728*1262+1271;
P(1502, 1) = 1728*1271+1268;
P(1502, 2) = 1728*1268+1269;
P(1502, 3) = 1728*1269+1270;
P(1502, 4) = 1728*1270+1553;
P(1502, 5) = 1728*1553+1554;
P(1502, 6) = 1728*1554+1555;
P(1502, 7) = 1728*1555+1544;
P(1502, 8) = 1728*1544+1545;
P(1502, 9) = 1728*1545+1262;
P(1503, 0) = 1728*1262+1271;
P(1503, 1) = 1728*1271+1506;
P(1503, 2) = 1728*1506+1507;
P(1503, 3) = 1728*1507+1556;
P(1503, 4) = 1728*1556+1559;
P(1503, 5) = 1728*1559+1550;
P(1503, 6) = 1728*1550+1549;
P(1503, 7) = 1728*1549+1544;
P(1503, 8) = 1728*1544+1545;
P(1503, 9) = 1728*1545+1262;
P(1504, 0) = 1728*1264+1265;
P(1504, 1) = 1728*1265+1266;
P(1504, 2) = 1728*1266+1267;
P(1504, 3) = 1728*1267+1316;
P(1504, 4) = 1728*1316+1317;
P(1504, 5) = 1728*1317+1318;
P(1504, 6) = 1728*1318+1327;
P(1504, 7) = 1728*1327+1324;
P(1504, 8) = 1728*1324+1275;
P(1504, 9) = 1728*1275+1264;
P(1505, 0) = 1728*1264+1265;
P(1505, 1) = 1728*1265+1266;
P(1505, 2) = 1728*1266+1267;
P(1505, 3) = 1728*1267+1316;
P(1505, 4) = 1728*1316+1319;
P(1505, 5) = 1728*1319+1554;
P(1505, 6) = 1728*1554+1553;
P(1505, 7) = 1728*1553+1270;
P(1505, 8) = 1728*1270+1269;
P(1505, 9) = 1728*1269+1264;
P(1506, 0) = 1728*1264+1269;
P(1506, 1) = 1728*1269+1270;
P(1506, 2) = 1728*1270+1279;
P(1506, 3) = 1728*1279+1276;
P(1506, 4) = 1728*1276+1277;
P(1506, 5) = 1728*1277+1272;
P(1506, 6) = 1728*1272+1273;
P(1506, 7) = 1728*1273+1274;
P(1506, 8) = 1728*1274+1275;
P(1506, 9) = 1728*1275+1264;
P(1507, 0) = 1728*1264+1269;
P(1507, 1) = 1728*1269+1270;
P(1507, 2) = 1728*1270+1553;
P(1507, 3) = 1728*1553+1552;
P(1507, 4) = 1728*1552+1563;
P(1507, 5) = 1728*1563+1562;
P(1507, 6) = 1728*1562+1327;
P(1507, 7) = 1728*1327+1324;
P(1507, 8) = 1728*1324+1275;
P(1507, 9) = 1728*1275+1264;
P(1508, 0) = 1728*1268+1269;
P(1508, 1) = 1728*1269+1270;
P(1508, 2) = 1728*1270+1279;
P(1508, 3) = 1728*1279+1514;
P(1508, 4) = 1728*1514+1515;
P(1508, 5) = 1728*1515+1504;
P(1508, 6) = 1728*1504+1505;
P(1508, 7) = 1728*1505+1506;
P(1508, 8) = 1728*1506+1271;
P(1508, 9) = 1728*1271+1268;
P(1509, 0) = 1728*1268+1269;
P(1509, 1) = 1728*1269+1270;
P(1509, 2) = 1728*1270+1553;
P(1509, 3) = 1728*1553+1552;
P(1509, 4) = 1728*1552+1557;
P(1509, 5) = 1728*1557+1556;
P(1509, 6) = 1728*1556+1507;
P(1509, 7) = 1728*1507+1506;
P(1509, 8) = 1728*1506+1271;
P(1509, 9) = 1728*1271+1268;
P(1510, 0) = 1728*1270+1279;
P(1510, 1) = 1728*1279+1276;
P(1510, 2) = 1728*1276+1277;
P(1510, 3) = 1728*1277+1278;
P(1510, 4) = 1728*1278+1561;
P(1510, 5) = 1728*1561+1562;
P(1510, 6) = 1728*1562+1563;
P(1510, 7) = 1728*1563+1552;
P(1510, 8) = 1728*1552+1553;
P(1510, 9) = 1728*1553+1270;
P(1511, 0) = 1728*1270+1279;
P(1511, 1) = 1728*1279+1514;
P(1511, 2) = 1728*1514+1515;
P(1511, 3) = 1728*1515+1564;
P(1511, 4) = 1728*1564+1567;
P(1511, 5) = 1728*1567+1558;
P(1511, 6) = 1728*1558+1557;
P(1511, 7) = 1728*1557+1552;
P(1511, 8) = 1728*1552+1553;
P(1511, 9) = 1728*1553+1270;
P(1512, 0) = 1728*1272+1273;
P(1512, 1) = 1728*1273+1274;
P(1512, 2) = 1728*1274+1275;
P(1512, 3) = 1728*1275+1324;
P(1512, 4) = 1728*1324+1325;
P(1512, 5) = 1728*1325+1326;
P(1512, 6) = 1728*1326+1335;
P(1512, 7) = 1728*1335+1332;
P(1512, 8) = 1728*1332+1283;
P(1512, 9) = 1728*1283+1272;
P(1513, 0) = 1728*1272+1273;
P(1513, 1) = 1728*1273+1274;
P(1513, 2) = 1728*1274+1275;
P(1513, 3) = 1728*1275+1324;
P(1513, 4) = 1728*1324+1327;
P(1513, 5) = 1728*1327+1562;
P(1513, 6) = 1728*1562+1561;
P(1513, 7) = 1728*1561+1278;
P(1513, 8) = 1728*1278+1277;
P(1513, 9) = 1728*1277+1272;
P(1514, 0) = 1728*1272+1277;
P(1514, 1) = 1728*1277+1278;
P(1514, 2) = 1728*1278+1287;
P(1514, 3) = 1728*1287+1284;
P(1514, 4) = 1728*1284+1285;
P(1514, 5) = 1728*1285+1280;
P(1514, 6) = 1728*1280+1281;
P(1514, 7) = 1728*1281+1282;
P(1514, 8) = 1728*1282+1283;
P(1514, 9) = 1728*1283+1272;
P(1515, 0) = 1728*1272+1277;
P(1515, 1) = 1728*1277+1278;
P(1515, 2) = 1728*1278+1561;
P(1515, 3) = 1728*1561+1560;
P(1515, 4) = 1728*1560+1571;
P(1515, 5) = 1728*1571+1570;
P(1515, 6) = 1728*1570+1335;
P(1515, 7) = 1728*1335+1332;
P(1515, 8) = 1728*1332+1283;
P(1515, 9) = 1728*1283+1272;
P(1516, 0) = 1728*1276+1277;
P(1516, 1) = 1728*1277+1278;
P(1516, 2) = 1728*1278+1287;
P(1516, 3) = 1728*1287+1522;
P(1516, 4) = 1728*1522+1523;
P(1516, 5) = 1728*1523+1512;
P(1516, 6) = 1728*1512+1513;
P(1516, 7) = 1728*1513+1514;
P(1516, 8) = 1728*1514+1279;
P(1516, 9) = 1728*1279+1276;
P(1517, 0) = 1728*1276+1277;
P(1517, 1) = 1728*1277+1278;
P(1517, 2) = 1728*1278+1561;
P(1517, 3) = 1728*1561+1560;
P(1517, 4) = 1728*1560+1565;
P(1517, 5) = 1728*1565+1564;
P(1517, 6) = 1728*1564+1515;
P(1517, 7) = 1728*1515+1514;
P(1517, 8) = 1728*1514+1279;
P(1517, 9) = 1728*1279+1276;
P(1518, 0) = 1728*1278+1287;
P(1518, 1) = 1728*1287+1284;
P(1518, 2) = 1728*1284+1285;
P(1518, 3) = 1728*1285+1286;
P(1518, 4) = 1728*1286+1569;
P(1518, 5) = 1728*1569+1570;
P(1518, 6) = 1728*1570+1571;
P(1518, 7) = 1728*1571+1560;
P(1518, 8) = 1728*1560+1561;
P(1518, 9) = 1728*1561+1278;
P(1519, 0) = 1728*1278+1287;
P(1519, 1) = 1728*1287+1522;
P(1519, 2) = 1728*1522+1523;
P(1519, 3) = 1728*1523+1572;
P(1519, 4) = 1728*1572+1575;
P(1519, 5) = 1728*1575+1566;
P(1519, 6) = 1728*1566+1565;
P(1519, 7) = 1728*1565+1560;
P(1519, 8) = 1728*1560+1561;
P(1519, 9) = 1728*1561+1278;
P(1520, 0) = 1728*1280+1281;
P(1520, 1) = 1728*1281+1282;
P(1520, 2) = 1728*1282+1283;
P(1520, 3) = 1728*1283+1332;
P(1520, 4) = 1728*1332+1333;
P(1520, 5) = 1728*1333+1334;
P(1520, 6) = 1728*1334+1343;
P(1520, 7) = 1728*1343+1340;
P(1520, 8) = 1728*1340+1291;
P(1520, 9) = 1728*1291+1280;
P(1521, 0) = 1728*1280+1281;
P(1521, 1) = 1728*1281+1282;
P(1521, 2) = 1728*1282+1283;
P(1521, 3) = 1728*1283+1332;
P(1521, 4) = 1728*1332+1335;
P(1521, 5) = 1728*1335+1570;
P(1521, 6) = 1728*1570+1569;
P(1521, 7) = 1728*1569+1286;
P(1521, 8) = 1728*1286+1285;
P(1521, 9) = 1728*1285+1280;
P(1522, 0) = 1728*1280+1285;
P(1522, 1) = 1728*1285+1286;
P(1522, 2) = 1728*1286+1295;
P(1522, 3) = 1728*1295+1292;
P(1522, 4) = 1728*1292+1293;
P(1522, 5) = 1728*1293+1288;
P(1522, 6) = 1728*1288+1289;
P(1522, 7) = 1728*1289+1290;
P(1522, 8) = 1728*1290+1291;
P(1522, 9) = 1728*1291+1280;
P(1523, 0) = 1728*1280+1285;
P(1523, 1) = 1728*1285+1286;
P(1523, 2) = 1728*1286+1569;
P(1523, 3) = 1728*1569+1568;
P(1523, 4) = 1728*1568+1579;
P(1523, 5) = 1728*1579+1578;
P(1523, 6) = 1728*1578+1343;
P(1523, 7) = 1728*1343+1340;
P(1523, 8) = 1728*1340+1291;
P(1523, 9) = 1728*1291+1280;
P(1524, 0) = 1728*1284+1285;
P(1524, 1) = 1728*1285+1286;
P(1524, 2) = 1728*1286+1295;
P(1524, 3) = 1728*1295+1530;
P(1524, 4) = 1728*1530+1531;
P(1524, 5) = 1728*1531+1520;
P(1524, 6) = 1728*1520+1521;
P(1524, 7) = 1728*1521+1522;
P(1524, 8) = 1728*1522+1287;
P(1524, 9) = 1728*1287+1284;
P(1525, 0) = 1728*1284+1285;
P(1525, 1) = 1728*1285+1286;
P(1525, 2) = 1728*1286+1569;
P(1525, 3) = 1728*1569+1568;
P(1525, 4) = 1728*1568+1573;
P(1525, 5) = 1728*1573+1572;
P(1525, 6) = 1728*1572+1523;
P(1525, 7) = 1728*1523+1522;
P(1525, 8) = 1728*1522+1287;
P(1525, 9) = 1728*1287+1284;
P(1526, 0) = 1728*1286+1295;
P(1526, 1) = 1728*1295+1292;
P(1526, 2) = 1728*1292+1293;
P(1526, 3) = 1728*1293+1294;
P(1526, 4) = 1728*1294+1577;
P(1526, 5) = 1728*1577+1578;
P(1526, 6) = 1728*1578+1579;
P(1526, 7) = 1728*1579+1568;
P(1526, 8) = 1728*1568+1569;
P(1526, 9) = 1728*1569+1286;
P(1527, 0) = 1728*1286+1295;
P(1527, 1) = 1728*1295+1530;
P(1527, 2) = 1728*1530+1531;
P(1527, 3) = 1728*1531+1580;
P(1527, 4) = 1728*1580+1583;
P(1527, 5) = 1728*1583+1574;
P(1527, 6) = 1728*1574+1573;
P(1527, 7) = 1728*1573+1568;
P(1527, 8) = 1728*1568+1569;
P(1527, 9) = 1728*1569+1286;
P(1528, 0) = 1728*1288+1289;
P(1528, 1) = 1728*1289+1290;
P(1528, 2) = 1728*1290+1291;
P(1528, 3) = 1728*1291+1340;
P(1528, 4) = 1728*1340+1343;
P(1528, 5) = 1728*1343+1578;
P(1528, 6) = 1728*1578+1577;
P(1528, 7) = 1728*1577+1294;
P(1528, 8) = 1728*1294+1293;
P(1528, 9) = 1728*1293+1288;
P(1529, 0) = 1728*1292+1293;
P(1529, 1) = 1728*1293+1294;
P(1529, 2) = 1728*1294+1577;
P(1529, 3) = 1728*1577+1576;
P(1529, 4) = 1728*1576+1581;
P(1529, 5) = 1728*1581+1580;
P(1529, 6) = 1728*1580+1531;
P(1529, 7) = 1728*1531+1530;
P(1529, 8) = 1728*1530+1295;
P(1529, 9) = 1728*1295+1292;
P(1530, 0) = 1728*1296+1297;
P(1530, 1) = 1728*1297+1298;
P(1530, 2) = 1728*1298+1299;
P(1530, 3) = 1728*1299+1348;
P(1530, 4) = 1728*1348+1349;
P(1530, 5) = 1728*1349+1350;
P(1530, 6) = 1728*1350+1359;
P(1530, 7) = 1728*1359+1356;
P(1530, 8) = 1728*1356+1307;
P(1530, 9) = 1728*1307+1296;
P(1531, 0) = 1728*1296+1297;
P(1531, 1) = 1728*1297+1298;
P(1531, 2) = 1728*1298+1299;
P(1531, 3) = 1728*1299+1348;
P(1531, 4) = 1728*1348+1351;
P(1531, 5) = 1728*1351+1586;
P(1531, 6) = 1728*1586+1585;
P(1531, 7) = 1728*1585+1302;
P(1531, 8) = 1728*1302+1301;
P(1531, 9) = 1728*1301+1296;
P(1532, 0) = 1728*1296+1297;
P(1532, 1) = 1728*1297+1298;
P(1532, 2) = 1728*1298+1299;
P(1532, 3) = 1728*1299+1336;
P(1532, 4) = 1728*1336+1341;
P(1532, 5) = 1728*1341+1342;
P(1532, 6) = 1728*1342+1303;
P(1532, 7) = 1728*1303+1300;
P(1532, 8) = 1728*1300+1301;
P(1532, 9) = 1728*1301+1296;
P(1533, 0) = 1728*1296+1301;
P(1533, 1) = 1728*1301+1302;
P(1533, 2) = 1728*1302+1311;
P(1533, 3) = 1728*1311+1308;
P(1533, 4) = 1728*1308+1309;
P(1533, 5) = 1728*1309+1304;
P(1533, 6) = 1728*1304+1305;
P(1533, 7) = 1728*1305+1306;
P(1533, 8) = 1728*1306+1307;
P(1533, 9) = 1728*1307+1296;
P(1534, 0) = 1728*1296+1301;
P(1534, 1) = 1728*1301+1302;
P(1534, 2) = 1728*1302+1585;
P(1534, 3) = 1728*1585+1584;
P(1534, 4) = 1728*1584+1595;
P(1534, 5) = 1728*1595+1594;
P(1534, 6) = 1728*1594+1359;
P(1534, 7) = 1728*1359+1356;
P(1534, 8) = 1728*1356+1307;
P(1534, 9) = 1728*1307+1296;
P(1535, 0) = 1728*1299+1348;
P(1535, 1) = 1728*1348+1351;
P(1535, 2) = 1728*1351+1390;
P(1535, 3) = 1728*1390+1389;
P(1535, 4) = 1728*1389+1388;
P(1535, 5) = 1728*1388+1339;
P(1535, 6) = 1728*1339+1338;
P(1535, 7) = 1728*1338+1337;
P(1535, 8) = 1728*1337+1336;
P(1535, 9) = 1728*1336+1299;
P(1536, 0) = 1728*1299+1348;
P(1536, 1) = 1728*1348+1351;
P(1536, 2) = 1728*1351+1586;
P(1536, 3) = 1728*1586+1587;
P(1536, 4) = 1728*1587+1624;
P(1536, 5) = 1728*1624+1625;
P(1536, 6) = 1728*1625+1342;
P(1536, 7) = 1728*1342+1341;
P(1536, 8) = 1728*1341+1336;
P(1536, 9) = 1728*1336+1299;
P(1537, 0) = 1728*1300+1301;
P(1537, 1) = 1728*1301+1302;
P(1537, 2) = 1728*1302+1311;
P(1537, 3) = 1728*1311+1546;
P(1537, 4) = 1728*1546+1547;
P(1537, 5) = 1728*1547+1536;
P(1537, 6) = 1728*1536+1537;
P(1537, 7) = 1728*1537+1538;
P(1537, 8) = 1728*1538+1303;
P(1537, 9) = 1728*1303+1300;
P(1538, 0) = 1728*1300+1301;
P(1538, 1) = 1728*1301+1302;
P(1538, 2) = 1728*1302+1585;
P(1538, 3) = 1728*1585+1584;
P(1538, 4) = 1728*1584+1589;
P(1538, 5) = 1728*1589+1588;
P(1538, 6) = 1728*1588+1539;
P(1538, 7) = 1728*1539+1538;
P(1538, 8) = 1728*1538+1303;
P(1538, 9) = 1728*1303+1300;
P(1539, 0) = 1728*1300+1301;
P(1539, 1) = 1728*1301+1302;
P(1539, 2) = 1728*1302+1585;
P(1539, 3) = 1728*1585+1586;
P(1539, 4) = 1728*1586+1587;
P(1539, 5) = 1728*1587+1624;
P(1539, 6) = 1728*1624+1625;
P(1539, 7) = 1728*1625+1342;
P(1539, 8) = 1728*1342+1303;
P(1539, 9) = 1728*1303+1300;
P(1540, 0) = 1728*1302+1311;
P(1540, 1) = 1728*1311+1308;
P(1540, 2) = 1728*1308+1309;
P(1540, 3) = 1728*1309+1310;
P(1540, 4) = 1728*1310+1593;
P(1540, 5) = 1728*1593+1594;
P(1540, 6) = 1728*1594+1595;
P(1540, 7) = 1728*1595+1584;
P(1540, 8) = 1728*1584+1585;
P(1540, 9) = 1728*1585+1302;
P(1541, 0) = 1728*1302+1311;
P(1541, 1) = 1728*1311+1546;
P(1541, 2) = 1728*1546+1547;
P(1541, 3) = 1728*1547+1596;
P(1541, 4) = 1728*1596+1599;
P(1541, 5) = 1728*1599+1590;
P(1541, 6) = 1728*1590+1589;
P(1541, 7) = 1728*1589+1584;
P(1541, 8) = 1728*1584+1585;
P(1541, 9) = 1728*1585+1302;
P(1542, 0) = 1728*1303+1342;
P(1542, 1) = 1728*1342+1341;
P(1542, 2) = 1728*1341+1340;
P(1542, 3) = 1728*1340+1343;
P(1542, 4) = 1728*1343+1578;
P(1542, 5) = 1728*1578+1577;
P(1542, 6) = 1728*1577+1576;
P(1542, 7) = 1728*1576+1539;
P(1542, 8) = 1728*1539+1538;
P(1542, 9) = 1728*1538+1303;
P(1543, 0) = 1728*1303+1342;
P(1543, 1) = 1728*1342+1625;
P(1543, 2) = 1728*1625+1624;
P(1543, 3) = 1728*1624+1629;
P(1543, 4) = 1728*1629+1630;
P(1543, 5) = 1728*1630+1591;
P(1543, 6) = 1728*1591+1588;
P(1543, 7) = 1728*1588+1539;
P(1543, 8) = 1728*1539+1538;
P(1543, 9) = 1728*1538+1303;
P(1544, 0) = 1728*1304+1305;
P(1544, 1) = 1728*1305+1306;
P(1544, 2) = 1728*1306+1307;
P(1544, 3) = 1728*1307+1356;
P(1544, 4) = 1728*1356+1357;
P(1544, 5) = 1728*1357+1358;
P(1544, 6) = 1728*1358+1367;
P(1544, 7) = 1728*1367+1364;
P(1544, 8) = 1728*1364+1315;
P(1544, 9) = 1728*1315+1304;
P(1545, 0) = 1728*1304+1305;
P(1545, 1) = 1728*1305+1306;
P(1545, 2) = 1728*1306+1307;
P(1545, 3) = 1728*1307+1356;
P(1545, 4) = 1728*1356+1359;
P(1545, 5) = 1728*1359+1594;
P(1545, 6) = 1728*1594+1593;
P(1545, 7) = 1728*1593+1310;
P(1545, 8) = 1728*1310+1309;
P(1545, 9) = 1728*1309+1304;
P(1546, 0) = 1728*1304+1309;
P(1546, 1) = 1728*1309+1310;
P(1546, 2) = 1728*1310+1319;
P(1546, 3) = 1728*1319+1316;
P(1546, 4) = 1728*1316+1317;
P(1546, 5) = 1728*1317+1312;
P(1546, 6) = 1728*1312+1313;
P(1546, 7) = 1728*1313+1314;
P(1546, 8) = 1728*1314+1315;
P(1546, 9) = 1728*1315+1304;
P(1547, 0) = 1728*1304+1309;
P(1547, 1) = 1728*1309+1310;
P(1547, 2) = 1728*1310+1593;
P(1547, 3) = 1728*1593+1592;
P(1547, 4) = 1728*1592+1603;
P(1547, 5) = 1728*1603+1602;
P(1547, 6) = 1728*1602+1367;
P(1547, 7) = 1728*1367+1364;
P(1547, 8) = 1728*1364+1315;
P(1547, 9) = 1728*1315+1304;
P(1548, 0) = 1728*1308+1309;
P(1548, 1) = 1728*1309+1310;
P(1548, 2) = 1728*1310+1319;
P(1548, 3) = 1728*1319+1554;
P(1548, 4) = 1728*1554+1555;
P(1548, 5) = 1728*1555+1544;
P(1548, 6) = 1728*1544+1545;
P(1548, 7) = 1728*1545+1546;
P(1548, 8) = 1728*1546+1311;
P(1548, 9) = 1728*1311+1308;
P(1549, 0) = 1728*1308+1309;
P(1549, 1) = 1728*1309+1310;
P(1549, 2) = 1728*1310+1593;
P(1549, 3) = 1728*1593+1592;
P(1549, 4) = 1728*1592+1597;
P(1549, 5) = 1728*1597+1596;
P(1549, 6) = 1728*1596+1547;
P(1549, 7) = 1728*1547+1546;
P(1549, 8) = 1728*1546+1311;
P(1549, 9) = 1728*1311+1308;
P(1550, 0) = 1728*1310+1319;
P(1550, 1) = 1728*1319+1316;
P(1550, 2) = 1728*1316+1317;
P(1550, 3) = 1728*1317+1318;
P(1550, 4) = 1728*1318+1601;
P(1550, 5) = 1728*1601+1602;
P(1550, 6) = 1728*1602+1603;
P(1550, 7) = 1728*1603+1592;
P(1550, 8) = 1728*1592+1593;
P(1550, 9) = 1728*1593+1310;
P(1551, 0) = 1728*1310+1319;
P(1551, 1) = 1728*1319+1554;
P(1551, 2) = 1728*1554+1555;
P(1551, 3) = 1728*1555+1604;
P(1551, 4) = 1728*1604+1607;
P(1551, 5) = 1728*1607+1598;
P(1551, 6) = 1728*1598+1597;
P(1551, 7) = 1728*1597+1592;
P(1551, 8) = 1728*1592+1593;
P(1551, 9) = 1728*1593+1310;
P(1552, 0) = 1728*1312+1313;
P(1552, 1) = 1728*1313+1314;
P(1552, 2) = 1728*1314+1315;
P(1552, 3) = 1728*1315+1364;
P(1552, 4) = 1728*1364+1365;
P(1552, 5) = 1728*1365+1366;
P(1552, 6) = 1728*1366+1375;
P(1552, 7) = 1728*1375+1372;
P(1552, 8) = 1728*1372+1323;
P(1552, 9) = 1728*1323+1312;
P(1553, 0) = 1728*1312+1313;
P(1553, 1) = 1728*1313+1314;
P(1553, 2) = 1728*1314+1315;
P(1553, 3) = 1728*1315+1364;
P(1553, 4) = 1728*1364+1367;
P(1553, 5) = 1728*1367+1602;
P(1553, 6) = 1728*1602+1601;
P(1553, 7) = 1728*1601+1318;
P(1553, 8) = 1728*1318+1317;
P(1553, 9) = 1728*1317+1312;
P(1554, 0) = 1728*1312+1317;
P(1554, 1) = 1728*1317+1318;
P(1554, 2) = 1728*1318+1327;
P(1554, 3) = 1728*1327+1324;
P(1554, 4) = 1728*1324+1325;
P(1554, 5) = 1728*1325+1320;
P(1554, 6) = 1728*1320+1321;
P(1554, 7) = 1728*1321+1322;
P(1554, 8) = 1728*1322+1323;
P(1554, 9) = 1728*1323+1312;
P(1555, 0) = 1728*1312+1317;
P(1555, 1) = 1728*1317+1318;
P(1555, 2) = 1728*1318+1601;
P(1555, 3) = 1728*1601+1600;
P(1555, 4) = 1728*1600+1611;
P(1555, 5) = 1728*1611+1610;
P(1555, 6) = 1728*1610+1375;
P(1555, 7) = 1728*1375+1372;
P(1555, 8) = 1728*1372+1323;
P(1555, 9) = 1728*1323+1312;
P(1556, 0) = 1728*1316+1317;
P(1556, 1) = 1728*1317+1318;
P(1556, 2) = 1728*1318+1327;
P(1556, 3) = 1728*1327+1562;
P(1556, 4) = 1728*1562+1563;
P(1556, 5) = 1728*1563+1552;
P(1556, 6) = 1728*1552+1553;
P(1556, 7) = 1728*1553+1554;
P(1556, 8) = 1728*1554+1319;
P(1556, 9) = 1728*1319+1316;
P(1557, 0) = 1728*1316+1317;
P(1557, 1) = 1728*1317+1318;
P(1557, 2) = 1728*1318+1601;
P(1557, 3) = 1728*1601+1600;
P(1557, 4) = 1728*1600+1605;
P(1557, 5) = 1728*1605+1604;
P(1557, 6) = 1728*1604+1555;
P(1557, 7) = 1728*1555+1554;
P(1557, 8) = 1728*1554+1319;
P(1557, 9) = 1728*1319+1316;
P(1558, 0) = 1728*1318+1327;
P(1558, 1) = 1728*1327+1324;
P(1558, 2) = 1728*1324+1325;
P(1558, 3) = 1728*1325+1326;
P(1558, 4) = 1728*1326+1609;
P(1558, 5) = 1728*1609+1610;
P(1558, 6) = 1728*1610+1611;
P(1558, 7) = 1728*1611+1600;
P(1558, 8) = 1728*1600+1601;
P(1558, 9) = 1728*1601+1318;
P(1559, 0) = 1728*1318+1327;
P(1559, 1) = 1728*1327+1562;
P(1559, 2) = 1728*1562+1563;
P(1559, 3) = 1728*1563+1612;
P(1559, 4) = 1728*1612+1615;
P(1559, 5) = 1728*1615+1606;
P(1559, 6) = 1728*1606+1605;
P(1559, 7) = 1728*1605+1600;
P(1559, 8) = 1728*1600+1601;
P(1559, 9) = 1728*1601+1318;
P(1560, 0) = 1728*1320+1321;
P(1560, 1) = 1728*1321+1322;
P(1560, 2) = 1728*1322+1323;
P(1560, 3) = 1728*1323+1372;
P(1560, 4) = 1728*1372+1373;
P(1560, 5) = 1728*1373+1374;
P(1560, 6) = 1728*1374+1383;
P(1560, 7) = 1728*1383+1380;
P(1560, 8) = 1728*1380+1331;
P(1560, 9) = 1728*1331+1320;
P(1561, 0) = 1728*1320+1321;
P(1561, 1) = 1728*1321+1322;
P(1561, 2) = 1728*1322+1323;
P(1561, 3) = 1728*1323+1372;
P(1561, 4) = 1728*1372+1375;
P(1561, 5) = 1728*1375+1610;
P(1561, 6) = 1728*1610+1609;
P(1561, 7) = 1728*1609+1326;
P(1561, 8) = 1728*1326+1325;
P(1561, 9) = 1728*1325+1320;
P(1562, 0) = 1728*1320+1325;
P(1562, 1) = 1728*1325+1326;
P(1562, 2) = 1728*1326+1335;
P(1562, 3) = 1728*1335+1332;
P(1562, 4) = 1728*1332+1333;
P(1562, 5) = 1728*1333+1328;
P(1562, 6) = 1728*1328+1329;
P(1562, 7) = 1728*1329+1330;
P(1562, 8) = 1728*1330+1331;
P(1562, 9) = 1728*1331+1320;
P(1563, 0) = 1728*1320+1325;
P(1563, 1) = 1728*1325+1326;
P(1563, 2) = 1728*1326+1609;
P(1563, 3) = 1728*1609+1608;
P(1563, 4) = 1728*1608+1619;
P(1563, 5) = 1728*1619+1618;
P(1563, 6) = 1728*1618+1383;
P(1563, 7) = 1728*1383+1380;
P(1563, 8) = 1728*1380+1331;
P(1563, 9) = 1728*1331+1320;
P(1564, 0) = 1728*1324+1325;
P(1564, 1) = 1728*1325+1326;
P(1564, 2) = 1728*1326+1335;
P(1564, 3) = 1728*1335+1570;
P(1564, 4) = 1728*1570+1571;
P(1564, 5) = 1728*1571+1560;
P(1564, 6) = 1728*1560+1561;
P(1564, 7) = 1728*1561+1562;
P(1564, 8) = 1728*1562+1327;
P(1564, 9) = 1728*1327+1324;
P(1565, 0) = 1728*1324+1325;
P(1565, 1) = 1728*1325+1326;
P(1565, 2) = 1728*1326+1609;
P(1565, 3) = 1728*1609+1608;
P(1565, 4) = 1728*1608+1613;
P(1565, 5) = 1728*1613+1612;
P(1565, 6) = 1728*1612+1563;
P(1565, 7) = 1728*1563+1562;
P(1565, 8) = 1728*1562+1327;
P(1565, 9) = 1728*1327+1324;
P(1566, 0) = 1728*1326+1335;
P(1566, 1) = 1728*1335+1332;
P(1566, 2) = 1728*1332+1333;
P(1566, 3) = 1728*1333+1334;
P(1566, 4) = 1728*1334+1617;
P(1566, 5) = 1728*1617+1618;
P(1566, 6) = 1728*1618+1619;
P(1566, 7) = 1728*1619+1608;
P(1566, 8) = 1728*1608+1609;
P(1566, 9) = 1728*1609+1326;
P(1567, 0) = 1728*1326+1335;
P(1567, 1) = 1728*1335+1570;
P(1567, 2) = 1728*1570+1571;
P(1567, 3) = 1728*1571+1620;
P(1567, 4) = 1728*1620+1623;
P(1567, 5) = 1728*1623+1614;
P(1567, 6) = 1728*1614+1613;
P(1567, 7) = 1728*1613+1608;
P(1567, 8) = 1728*1608+1609;
P(1567, 9) = 1728*1609+1326;
P(1568, 0) = 1728*1328+1329;
P(1568, 1) = 1728*1329+1330;
P(1568, 2) = 1728*1330+1331;
P(1568, 3) = 1728*1331+1380;
P(1568, 4) = 1728*1380+1381;
P(1568, 5) = 1728*1381+1382;
P(1568, 6) = 1728*1382+1391;
P(1568, 7) = 1728*1391+1388;
P(1568, 8) = 1728*1388+1339;
P(1568, 9) = 1728*1339+1328;
P(1569, 0) = 1728*1328+1329;
P(1569, 1) = 1728*1329+1330;
P(1569, 2) = 1728*1330+1331;
P(1569, 3) = 1728*1331+1380;
P(1569, 4) = 1728*1380+1383;
P(1569, 5) = 1728*1383+1618;
P(1569, 6) = 1728*1618+1617;
P(1569, 7) = 1728*1617+1334;
P(1569, 8) = 1728*1334+1333;
P(1569, 9) = 1728*1333+1328;
P(1570, 0) = 1728*1328+1333;
P(1570, 1) = 1728*1333+1334;
P(1570, 2) = 1728*1334+1343;
P(1570, 3) = 1728*1343+1340;
P(1570, 4) = 1728*1340+1341;
P(1570, 5) = 1728*1341+1336;
P(1570, 6) = 1728*1336+1337;
P(1570, 7) = 1728*1337+1338;
P(1570, 8) = 1728*1338+1339;
P(1570, 9) = 1728*1339+1328;
P(1571, 0) = 1728*1328+1333;
P(1571, 1) = 1728*1333+1334;
P(1571, 2) = 1728*1334+1617;
P(1571, 3) = 1728*1617+1616;
P(1571, 4) = 1728*1616+1627;
P(1571, 5) = 1728*1627+1626;
P(1571, 6) = 1728*1626+1391;
P(1571, 7) = 1728*1391+1388;
P(1571, 8) = 1728*1388+1339;
P(1571, 9) = 1728*1339+1328;
P(1572, 0) = 1728*1332+1333;
P(1572, 1) = 1728*1333+1334;
P(1572, 2) = 1728*1334+1343;
P(1572, 3) = 1728*1343+1578;
P(1572, 4) = 1728*1578+1579;
P(1572, 5) = 1728*1579+1568;
P(1572, 6) = 1728*1568+1569;
P(1572, 7) = 1728*1569+1570;
P(1572, 8) = 1728*1570+1335;
P(1572, 9) = 1728*1335+1332;
P(1573, 0) = 1728*1332+1333;
P(1573, 1) = 1728*1333+1334;
P(1573, 2) = 1728*1334+1617;
P(1573, 3) = 1728*1617+1616;
P(1573, 4) = 1728*1616+1621;
P(1573, 5) = 1728*1621+1620;
P(1573, 6) = 1728*1620+1571;
P(1573, 7) = 1728*1571+1570;
P(1573, 8) = 1728*1570+1335;
P(1573, 9) = 1728*1335+1332;
P(1574, 0) = 1728*1334+1343;
P(1574, 1) = 1728*1343+1340;
P(1574, 2) = 1728*1340+1341;
P(1574, 3) = 1728*1341+1342;
P(1574, 4) = 1728*1342+1625;
P(1574, 5) = 1728*1625+1626;
P(1574, 6) = 1728*1626+1627;
P(1574, 7) = 1728*1627+1616;
P(1574, 8) = 1728*1616+1617;
P(1574, 9) = 1728*1617+1334;
P(1575, 0) = 1728*1334+1343;
P(1575, 1) = 1728*1343+1578;
P(1575, 2) = 1728*1578+1579;
P(1575, 3) = 1728*1579+1628;
P(1575, 4) = 1728*1628+1631;
P(1575, 5) = 1728*1631+1622;
P(1575, 6) = 1728*1622+1621;
P(1575, 7) = 1728*1621+1616;
P(1575, 8) = 1728*1616+1617;
P(1575, 9) = 1728*1617+1334;
P(1576, 0) = 1728*1336+1337;
P(1576, 1) = 1728*1337+1338;
P(1576, 2) = 1728*1338+1339;
P(1576, 3) = 1728*1339+1388;
P(1576, 4) = 1728*1388+1391;
P(1576, 5) = 1728*1391+1626;
P(1576, 6) = 1728*1626+1625;
P(1576, 7) = 1728*1625+1342;
P(1576, 8) = 1728*1342+1341;
P(1576, 9) = 1728*1341+1336;
P(1577, 0) = 1728*1340+1341;
P(1577, 1) = 1728*1341+1342;
P(1577, 2) = 1728*1342+1625;
P(1577, 3) = 1728*1625+1624;
P(1577, 4) = 1728*1624+1629;
P(1577, 5) = 1728*1629+1628;
P(1577, 6) = 1728*1628+1579;
P(1577, 7) = 1728*1579+1578;
P(1577, 8) = 1728*1578+1343;
P(1577, 9) = 1728*1343+1340;
P(1578, 0) = 1728*1344+1345;
P(1578, 1) = 1728*1345+1346;
P(1578, 2) = 1728*1346+1347;
P(1578, 3) = 1728*1347+1396;
P(1578, 4) = 1728*1396+1397;
P(1578, 5) = 1728*1397+1398;
P(1578, 6) = 1728*1398+1407;
P(1578, 7) = 1728*1407+1404;
P(1578, 8) = 1728*1404+1355;
P(1578, 9) = 1728*1355+1344;
P(1579, 0) = 1728*1344+1345;
P(1579, 1) = 1728*1345+1346;
P(1579, 2) = 1728*1346+1347;
P(1579, 3) = 1728*1347+1396;
P(1579, 4) = 1728*1396+1399;
P(1579, 5) = 1728*1399+1634;
P(1579, 6) = 1728*1634+1633;
P(1579, 7) = 1728*1633+1350;
P(1579, 8) = 1728*1350+1349;
P(1579, 9) = 1728*1349+1344;
P(1580, 0) = 1728*1344+1345;
P(1580, 1) = 1728*1345+1346;
P(1580, 2) = 1728*1346+1347;
P(1580, 3) = 1728*1347+1384;
P(1580, 4) = 1728*1384+1389;
P(1580, 5) = 1728*1389+1390;
P(1580, 6) = 1728*1390+1351;
P(1580, 7) = 1728*1351+1348;
P(1580, 8) = 1728*1348+1349;
P(1580, 9) = 1728*1349+1344;
P(1581, 0) = 1728*1344+1349;
P(1581, 1) = 1728*1349+1350;
P(1581, 2) = 1728*1350+1359;
P(1581, 3) = 1728*1359+1356;
P(1581, 4) = 1728*1356+1357;
P(1581, 5) = 1728*1357+1352;
P(1581, 6) = 1728*1352+1353;
P(1581, 7) = 1728*1353+1354;
P(1581, 8) = 1728*1354+1355;
P(1581, 9) = 1728*1355+1344;
P(1582, 0) = 1728*1344+1349;
P(1582, 1) = 1728*1349+1350;
P(1582, 2) = 1728*1350+1633;
P(1582, 3) = 1728*1633+1632;
P(1582, 4) = 1728*1632+1643;
P(1582, 5) = 1728*1643+1642;
P(1582, 6) = 1728*1642+1407;
P(1582, 7) = 1728*1407+1404;
P(1582, 8) = 1728*1404+1355;
P(1582, 9) = 1728*1355+1344;
P(1583, 0) = 1728*1347+1396;
P(1583, 1) = 1728*1396+1399;
P(1583, 2) = 1728*1399+1438;
P(1583, 3) = 1728*1438+1437;
P(1583, 4) = 1728*1437+1436;
P(1583, 5) = 1728*1436+1387;
P(1583, 6) = 1728*1387+1386;
P(1583, 7) = 1728*1386+1385;
P(1583, 8) = 1728*1385+1384;
P(1583, 9) = 1728*1384+1347;
P(1584, 0) = 1728*1347+1396;
P(1584, 1) = 1728*1396+1399;
P(1584, 2) = 1728*1399+1634;
P(1584, 3) = 1728*1634+1635;
P(1584, 4) = 1728*1635+1672;
P(1584, 5) = 1728*1672+1673;
P(1584, 6) = 1728*1673+1390;
P(1584, 7) = 1728*1390+1389;
P(1584, 8) = 1728*1389+1384;
P(1584, 9) = 1728*1384+1347;
P(1585, 0) = 1728*1348+1349;
P(1585, 1) = 1728*1349+1350;
P(1585, 2) = 1728*1350+1359;
P(1585, 3) = 1728*1359+1594;
P(1585, 4) = 1728*1594+1595;
P(1585, 5) = 1728*1595+1584;
P(1585, 6) = 1728*1584+1585;
P(1585, 7) = 1728*1585+1586;
P(1585, 8) = 1728*1586+1351;
P(1585, 9) = 1728*1351+1348;
P(1586, 0) = 1728*1348+1349;
P(1586, 1) = 1728*1349+1350;
P(1586, 2) = 1728*1350+1633;
P(1586, 3) = 1728*1633+1632;
P(1586, 4) = 1728*1632+1637;
P(1586, 5) = 1728*1637+1636;
P(1586, 6) = 1728*1636+1587;
P(1586, 7) = 1728*1587+1586;
P(1586, 8) = 1728*1586+1351;
P(1586, 9) = 1728*1351+1348;
P(1587, 0) = 1728*1348+1349;
P(1587, 1) = 1728*1349+1350;
P(1587, 2) = 1728*1350+1633;
P(1587, 3) = 1728*1633+1634;
P(1587, 4) = 1728*1634+1635;
P(1587, 5) = 1728*1635+1672;
P(1587, 6) = 1728*1672+1673;
P(1587, 7) = 1728*1673+1390;
P(1587, 8) = 1728*1390+1351;
P(1587, 9) = 1728*1351+1348;
P(1588, 0) = 1728*1350+1359;
P(1588, 1) = 1728*1359+1356;
P(1588, 2) = 1728*1356+1357;
P(1588, 3) = 1728*1357+1358;
P(1588, 4) = 1728*1358+1641;
P(1588, 5) = 1728*1641+1642;
P(1588, 6) = 1728*1642+1643;
P(1588, 7) = 1728*1643+1632;
P(1588, 8) = 1728*1632+1633;
P(1588, 9) = 1728*1633+1350;
P(1589, 0) = 1728*1350+1359;
P(1589, 1) = 1728*1359+1594;
P(1589, 2) = 1728*1594+1595;
P(1589, 3) = 1728*1595+1644;
P(1589, 4) = 1728*1644+1647;
P(1589, 5) = 1728*1647+1638;
P(1589, 6) = 1728*1638+1637;
P(1589, 7) = 1728*1637+1632;
P(1589, 8) = 1728*1632+1633;
P(1589, 9) = 1728*1633+1350;
P(1590, 0) = 1728*1351+1390;
P(1590, 1) = 1728*1390+1389;
P(1590, 2) = 1728*1389+1388;
P(1590, 3) = 1728*1388+1391;
P(1590, 4) = 1728*1391+1626;
P(1590, 5) = 1728*1626+1625;
P(1590, 6) = 1728*1625+1624;
P(1590, 7) = 1728*1624+1587;
P(1590, 8) = 1728*1587+1586;
P(1590, 9) = 1728*1586+1351;
P(1591, 0) = 1728*1351+1390;
P(1591, 1) = 1728*1390+1673;
P(1591, 2) = 1728*1673+1672;
P(1591, 3) = 1728*1672+1677;
P(1591, 4) = 1728*1677+1678;
P(1591, 5) = 1728*1678+1639;
P(1591, 6) = 1728*1639+1636;
P(1591, 7) = 1728*1636+1587;
P(1591, 8) = 1728*1587+1586;
P(1591, 9) = 1728*1586+1351;
P(1592, 0) = 1728*1352+1353;
P(1592, 1) = 1728*1353+1354;
P(1592, 2) = 1728*1354+1355;
P(1592, 3) = 1728*1355+1404;
P(1592, 4) = 1728*1404+1405;
P(1592, 5) = 1728*1405+1406;
P(1592, 6) = 1728*1406+1415;
P(1592, 7) = 1728*1415+1412;
P(1592, 8) = 1728*1412+1363;
P(1592, 9) = 1728*1363+1352;
P(1593, 0) = 1728*1352+1353;
P(1593, 1) = 1728*1353+1354;
P(1593, 2) = 1728*1354+1355;
P(1593, 3) = 1728*1355+1404;
P(1593, 4) = 1728*1404+1407;
P(1593, 5) = 1728*1407+1642;
P(1593, 6) = 1728*1642+1641;
P(1593, 7) = 1728*1641+1358;
P(1593, 8) = 1728*1358+1357;
P(1593, 9) = 1728*1357+1352;
P(1594, 0) = 1728*1352+1357;
P(1594, 1) = 1728*1357+1358;
P(1594, 2) = 1728*1358+1367;
P(1594, 3) = 1728*1367+1364;
P(1594, 4) = 1728*1364+1365;
P(1594, 5) = 1728*1365+1360;
P(1594, 6) = 1728*1360+1361;
P(1594, 7) = 1728*1361+1362;
P(1594, 8) = 1728*1362+1363;
P(1594, 9) = 1728*1363+1352;
P(1595, 0) = 1728*1352+1357;
P(1595, 1) = 1728*1357+1358;
P(1595, 2) = 1728*1358+1641;
P(1595, 3) = 1728*1641+1640;
P(1595, 4) = 1728*1640+1651;
P(1595, 5) = 1728*1651+1650;
P(1595, 6) = 1728*1650+1415;
P(1595, 7) = 1728*1415+1412;
P(1595, 8) = 1728*1412+1363;
P(1595, 9) = 1728*1363+1352;
P(1596, 0) = 1728*1356+1357;
P(1596, 1) = 1728*1357+1358;
P(1596, 2) = 1728*1358+1367;
P(1596, 3) = 1728*1367+1602;
P(1596, 4) = 1728*1602+1603;
P(1596, 5) = 1728*1603+1592;
P(1596, 6) = 1728*1592+1593;
P(1596, 7) = 1728*1593+1594;
P(1596, 8) = 1728*1594+1359;
P(1596, 9) = 1728*1359+1356;
P(1597, 0) = 1728*1356+1357;
P(1597, 1) = 1728*1357+1358;
P(1597, 2) = 1728*1358+1641;
P(1597, 3) = 1728*1641+1640;
P(1597, 4) = 1728*1640+1645;
P(1597, 5) = 1728*1645+1644;
P(1597, 6) = 1728*1644+1595;
P(1597, 7) = 1728*1595+1594;
P(1597, 8) = 1728*1594+1359;
P(1597, 9) = 1728*1359+1356;
P(1598, 0) = 1728*1358+1367;
P(1598, 1) = 1728*1367+1364;
P(1598, 2) = 1728*1364+1365;
P(1598, 3) = 1728*1365+1366;
P(1598, 4) = 1728*1366+1649;
P(1598, 5) = 1728*1649+1650;
P(1598, 6) = 1728*1650+1651;
P(1598, 7) = 1728*1651+1640;
P(1598, 8) = 1728*1640+1641;
P(1598, 9) = 1728*1641+1358;
P(1599, 0) = 1728*1358+1367;
P(1599, 1) = 1728*1367+1602;
P(1599, 2) = 1728*1602+1603;
P(1599, 3) = 1728*1603+1652;
P(1599, 4) = 1728*1652+1655;
P(1599, 5) = 1728*1655+1646;
P(1599, 6) = 1728*1646+1645;
P(1599, 7) = 1728*1645+1640;
P(1599, 8) = 1728*1640+1641;
P(1599, 9) = 1728*1641+1358;
P(1600, 0) = 1728*1360+1361;
P(1600, 1) = 1728*1361+1362;
P(1600, 2) = 1728*1362+1363;
P(1600, 3) = 1728*1363+1412;
P(1600, 4) = 1728*1412+1413;
P(1600, 5) = 1728*1413+1414;
P(1600, 6) = 1728*1414+1423;
P(1600, 7) = 1728*1423+1420;
P(1600, 8) = 1728*1420+1371;
P(1600, 9) = 1728*1371+1360;
P(1601, 0) = 1728*1360+1361;
P(1601, 1) = 1728*1361+1362;
P(1601, 2) = 1728*1362+1363;
P(1601, 3) = 1728*1363+1412;
P(1601, 4) = 1728*1412+1415;
P(1601, 5) = 1728*1415+1650;
P(1601, 6) = 1728*1650+1649;
P(1601, 7) = 1728*1649+1366;
P(1601, 8) = 1728*1366+1365;
P(1601, 9) = 1728*1365+1360;
P(1602, 0) = 1728*1360+1365;
P(1602, 1) = 1728*1365+1366;
P(1602, 2) = 1728*1366+1375;
P(1602, 3) = 1728*1375+1372;
P(1602, 4) = 1728*1372+1373;
P(1602, 5) = 1728*1373+1368;
P(1602, 6) = 1728*1368+1369;
P(1602, 7) = 1728*1369+1370;
P(1602, 8) = 1728*1370+1371;
P(1602, 9) = 1728*1371+1360;
P(1603, 0) = 1728*1360+1365;
P(1603, 1) = 1728*1365+1366;
P(1603, 2) = 1728*1366+1649;
P(1603, 3) = 1728*1649+1648;
P(1603, 4) = 1728*1648+1659;
P(1603, 5) = 1728*1659+1658;
P(1603, 6) = 1728*1658+1423;
P(1603, 7) = 1728*1423+1420;
P(1603, 8) = 1728*1420+1371;
P(1603, 9) = 1728*1371+1360;
P(1604, 0) = 1728*1364+1365;
P(1604, 1) = 1728*1365+1366;
P(1604, 2) = 1728*1366+1375;
P(1604, 3) = 1728*1375+1610;
P(1604, 4) = 1728*1610+1611;
P(1604, 5) = 1728*1611+1600;
P(1604, 6) = 1728*1600+1601;
P(1604, 7) = 1728*1601+1602;
P(1604, 8) = 1728*1602+1367;
P(1604, 9) = 1728*1367+1364;
P(1605, 0) = 1728*1364+1365;
P(1605, 1) = 1728*1365+1366;
P(1605, 2) = 1728*1366+1649;
P(1605, 3) = 1728*1649+1648;
P(1605, 4) = 1728*1648+1653;
P(1605, 5) = 1728*1653+1652;
P(1605, 6) = 1728*1652+1603;
P(1605, 7) = 1728*1603+1602;
P(1605, 8) = 1728*1602+1367;
P(1605, 9) = 1728*1367+1364;
P(1606, 0) = 1728*1366+1375;
P(1606, 1) = 1728*1375+1372;
P(1606, 2) = 1728*1372+1373;
P(1606, 3) = 1728*1373+1374;
P(1606, 4) = 1728*1374+1657;
P(1606, 5) = 1728*1657+1658;
P(1606, 6) = 1728*1658+1659;
P(1606, 7) = 1728*1659+1648;
P(1606, 8) = 1728*1648+1649;
P(1606, 9) = 1728*1649+1366;
P(1607, 0) = 1728*1366+1375;
P(1607, 1) = 1728*1375+1610;
P(1607, 2) = 1728*1610+1611;
P(1607, 3) = 1728*1611+1660;
P(1607, 4) = 1728*1660+1663;
P(1607, 5) = 1728*1663+1654;
P(1607, 6) = 1728*1654+1653;
P(1607, 7) = 1728*1653+1648;
P(1607, 8) = 1728*1648+1649;
P(1607, 9) = 1728*1649+1366;
P(1608, 0) = 1728*1368+1369;
P(1608, 1) = 1728*1369+1370;
P(1608, 2) = 1728*1370+1371;
P(1608, 3) = 1728*1371+1420;
P(1608, 4) = 1728*1420+1421;
P(1608, 5) = 1728*1421+1422;
P(1608, 6) = 1728*1422+1431;
P(1608, 7) = 1728*1431+1428;
P(1608, 8) = 1728*1428+1379;
P(1608, 9) = 1728*1379+1368;
P(1609, 0) = 1728*1368+1369;
P(1609, 1) = 1728*1369+1370;
P(1609, 2) = 1728*1370+1371;
P(1609, 3) = 1728*1371+1420;
P(1609, 4) = 1728*1420+1423;
P(1609, 5) = 1728*1423+1658;
P(1609, 6) = 1728*1658+1657;
P(1609, 7) = 1728*1657+1374;
P(1609, 8) = 1728*1374+1373;
P(1609, 9) = 1728*1373+1368;
P(1610, 0) = 1728*1368+1373;
P(1610, 1) = 1728*1373+1374;
P(1610, 2) = 1728*1374+1383;
P(1610, 3) = 1728*1383+1380;
P(1610, 4) = 1728*1380+1381;
P(1610, 5) = 1728*1381+1376;
P(1610, 6) = 1728*1376+1377;
P(1610, 7) = 1728*1377+1378;
P(1610, 8) = 1728*1378+1379;
P(1610, 9) = 1728*1379+1368;
P(1611, 0) = 1728*1368+1373;
P(1611, 1) = 1728*1373+1374;
P(1611, 2) = 1728*1374+1657;
P(1611, 3) = 1728*1657+1656;
P(1611, 4) = 1728*1656+1667;
P(1611, 5) = 1728*1667+1666;
P(1611, 6) = 1728*1666+1431;
P(1611, 7) = 1728*1431+1428;
P(1611, 8) = 1728*1428+1379;
P(1611, 9) = 1728*1379+1368;
P(1612, 0) = 1728*1372+1373;
P(1612, 1) = 1728*1373+1374;
P(1612, 2) = 1728*1374+1383;
P(1612, 3) = 1728*1383+1618;
P(1612, 4) = 1728*1618+1619;
P(1612, 5) = 1728*1619+1608;
P(1612, 6) = 1728*1608+1609;
P(1612, 7) = 1728*1609+1610;
P(1612, 8) = 1728*1610+1375;
P(1612, 9) = 1728*1375+1372;
P(1613, 0) = 1728*1372+1373;
P(1613, 1) = 1728*1373+1374;
P(1613, 2) = 1728*1374+1657;
P(1613, 3) = 1728*1657+1656;
P(1613, 4) = 1728*1656+1661;
P(1613, 5) = 1728*1661+1660;
P(1613, 6) = 1728*1660+1611;
P(1613, 7) = 1728*1611+1610;
P(1613, 8) = 1728*1610+1375;
P(1613, 9) = 1728*1375+1372;
P(1614, 0) = 1728*1374+1383;
P(1614, 1) = 1728*1383+1380;
P(1614, 2) = 1728*1380+1381;
P(1614, 3) = 1728*1381+1382;
P(1614, 4) = 1728*1382+1665;
P(1614, 5) = 1728*1665+1666;
P(1614, 6) = 1728*1666+1667;
P(1614, 7) = 1728*1667+1656;
P(1614, 8) = 1728*1656+1657;
P(1614, 9) = 1728*1657+1374;
P(1615, 0) = 1728*1374+1383;
P(1615, 1) = 1728*1383+1618;
P(1615, 2) = 1728*1618+1619;
P(1615, 3) = 1728*1619+1668;
P(1615, 4) = 1728*1668+1671;
P(1615, 5) = 1728*1671+1662;
P(1615, 6) = 1728*1662+1661;
P(1615, 7) = 1728*1661+1656;
P(1615, 8) = 1728*1656+1657;
P(1615, 9) = 1728*1657+1374;
P(1616, 0) = 1728*1376+1377;
P(1616, 1) = 1728*1377+1378;
P(1616, 2) = 1728*1378+1379;
P(1616, 3) = 1728*1379+1428;
P(1616, 4) = 1728*1428+1429;
P(1616, 5) = 1728*1429+1430;
P(1616, 6) = 1728*1430+1439;
P(1616, 7) = 1728*1439+1436;
P(1616, 8) = 1728*1436+1387;
P(1616, 9) = 1728*1387+1376;
P(1617, 0) = 1728*1376+1377;
P(1617, 1) = 1728*1377+1378;
P(1617, 2) = 1728*1378+1379;
P(1617, 3) = 1728*1379+1428;
P(1617, 4) = 1728*1428+1431;
P(1617, 5) = 1728*1431+1666;
P(1617, 6) = 1728*1666+1665;
P(1617, 7) = 1728*1665+1382;
P(1617, 8) = 1728*1382+1381;
P(1617, 9) = 1728*1381+1376;
P(1618, 0) = 1728*1376+1381;
P(1618, 1) = 1728*1381+1382;
P(1618, 2) = 1728*1382+1391;
P(1618, 3) = 1728*1391+1388;
P(1618, 4) = 1728*1388+1389;
P(1618, 5) = 1728*1389+1384;
P(1618, 6) = 1728*1384+1385;
P(1618, 7) = 1728*1385+1386;
P(1618, 8) = 1728*1386+1387;
P(1618, 9) = 1728*1387+1376;
P(1619, 0) = 1728*1376+1381;
P(1619, 1) = 1728*1381+1382;
P(1619, 2) = 1728*1382+1665;
P(1619, 3) = 1728*1665+1664;
P(1619, 4) = 1728*1664+1675;
P(1619, 5) = 1728*1675+1674;
P(1619, 6) = 1728*1674+1439;
P(1619, 7) = 1728*1439+1436;
P(1619, 8) = 1728*1436+1387;
P(1619, 9) = 1728*1387+1376;
P(1620, 0) = 1728*1380+1381;
P(1620, 1) = 1728*1381+1382;
P(1620, 2) = 1728*1382+1391;
P(1620, 3) = 1728*1391+1626;
P(1620, 4) = 1728*1626+1627;
P(1620, 5) = 1728*1627+1616;
P(1620, 6) = 1728*1616+1617;
P(1620, 7) = 1728*1617+1618;
P(1620, 8) = 1728*1618+1383;
P(1620, 9) = 1728*1383+1380;
P(1621, 0) = 1728*1380+1381;
P(1621, 1) = 1728*1381+1382;
P(1621, 2) = 1728*1382+1665;
P(1621, 3) = 1728*1665+1664;
P(1621, 4) = 1728*1664+1669;
P(1621, 5) = 1728*1669+1668;
P(1621, 6) = 1728*1668+1619;
P(1621, 7) = 1728*1619+1618;
P(1621, 8) = 1728*1618+1383;
P(1621, 9) = 1728*1383+1380;
P(1622, 0) = 1728*1382+1391;
P(1622, 1) = 1728*1391+1388;
P(1622, 2) = 1728*1388+1389;
P(1622, 3) = 1728*1389+1390;
P(1622, 4) = 1728*1390+1673;
P(1622, 5) = 1728*1673+1674;
P(1622, 6) = 1728*1674+1675;
P(1622, 7) = 1728*1675+1664;
P(1622, 8) = 1728*1664+1665;
P(1622, 9) = 1728*1665+1382;
P(1623, 0) = 1728*1382+1391;
P(1623, 1) = 1728*1391+1626;
P(1623, 2) = 1728*1626+1627;
P(1623, 3) = 1728*1627+1676;
P(1623, 4) = 1728*1676+1679;
P(1623, 5) = 1728*1679+1670;
P(1623, 6) = 1728*1670+1669;
P(1623, 7) = 1728*1669+1664;
P(1623, 8) = 1728*1664+1665;
P(1623, 9) = 1728*1665+1382;
P(1624, 0) = 1728*1384+1385;
P(1624, 1) = 1728*1385+1386;
P(1624, 2) = 1728*1386+1387;
P(1624, 3) = 1728*1387+1436;
P(1624, 4) = 1728*1436+1439;
P(1624, 5) = 1728*1439+1674;
P(1624, 6) = 1728*1674+1673;
P(1624, 7) = 1728*1673+1390;
P(1624, 8) = 1728*1390+1389;
P(1624, 9) = 1728*1389+1384;
P(1625, 0) = 1728*1388+1389;
P(1625, 1) = 1728*1389+1390;
P(1625, 2) = 1728*1390+1673;
P(1625, 3) = 1728*1673+1672;
P(1625, 4) = 1728*1672+1677;
P(1625, 5) = 1728*1677+1676;
P(1625, 6) = 1728*1676+1627;
P(1625, 7) = 1728*1627+1626;
P(1625, 8) = 1728*1626+1391;
P(1625, 9) = 1728*1391+1388;
P(1626, 0) = 1728*1392+1393;
P(1626, 1) = 1728*1393+1394;
P(1626, 2) = 1728*1394+1395;
P(1626, 3) = 1728*1395+1432;
P(1626, 4) = 1728*1432+1437;
P(1626, 5) = 1728*1437+1438;
P(1626, 6) = 1728*1438+1399;
P(1626, 7) = 1728*1399+1396;
P(1626, 8) = 1728*1396+1397;
P(1626, 9) = 1728*1397+1392;
P(1627, 0) = 1728*1392+1397;
P(1627, 1) = 1728*1397+1398;
P(1627, 2) = 1728*1398+1407;
P(1627, 3) = 1728*1407+1404;
P(1627, 4) = 1728*1404+1405;
P(1627, 5) = 1728*1405+1400;
P(1627, 6) = 1728*1400+1401;
P(1627, 7) = 1728*1401+1402;
P(1627, 8) = 1728*1402+1403;
P(1627, 9) = 1728*1403+1392;
P(1628, 0) = 1728*1396+1397;
P(1628, 1) = 1728*1397+1398;
P(1628, 2) = 1728*1398+1407;
P(1628, 3) = 1728*1407+1642;
P(1628, 4) = 1728*1642+1643;
P(1628, 5) = 1728*1643+1632;
P(1628, 6) = 1728*1632+1633;
P(1628, 7) = 1728*1633+1634;
P(1628, 8) = 1728*1634+1399;
P(1628, 9) = 1728*1399+1396;
P(1629, 0) = 1728*1396+1397;
P(1629, 1) = 1728*1397+1398;
P(1629, 2) = 1728*1398+1681;
P(1629, 3) = 1728*1681+1680;
P(1629, 4) = 1728*1680+1685;
P(1629, 5) = 1728*1685+1684;
P(1629, 6) = 1728*1684+1635;
P(1629, 7) = 1728*1635+1634;
P(1629, 8) = 1728*1634+1399;
P(1629, 9) = 1728*1399+1396;
P(1630, 0) = 1728*1396+1397;
P(1630, 1) = 1728*1397+1398;
P(1630, 2) = 1728*1398+1681;
P(1630, 3) = 1728*1681+1682;
P(1630, 4) = 1728*1682+1683;
P(1630, 5) = 1728*1683+1720;
P(1630, 6) = 1728*1720+1721;
P(1630, 7) = 1728*1721+1438;
P(1630, 8) = 1728*1438+1399;
P(1630, 9) = 1728*1399+1396;
P(1631, 0) = 1728*1398+1407;
P(1631, 1) = 1728*1407+1404;
P(1631, 2) = 1728*1404+1405;
P(1631, 3) = 1728*1405+1406;
P(1631, 4) = 1728*1406+1689;
P(1631, 5) = 1728*1689+1690;
P(1631, 6) = 1728*1690+1691;
P(1631, 7) = 1728*1691+1680;
P(1631, 8) = 1728*1680+1681;
P(1631, 9) = 1728*1681+1398;
P(1632, 0) = 1728*1398+1407;
P(1632, 1) = 1728*1407+1642;
P(1632, 2) = 1728*1642+1643;
P(1632, 3) = 1728*1643+1692;
P(1632, 4) = 1728*1692+1695;
P(1632, 5) = 1728*1695+1686;
P(1632, 6) = 1728*1686+1685;
P(1632, 7) = 1728*1685+1680;
P(1632, 8) = 1728*1680+1681;
P(1632, 9) = 1728*1681+1398;
P(1633, 0) = 1728*1399+1438;
P(1633, 1) = 1728*1438+1437;
P(1633, 2) = 1728*1437+1436;
P(1633, 3) = 1728*1436+1439;
P(1633, 4) = 1728*1439+1674;
P(1633, 5) = 1728*1674+1673;
P(1633, 6) = 1728*1673+1672;
P(1633, 7) = 1728*1672+1635;
P(1633, 8) = 1728*1635+1634;
P(1633, 9) = 1728*1634+1399;
P(1634, 0) = 1728*1399+1438;
P(1634, 1) = 1728*1438+1721;
P(1634, 2) = 1728*1721+1720;
P(1634, 3) = 1728*1720+1725;
P(1634, 4) = 1728*1725+1726;
P(1634, 5) = 1728*1726+1687;
P(1634, 6) = 1728*1687+1684;
P(1634, 7) = 1728*1684+1635;
P(1634, 8) = 1728*1635+1634;
P(1634, 9) = 1728*1634+1399;
P(1635, 0) = 1728*1400+1405;
P(1635, 1) = 1728*1405+1406;
P(1635, 2) = 1728*1406+1415;
P(1635, 3) = 1728*1415+1412;
P(1635, 4) = 1728*1412+1413;
P(1635, 5) = 1728*1413+1408;
P(1635, 6) = 1728*1408+1409;
P(1635, 7) = 1728*1409+1410;
P(1635, 8) = 1728*1410+1411;
P(1635, 9) = 1728*1411+1400;
P(1636, 0) = 1728*1404+1405;
P(1636, 1) = 1728*1405+1406;
P(1636, 2) = 1728*1406+1415;
P(1636, 3) = 1728*1415+1650;
P(1636, 4) = 1728*1650+1651;
P(1636, 5) = 1728*1651+1640;
P(1636, 6) = 1728*1640+1641;
P(1636, 7) = 1728*1641+1642;
P(1636, 8) = 1728*1642+1407;
P(1636, 9) = 1728*1407+1404;
P(1637, 0) = 1728*1404+1405;
P(1637, 1) = 1728*1405+1406;
P(1637, 2) = 1728*1406+1689;
P(1637, 3) = 1728*1689+1688;
P(1637, 4) = 1728*1688+1693;
P(1637, 5) = 1728*1693+1692;
P(1637, 6) = 1728*1692+1643;
P(1637, 7) = 1728*1643+1642;
P(1637, 8) = 1728*1642+1407;
P(1637, 9) = 1728*1407+1404;
P(1638, 0) = 1728*1406+1415;
P(1638, 1) = 1728*1415+1412;
P(1638, 2) = 1728*1412+1413;
P(1638, 3) = 1728*1413+1414;
P(1638, 4) = 1728*1414+1697;
P(1638, 5) = 1728*1697+1698;
P(1638, 6) = 1728*1698+1699;
P(1638, 7) = 1728*1699+1688;
P(1638, 8) = 1728*1688+1689;
P(1638, 9) = 1728*1689+1406;
P(1639, 0) = 1728*1406+1415;
P(1639, 1) = 1728*1415+1650;
P(1639, 2) = 1728*1650+1651;
P(1639, 3) = 1728*1651+1700;
P(1639, 4) = 1728*1700+1703;
P(1639, 5) = 1728*1703+1694;
P(1639, 6) = 1728*1694+1693;
P(1639, 7) = 1728*1693+1688;
P(1639, 8) = 1728*1688+1689;
P(1639, 9) = 1728*1689+1406;
P(1640, 0) = 1728*1408+1413;
P(1640, 1) = 1728*1413+1414;
P(1640, 2) = 1728*1414+1423;
P(1640, 3) = 1728*1423+1420;
P(1640, 4) = 1728*1420+1421;
P(1640, 5) = 1728*1421+1416;
P(1640, 6) = 1728*1416+1417;
P(1640, 7) = 1728*1417+1418;
P(1640, 8) = 1728*1418+1419;
P(1640, 9) = 1728*1419+1408;
P(1641, 0) = 1728*1412+1413;
P(1641, 1) = 1728*1413+1414;
P(1641, 2) = 1728*1414+1423;
P(1641, 3) = 1728*1423+1658;
P(1641, 4) = 1728*1658+1659;
P(1641, 5) = 1728*1659+1648;
P(1641, 6) = 1728*1648+1649;
P(1641, 7) = 1728*1649+1650;
P(1641, 8) = 1728*1650+1415;
P(1641, 9) = 1728*1415+1412;
P(1642, 0) = 1728*1412+1413;
P(1642, 1) = 1728*1413+1414;
P(1642, 2) = 1728*1414+1697;
P(1642, 3) = 1728*1697+1696;
P(1642, 4) = 1728*1696+1701;
P(1642, 5) = 1728*1701+1700;
P(1642, 6) = 1728*1700+1651;
P(1642, 7) = 1728*1651+1650;
P(1642, 8) = 1728*1650+1415;
P(1642, 9) = 1728*1415+1412;
P(1643, 0) = 1728*1414+1423;
P(1643, 1) = 1728*1423+1420;
P(1643, 2) = 1728*1420+1421;
P(1643, 3) = 1728*1421+1422;
P(1643, 4) = 1728*1422+1705;
P(1643, 5) = 1728*1705+1706;
P(1643, 6) = 1728*1706+1707;
P(1643, 7) = 1728*1707+1696;
P(1643, 8) = 1728*1696+1697;
P(1643, 9) = 1728*1697+1414;
P(1644, 0) = 1728*1414+1423;
P(1644, 1) = 1728*1423+1658;
P(1644, 2) = 1728*1658+1659;
P(1644, 3) = 1728*1659+1708;
P(1644, 4) = 1728*1708+1711;
P(1644, 5) = 1728*1711+1702;
P(1644, 6) = 1728*1702+1701;
P(1644, 7) = 1728*1701+1696;
P(1644, 8) = 1728*1696+1697;
P(1644, 9) = 1728*1697+1414;
P(1645, 0) = 1728*1416+1421;
P(1645, 1) = 1728*1421+1422;
P(1645, 2) = 1728*1422+1431;
P(1645, 3) = 1728*1431+1428;
P(1645, 4) = 1728*1428+1429;
P(1645, 5) = 1728*1429+1424;
P(1645, 6) = 1728*1424+1425;
P(1645, 7) = 1728*1425+1426;
P(1645, 8) = 1728*1426+1427;
P(1645, 9) = 1728*1427+1416;
P(1646, 0) = 1728*1420+1421;
P(1646, 1) = 1728*1421+1422;
P(1646, 2) = 1728*1422+1431;
P(1646, 3) = 1728*1431+1666;
P(1646, 4) = 1728*1666+1667;
P(1646, 5) = 1728*1667+1656;
P(1646, 6) = 1728*1656+1657;
P(1646, 7) = 1728*1657+1658;
P(1646, 8) = 1728*1658+1423;
P(1646, 9) = 1728*1423+1420;
P(1647, 0) = 1728*1420+1421;
P(1647, 1) = 1728*1421+1422;
P(1647, 2) = 1728*1422+1705;
P(1647, 3) = 1728*1705+1704;
P(1647, 4) = 1728*1704+1709;
P(1647, 5) = 1728*1709+1708;
P(1647, 6) = 1728*1708+1659;
P(1647, 7) = 1728*1659+1658;
P(1647, 8) = 1728*1658+1423;
P(1647, 9) = 1728*1423+1420;
P(1648, 0) = 1728*1422+1431;
P(1648, 1) = 1728*1431+1428;
P(1648, 2) = 1728*1428+1429;
P(1648, 3) = 1728*1429+1430;
P(1648, 4) = 1728*1430+1713;
P(1648, 5) = 1728*1713+1714;
P(1648, 6) = 1728*1714+1715;
P(1648, 7) = 1728*1715+1704;
P(1648, 8) = 1728*1704+1705;
P(1648, 9) = 1728*1705+1422;
P(1649, 0) = 1728*1422+1431;
P(1649, 1) = 1728*1431+1666;
P(1649, 2) = 1728*1666+1667;
P(1649, 3) = 1728*1667+1716;
P(1649, 4) = 1728*1716+1719;
P(1649, 5) = 1728*1719+1710;
P(1649, 6) = 1728*1710+1709;
P(1649, 7) = 1728*1709+1704;
P(1649, 8) = 1728*1704+1705;
P(1649, 9) = 1728*1705+1422;
P(1650, 0) = 1728*1424+1429;
P(1650, 1) = 1728*1429+1430;
P(1650, 2) = 1728*1430+1439;
P(1650, 3) = 1728*1439+1436;
P(1650, 4) = 1728*1436+1437;
P(1650, 5) = 1728*1437+1432;
P(1650, 6) = 1728*1432+1433;
P(1650, 7) = 1728*1433+1434;
P(1650, 8) = 1728*1434+1435;
P(1650, 9) = 1728*1435+1424;
P(1651, 0) = 1728*1428+1429;
P(1651, 1) = 1728*1429+1430;
P(1651, 2) = 1728*1430+1439;
P(1651, 3) = 1728*1439+1674;
P(1651, 4) = 1728*1674+1675;
P(1651, 5) = 1728*1675+1664;
P(1651, 6) = 1728*1664+1665;
P(1651, 7) = 1728*1665+1666;
P(1651, 8) = 1728*1666+1431;
P(1651, 9) = 1728*1431+1428;
P(1652, 0) = 1728*1428+1429;
P(1652, 1) = 1728*1429+1430;
P(1652, 2) = 1728*1430+1713;
P(1652, 3) = 1728*1713+1712;
P(1652, 4) = 1728*1712+1717;
P(1652, 5) = 1728*1717+1716;
P(1652, 6) = 1728*1716+1667;
P(1652, 7) = 1728*1667+1666;
P(1652, 8) = 1728*1666+1431;
P(1652, 9) = 1728*1431+1428;
P(1653, 0) = 1728*1430+1439;
P(1653, 1) = 1728*1439+1436;
P(1653, 2) = 1728*1436+1437;
P(1653, 3) = 1728*1437+1438;
P(1653, 4) = 1728*1438+1721;
P(1653, 5) = 1728*1721+1722;
P(1653, 6) = 1728*1722+1723;
P(1653, 7) = 1728*1723+1712;
P(1653, 8) = 1728*1712+1713;
P(1653, 9) = 1728*1713+1430;
P(1654, 0) = 1728*1430+1439;
P(1654, 1) = 1728*1439+1674;
P(1654, 2) = 1728*1674+1675;
P(1654, 3) = 1728*1675+1724;
P(1654, 4) = 1728*1724+1727;
P(1654, 5) = 1728*1727+1718;
P(1654, 6) = 1728*1718+1717;
P(1654, 7) = 1728*1717+1712;
P(1654, 8) = 1728*1712+1713;
P(1654, 9) = 1728*1713+1430;
P(1655, 0) = 1728*1436+1437;
P(1655, 1) = 1728*1437+1438;
P(1655, 2) = 1728*1438+1721;
P(1655, 3) = 1728*1721+1720;
P(1655, 4) = 1728*1720+1725;
P(1655, 5) = 1728*1725+1724;
P(1655, 6) = 1728*1724+1675;
P(1655, 7) = 1728*1675+1674;
P(1655, 8) = 1728*1674+1439;
P(1655, 9) = 1728*1439+1436;
P(1656, 0) = 1728*1440+1441;
P(1656, 1) = 1728*1441+1442;
P(1656, 2) = 1728*1442+1443;
P(1656, 3) = 1728*1443+1492;
P(1656, 4) = 1728*1492+1493;
P(1656, 5) = 1728*1493+1494;
P(1656, 6) = 1728*1494+1503;
P(1656, 7) = 1728*1503+1500;
P(1656, 8) = 1728*1500+1451;
P(1656, 9) = 1728*1451+1440;
P(1657, 0) = 1728*1440+1441;
P(1657, 1) = 1728*1441+1442;
P(1657, 2) = 1728*1442+1443;
P(1657, 3) = 1728*1443+1480;
P(1657, 4) = 1728*1480+1485;
P(1657, 5) = 1728*1485+1486;
P(1657, 6) = 1728*1486+1447;
P(1657, 7) = 1728*1447+1444;
P(1657, 8) = 1728*1444+1445;
P(1657, 9) = 1728*1445+1440;
P(1658, 0) = 1728*1440+1445;
P(1658, 1) = 1728*1445+1446;
P(1658, 2) = 1728*1446+1455;
P(1658, 3) = 1728*1455+1452;
P(1658, 4) = 1728*1452+1453;
P(1658, 5) = 1728*1453+1448;
P(1658, 6) = 1728*1448+1449;
P(1658, 7) = 1728*1449+1450;
P(1658, 8) = 1728*1450+1451;
P(1658, 9) = 1728*1451+1440;
P(1659, 0) = 1728*1443+1492;
P(1659, 1) = 1728*1492+1495;
P(1659, 2) = 1728*1495+1534;
P(1659, 3) = 1728*1534+1533;
P(1659, 4) = 1728*1533+1532;
P(1659, 5) = 1728*1532+1483;
P(1659, 6) = 1728*1483+1482;
P(1659, 7) = 1728*1482+1481;
P(1659, 8) = 1728*1481+1480;
P(1659, 9) = 1728*1480+1443;
P(1660, 0) = 1728*1444+1445;
P(1660, 1) = 1728*1445+1446;
P(1660, 2) = 1728*1446+1455;
P(1660, 3) = 1728*1455+1452;
P(1660, 4) = 1728*1452+1691;
P(1660, 5) = 1728*1691+1680;
P(1660, 6) = 1728*1680+1681;
P(1660, 7) = 1728*1681+1682;
P(1660, 8) = 1728*1682+1683;
P(1660, 9) = 1728*1683+1444;
P(1661, 0) = 1728*1444+1683;
P(1661, 1) = 1728*1683+1720;
P(1661, 2) = 1728*1720+1721;
P(1661, 3) = 1728*1721+1722;
P(1661, 4) = 1728*1722+1723;
P(1661, 5) = 1728*1723+1484;
P(1661, 6) = 1728*1484+1485;
P(1661, 7) = 1728*1485+1486;
P(1661, 8) = 1728*1486+1447;
P(1661, 9) = 1728*1447+1444;
P(1662, 0) = 1728*1448+1449;
P(1662, 1) = 1728*1449+1450;
P(1662, 2) = 1728*1450+1451;
P(1662, 3) = 1728*1451+1500;
P(1662, 4) = 1728*1500+1501;
P(1662, 5) = 1728*1501+1502;
P(1662, 6) = 1728*1502+1511;
P(1662, 7) = 1728*1511+1508;
P(1662, 8) = 1728*1508+1459;
P(1662, 9) = 1728*1459+1448;
P(1663, 0) = 1728*1448+1453;
P(1663, 1) = 1728*1453+1454;
P(1663, 2) = 1728*1454+1463;
P(1663, 3) = 1728*1463+1460;
P(1663, 4) = 1728*1460+1461;
P(1663, 5) = 1728*1461+1456;
P(1663, 6) = 1728*1456+1457;
P(1663, 7) = 1728*1457+1458;
P(1663, 8) = 1728*1458+1459;
P(1663, 9) = 1728*1459+1448;
P(1664, 0) = 1728*1452+1453;
P(1664, 1) = 1728*1453+1454;
P(1664, 2) = 1728*1454+1463;
P(1664, 3) = 1728*1463+1460;
P(1664, 4) = 1728*1460+1699;
P(1664, 5) = 1728*1699+1688;
P(1664, 6) = 1728*1688+1689;
P(1664, 7) = 1728*1689+1690;
P(1664, 8) = 1728*1690+1691;
P(1664, 9) = 1728*1691+1452;
P(1665, 0) = 1728*1456+1457;
P(1665, 1) = 1728*1457+1458;
P(1665, 2) = 1728*1458+1459;
P(1665, 3) = 1728*1459+1508;
P(1665, 4) = 1728*1508+1509;
P(1665, 5) = 1728*1509+1510;
P(1665, 6) = 1728*1510+1519;
P(1665, 7) = 1728*1519+1516;
P(1665, 8) = 1728*1516+1467;
P(1665, 9) = 1728*1467+1456;
P(1666, 0) = 1728*1456+1461;
P(1666, 1) = 1728*1461+1462;
P(1666, 2) = 1728*1462+1471;
P(1666, 3) = 1728*1471+1468;
P(1666, 4) = 1728*1468+1469;
P(1666, 5) = 1728*1469+1464;
P(1666, 6) = 1728*1464+1465;
P(1666, 7) = 1728*1465+1466;
P(1666, 8) = 1728*1466+1467;
P(1666, 9) = 1728*1467+1456;
P(1667, 0) = 1728*1460+1461;
P(1667, 1) = 1728*1461+1462;
P(1667, 2) = 1728*1462+1471;
P(1667, 3) = 1728*1471+1468;
P(1667, 4) = 1728*1468+1707;
P(1667, 5) = 1728*1707+1696;
P(1667, 6) = 1728*1696+1697;
P(1667, 7) = 1728*1697+1698;
P(1667, 8) = 1728*1698+1699;
P(1667, 9) = 1728*1699+1460;
P(1668, 0) = 1728*1464+1465;
P(1668, 1) = 1728*1465+1466;
P(1668, 2) = 1728*1466+1467;
P(1668, 3) = 1728*1467+1516;
P(1668, 4) = 1728*1516+1517;
P(1668, 5) = 1728*1517+1518;
P(1668, 6) = 1728*1518+1527;
P(1668, 7) = 1728*1527+1524;
P(1668, 8) = 1728*1524+1475;
P(1668, 9) = 1728*1475+1464;
P(1669, 0) = 1728*1464+1469;
P(1669, 1) = 1728*1469+1470;
P(1669, 2) = 1728*1470+1479;
P(1669, 3) = 1728*1479+1476;
P(1669, 4) = 1728*1476+1477;
P(1669, 5) = 1728*1477+1472;
P(1669, 6) = 1728*1472+1473;
P(1669, 7) = 1728*1473+1474;
P(1669, 8) = 1728*1474+1475;
P(1669, 9) = 1728*1475+1464;
P(1670, 0) = 1728*1468+1469;
P(1670, 1) = 1728*1469+1470;
P(1670, 2) = 1728*1470+1479;
P(1670, 3) = 1728*1479+1476;
P(1670, 4) = 1728*1476+1715;
P(1670, 5) = 1728*1715+1704;
P(1670, 6) = 1728*1704+1705;
P(1670, 7) = 1728*1705+1706;
P(1670, 8) = 1728*1706+1707;
P(1670, 9) = 1728*1707+1468;
P(1671, 0) = 1728*1472+1473;
P(1671, 1) = 1728*1473+1474;
P(1671, 2) = 1728*1474+1475;
P(1671, 3) = 1728*1475+1524;
P(1671, 4) = 1728*1524+1525;
P(1671, 5) = 1728*1525+1526;
P(1671, 6) = 1728*1526+1535;
P(1671, 7) = 1728*1535+1532;
P(1671, 8) = 1728*1532+1483;
P(1671, 9) = 1728*1483+1472;
P(1672, 0) = 1728*1472+1477;
P(1672, 1) = 1728*1477+1478;
P(1672, 2) = 1728*1478+1487;
P(1672, 3) = 1728*1487+1484;
P(1672, 4) = 1728*1484+1485;
P(1672, 5) = 1728*1485+1480;
P(1672, 6) = 1728*1480+1481;
P(1672, 7) = 1728*1481+1482;
P(1672, 8) = 1728*1482+1483;
P(1672, 9) = 1728*1483+1472;
P(1673, 0) = 1728*1476+1477;
P(1673, 1) = 1728*1477+1478;
P(1673, 2) = 1728*1478+1487;
P(1673, 3) = 1728*1487+1484;
P(1673, 4) = 1728*1484+1723;
P(1673, 5) = 1728*1723+1712;
P(1673, 6) = 1728*1712+1713;
P(1673, 7) = 1728*1713+1714;
P(1673, 8) = 1728*1714+1715;
P(1673, 9) = 1728*1715+1476;
P(1674, 0) = 1728*1488+1489;
P(1674, 1) = 1728*1489+1490;
P(1674, 2) = 1728*1490+1491;
P(1674, 3) = 1728*1491+1540;
P(1674, 4) = 1728*1540+1541;
P(1674, 5) = 1728*1541+1542;
P(1674, 6) = 1728*1542+1551;
P(1674, 7) = 1728*1551+1548;
P(1674, 8) = 1728*1548+1499;
P(1674, 9) = 1728*1499+1488;
P(1675, 0) = 1728*1488+1489;
P(1675, 1) = 1728*1489+1490;
P(1675, 2) = 1728*1490+1491;
P(1675, 3) = 1728*1491+1528;
P(1675, 4) = 1728*1528+1533;
P(1675, 5) = 1728*1533+1534;
P(1675, 6) = 1728*1534+1495;
P(1675, 7) = 1728*1495+1492;
P(1675, 8) = 1728*1492+1493;
P(1675, 9) = 1728*1493+1488;
P(1676, 0) = 1728*1488+1493;
P(1676, 1) = 1728*1493+1494;
P(1676, 2) = 1728*1494+1503;
P(1676, 3) = 1728*1503+1500;
P(1676, 4) = 1728*1500+1501;
P(1676, 5) = 1728*1501+1496;
P(1676, 6) = 1728*1496+1497;
P(1676, 7) = 1728*1497+1498;
P(1676, 8) = 1728*1498+1499;
P(1676, 9) = 1728*1499+1488;
P(1677, 0) = 1728*1491+1540;
P(1677, 1) = 1728*1540+1543;
P(1677, 2) = 1728*1543+1582;
P(1677, 3) = 1728*1582+1581;
P(1677, 4) = 1728*1581+1580;
P(1677, 5) = 1728*1580+1531;
P(1677, 6) = 1728*1531+1530;
P(1677, 7) = 1728*1530+1529;
P(1677, 8) = 1728*1529+1528;
P(1677, 9) = 1728*1528+1491;
P(1678, 0) = 1728*1496+1497;
P(1678, 1) = 1728*1497+1498;
P(1678, 2) = 1728*1498+1499;
P(1678, 3) = 1728*1499+1548;
P(1678, 4) = 1728*1548+1549;
P(1678, 5) = 1728*1549+1550;
P(1678, 6) = 1728*1550+1559;
P(1678, 7) = 1728*1559+1556;
P(1678, 8) = 1728*1556+1507;
P(1678, 9) = 1728*1507+1496;
P(1679, 0) = 1728*1496+1501;
P(1679, 1) = 1728*1501+1502;
P(1679, 2) = 1728*1502+1511;
P(1679, 3) = 1728*1511+1508;
P(1679, 4) = 1728*1508+1509;
P(1679, 5) = 1728*1509+1504;
P(1679, 6) = 1728*1504+1505;
P(1679, 7) = 1728*1505+1506;
P(1679, 8) = 1728*1506+1507;
P(1679, 9) = 1728*1507+1496;
P(1680, 0) = 1728*1504+1505;
P(1680, 1) = 1728*1505+1506;
P(1680, 2) = 1728*1506+1507;
P(1680, 3) = 1728*1507+1556;
P(1680, 4) = 1728*1556+1557;
P(1680, 5) = 1728*1557+1558;
P(1680, 6) = 1728*1558+1567;
P(1680, 7) = 1728*1567+1564;
P(1680, 8) = 1728*1564+1515;
P(1680, 9) = 1728*1515+1504;
P(1681, 0) = 1728*1504+1509;
P(1681, 1) = 1728*1509+1510;
P(1681, 2) = 1728*1510+1519;
P(1681, 3) = 1728*1519+1516;
P(1681, 4) = 1728*1516+1517;
P(1681, 5) = 1728*1517+1512;
P(1681, 6) = 1728*1512+1513;
P(1681, 7) = 1728*1513+1514;
P(1681, 8) = 1728*1514+1515;
P(1681, 9) = 1728*1515+1504;
P(1682, 0) = 1728*1512+1513;
P(1682, 1) = 1728*1513+1514;
P(1682, 2) = 1728*1514+1515;
P(1682, 3) = 1728*1515+1564;
P(1682, 4) = 1728*1564+1565;
P(1682, 5) = 1728*1565+1566;
P(1682, 6) = 1728*1566+1575;
P(1682, 7) = 1728*1575+1572;
P(1682, 8) = 1728*1572+1523;
P(1682, 9) = 1728*1523+1512;
P(1683, 0) = 1728*1512+1517;
P(1683, 1) = 1728*1517+1518;
P(1683, 2) = 1728*1518+1527;
P(1683, 3) = 1728*1527+1524;
P(1683, 4) = 1728*1524+1525;
P(1683, 5) = 1728*1525+1520;
P(1683, 6) = 1728*1520+1521;
P(1683, 7) = 1728*1521+1522;
P(1683, 8) = 1728*1522+1523;
P(1683, 9) = 1728*1523+1512;
P(1684, 0) = 1728*1520+1521;
P(1684, 1) = 1728*1521+1522;
P(1684, 2) = 1728*1522+1523;
P(1684, 3) = 1728*1523+1572;
P(1684, 4) = 1728*1572+1573;
P(1684, 5) = 1728*1573+1574;
P(1684, 6) = 1728*1574+1583;
P(1684, 7) = 1728*1583+1580;
P(1684, 8) = 1728*1580+1531;
P(1684, 9) = 1728*1531+1520;
P(1685, 0) = 1728*1520+1525;
P(1685, 1) = 1728*1525+1526;
P(1685, 2) = 1728*1526+1535;
P(1685, 3) = 1728*1535+1532;
P(1685, 4) = 1728*1532+1533;
P(1685, 5) = 1728*1533+1528;
P(1685, 6) = 1728*1528+1529;
P(1685, 7) = 1728*1529+1530;
P(1685, 8) = 1728*1530+1531;
P(1685, 9) = 1728*1531+1520;
P(1686, 0) = 1728*1536+1537;
P(1686, 1) = 1728*1537+1538;
P(1686, 2) = 1728*1538+1539;
P(1686, 3) = 1728*1539+1588;
P(1686, 4) = 1728*1588+1589;
P(1686, 5) = 1728*1589+1590;
P(1686, 6) = 1728*1590+1599;
P(1686, 7) = 1728*1599+1596;
P(1686, 8) = 1728*1596+1547;
P(1686, 9) = 1728*1547+1536;
P(1687, 0) = 1728*1536+1537;
P(1687, 1) = 1728*1537+1538;
P(1687, 2) = 1728*1538+1539;
P(1687, 3) = 1728*1539+1576;
P(1687, 4) = 1728*1576+1581;
P(1687, 5) = 1728*1581+1582;
P(1687, 6) = 1728*1582+1543;
P(1687, 7) = 1728*1543+1540;
P(1687, 8) = 1728*1540+1541;
P(1687, 9) = 1728*1541+1536;
P(1688, 0) = 1728*1536+1541;
P(1688, 1) = 1728*1541+1542;
P(1688, 2) = 1728*1542+1551;
P(1688, 3) = 1728*1551+1548;
P(1688, 4) = 1728*1548+1549;
P(1688, 5) = 1728*1549+1544;
P(1688, 6) = 1728*1544+1545;
P(1688, 7) = 1728*1545+1546;
P(1688, 8) = 1728*1546+1547;
P(1688, 9) = 1728*1547+1536;
P(1689, 0) = 1728*1539+1588;
P(1689, 1) = 1728*1588+1591;
P(1689, 2) = 1728*1591+1630;
P(1689, 3) = 1728*1630+1629;
P(1689, 4) = 1728*1629+1628;
P(1689, 5) = 1728*1628+1579;
P(1689, 6) = 1728*1579+1578;
P(1689, 7) = 1728*1578+1577;
P(1689, 8) = 1728*1577+1576;
P(1689, 9) = 1728*1576+1539;
P(1690, 0) = 1728*1544+1545;
P(1690, 1) = 1728*1545+1546;
P(1690, 2) = 1728*1546+1547;
P(1690, 3) = 1728*1547+1596;
P(1690, 4) = 1728*1596+1597;
P(1690, 5) = 1728*1597+1598;
P(1690, 6) = 1728*1598+1607;
P(1690, 7) = 1728*1607+1604;
P(1690, 8) = 1728*1604+1555;
P(1690, 9) = 1728*1555+1544;
P(1691, 0) = 1728*1544+1549;
P(1691, 1) = 1728*1549+1550;
P(1691, 2) = 1728*1550+1559;
P(1691, 3) = 1728*1559+1556;
P(1691, 4) = 1728*1556+1557;
P(1691, 5) = 1728*1557+1552;
P(1691, 6) = 1728*1552+1553;
P(1691, 7) = 1728*1553+1554;
P(1691, 8) = 1728*1554+1555;
P(1691, 9) = 1728*1555+1544;
P(1692, 0) = 1728*1552+1553;
P(1692, 1) = 1728*1553+1554;
P(1692, 2) = 1728*1554+1555;
P(1692, 3) = 1728*1555+1604;
P(1692, 4) = 1728*1604+1605;
P(1692, 5) = 1728*1605+1606;
P(1692, 6) = 1728*1606+1615;
P(1692, 7) = 1728*1615+1612;
P(1692, 8) = 1728*1612+1563;
P(1692, 9) = 1728*1563+1552;
P(1693, 0) = 1728*1552+1557;
P(1693, 1) = 1728*1557+1558;
P(1693, 2) = 1728*1558+1567;
P(1693, 3) = 1728*1567+1564;
P(1693, 4) = 1728*1564+1565;
P(1693, 5) = 1728*1565+1560;
P(1693, 6) = 1728*1560+1561;
P(1693, 7) = 1728*1561+1562;
P(1693, 8) = 1728*1562+1563;
P(1693, 9) = 1728*1563+1552;
P(1694, 0) = 1728*1560+1561;
P(1694, 1) = 1728*1561+1562;
P(1694, 2) = 1728*1562+1563;
P(1694, 3) = 1728*1563+1612;
P(1694, 4) = 1728*1612+1613;
P(1694, 5) = 1728*1613+1614;
P(1694, 6) = 1728*1614+1623;
P(1694, 7) = 1728*1623+1620;
P(1694, 8) = 1728*1620+1571;
P(1694, 9) = 1728*1571+1560;
P(1695, 0) = 1728*1560+1565;
P(1695, 1) = 1728*1565+1566;
P(1695, 2) = 1728*1566+1575;
P(1695, 3) = 1728*1575+1572;
P(1695, 4) = 1728*1572+1573;
P(1695, 5) = 1728*1573+1568;
P(1695, 6) = 1728*1568+1569;
P(1695, 7) = 1728*1569+1570;
P(1695, 8) = 1728*1570+1571;
P(1695, 9) = 1728*1571+1560;
P(1696, 0) = 1728*1568+1569;
P(1696, 1) = 1728*1569+1570;
P(1696, 2) = 1728*1570+1571;
P(1696, 3) = 1728*1571+1620;
P(1696, 4) = 1728*1620+1621;
P(1696, 5) = 1728*1621+1622;
P(1696, 6) = 1728*1622+1631;
P(1696, 7) = 1728*1631+1628;
P(1696, 8) = 1728*1628+1579;
P(1696, 9) = 1728*1579+1568;
P(1697, 0) = 1728*1568+1573;
P(1697, 1) = 1728*1573+1574;
P(1697, 2) = 1728*1574+1583;
P(1697, 3) = 1728*1583+1580;
P(1697, 4) = 1728*1580+1581;
P(1697, 5) = 1728*1581+1576;
P(1697, 6) = 1728*1576+1577;
P(1697, 7) = 1728*1577+1578;
P(1697, 8) = 1728*1578+1579;
P(1697, 9) = 1728*1579+1568;
P(1698, 0) = 1728*1584+1585;
P(1698, 1) = 1728*1585+1586;
P(1698, 2) = 1728*1586+1587;
P(1698, 3) = 1728*1587+1636;
P(1698, 4) = 1728*1636+1637;
P(1698, 5) = 1728*1637+1638;
P(1698, 6) = 1728*1638+1647;
P(1698, 7) = 1728*1647+1644;
P(1698, 8) = 1728*1644+1595;
P(1698, 9) = 1728*1595+1584;
P(1699, 0) = 1728*1584+1585;
P(1699, 1) = 1728*1585+1586;
P(1699, 2) = 1728*1586+1587;
P(1699, 3) = 1728*1587+1624;
P(1699, 4) = 1728*1624+1629;
P(1699, 5) = 1728*1629+1630;
P(1699, 6) = 1728*1630+1591;
P(1699, 7) = 1728*1591+1588;
P(1699, 8) = 1728*1588+1589;
P(1699, 9) = 1728*1589+1584;
P(1700, 0) = 1728*1584+1589;
P(1700, 1) = 1728*1589+1590;
P(1700, 2) = 1728*1590+1599;
P(1700, 3) = 1728*1599+1596;
P(1700, 4) = 1728*1596+1597;
P(1700, 5) = 1728*1597+1592;
P(1700, 6) = 1728*1592+1593;
P(1700, 7) = 1728*1593+1594;
P(1700, 8) = 1728*1594+1595;
P(1700, 9) = 1728*1595+1584;
P(1701, 0) = 1728*1587+1636;
P(1701, 1) = 1728*1636+1639;
P(1701, 2) = 1728*1639+1678;
P(1701, 3) = 1728*1678+1677;
P(1701, 4) = 1728*1677+1676;
P(1701, 5) = 1728*1676+1627;
P(1701, 6) = 1728*1627+1626;
P(1701, 7) = 1728*1626+1625;
P(1701, 8) = 1728*1625+1624;
P(1701, 9) = 1728*1624+1587;
P(1702, 0) = 1728*1592+1593;
P(1702, 1) = 1728*1593+1594;
P(1702, 2) = 1728*1594+1595;
P(1702, 3) = 1728*1595+1644;
P(1702, 4) = 1728*1644+1645;
P(1702, 5) = 1728*1645+1646;
P(1702, 6) = 1728*1646+1655;
P(1702, 7) = 1728*1655+1652;
P(1702, 8) = 1728*1652+1603;
P(1702, 9) = 1728*1603+1592;
P(1703, 0) = 1728*1592+1597;
P(1703, 1) = 1728*1597+1598;
P(1703, 2) = 1728*1598+1607;
P(1703, 3) = 1728*1607+1604;
P(1703, 4) = 1728*1604+1605;
P(1703, 5) = 1728*1605+1600;
P(1703, 6) = 1728*1600+1601;
P(1703, 7) = 1728*1601+1602;
P(1703, 8) = 1728*1602+1603;
P(1703, 9) = 1728*1603+1592;
P(1704, 0) = 1728*1600+1601;
P(1704, 1) = 1728*1601+1602;
P(1704, 2) = 1728*1602+1603;
P(1704, 3) = 1728*1603+1652;
P(1704, 4) = 1728*1652+1653;
P(1704, 5) = 1728*1653+1654;
P(1704, 6) = 1728*1654+1663;
P(1704, 7) = 1728*1663+1660;
P(1704, 8) = 1728*1660+1611;
P(1704, 9) = 1728*1611+1600;
P(1705, 0) = 1728*1600+1605;
P(1705, 1) = 1728*1605+1606;
P(1705, 2) = 1728*1606+1615;
P(1705, 3) = 1728*1615+1612;
P(1705, 4) = 1728*1612+1613;
P(1705, 5) = 1728*1613+1608;
P(1705, 6) = 1728*1608+1609;
P(1705, 7) = 1728*1609+1610;
P(1705, 8) = 1728*1610+1611;
P(1705, 9) = 1728*1611+1600;
P(1706, 0) = 1728*1608+1609;
P(1706, 1) = 1728*1609+1610;
P(1706, 2) = 1728*1610+1611;
P(1706, 3) = 1728*1611+1660;
P(1706, 4) = 1728*1660+1661;
P(1706, 5) = 1728*1661+1662;
P(1706, 6) = 1728*1662+1671;
P(1706, 7) = 1728*1671+1668;
P(1706, 8) = 1728*1668+1619;
P(1706, 9) = 1728*1619+1608;
P(1707, 0) = 1728*1608+1613;
P(1707, 1) = 1728*1613+1614;
P(1707, 2) = 1728*1614+1623;
P(1707, 3) = 1728*1623+1620;
P(1707, 4) = 1728*1620+1621;
P(1707, 5) = 1728*1621+1616;
P(1707, 6) = 1728*1616+1617;
P(1707, 7) = 1728*1617+1618;
P(1707, 8) = 1728*1618+1619;
P(1707, 9) = 1728*1619+1608;
P(1708, 0) = 1728*1616+1617;
P(1708, 1) = 1728*1617+1618;
P(1708, 2) = 1728*1618+1619;
P(1708, 3) = 1728*1619+1668;
P(1708, 4) = 1728*1668+1669;
P(1708, 5) = 1728*1669+1670;
P(1708, 6) = 1728*1670+1679;
P(1708, 7) = 1728*1679+1676;
P(1708, 8) = 1728*1676+1627;
P(1708, 9) = 1728*1627+1616;
P(1709, 0) = 1728*1616+1621;
P(1709, 1) = 1728*1621+1622;
P(1709, 2) = 1728*1622+1631;
P(1709, 3) = 1728*1631+1628;
P(1709, 4) = 1728*1628+1629;
P(1709, 5) = 1728*1629+1624;
P(1709, 6) = 1728*1624+1625;
P(1709, 7) = 1728*1625+1626;
P(1709, 8) = 1728*1626+1627;
P(1709, 9) = 1728*1627+1616;
P(1710, 0) = 1728*1632+1633;
P(1710, 1) = 1728*1633+1634;
P(1710, 2) = 1728*1634+1635;
P(1710, 3) = 1728*1635+1684;
P(1710, 4) = 1728*1684+1685;
P(1710, 5) = 1728*1685+1686;
P(1710, 6) = 1728*1686+1695;
P(1710, 7) = 1728*1695+1692;
P(1710, 8) = 1728*1692+1643;
P(1710, 9) = 1728*1643+1632;
P(1711, 0) = 1728*1632+1633;
P(1711, 1) = 1728*1633+1634;
P(1711, 2) = 1728*1634+1635;
P(1711, 3) = 1728*1635+1672;
P(1711, 4) = 1728*1672+1677;
P(1711, 5) = 1728*1677+1678;
P(1711, 6) = 1728*1678+1639;
P(1711, 7) = 1728*1639+1636;
P(1711, 8) = 1728*1636+1637;
P(1711, 9) = 1728*1637+1632;
P(1712, 0) = 1728*1632+1637;
P(1712, 1) = 1728*1637+1638;
P(1712, 2) = 1728*1638+1647;
P(1712, 3) = 1728*1647+1644;
P(1712, 4) = 1728*1644+1645;
P(1712, 5) = 1728*1645+1640;
P(1712, 6) = 1728*1640+1641;
P(1712, 7) = 1728*1641+1642;
P(1712, 8) = 1728*1642+1643;
P(1712, 9) = 1728*1643+1632;
P(1713, 0) = 1728*1635+1684;
P(1713, 1) = 1728*1684+1687;
P(1713, 2) = 1728*1687+1726;
P(1713, 3) = 1728*1726+1725;
P(1713, 4) = 1728*1725+1724;
P(1713, 5) = 1728*1724+1675;
P(1713, 6) = 1728*1675+1674;
P(1713, 7) = 1728*1674+1673;
P(1713, 8) = 1728*1673+1672;
P(1713, 9) = 1728*1672+1635;
P(1714, 0) = 1728*1640+1641;
P(1714, 1) = 1728*1641+1642;
P(1714, 2) = 1728*1642+1643;
P(1714, 3) = 1728*1643+1692;
P(1714, 4) = 1728*1692+1693;
P(1714, 5) = 1728*1693+1694;
P(1714, 6) = 1728*1694+1703;
P(1714, 7) = 1728*1703+1700;
P(1714, 8) = 1728*1700+1651;
P(1714, 9) = 1728*1651+1640;
P(1715, 0) = 1728*1640+1645;
P(1715, 1) = 1728*1645+1646;
P(1715, 2) = 1728*1646+1655;
P(1715, 3) = 1728*1655+1652;
P(1715, 4) = 1728*1652+1653;
P(1715, 5) = 1728*1653+1648;
P(1715, 6) = 1728*1648+1649;
P(1715, 7) = 1728*1649+1650;
P(1715, 8) = 1728*1650+1651;
P(1715, 9) = 1728*1651+1640;
P(1716, 0) = 1728*1648+1649;
P(1716, 1) = 1728*1649+1650;
P(1716, 2) = 1728*1650+1651;
P(1716, 3) = 1728*1651+1700;
P(1716, 4) = 1728*1700+1701;
P(1716, 5) = 1728*1701+1702;
P(1716, 6) = 1728*1702+1711;
P(1716, 7) = 1728*1711+1708;
P(1716, 8) = 1728*1708+1659;
P(1716, 9) = 1728*1659+1648;
P(1717, 0) = 1728*1648+1653;
P(1717, 1) = 1728*1653+1654;
P(1717, 2) = 1728*1654+1663;
P(1717, 3) = 1728*1663+1660;
P(1717, 4) = 1728*1660+1661;
P(1717, 5) = 1728*1661+1656;
P(1717, 6) = 1728*1656+1657;
P(1717, 7) = 1728*1657+1658;
P(1717, 8) = 1728*1658+1659;
P(1717, 9) = 1728*1659+1648;
P(1718, 0) = 1728*1656+1657;
P(1718, 1) = 1728*1657+1658;
P(1718, 2) = 1728*1658+1659;
P(1718, 3) = 1728*1659+1708;
P(1718, 4) = 1728*1708+1709;
P(1718, 5) = 1728*1709+1710;
P(1718, 6) = 1728*1710+1719;
P(1718, 7) = 1728*1719+1716;
P(1718, 8) = 1728*1716+1667;
P(1718, 9) = 1728*1667+1656;
P(1719, 0) = 1728*1656+1661;
P(1719, 1) = 1728*1661+1662;
P(1719, 2) = 1728*1662+1671;
P(1719, 3) = 1728*1671+1668;
P(1719, 4) = 1728*1668+1669;
P(1719, 5) = 1728*1669+1664;
P(1719, 6) = 1728*1664+1665;
P(1719, 7) = 1728*1665+1666;
P(1719, 8) = 1728*1666+1667;
P(1719, 9) = 1728*1667+1656;
P(1720, 0) = 1728*1664+1665;
P(1720, 1) = 1728*1665+1666;
P(1720, 2) = 1728*1666+1667;
P(1720, 3) = 1728*1667+1716;
P(1720, 4) = 1728*1716+1717;
P(1720, 5) = 1728*1717+1718;
P(1720, 6) = 1728*1718+1727;
P(1720, 7) = 1728*1727+1724;
P(1720, 8) = 1728*1724+1675;
P(1720, 9) = 1728*1675+1664;
P(1721, 0) = 1728*1664+1669;
P(1721, 1) = 1728*1669+1670;
P(1721, 2) = 1728*1670+1679;
P(1721, 3) = 1728*1679+1676;
P(1721, 4) = 1728*1676+1677;
P(1721, 5) = 1728*1677+1672;
P(1721, 6) = 1728*1672+1673;
P(1721, 7) = 1728*1673+1674;
P(1721, 8) = 1728*1674+1675;
P(1721, 9) = 1728*1675+1664;
P(1722, 0) = 1728*1680+1681;
P(1722, 1) = 1728*1681+1682;
P(1722, 2) = 1728*1682+1683;
P(1722, 3) = 1728*1683+1720;
P(1722, 4) = 1728*1720+1725;
P(1722, 5) = 1728*1725+1726;
P(1722, 6) = 1728*1726+1687;
P(1722, 7) = 1728*1687+1684;
P(1722, 8) = 1728*1684+1685;
P(1722, 9) = 1728*1685+1680;
P(1723, 0) = 1728*1680+1685;
P(1723, 1) = 1728*1685+1686;
P(1723, 2) = 1728*1686+1695;
P(1723, 3) = 1728*1695+1692;
P(1723, 4) = 1728*1692+1693;
P(1723, 5) = 1728*1693+1688;
P(1723, 6) = 1728*1688+1689;
P(1723, 7) = 1728*1689+1690;
P(1723, 8) = 1728*1690+1691;
P(1723, 9) = 1728*1691+1680;
P(1724, 0) = 1728*1688+1693;
P(1724, 1) = 1728*1693+1694;
P(1724, 2) = 1728*1694+1703;
P(1724, 3) = 1728*1703+1700;
P(1724, 4) = 1728*1700+1701;
P(1724, 5) = 1728*1701+1696;
P(1724, 6) = 1728*1696+1697;
P(1724, 7) = 1728*1697+1698;
P(1724, 8) = 1728*1698+1699;
P(1724, 9) = 1728*1699+1688;
P(1725, 0) = 1728*1696+1701;
P(1725, 1) = 1728*1701+1702;
P(1725, 2) = 1728*1702+1711;
P(1725, 3) = 1728*1711+1708;
P(1725, 4) = 1728*1708+1709;
P(1725, 5) = 1728*1709+1704;
P(1725, 6) = 1728*1704+1705;
P(1725, 7) = 1728*1705+1706;
P(1725, 8) = 1728*1706+1707;
P(1725, 9) = 1728*1707+1696;
P(1726, 0) = 1728*1704+1709;
P(1726, 1) = 1728*1709+1710;
P(1726, 2) = 1728*1710+1719;
P(1726, 3) = 1728*1719+1716;
P(1726, 4) = 1728*1716+1717;
P(1726, 5) = 1728*1717+1712;
P(1726, 6) = 1728*1712+1713;
P(1726, 7) = 1728*1713+1714;
P(1726, 8) = 1728*1714+1715;
P(1726, 9) = 1728*1715+1704;
P(1727, 0) = 1728*1712+1717;
P(1727, 1) = 1728*1717+1718;
P(1727, 2) = 1728*1718+1727;
P(1727, 3) = 1728*1727+1724;
P(1727, 4) = 1728*1724+1725;
P(1727, 5) = 1728*1725+1720;
P(1727, 6) = 1728*1720+1721;
P(1727, 7) = 1728*1721+1722;
P(1727, 8) = 1728*1722+1723;
P(1727, 9) = 1728*1723+1712;
return P;
}
| 36.599248 | 71 | 0.57421 | [
"vector"
] |
463a1991c289c67373b3d47fdc11be25cbcb0343 | 9,255 | cpp | C++ | Lib-Engine/src/sfz/renderer/HighLevelCmdList.cpp | PetorSFZ/sfz_tech | 0d4027ad2c2bb444b83e78f009b649478cb97a73 | [
"Zlib"
] | 2 | 2020-09-04T16:52:47.000Z | 2021-04-21T18:30:25.000Z | Lib-Engine/src/sfz/renderer/HighLevelCmdList.cpp | PetorSFZ/sfz_tech | 0d4027ad2c2bb444b83e78f009b649478cb97a73 | [
"Zlib"
] | null | null | null | Lib-Engine/src/sfz/renderer/HighLevelCmdList.cpp | PetorSFZ/sfz_tech | 0d4027ad2c2bb444b83e78f009b649478cb97a73 | [
"Zlib"
] | null | null | null | // Copyright (c) Peter Hillerström (skipifzero.com, peter@hstroem.se)
// For other contributors see Contributors.txt
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
#include "sfz/renderer/HighLevelCmdList.hpp"
#include "sfz/renderer/ZeroGUtils.hpp"
#include "sfz/resources/BufferResource.hpp"
#include "sfz/resources/FramebufferResource.hpp"
#include "sfz/resources/TextureResource.hpp"
namespace sfz {
// HighLevelCmdList
// ------------------------------------------------------------------------------------------------
void HighLevelCmdList::init(
const char* cmdListName,
u64 currFrameIdx,
zg::CommandList cmdList,
zg::Uploader* uploader,
zg::Framebuffer* defaultFB)
{
this->destroy();
mName = strID(cmdListName);
mCurrFrameIdx = currFrameIdx;
mCmdList = sfz_move(cmdList);
mUploader = uploader;
mResources = &sfz::getResourceManager();
mShaders = &sfz::getShaderManager();
mDefaultFB = defaultFB;
}
void HighLevelCmdList::destroy() noexcept
{
mName = {};
mCurrFrameIdx = 0;
mCmdList.destroy();
mResources = nullptr;
mShaders = nullptr;
mBoundShader = nullptr;
mDefaultFB = nullptr;
}
// HighLevelCmdList: Methods
// ------------------------------------------------------------------------------------------------
void HighLevelCmdList::setShader(SfzHandle handle)
{
mBoundShader = mShaders->getShader(handle);
sfz_assert(mBoundShader != nullptr);
if (mBoundShader->type == ShaderType::COMPUTE) {
CHECK_ZG mCmdList.setPipeline(mBoundShader->compute.pipeline);
}
else {
CHECK_ZG mCmdList.setPipeline(mBoundShader->render.pipeline);
}
}
void HighLevelCmdList::setFramebuffer(SfzHandle handle)
{
FramebufferResource* fb = mResources->getFramebuffer(handle);
sfz_assert(fb != nullptr);
CHECK_ZG mCmdList.setFramebuffer(fb->framebuffer);
}
void HighLevelCmdList::setFramebufferDefault()
{
CHECK_ZG mCmdList.setFramebuffer(*mDefaultFB);
}
void HighLevelCmdList::clearRenderTargetsOptimal()
{
CHECK_ZG mCmdList.clearRenderTargetsOptimal();
}
void HighLevelCmdList::clearDepthBufferOptimal()
{
CHECK_ZG mCmdList.clearDepthBufferOptimal();
}
void HighLevelCmdList::setPushConstantUntyped(u32 reg, const void* data, u32 numBytes)
{
sfz_assert(numBytes > 0);
sfz_assert(numBytes <= 128);
CHECK_ZG mCmdList.setPushConstant(reg, data, numBytes);
}
void HighLevelCmdList::setBindings(const Bindings& bindings)
{
ZgPipelineBindings zgBindings = {};
for (const BindingHL& binding : bindings.bindings) {
BufferResource* bufferRes = nullptr;
ZgBuffer* buffer = nullptr;
if (binding.type == ZG_BINDING_TYPE_BUFFER_CONST ||
binding.type == ZG_BINDING_TYPE_BUFFER_TYPED ||
binding.type == ZG_BINDING_TYPE_BUFFER_STRUCTURED ||
binding.type == ZG_BINDING_TYPE_BUFFER_STRUCTURED_UAV) {
bufferRes = mResources->getBuffer(binding.handle);
sfz_assert(bufferRes != nullptr);
sfz_assert(binding.reg != ~0u);
buffer = nullptr;
if (bufferRes->type == BufferResourceType::STATIC) {
buffer = bufferRes->staticMem.buffer.handle;
}
else if (bufferRes->type == BufferResourceType::STREAMING) {
buffer = bufferRes->streamingMem.data(mCurrFrameIdx).buffer.handle;
}
else {
sfz_assert_hard(false);
}
}
if (binding.type == ZG_BINDING_TYPE_BUFFER_CONST) {
zgBindings.addBufferConst(binding.reg, buffer);
}
else if (binding.type == ZG_BINDING_TYPE_BUFFER_TYPED) {
zgBindings.addBufferTyped(binding.reg, buffer, binding.format, bufferRes->maxNumElements);
}
else if (binding.type == ZG_BINDING_TYPE_BUFFER_STRUCTURED) {
zgBindings.addBufferStructured(binding.reg, buffer, bufferRes->elementSizeBytes, bufferRes->maxNumElements);
}
else if (binding.type == ZG_BINDING_TYPE_BUFFER_STRUCTURED_UAV) {
zgBindings.addBufferStructuredUAV(binding.reg, buffer, bufferRes->elementSizeBytes, bufferRes->maxNumElements);
}
else if (binding.type == ZG_BINDING_TYPE_TEXTURE) {
TextureResource* resource = mResources->getTexture(binding.handle);
sfz_assert(resource != nullptr);
sfz_assert(binding.reg != ~0u);
zgBindings.addTexture(binding.reg, resource->texture.handle);
}
else if (binding.type == ZG_BINDING_TYPE_TEXTURE_UAV) {
TextureResource* resource = mResources->getTexture(binding.handle);
sfz_assert(resource != nullptr);
sfz_assert(binding.reg != ~0u);
sfz_assert(binding.mipLevel < resource->numMipmaps);
zgBindings.addTextureUAV(binding.reg, resource->texture.handle, binding.mipLevel);
}
}
CHECK_ZG mCmdList.setPipelineBindings(zgBindings);
}
void HighLevelCmdList::uploadToStreamingBufferUntyped(
SfzHandle handle, const void* data, u32 elementSize, u32 numElements)
{
// Get streaming buffer
BufferResource* resource = mResources->getBuffer(handle);
sfz_assert(resource != nullptr);
sfz_assert(resource->type == BufferResourceType::STREAMING);
// Calculate number of bytes to copy to streaming buffer
const u32 numBytes = elementSize * numElements;
sfz_assert(numBytes != 0);
sfz_assert(numBytes <= (resource->elementSizeBytes * resource->maxNumElements));
sfz_assert(elementSize == resource->elementSizeBytes); // TODO: Might want to remove this assert
// Grab this frame's memory
StreamingBufferMemory& memory = resource->streamingMem.data(mCurrFrameIdx);
// Only allowed to upload to streaming buffer once per frame
sfz_assert(memory.lastFrameIdxTouched < mCurrFrameIdx);
memory.lastFrameIdxTouched = mCurrFrameIdx;
// Upload to buffer
CHECK_ZG mCmdList.uploadToBuffer(mUploader->handle, memory.buffer.handle, 0, data, numBytes);
}
void HighLevelCmdList::setVertexBuffer(u32 slot, SfzHandle handle)
{
BufferResource* resource = mResources->getBuffer(handle);
sfz_assert(resource != nullptr);
zg::Buffer* buffer = nullptr;
if (resource->type == BufferResourceType::STATIC) {
buffer = &resource->staticMem.buffer;
}
else if (resource->type == BufferResourceType::STREAMING) {
buffer = &resource->streamingMem.data(mCurrFrameIdx).buffer;
}
else {
sfz_assert_hard(false);
}
CHECK_ZG mCmdList.setVertexBuffer(slot, *buffer);
}
void HighLevelCmdList::setIndexBuffer(SfzHandle handle, ZgIndexBufferType indexType)
{
BufferResource* resource = mResources->getBuffer(handle);
sfz_assert(resource != nullptr);
zg::Buffer* buffer = nullptr;
if (resource->type == BufferResourceType::STATIC) {
buffer = &resource->staticMem.buffer;
}
else if (resource->type == BufferResourceType::STREAMING) {
buffer = &resource->streamingMem.data(mCurrFrameIdx).buffer;
}
else {
sfz_assert_hard(false);
}
CHECK_ZG mCmdList.setIndexBuffer(*buffer, indexType);
}
void HighLevelCmdList::drawTriangles(u32 startVertex, u32 numVertices)
{
sfz_assert(mBoundShader != nullptr);
sfz_assert(mBoundShader->type == ShaderType::RENDER);
CHECK_ZG mCmdList.drawTriangles(startVertex, numVertices);
}
void HighLevelCmdList::drawTrianglesIndexed(u32 firstIndex, u32 numIndices)
{
sfz_assert(mBoundShader != nullptr);
sfz_assert(mBoundShader->type == ShaderType::RENDER);
CHECK_ZG mCmdList.drawTrianglesIndexed(firstIndex, numIndices);
}
i32x3 HighLevelCmdList::getComputeGroupDims() const
{
sfz_assert(mBoundShader != nullptr);
sfz_assert(mBoundShader->type == ShaderType::COMPUTE);
u32 x = 0, y = 0, z = 0;
mBoundShader->compute.pipeline.getGroupDims(x, y, z);
return i32x3(x, y, z);
}
void HighLevelCmdList::dispatchCompute(i32 groupCountX, i32 groupCountY, i32 groupCountZ)
{
sfz_assert(mBoundShader != nullptr);
sfz_assert(mBoundShader->type == ShaderType::COMPUTE);
sfz_assert(groupCountX > 0);
sfz_assert(groupCountY > 0);
sfz_assert(groupCountZ > 0);
CHECK_ZG mCmdList.dispatchCompute(groupCountX, groupCountY, groupCountZ);
}
void HighLevelCmdList::uavBarrierAll()
{
CHECK_ZG mCmdList.uavBarrier();
}
void HighLevelCmdList::uavBarrierBuffer(SfzHandle handle)
{
BufferResource* resource = mResources->getBuffer(handle);
sfz_assert(resource != nullptr);
zg::Buffer* buffer = nullptr;
if (resource->type == BufferResourceType::STATIC) {
buffer = &resource->staticMem.buffer;
}
else if (resource->type == BufferResourceType::STREAMING) {
buffer = &resource->streamingMem.data(mCurrFrameIdx).buffer;
}
else {
sfz_assert_hard(false);
}
CHECK_ZG mCmdList.uavBarrier(*buffer);
}
void HighLevelCmdList::uavBarrierTexture(SfzHandle handle)
{
TextureResource* resource = mResources->getTexture(handle);
sfz_assert(resource != nullptr);
CHECK_ZG mCmdList.uavBarrier(resource->texture);
}
} // namespace sfz
| 31.161616 | 114 | 0.742626 | [
"render"
] |
463a7b0194df986b546e95634c21928ec7f4f0a1 | 11,506 | cpp | C++ | plugins/builtin/source/content/lang_builtin_functions.cpp | Laxer3a/psdebugtool | 41efa5f35785afd8f6dc868d8dbdb0dcf8eb25fb | [
"MIT"
] | 4 | 2021-05-09T23:33:54.000Z | 2022-03-06T10:16:31.000Z | plugins/builtin/source/content/lang_builtin_functions.cpp | Laxer3a/psdebugtool | 41efa5f35785afd8f6dc868d8dbdb0dcf8eb25fb | [
"MIT"
] | null | null | null | plugins/builtin/source/content/lang_builtin_functions.cpp | Laxer3a/psdebugtool | 41efa5f35785afd8f6dc868d8dbdb0dcf8eb25fb | [
"MIT"
] | 6 | 2021-05-09T21:41:48.000Z | 2021-09-08T10:54:28.000Z | #include <hex/plugin.hpp>
#include <hex/lang/ast_node.hpp>
#include <hex/lang/log_console.hpp>
#include <hex/lang/evaluator.hpp>
#include <hex/helpers/utils.hpp>
#include <vector>
namespace hex::plugin::builtin {
#define LITERAL_COMPARE(literal, cond) std::visit([&](auto &&literal) { return (cond) != 0; }, literal)
#define AS_TYPE(type, value) ctx.template asType<type>(value)
void registerPatternLanguageFunctions() {
using namespace hex::lang;
/* findSequence(occurrenceIndex, byte...) */
ContentRegistry::PatternLanguageFunctions::add("findSequence", ContentRegistry::PatternLanguageFunctions::MoreParametersThan | 1, [](auto &ctx, auto params) {
auto& occurrenceIndex = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
std::vector<u8> sequence;
for (u32 i = 1; i < params.size(); i++) {
sequence.push_back(std::visit([&](auto &&value) -> u8 {
if (value <= 0xFF)
return value;
else
ctx.getConsole().abortEvaluation("sequence bytes need to fit into 1 byte");
}, AS_TYPE(ASTNodeIntegerLiteral, params[i])->getValue()));
}
std::vector<u8> bytes(sequence.size(), 0x00);
u32 occurrences = 0;
for (u64 offset = 0; offset < SharedData::currentProvider->getSize() - sequence.size(); offset++) {
SharedData::currentProvider->read(offset, bytes.data(), bytes.size());
if (bytes == sequence) {
if (LITERAL_COMPARE(occurrenceIndex, occurrences < occurrenceIndex)) {
occurrences++;
continue;
}
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, offset });
}
}
ctx.getConsole().abortEvaluation("failed to find sequence");
});
/* readUnsigned(address, size) */
ContentRegistry::PatternLanguageFunctions::add("readUnsigned", 2, [](auto &ctx, auto params) {
auto address = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
auto size = AS_TYPE(ASTNodeIntegerLiteral, params[1])->getValue();
if (LITERAL_COMPARE(address, address >= SharedData::currentProvider->getActualSize()))
ctx.getConsole().abortEvaluation("address out of range");
return std::visit([&](auto &&address, auto &&size) {
if (size <= 0 || size > 16)
ctx.getConsole().abortEvaluation("invalid read size");
u8 value[(u8)size];
SharedData::currentProvider->read(address, value, size);
switch ((u8)size) {
case 1: return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned8Bit, *reinterpret_cast<u8*>(value) });
case 2: return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned16Bit, *reinterpret_cast<u16*>(value) });
case 4: return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned32Bit, *reinterpret_cast<u32*>(value) });
case 8: return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, *reinterpret_cast<u64*>(value) });
case 16: return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned128Bit, *reinterpret_cast<u128*>(value) });
default: ctx.getConsole().abortEvaluation("invalid read size");
}
}, address, size);
});
/* readSigned(address, size) */
ContentRegistry::PatternLanguageFunctions::add("readSigned", 2, [](auto &ctx, auto params) {
auto address = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
auto size = AS_TYPE(ASTNodeIntegerLiteral, params[1])->getValue();
if (LITERAL_COMPARE(address, address >= SharedData::currentProvider->getActualSize()))
ctx.getConsole().abortEvaluation("address out of range");
return std::visit([&](auto &&address, auto &&size) {
if (size <= 0 || size > 16)
ctx.getConsole().abortEvaluation("invalid read size");
u8 value[(u8)size];
SharedData::currentProvider->read(address, value, size);
switch ((u8)size) {
case 1: return new ASTNodeIntegerLiteral({ Token::ValueType::Signed8Bit, *reinterpret_cast<s8*>(value) });
case 2: return new ASTNodeIntegerLiteral({ Token::ValueType::Signed16Bit, *reinterpret_cast<s16*>(value) });
case 4: return new ASTNodeIntegerLiteral({ Token::ValueType::Signed32Bit, *reinterpret_cast<s32*>(value) });
case 8: return new ASTNodeIntegerLiteral({ Token::ValueType::Signed64Bit, *reinterpret_cast<s64*>(value) });
case 16: return new ASTNodeIntegerLiteral({ Token::ValueType::Signed128Bit, *reinterpret_cast<s128*>(value) });
default: ctx.getConsole().abortEvaluation("invalid read size");
}
}, address, size);
});
/* assert(condition, message) */
ContentRegistry::PatternLanguageFunctions::add("assert", 2, [](auto &ctx, auto params) {
auto condition = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
auto message = AS_TYPE(ASTNodeStringLiteral, params[1])->getString();
if (LITERAL_COMPARE(condition, condition == 0))
ctx.getConsole().abortEvaluation(hex::format("assert failed \"{0}\"", message.data()));
return nullptr;
});
/* warnAssert(condition, message) */
ContentRegistry::PatternLanguageFunctions::add("warnAssert", 2, [](auto ctx, auto params) {
auto condition = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
auto message = AS_TYPE(ASTNodeStringLiteral, params[1])->getString();
if (LITERAL_COMPARE(condition, condition == 0))
ctx.getConsole().log(LogConsole::Level::Warning, hex::format("assert failed \"{0}\"", message.data()));
return nullptr;
});
/* print(values...) */
ContentRegistry::PatternLanguageFunctions::add("print", ContentRegistry::PatternLanguageFunctions::MoreParametersThan | 0, [](auto &ctx, auto params) {
std::string message;
for (auto& param : params) {
if (auto integerLiteral = dynamic_cast<ASTNodeIntegerLiteral*>(param); integerLiteral != nullptr) {
switch (integerLiteral->getType()) {
case Token::ValueType::Character: message += std::get<s8>(integerLiteral->getValue()); break;
case Token::ValueType::Unsigned8Bit: message += std::to_string(std::get<u8>(integerLiteral->getValue())); break;
case Token::ValueType::Signed8Bit: message += std::to_string(std::get<s8>(integerLiteral->getValue())); break;
case Token::ValueType::Unsigned16Bit: message += std::to_string(std::get<u16>(integerLiteral->getValue())); break;
case Token::ValueType::Signed16Bit: message += std::to_string(std::get<s16>(integerLiteral->getValue())); break;
case Token::ValueType::Unsigned32Bit: message += std::to_string(std::get<u32>(integerLiteral->getValue())); break;
case Token::ValueType::Signed32Bit: message += std::to_string(std::get<s32>(integerLiteral->getValue())); break;
case Token::ValueType::Unsigned64Bit: message += std::to_string(std::get<u64>(integerLiteral->getValue())); break;
case Token::ValueType::Signed64Bit: message += std::to_string(std::get<s64>(integerLiteral->getValue())); break;
case Token::ValueType::Unsigned128Bit: message += hex::to_string(std::get<u128>(integerLiteral->getValue())); break;
case Token::ValueType::Signed128Bit: message += hex::to_string(std::get<s128>(integerLiteral->getValue())); break;
case Token::ValueType::Float: message += std::to_string(std::get<float>(integerLiteral->getValue())); break;
case Token::ValueType::Double: message += std::to_string(std::get<double>(integerLiteral->getValue())); break;
case Token::ValueType::Boolean: message += std::get<s32>(integerLiteral->getValue()) ? "true" : "false"; break;
case Token::ValueType::CustomType: message += "< Custom Type >"; break;
}
}
else if (auto stringLiteral = dynamic_cast<ASTNodeStringLiteral*>(param); stringLiteral != nullptr)
message += stringLiteral->getString();
}
ctx.getConsole().log(LogConsole::Level::Info, message);
return nullptr;
});
/* addressof(rValueString) */
ContentRegistry::PatternLanguageFunctions::add("addressof", 1, [](auto &ctx, auto params) -> ASTNode* {
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
std::vector<std::string> path = splitString(name, ".");
auto pattern = ctx.patternFromName(path);
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getOffset()) });
});
/* sizeof(rValueString) */
ContentRegistry::PatternLanguageFunctions::add("sizeof", 1, [](auto &ctx, auto params) -> ASTNode* {
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
std::vector<std::string> path = splitString(name, ".");
auto pattern = ctx.patternFromName(path);
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getSize()) });
});
/* nextAfter(rValueString) */
ContentRegistry::PatternLanguageFunctions::add("nextAfter", 1, [](auto &ctx, auto params) -> ASTNode* {
auto name = AS_TYPE(ASTNodeStringLiteral, params[0])->getString();
std::vector<std::string> path = splitString(name, ".");
auto pattern = ctx.patternFromName(path);
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(pattern->getOffset() + pattern->getSize()) });
});
/* alignTo(alignment, value) */
ContentRegistry::PatternLanguageFunctions::add("alignTo", 2, [](auto &ctx, auto params) -> ASTNode* {
auto alignment = AS_TYPE(ASTNodeIntegerLiteral, params[0])->getValue();
auto value = AS_TYPE(ASTNodeIntegerLiteral, params[1])->getValue();
auto result = std::visit([](auto &&alignment, auto &&value) {
u64 remainder = u64(value) % u64(alignment);
return remainder != 0 ? u64(value) + (u64(alignment) - remainder) : u64(value);
}, alignment, value);
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(result) });
});
/* dataSize() */
ContentRegistry::PatternLanguageFunctions::add("dataSize", ContentRegistry::PatternLanguageFunctions::NoParameters, [](auto &ctx, auto params) -> ASTNode* {
return new ASTNodeIntegerLiteral({ Token::ValueType::Unsigned64Bit, u64(SharedData::currentProvider->getActualSize()) });
});
}
} | 56.126829 | 166 | 0.595689 | [
"vector"
] |
463f296a60c418eee2f13cbfe87f3d481d426450 | 491 | cpp | C++ | src/Layer.cpp | Delpod/Asimo-s-Escape | 4d2a599fcb17f4c76cfda45cb2c310bd01f66faa | [
"Zlib",
"Apache-2.0"
] | 1 | 2021-01-19T21:20:35.000Z | 2021-01-19T21:20:35.000Z | src/Layer.cpp | Delpod/Asimo-s-Escape | 4d2a599fcb17f4c76cfda45cb2c310bd01f66faa | [
"Zlib",
"Apache-2.0"
] | null | null | null | src/Layer.cpp | Delpod/Asimo-s-Escape | 4d2a599fcb17f4c76cfda45cb2c310bd01f66faa | [
"Zlib",
"Apache-2.0"
] | null | null | null | #include "Layer.h"
Layer::~Layer() {
for(std::vector<GameObject*>::iterator it = m_gameObjects.begin(); it != m_gameObjects.end(); ++it) {
delete (*it);
}
m_gameObjects.clear();
}
void Layer::update(sf::Time &pauseTime) {
for(unsigned int i = 0; i < m_gameObjects.size(); ++i) {
m_gameObjects[i]->update(pauseTime);
}
}
void Layer::draw(sf::RenderWindow *pWindow) {
for(unsigned int i = 0; i < m_gameObjects.size(); ++i) {
pWindow->draw(*(m_gameObjects[i]->getSprite()));
}
} | 24.55 | 102 | 0.643585 | [
"vector"
] |
4641867902a792422e8ec75d963b15049d725748 | 4,559 | cpp | C++ | src/ShopMyCloset/clothesmodel.cpp | EiriniMits/ShopMyCloset | 63c07b3458fa1bf28f411015491c5c75942132ea | [
"Apache-2.0"
] | 7 | 2018-03-02T02:56:11.000Z | 2021-12-16T13:07:55.000Z | src/ShopMyCloset/clothesmodel.cpp | EiriniMits/ShopMyCloset | 63c07b3458fa1bf28f411015491c5c75942132ea | [
"Apache-2.0"
] | null | null | null | src/ShopMyCloset/clothesmodel.cpp | EiriniMits/ShopMyCloset | 63c07b3458fa1bf28f411015491c5c75942132ea | [
"Apache-2.0"
] | 4 | 2018-03-02T02:55:59.000Z | 2020-06-11T12:35:04.000Z | #include "clothesmodel.h"
// insert an item into a database
void ClothesModel::insertItem (QString id, QString name,QString brand, QString imgPath,QString description,QString size,std::vector<QString> colors, std::vector<std::pair<QString,double>> components,QString price)
{
beginResetModel();
Clothes *c;
c = new Clothes(id,name,brand,imgPath,description,size,colors,components,price);
qDebug ("object created\n");
this->myData.push_back(*c);
endResetModel();
qDebug("Size of Items vector is now %d\n",myData.size());
}
//deletes an item from database according to it's unique id
void ClothesModel::deleteItem(QString id){
int k=0;
beginResetModel();
for (unsigned long j=0;j<myData.size();j++)
{
if ( ((Clothes)myData[j]).getId()==id)
{
break;
}
k++;
}
myData.erase(myData.begin() + k);
endResetModel();
}
//changes item's info
void ClothesModel::changeItem1 (QString id,QString name,QString brand, QString imgPath,QString description,QString size,QString price)
{
beginResetModel();
for (unsigned long j=0;j<myData.size();j++)
{
if ( ((Clothes)myData[j]).getId()==id)
{
beginResetModel();
int id = rand() % 10000000 + 1;
QString id2 = QString::number(id);
Clothes *c;
c = new Clothes(id2,name,brand,imgPath,description,size,((Clothes)myData[j]).getColors(),((Clothes)myData[j]).getComponents(),price);
qDebug ("object changed\n");
this->myData.push_back(*c);
endResetModel();
break;
}
}
}
void ClothesModel::changeItem2 (QString id,QString name,QString brand, QString imgPath,QString description,QString size,std::vector<QString> colors,QString price)
{
beginResetModel();
for (unsigned long j=0;j<myData.size();j++)
{
if ( ((Clothes)myData[j]).getId()==id)
{
beginResetModel();
int id = rand() % 10000000 + 1;
QString id2 = QString::number(id);
Clothes *c;
c = new Clothes(id2,name,brand,imgPath,description,size,colors,((Clothes)myData[j]).getComponents(),price);
qDebug ("object changed\n");
this->myData.push_back(*c);
endResetModel();
break;
}
}
}
void ClothesModel::changeItem3 (QString id,QString name,QString brand, QString imgPath,QString description,QString size,std::vector<std::pair<QString,double>> components,QString price)
{
beginResetModel();
for (unsigned long j=0;j<myData.size();j++)
{
if ( ((Clothes)myData[j]).getId()==id)
{
beginResetModel();
int id = rand() % 10000000 + 1;
QString id2 = QString::number(id);
Clothes *c;
c = new Clothes(id2,name,brand,imgPath,description,size,((Clothes)myData[j]).getColors(),components,price);
qDebug ("object changed\n");
this->myData.push_back(*c);
endResetModel();
break;
}
}
}
QHash<int, QByteArray> ClothesModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[IdRole] = "id";
roles[NameRole] = "name";
roles[BrandRole] = "brand";
roles[ImgPathRole] = "image";
roles[DescriptionRole] = "description";
roles[SizeRole] = "size";
roles[ColorsRole] = "colors";
roles[MaterialsRole] = "materials";
roles[PriceRole] = "price";
return roles;
}
int ClothesModel::rowCount(const QModelIndex &parent) const
{
return myData.size();
}
QVariant ClothesModel::data(const QModelIndex &index, int role) const
{
int row = index.row();
if (myData.size()>row && row>=0)
{
Clothes i = myData[row];
switch (role)
{
case IdRole: return i.getId();
case NameRole: return i.getName();
case BrandRole: return i.getBrand();
case ImgPathRole: return i.getImgPath();
case DescriptionRole: return i.getDescription();
case SizeRole: return i.getSize();
case ColorsRole: return i.getColorSimple();
case MaterialsRole: return i.getComponentsSimple();
case PriceRole: return i.getPrice();
default: return QVariant();
}
}
else
{
QVariant qv;
return qv;
}
}
| 32.333333 | 213 | 0.575345 | [
"object",
"vector"
] |
4646b0cda36602f478bbbb808693a25f64a5814e | 4,764 | cpp | C++ | Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp | brucerennie/cgal | 314b94aafa9b08a1d086accd2cadff1aae1b57a9 | [
"CC0-1.0"
] | 3,227 | 2015-03-05T00:19:18.000Z | 2022-03-31T08:20:35.000Z | Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp | brucerennie/cgal | 314b94aafa9b08a1d086accd2cadff1aae1b57a9 | [
"CC0-1.0"
] | 5,574 | 2015-03-05T00:01:56.000Z | 2022-03-31T15:08:11.000Z | Arrangement_on_surface_2/examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp | brucerennie/cgal | 314b94aafa9b08a1d086accd2cadff1aae1b57a9 | [
"CC0-1.0"
] | 1,274 | 2015-03-05T00:01:12.000Z | 2022-03-31T14:47:56.000Z | //! \file examples/Arrangement_on_surface_2/spherical_degenerate_sweep.cpp
// Using the global aggregated insertion function.
// #define CGAL_SL_VERBOSE 0
// #define CGAL_ARRANGEMENT_ON_SURFACE_INSERT_VERBOSE 1
// #define CGAL_ARR_CONSTRUCTION_SL_VISITOR_VERBOSE 1
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
#include <CGAL/Arr_spherical_topology_traits_2.h>
#include "arr_print.h"
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
#if 0
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -8, 6> Geom_traits_2;
#elif 0
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -11, 7> Geom_traits_2;
#else
typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel, -1, 0> Geom_traits_2;
#endif
typedef Geom_traits_2::Point_2 Point_2;
typedef Geom_traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Arr_spherical_topology_traits_2<Geom_traits_2> Topol_traits_2;
typedef CGAL::Arrangement_on_surface_2<Geom_traits_2, Topol_traits_2>
Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle;
int main() {
Geom_traits_2 traits;
Geom_traits_2::Construct_point_2 ctr_p = traits.construct_point_2_object();
Geom_traits_2::Construct_x_monotone_curve_2 ctr_xcv =
traits.construct_x_monotone_curve_2_object();
std::vector< Point_2 > points;
std::vector< X_monotone_curve_2 > xcvs;
CGAL::IO::set_pretty_mode(std::cout);
Point_2 sp = ctr_p(0, 0, -1);
Point_2 np = ctr_p(0, 0, 1);
points.push_back(sp);
points.push_back(np);
Point_2 p1 = ctr_p(-1, 0, 0);
Point_2 p2 = ctr_p( 0, -1, 0);
Point_2 p3 = ctr_p( 1, 0, 0);
points.push_back(p1);
points.push_back(p2);
points.push_back(p3);
X_monotone_curve_2 xcv_sp1 = ctr_xcv(sp, p1);
X_monotone_curve_2 xcv_sp2 = ctr_xcv(sp, p2);
X_monotone_curve_2 xcv_sp3 = ctr_xcv(sp, p3);
CGAL_assertion(xcv_sp1.is_vertical());
CGAL_assertion(xcv_sp2.is_vertical());
CGAL_assertion(xcv_sp3.is_vertical());
xcvs.push_back(xcv_sp1); // 0
xcvs.push_back(xcv_sp2); // 1
xcvs.push_back(xcv_sp3); // 2
X_monotone_curve_2 xcv_12 = ctr_xcv(p1, p2);
X_monotone_curve_2 xcv_23 = ctr_xcv(p2, p3);
CGAL_assertion(!xcv_12.is_vertical());
CGAL_assertion(!xcv_23.is_vertical());
xcvs.push_back(xcv_12); // 3
xcvs.push_back(xcv_23); // 4
X_monotone_curve_2 xcv_np1 = ctr_xcv(np, p1);
X_monotone_curve_2 xcv_np2 = ctr_xcv(np, p2);
X_monotone_curve_2 xcv_np3 = ctr_xcv(np, p3);
CGAL_assertion(xcv_np1.is_vertical());
CGAL_assertion(xcv_np2.is_vertical());
CGAL_assertion(xcv_np3.is_vertical());
xcvs.push_back(xcv_np1); // 5
xcvs.push_back(xcv_np2); // 6
xcvs.push_back(xcv_np3); // 7
unsigned subsetsp = (1 << points.size());
std::cout << "#subsets points: " << subsetsp << std::endl;
unsigned subsets = (1 << xcvs.size());
std::cout << "#subsets curves: " << subsets << std::endl;
std::cout << "total combinations: " << (subsetsp)*(subsets)
<< std::endl<< std::endl;
for (unsigned up = 0; up < subsetsp; up++) {
std::vector< Point_2 > points_sub;
for (unsigned ep = 0; ep <= points.size(); ep++) {
if (up & (1 << ep)) {
std::cout << "take pt: " << ep << std::endl;
points_sub.push_back(points[ep]);
}
}
for (unsigned u = 0; u < subsets; u++) {
std::vector< X_monotone_curve_2 > xcvs_sub;
for (unsigned e = 0; e <= xcvs.size(); e++) {
if (u & (1 << e)) {
std::cout << "take xcv: " << e << std::endl;
xcvs_sub.push_back(xcvs[e]);
}
}
std::cout << "subsetpoints #" << up << " has size: "
<< points_sub.size() << std::endl;
std::cout << "subsetcurves #" << u << " has size: "
<< xcvs_sub.size() << std::endl;
#if 1
Arrangement_2 arr;
std::cout << "inserting "
<< xcvs_sub.size() << " x-monotone curves and "
<< points_sub.size() << " isolated points."
<< std::endl;
// TODO why is this signature not available as "insert(...)"
CGAL::insert_empty(arr, xcvs_sub.begin(), xcvs_sub.end(),
points_sub.begin(), points_sub.end());
print_arrangement_size(arr); // print the arrangement size
std::cout << "======================================================="
<< std::endl << std::endl << std::endl;
#endif
//std::cout << "arr: " << arr << std::endl;
std::cout << std::endl;
}
}
return 0;
}
| 34.273381 | 80 | 0.629513 | [
"vector"
] |
464ba5584b5fa58779c06e70d3d52c5c0f20a267 | 669 | cpp | C++ | cpp-leetcode/leetcode1894-find-the-student-that-will-replace-the-chalk_mod_tip.cpp | yanglr/LeetCodeOJ | 27dd1e4a2442b707deae7921e0118752248bef5e | [
"MIT"
] | 45 | 2021-07-25T00:45:43.000Z | 2022-03-24T05:10:43.000Z | cpp-leetcode/leetcode1894-find-the-student-that-will-replace-the-chalk_mod_tip.cpp | yanglr/LeetCodeOJ | 27dd1e4a2442b707deae7921e0118752248bef5e | [
"MIT"
] | null | null | null | cpp-leetcode/leetcode1894-find-the-student-that-will-replace-the-chalk_mod_tip.cpp | yanglr/LeetCodeOJ | 27dd1e4a2442b707deae7921e0118752248bef5e | [
"MIT"
] | 15 | 2021-07-25T00:40:52.000Z | 2021-12-27T06:25:31.000Z | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int chalkReplacer(vector<int>& chalk, int k) {
long long sum = 0;
for (auto num : chalk)
sum += num; // 求和
k = k % sum; // 小技巧: mod, 减小目标值 k 的规模
int len = chalk.size();
for (int i = 0; i < len; i++)
{
if (k < chalk[i]) return i; // 不够减时
k -= chalk[i];
}
return -1;
}
};
// Test
int main()
{
Solution sol;
vector<int> chalk = {3, 1, 7};
int k = 30004001;
int res = sol.chalkReplacer(chalk, k);
cout << res << endl;
return 0;
} | 20.272727 | 50 | 0.490284 | [
"vector"
] |
46521f231af8be920f12d071469f84270b265ee2 | 28,674 | cxx | C++ | resip/stack/test/limpc.cxx | dulton/reSipServer | ac4241df81c1e3eef2e678271ffef4dda1fc6747 | [
"Apache-2.0"
] | 1 | 2019-04-15T14:10:58.000Z | 2019-04-15T14:10:58.000Z | resip/stack/test/limpc.cxx | dulton/reSipServer | ac4241df81c1e3eef2e678271ffef4dda1fc6747 | [
"Apache-2.0"
] | null | null | null | resip/stack/test/limpc.cxx | dulton/reSipServer | ac4241df81c1e3eef2e678271ffef4dda1fc6747 | [
"Apache-2.0"
] | 2 | 2019-10-31T09:11:09.000Z | 2021-09-17T01:00:49.000Z | #if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <cstring>
#include <cassert>
#include <stdio.h>
#include <signal.h>
//#define USE_CURSES
#ifdef USE_CURSES
#include <ncurses.h>
#else
#include <iostream>
#include <cstdio>
#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
typedef void WINDOW;
// !ah! Really ought to check for ncurses and be a bit better behaved than this.
#if !defined(TRUE)
#define TRUE true
#endif
#if !defined(FALSE)
#define FALSE false
#endif
char ACS_HLINE=1;
char ACS_VLINE=2;
WINDOW* stdscr=0;
WINDOW* newwin(...) { return NULL; };
void waddstr(WINDOW*, const char* text) { std::clog << text; };
char getch()
{
char buf[1];
int r = read(fileno(stdin),&buf,1);
if ( r ==1 )
{
return buf[0];
}
return 0;
};
void werase(WINDOW*) {};
void wrefresh(...) {};
void mvhline(...) {};
void refresh(...) {};
void getmaxyx(...) {};
void clearok(...) {};
void waddch(...) {};
void initscr(...) {};
void cbreak(...) {};
void noecho(...) {};
void nonl(...) {};
void intrflush(...) {};
void keypad(...) {};
void scrollok(...) {};
void wmove(...) {};
void mvvline(...) {};
#endif
#ifndef WIN32
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#endif
#include "rutil/FdPoll.hxx"
#include "rutil/Socket.hxx"
#include "rutil/Logger.hxx"
#include "resip/stack/SipStack.hxx"
#include "resip/stack/Uri.hxx"
#include "resip/stack/TuIM.hxx"
#ifdef USE_SSL
#include "resip/stack/ssl/Security.hxx"
#endif
static int myMain(int argc, char* argv[]);
using namespace resip;
using namespace std;
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
static WINDOW* commandWin=0;
static WINDOW* textWin=0;
static WINDOW* statusWin=0;
static TuIM* tuIM;
static Uri dest;
void
displayPres()
{
werase(statusWin);
for( int i=0; i<tuIM->getNumBuddies();i++)
{
Uri uri = tuIM->getBuddyUri(i);
Data status;
bool online = tuIM->getBuddyStatus(i,&status);
const char* stat = (online)?"online":"offline";
waddstr(statusWin,uri.getAor().c_str());
waddstr(statusWin," ");
waddstr(statusWin,stat);
waddstr(statusWin," ");
waddstr(statusWin,status.c_str());
waddstr(statusWin,"\n");
}
wrefresh(statusWin);
}
bool
processStdin( Uri* dest, bool sign, bool encryp )
{
static unsigned int num=0;
static char buf[1024];
char c = getch();
if ( c == 0 )
{
return true;
}
if ( c == '\f' )
{
clearok(textWin,TRUE);
clearok(statusWin,TRUE);
clearok(commandWin,TRUE);
assert( num < sizeof(buf) );
buf[num] = 0;
werase(commandWin);
waddstr(commandWin,buf);
wrefresh(textWin);
wrefresh(statusWin);
wrefresh(commandWin);
return true;
}
#if 0
char junk[6];
junk[0]=' ';
junk[1]='0'+(c/100);
junk[2]='0'+((c/10)%10);
junk[3]='0'+(c%10);
junk[4]=' ';
junk[5]=0;
waddstr(commandWin,junk);
#endif
if ( (c == '\a') || (c == '\b') || (c == 4 ) || (c == 0x7F) )
{
if ( num > 0 )
{
num--;
}
buf[num]=0;
werase(commandWin);
waddstr(commandWin,buf);
wrefresh(commandWin);
return true;
}
if ( (c == '\r') || (c == '\n') || (num+2>=sizeof(buf)) )
{
buf[num] =0;
if ( (num>3) && (!strncmp("to:",buf,3)) )
{
buf[num] = 0;
*dest = Uri(Data(buf+3));
//cerr << "Set destination to <" << *dest << ">";
waddstr(textWin,"Set destination to ");
waddstr(textWin, Data::from(*dest).c_str());
waddstr(textWin,"\n");
wrefresh(textWin);
}
else if ( (num>4) && (!strncmp("add:",buf,4)) )
{
buf[num] = 0;
Uri uri(Data(buf+4));
//cerr << "Subscribing to buddy <" << uri << ">";
waddstr(textWin, "Subscribing to ");
waddstr(textWin, Data::from(uri).c_str());
waddstr(textWin, "\n");
wrefresh(textWin);
tuIM->addBuddy( uri, Data::Empty );
displayPres();
}
else if ( (num>=7) && (!strncmp("status:",buf,7)) )
{
buf[num] = 0;
Data stat(buf+7);
//cerr << "setting presence status to <" << stat << ">";
waddstr(textWin,"Set presece status to <");
waddstr(textWin,stat.c_str());
waddstr(textWin,">\n");
wrefresh(textWin);
tuIM->setMyPresence( !stat.empty(), stat );
}
else if ( (num==1) && (!strncmp(".",buf,1)) )
{
//DebugLog( << "Got a period - end program" );
return false;
}
else
{
if ( num >= 1 )
{
assert( num < sizeof(buf) );
buf[num] = 0;
Data text(buf);
Data destValue = dest->getAor();
DebugLog( << "Destination is " << destValue );
Data encFor = Data::Empty;
if (encryp)
{
encFor = dest->getAorNoPort();
}
DebugLog( << "Destination encrypt for is " << encFor );
if ( tuIM->haveCerts(sign,encFor) )
{
waddstr(textWin,"To: ");
waddstr(textWin,destValue.c_str());
waddstr(textWin," ");
waddstr(textWin,text.c_str());
waddstr(textWin,"\n");
wrefresh(textWin);
tuIM->sendPage( text , *dest, sign , encFor );
}
else
{
waddstr(textWin,"Don't have aproperate certificates to sign and encrypt a message to ");
waddstr(textWin,destValue.c_str());
waddstr(textWin,"\n");
wrefresh(textWin);
}
}
}
num = 0;
werase(commandWin);
wrefresh(commandWin);
}
else
{
buf[num++] = c;
assert( num < sizeof(buf) );
waddch(commandWin,c);
wrefresh(commandWin);
}
return true;
}
class StdInWatcher : public resip::FdPollItemIf
{
public:
StdInWatcher(Uri* dest, bool sign, bool encrypt) :
mDest(dest),
mSign(sign),
mEncrypt(encrypt),
mKeepGoing(true)
{}
virtual ~StdInWatcher(){}
virtual void processPollEvent(FdPollEventMask mask)
{
mKeepGoing=processStdin(mDest, mSign, mEncrypt);
}
inline bool keepGoing() const {return mKeepGoing;}
private:
Uri* mDest;
bool mSign;
bool mEncrypt;
bool mKeepGoing;
}; // class StdInWatcher
class TestCallback: public TuIM::Callback
{
public:
virtual void presenceUpdate(const Uri& dest, bool open, const Data& status );
virtual void receivedPage( const Data& msg, const Uri& from ,
const Data& signedBy, SignatureStatus sigStatus,
bool wasEncryped );
virtual void sendPageFailed( const Uri& dest,int respNumber );
virtual void registrationFailed(const resip::Uri&, int respNumber);
virtual void registrationWorked(const Uri& dest );
virtual void receivePageFailed(const Uri& sender);
};
void
TestCallback::presenceUpdate(const Uri& from, bool open, const Data& status )
{
const char* stat = (open)?"online":"offline";
//cout << from << " set presence to " << stat << " " << status.c_str() << endl;
waddstr(textWin,"Status: ");
waddstr(textWin, from.getAor().c_str());
waddstr(textWin," is ");
waddstr(textWin,stat);
waddstr(textWin," ");
waddstr(textWin,status.c_str());
waddstr(textWin,"\n");
wrefresh(textWin);
displayPres();
}
void
TestCallback::receivedPage( const Data& msg, const Uri& from,
const Data& signedBy, SignatureStatus sigStatus,
bool wasEncryped )
{
//DebugLog(<< "In TestPageCallback");
if ( dest != from )
{
dest = from;
//cerr << "Set destination to <" << *mDest << ">" << endl;
waddstr(textWin,"Set destination to ");
waddstr(textWin, Data::from(dest).c_str());
waddstr(textWin,"\n");
}
//cout << from;
waddstr(textWin,"From: ");
waddstr(textWin,from.getAor().c_str());
if ( !wasEncryped )
{
//cout << " -NOT SECURE- ";
waddstr(textWin," -NOT SECURE-");
}
else
{
waddstr(textWin," -secure-");
}
switch ( sigStatus )
{
case SignatureSelfSigned:
//cout << " -self signed signature (bad)- ";
waddstr(textWin,"bad signature");
break;
case SignatureIsBad:
//cout << " -bad signature- ";
waddstr(textWin,"bad signature");
break;
case SignatureNone:
//cout << " -no signature- ";
waddstr(textWin,"no signature");
break;
case SignatureTrusted:
//cout << " <signed " << signedBy << " > ";
waddstr(textWin,"signed ");
waddstr(textWin,signedBy.c_str());
break;
case SignatureCATrusted:
//cout << " <ca signed " << signedBy << " > ";
waddstr(textWin,"ca signed " );
waddstr(textWin,signedBy.c_str());
break;
case SignatureNotTrusted:
//cout << " <signed " << signedBy << " NOT TRUSTED > ";
waddstr(textWin,"untrusted signature ");
waddstr(textWin,signedBy.c_str());
break;
}
//cout << " says:" << endl;
//cout << msg.escaped() << endl;
waddstr(textWin, " says: ");
waddstr(textWin, msg.escaped().c_str() );
waddstr(textWin, "\n");
wrefresh(textWin);
}
void
TestCallback::sendPageFailed( const Uri& target, int respNum )
{
//InfoLog(<< "In TestErrCallback");
// cerr << "Message to " << dest << " failed" << endl;
Data num(respNum);
waddstr(textWin,"Message to ");
waddstr(textWin, Data::from(target).c_str());
waddstr(textWin," failed (");
waddstr(textWin,num.c_str());
waddstr(textWin," response)\n");
wrefresh(textWin);
}
void
TestCallback::receivePageFailed( const Uri& target )
{
//InfoLog(<< "In TestErrCallback");
// cerr << "Message to " << dest << " failed" << endl;
waddstr(textWin,"Can not understand messager from ");
waddstr(textWin, Data::from(target).c_str());
waddstr(textWin,"\n");
wrefresh(textWin);
}
void
TestCallback::registrationFailed(const resip::Uri& target, int respNum )
{
Data num(respNum);
waddstr(textWin,"Registration to ");
waddstr(textWin, Data::from(target).c_str());
waddstr(textWin," failed (");
waddstr(textWin,num.c_str());
waddstr(textWin," response)\n");
wrefresh(textWin);
}
void
TestCallback::registrationWorked(const resip::Uri& target)
{
waddstr(textWin,"Registration to ");
waddstr(textWin, Data::from(target).c_str());
waddstr(textWin," worked");
wrefresh(textWin);
}
int
main(int argc, char* argv[])
{
#ifndef _WIN32
if ( signal( SIGPIPE, SIG_IGN) == SIG_ERR)
{
cerr << "Couldn't install signal handler for SIGPIPE" << endl;
exit(-1);
}
#endif
int r;
try
{
r = myMain( argc, argv );
}
catch( ... )
{
ErrLog( << "Got a exception passed all the way to the top of limp" );
exit(-1);
}
return r;
}
static int
myMain(int argc, char* argv[])
{
Log::initialize(Log::Cerr, Log::Err, argv[0]);
Log::setLevel(Log::Warning);
InfoLog(<<"Test Driver for IM Starting");
int port = 5060;
int tlsPort = 0;
int dtlsPort = 0;
Uri aor;
bool haveAor=false;
dest = Uri("sip:nobody@example.com");
Data aorPassword;
Uri contact("sip:user@");
bool haveContact=false;
Uri outbound;
bool noRegister = false;
Data tlsDomain = Data::Empty;
Data sendMsg = Data::Empty;
int numAdd=0;
Data addList[100];
int numPub=0;
Data pubList[100];
bool encryp=false;
bool sign=false;
Data key("password");
bool useTls = true;
bool noTls = false;
bool noTcp = false;
bool prefUdp = false;
bool prefTls = false;
bool prefDtls = false;
bool prefTcp = false;
bool noUdp = false;
bool noV6 = false;
bool noV4 = false;
bool genUserCert = false;
for ( int i=1; i<argc; i++)
{
if (!strcmp(argv[i],"-vv"))
{
Log::setLevel(Log::Stack);
}
else if (!strcmp(argv[i],"-v"))
{
Log::setLevel(Log::Info);
}
else if (!strcmp(argv[i],"-encrypt"))
{
encryp = true;
}
else if (!strcmp(argv[i],"-genUserCert"))
{
genUserCert = true;
}
else if (!strcmp(argv[i],"-noRegister"))
{
noRegister = true;
}
else if (!strcmp(argv[i],"-sign"))
{
sign = true;
}
else if (!strcmp(argv[i],"-tlsDomain"))
{
i++;
assert( i<argc );
tlsDomain = Data(argv[i]);
}
else if (!strcmp(argv[i],"-ssl"))
{
useTls = false;
}
else if (!strcmp(argv[i],"-noTcp"))
{
noTcp = true;
}
else if (!strcmp(argv[i],"-noTls"))
{
noTls = true;
}
else if (!strcmp(argv[i],"-noUdp"))
{
noUdp = true;
}
else if (!strcmp(argv[i],"-prefTcp"))
{
prefTcp = true;
}
else if (!strcmp(argv[i],"-prefTls"))
{
prefTls = true;
}
else if (!strcmp(argv[i],"-prefUdp"))
{
prefUdp = true;
}
else if (!strcmp(argv[i],"-noV6"))
{
noV6 = true;
}
else if (!strcmp(argv[i],"-noV4"))
{
noV4 = true;
}
else if (!strcmp(argv[i],"-port"))
{
i++;
assert( i<argc );
port = atoi( argv[i] );
}
else if (!strcmp(argv[i],"-tlsPort"))
{
i++;
assert( i<argc );
tlsPort = atoi( argv[i] );
}
else if (!strcmp(argv[i],"-dtlsPort"))
{
i++;
assert( i<argc );
dtlsPort = atoi( argv[i] );
}
else if (!strcmp(argv[i],"-aor"))
{
i++;
assert( i<argc );
try
{
aor = Uri(Data(argv[i]));
}
catch (...)
{
ErrLog( <<"AOR URI is not valid - must start with sip: ");
exit(-1);
}
haveAor=true;
}
else if (!strcmp(argv[i],"-outbound"))
{
i++;
assert( i<argc );
try
{
outbound = Uri(Data(argv[i]));
}
catch (...)
{
ErrLog( <<"Outbound URI is not valid - must start with sip: ");
exit(-1);
}
}
else if (!strcmp(argv[i],"-send"))
{
i++;
assert( i<argc );
sendMsg = Data(argv[i]);
}
else if (!strcmp(argv[i],"-contact"))
{
i++;
assert( i<argc );
try
{
contact = Uri(Data(argv[i]));
}
catch (...)
{
ErrLog( <<"Contact URI is not valid - must start with sip: ");
exit(-1);
}
haveContact=true;
}
else if (!strcmp(argv[i],"-add"))
{
i++;
assert( i<argc );
addList[numAdd++] = Data(argv[i]);
assert( numAdd < 100 );
try
{
// CJ TODO FIX
//Uri uri( Data(argv[i]) );
}
catch (...)
{
ErrLog( <<"URI in -add is not valid - must start with sip: ");
exit(-1);
}
}
else if (!strcmp(argv[i],"-pub"))
{
i++;
assert( i<argc );
pubList[numPub++] = Data(argv[i]);
assert( numPub < 100 );
try
{
// CJ TODO FIX
//Uri uri(Data(argv[i]));
}
catch (...)
{
ErrLog( <<"Pub URI is not valid - must start with sip: ");
exit(-1);
}
}
else if (!strcmp(argv[i],"-aorPassword"))
{
i++;
assert( i<argc );
aorPassword = Data(argv[i]);
}
else if (!strcmp(argv[i],"-to"))
{
i++;
assert( i<argc );
try
{
dest = Uri(Data(argv[i]));
}
catch (...)
{
ErrLog( <<"To URI is not valid - must start with sip: ");
exit(-1);
}
}
else if (!strcmp(argv[i],"-key"))
{
i++;
assert( i<argc );
key = Data(argv[i]);
}
else
{
clog <<"Bad command line opion: " << argv[i] << endl;
clog <<"options are: " << endl
<< "\t [-v] [-vv] [-tls] [-port 5060] [-tlsport 5061]" << endl
<< "\t [-aor sip:alice@example.com] [-aorPassword password]" << endl
<< "\t [-to sip:friend@example.com] [-add sip:buddy@example.com]" << endl
<< "\t [-sign] [-encrypt] [-key secret]" << endl
<< "\t [-contact sip:me@example.com] " << endl
<< "\t [-outbound \"sip:example.com;lr\"] " << endl
<< "\t [-noRegister] " << endl
<< "\t [-pub sip:foo.com] " << endl
<< "\t [-tlsDomain foo.com] " << endl
<< "\t [-send myMessage] " << endl;
clog << endl
<< " -v is verbose" << endl
<< " -vv is very verbose" << endl
<< " -noV6 don't use IPv6" << endl
<< " -noV4 don't use IPv4" << endl
<< " -noUdp don't use UDP" << endl
<< " -noTcp don't use TCP" << endl
<< " -noTls don't use TLS" << endl
<< " -prefUdp prefer UDP" << endl
<< " -prefTcp prefer TCP" << endl
<< " -prefTls prefer TLS" << endl
<< " -port sets the UDP and TCP port to listen on" << endl
<< " -tlsPort sets the port to listen for TLS on" << endl
<< " -tlsDomain domainName - sets tls and dtls to act as tls server instead of client" << endl
<< " -ssl - use ssl instead of tls" << endl
<< " -aor sets the proxy and user name to register with" << endl
<< " -aorPassword sets the password to use for registration" << endl
<< " -noRegister causes it not to register - by default the AOR is registered" << endl
<< " -to sets initial location to send messages to" << endl
<< " -outbound sets the outbound proxy" << endl
<< " -add adds a budy who's presence will be monitored" << endl
<< " -pub adds a State Agent to send publishes too" << endl
<< " -sign signs message you send and -encryp encrypt them " << endl
<< " -send takes a string (needs to be quoted if it has spaces) "
<< "and sends it as an IM " << endl
<< "\t(You need PKI certs for this to work)" << endl
<< " -key allows you to enter a secret used to load your private key."<< endl
<< " If you set the secret to - the system will querry you for it."<< endl
<< " -contact overrides your SIP contact - can be used for NAT games" << endl
<< "\t there can be many -add " << endl
<< " -genUserCert - generate a new user cert" << endl
<< " " << endl
<< "Examples" << endl
<< "An example command line for a user with account name alice at example.com is:" << endl
<< "\t" << argv[0] << " -aor \"alice@example.com\" -aorPassword \"secret\"" << endl
<< "to watch the presence of bob and charlie add" << endl
<< "\t-add \"sip:bob@bilboxi.com\" -add \"charlie@example.com\" " << endl
<< "If Alice was behind a NAT that had a public address of 1.2.3.4 and had forwarded" << endl
<< "port 5070 on this NAT to the machine Alice was using, then the following " << endl
<< "options would be added" << endl
<< "\t-contact \"sip:alice@1.2.3.4:5070\" -port 5070" << endl
<< "" << endl
<< endl;
exit(1);
}
}
//InfoLog( << "Using port " << port );
#ifdef USE_SSL
InfoLog( << "Setting up Security" );
Security* security=NULL;
try
{
char cert_dir[ 1024 ] ;
char *home_dir = getenv( "HOME" ) ;
cert_dir[ 0 ] = '\0' ;
::strcat( cert_dir, home_dir ) ;
::strcat( cert_dir, "/.sipCerts/" ) ;
security = new Security( cert_dir ) ;
// ::free( home_dir ) ; // CJ TODO mem leak
}
catch( ... )
{
security = NULL;
ErrLog( << "Got a exception setting up Security" );
}
SipStack sipStack( security );
#else
SipStack sipStack( false /*multihtread*/ );
#endif
if ( key == Data("-") )
{
clog << "Please enter password to use to load your private key: ";
char buf[1024];
cin.get(buf,1024);
key = Data(buf);
InfoLog( << "Certificate key set to <" << key << ">" );
}
#ifdef USE_SSL
try
{
Security* security = sipStack.getSecurity();
assert(security != 0);
}
catch( ... )
{
ErrLog( << "Got an exception creating security object " );
}
try
{
assert(security != 0);
security->preload();
}
catch( ... )
{
ErrLog( << "Got a exception pre loading certificates" );
}
if (genUserCert)
{
assert( security );
security->generateUserCert(aor.getAor());
}
#endif
DebugLog( << "About to add the transports " );
if (port!=0)
{
if ( noUdp != true )
{
if (!noV4) sipStack.addTransport(UDP, port, V4);
#ifdef USE_IPV6
if (!noV6) sipStack.addTransport(UDP, port, V6);
#endif
}
if ( noTcp != true )
{
if (!noV4) sipStack.addTransport(TCP, port, V4);
#ifdef USE_IPV6
if (!noV6) sipStack.addTransport(TCP, port, V6);
#endif
}
}
#ifdef USE_SSL
if ( tlsPort != 0 )
{
if ( noTls != true )
{
if (!noV4)
{
sipStack.addTransport(TLS, tlsPort, V4, StunDisabled, Data::Empty, tlsDomain );
}
//if (!noV6) sipStack.addTlsTransport(tlsPort,Data::Empty,Data::Empty,Data::Empty,V6);
}
}
#ifdef USE_DTLS
if ( dtlsPort != 0 )
{
if ( noTls != true )
{
if (!noV4)
{
sipStack.addTransport(DTLS, dtlsPort, V4, StunDisabled, Data::Empty, tlsDomain );
}
}
}
#endif
#endif
DebugLog( << "Done adding the transports " );
if (!haveContact)
{
// contact.port() = port;
// contact.host() = sipStack.getHostname();
}
if ( haveAor )
{
if (!haveContact)
{
contact.user() = aor.user();
#ifdef USE_SSL
if ( aor.scheme() == "sips" )
{
contact.scheme() = aor.scheme();
//contact.port() = tlsPort;
}
#endif
}
}
else
{
aor.port() = port;
aor.host() = sipStack.getHostname();
aor.user() = Data("user");
}
InfoLog( << "aor is " << aor );
InfoLog( << "contact is " << contact );
TestCallback callback;
tuIM = new TuIM(&sipStack,aor,contact,&callback);
Data name("SIPimp.org/0.2.5 (curses)");
tuIM->setUAName( name );
if ( !outbound.host().empty() )
{
tuIM->setOutboundProxy( outbound );
}
// setup prefered outbound transport
if ( prefUdp )
{
tuIM->setDefaultProtocol( UDP );
}
if ( prefTcp )
{
tuIM->setDefaultProtocol( TCP );
}
if ( prefTls )
{
tuIM->setDefaultProtocol( TLS );
}
if ( prefDtls )
{
tuIM->setDefaultProtocol( DTLS );
}
if ( haveAor )
{
if ( !noRegister )
{
tuIM->registerAor( aor, aorPassword );
}
}
initscr();
cbreak();
noecho();
nonl();
intrflush(stdscr, FALSE);
keypad(stdscr, TRUE);
int rows=0;
int cols=0;
getmaxyx(stdscr,rows,cols); /* get the number of rows and columns */
commandWin = newwin(2,cols,rows-2,0);
scrollok(commandWin, TRUE);
wmove(commandWin,0,0);
textWin = newwin(rows-3,cols*3/4,0,0);
scrollok(textWin, TRUE);
wmove(textWin,0,0);
statusWin = newwin(rows-3,cols-(cols*3/4)-1,0,1+cols*3/4);
scrollok(statusWin, FALSE);
wmove(statusWin,0,0);
mvhline(rows-3,0,ACS_HLINE,cols);
mvvline(0,(cols*3/4),ACS_VLINE,rows-3);
refresh();
for ( int i=0; i<numAdd; i++ )
{
Uri uri(addList[i]);
tuIM->addBuddy( uri, Data::Empty );
}
for ( int i=0; i<numPub; i++ )
{
Uri uri(pubList[i]);
tuIM->addStateAgent( uri );
}
displayPres();
waddstr(textWin,"Use -help on the command line to view options\n");
waddstr(textWin,"To set where your messages will get sent type\n");
waddstr(textWin," to: sip:alice@example.com \n");
waddstr(textWin,"To monitores someeone presence type\n");
waddstr(textWin," add: sip:buddy@example.com \n");
waddstr(textWin,"To change you online status type\n");
waddstr(textWin," status: in meeting\n");
waddstr(textWin,"To set yourself to offline type\n");
waddstr(textWin," status:\n");
waddstr(textWin,"To exit type a single period\n");
waddstr(textWin,"\n");
wrefresh(textWin);
if ( !sendMsg.empty() )
{
tuIM->sendPage( sendMsg , dest, sign , (encryp) ?
(dest.getAorNoPort()) : (Data::Empty) );
}
StdInWatcher watcher(&dest,sign,encryp);
FdPollItemHandle wh=sipStack.getPollGrp()->addPollItem(fileno(stdin), FPEM_Read, &watcher);
while (1)
{
try
{
sipStack.process( 50 );
}
catch (...)
{
ErrLog( << "Got a exception from sipStack::process" );
}
if(!watcher.keepGoing())
{
break;
}
try
{
tuIM->process();
}
catch (...)
{
ErrLog( << "Got a exception passed from TuIM::process" );
}
}
sipStack.getPollGrp()->delPollItem(wh);
return 0;
}
/* ====================================================================
* The Vovida Software License, Version 1.0
*
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 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 names "VOCAL", "Vovida Open Communication Application Library",
* and "Vovida Open Communication Application Library (VOCAL)" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact vocal@vovida.org.
*
* 4. Products derived from this software may not be called "VOCAL", nor
* may "VOCAL" appear in their name, without prior written
* permission of Vovida Networks, Inc.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
* IN EXCESS OF $1,000, NOR FOR ANY 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.
*
* ====================================================================
*
* This software consists of voluntary contributions made by Vovida
* Networks, Inc. and many individuals on behalf of Vovida Networks,
* Inc. For more information on Vovida Networks, Inc., please see
* <http://www.vovida.org/>.
*
*/
| 25.670546 | 108 | 0.524203 | [
"object"
] |
465238d298ae89a6d638a0a4d0d2f5fb312f056e | 35,448 | cpp | C++ | src/ascent/runtimes/expressions/ascent_derived_jit.cpp | goodbadwolf/ascent | 70662ebc6fd550d2d13349cb750022d9ce3b29a6 | [
"BSD-3-Clause"
] | 97 | 2017-10-23T23:59:46.000Z | 2022-03-02T22:21:00.000Z | src/ascent/runtimes/expressions/ascent_derived_jit.cpp | goodbadwolf/ascent | 70662ebc6fd550d2d13349cb750022d9ce3b29a6 | [
"BSD-3-Clause"
] | 475 | 2017-09-12T22:46:37.000Z | 2022-03-18T19:19:04.000Z | src/ascent/runtimes/expressions/ascent_derived_jit.cpp | goodbadwolf/ascent | 70662ebc6fd550d2d13349cb750022d9ce3b29a6 | [
"BSD-3-Clause"
] | 39 | 2017-09-12T20:18:29.000Z | 2022-01-20T00:22:55.000Z | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC.
//
// Produced at the Lawrence Livermore National Laboratory
//
// LLNL-CODE-716457
//
// All rights reserved.
//
// This file is part of Ascent.
//
// For details, see: http://ascent.readthedocs.io/.
//
// Please also read ascent/LICENSE
//
// 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 disclaimer below.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the LLNS/LLNL 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 LAWRENCE LIVERMORE NATIONAL SECURITY,
// LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//-----------------------------------------------------------------------------
///
/// file: ascent_derived_jit.cpp
///
//-----------------------------------------------------------------------------
#include <ascent_config.h>
#include "ascent_derived_jit.hpp"
#include "ascent_array.hpp"
#include "ascent_blueprint_architect.hpp"
#include "ascent_blueprint_topologies.hpp"
#include "ascent_expressions_ast.hpp"
#include <runtimes/flow_filters/ascent_runtime_utils.hpp>
#include <ascent_data_logger.hpp>
#include <ascent_mpi_utils.hpp>
#include <ascent_logging.hpp>
#include <cmath>
#include <cstring>
#include <functional>
#include <limits>
#ifdef ASCENT_JIT_ENABLED
#include <occa.hpp>
#include <occa/utils/env.hpp>
#include <stdlib.h>
#endif
#ifdef ASCENT_CUDA_ENABLED
#include <cuda_runtime.h>
#include <cuda.h>
#include "driver_types.h"
#endif
//-----------------------------------------------------------------------------
// -- begin ascent:: --
//-----------------------------------------------------------------------------
namespace ascent
{
//-----------------------------------------------------------------------------
// -- begin ascent::runtime --
//-----------------------------------------------------------------------------
namespace runtime
{
//-----------------------------------------------------------------------------
// -- begin ascent::runtime::expressions--
//-----------------------------------------------------------------------------
namespace expressions
{
int Jitable::m_cuda_device_id = -1;
namespace detail
{
std::string
type_string(const conduit::DataType &dtype)
{
std::string type;
if(dtype.is_float64())
{
type = "double";
}
else if(dtype.is_float32())
{
type = "float";
}
else if(dtype.is_int32())
{
type = "int";
}
else if(dtype.is_int64())
{
type = "long";
}
else if(dtype.is_unsigned_integer())
{
type = "unsigned long";
}
else
{
ASCENT_ERROR("JIT: unknown argument type: " << dtype.to_string());
}
return type;
}
//-----------------------------------------------------------------------------
// -- Array Allocation Functions
//-----------------------------------------------------------------------------
//{{{
using slice_t = std::tuple<size_t, size_t, size_t>;
#ifdef ASCENT_JIT_ENABLED
void
get_occa_mem(std::vector<Array<unsigned char>> &buffers,
const std::vector<slice_t> &slices,
std::vector<occa::memory> &occa)
{
occa::device &device = occa::getDevice();
ASCENT_DATA_OPEN("copy to device");
const std::string mode = device.mode();
// I think the valid modes are: "Serial" "OpenMP", "CUDA:
const size_t num_slices = slices.size();
occa.resize(num_slices);
for(size_t i = 0; i < num_slices; ++i)
{
ASCENT_DATA_OPEN("array_" + std::to_string(i));
flow::Timer device_array_timer;
Array<unsigned char> &buf = buffers[std::get<0>(slices[i])];
size_t buf_offset = std::get<1>(slices[i]);
size_t buf_size = std::get<2>(slices[i]);
unsigned char * ptr;
if(mode == "Serial" || mode == "OpenMP")
{
ptr = buf.get_host_ptr();
}
#ifdef ASCENT_CUDA_ENABLED
else if(mode == "CUDA")
{
ptr = buf.get_device_ptr();
}
#endif
else
{
ASCENT_ERROR("Unknow occa mode " << mode);
}
void * v_ptr = (void *)(ptr + buf_offset);
occa[i] = device.wrapMemory(v_ptr, buf_size * sizeof(unsigned char));
ASCENT_DATA_ADD("bytes", buf_size);
ASCENT_DATA_CLOSE();
}
ASCENT_DATA_CLOSE();
}
// pack/allocate the host array using a contiguous schema
void
host_realloc_array(const conduit::Node &src_array,
const conduit::Schema &dest_schema,
conduit::Node &dest_array)
{
// This check isn't strong enough, it will pass if the objects have different
// child names
if(!dest_schema.compatible(src_array.schema()))
{
ASCENT_ERROR("JIT: failed to allocate host array because the source and "
"destination schemas are incompatible.");
}
if(src_array.schema().equals(dest_schema))
{
// we don't need to copy the data since it's already the schema we want
dest_array.set_external(src_array);
}
else
{
// reallocate to a better schema
dest_array.set(dest_schema);
dest_array.update_compatible(src_array);
// src_array.info().print();
// dest_array.info().print();
}
}
// temporaries will always be one chunk of memory
void
device_alloc_temporary(const std::string &array_name,
const conduit::Schema &dest_schema,
conduit::Node &args,
std::vector<Array<unsigned char>> &array_memories,
std::vector<slice_t> &slices,
unsigned char *host_ptr)
{
ASCENT_DATA_OPEN("temp Array");
const auto size = dest_schema.total_bytes_compact();
Array<unsigned char> mem;
if(host_ptr == nullptr)
{
mem.resize(size);
}
else
{
// instead of using a temporary array for output and copying, we can point
// Array<> at the destination conduit array
mem.set(host_ptr, size);
}
array_memories.push_back(mem);
slices.push_back(slice_t(array_memories.size() - 1, 0, size));
if(dest_schema.number_of_children() == 0)
{
const std::string param =
detail::type_string(dest_schema.dtype()) + " *" + array_name;
args[param + "/index"] = slices.size() - 1;
}
else
{
for(const std::string &component : dest_schema.child_names())
{
const std::string param =
detail::type_string(dest_schema[component].dtype()) + " *" +
array_name + "_" + component;
args[param + "/index"] = slices.size() - 1;
}
}
ASCENT_DATA_ADD("bytes", dest_schema.total_bytes_compact());
ASCENT_DATA_CLOSE();
}
void
device_alloc_array(const conduit::Node &array,
const conduit::Schema &dest_schema,
conduit::Node &args,
std::vector<Array<unsigned char>> &array_memories,
std::vector<slice_t> &slices)
{
ASCENT_DATA_OPEN("input Array");
conduit::Node res_array;
flow::Timer host_array_timer;
host_realloc_array(array, dest_schema, res_array);
ASCENT_DATA_ADD("bytes", res_array.total_bytes_compact());
flow::Timer device_array_timer;
if(array.number_of_children() == 0)
{
unsigned char *start_ptr =
static_cast<unsigned char *>(const_cast<void *>(res_array.data_ptr()));
const auto size = res_array.total_bytes_compact();
Array<unsigned char> mem;
mem.set(start_ptr, size);
const std::string param =
"const " + detail::type_string(array.dtype()) + " *" + array.name();
array_memories.push_back(mem);
slices.push_back(slice_t(array_memories.size() - 1, 0, size));
args[param + "/index"] = slices.size() - 1;
}
else
{
std::set<MemoryRegion> memory_regions;
for(const std::string &component : res_array.child_names())
{
const conduit::Node &n_component = res_array[component];
const void *start_ptr = res_array[component].data_ptr();
const size_t size = n_component.dtype().spanned_bytes();
MemoryRegion memory_region(start_ptr, size);
const auto inserted = memory_regions.insert(memory_region);
// if overlaps, union two regions
if(!inserted.second)
{
auto hint = inserted.first;
hint++;
const unsigned char *min_start =
std::min(inserted.first->start,
memory_region.start,
std::less<const unsigned char *>());
const unsigned char *max_end =
std::max(inserted.first->end,
memory_region.end,
std::less<const unsigned char *>());
MemoryRegion unioned_region(min_start, max_end);
memory_regions.erase(inserted.first);
memory_regions.insert(hint, unioned_region);
}
}
//
// Matt: I feel like this is overkill, although I don't claim to know
// what this code fully does. Right now, its either block copyable
// or not. It should not matter if the block is in some larger region.
// I am just a cave man.
//
for(const std::string &component : res_array.child_names())
{
const conduit::Node &n_component = res_array[component];
const void *start_ptr = res_array[component].data_ptr();
const size_t size = n_component.dtype().spanned_bytes();
MemoryRegion sub_region(start_ptr, size);
const auto full_region_it = memory_regions.find(sub_region);
if(!full_region_it->allocated)
{
full_region_it->allocated = true;
Array<unsigned char> mem;
unsigned char *data_ptr =
const_cast<unsigned char *>(full_region_it->start);
mem.set(data_ptr, full_region_it->end - full_region_it->start);
array_memories.push_back(mem);
full_region_it->index = array_memories.size() - 1;
}
const std::string param = "const " +
detail::type_string(n_component.dtype()) +
" *" + array.name() + "_" + component;
// make a slice, push it and use that to support cases where
// we have multiple pointers inside one allocation
slices.push_back(slice_t(full_region_it->index,
static_cast<const unsigned char *>(start_ptr) -
full_region_it->start,
size));
args[param + "/index"] = slices.size() - 1;
}
}
ASCENT_DATA_CLOSE();
}
#endif
std::string
indent_code(const std::string &input_code, const int num_spaces)
{
std::stringstream ss(input_code);
std::string line;
std::unordered_set<std::string> lines;
std::string output_code;
// num_spaces is the starting indentation level
std::string indent(num_spaces, ' ');
while(std::getline(ss, line))
{
if(line == "{")
{
output_code += indent + line + "\n";
indent += " ";
}
else if(line == "}")
{
try
{
indent = indent.substr(2);
}
catch(const std::out_of_range &e)
{
ASCENT_ERROR("Could not indent string:\n" << input_code);
}
output_code += indent + line + "\n";
}
else
{
output_code += indent + line + "\n";
}
}
return output_code;
}
};
//-----------------------------------------------------------------------------
// -- MemoryRegion
//-----------------------------------------------------------------------------
//{{{
MemoryRegion::MemoryRegion(const void *start, const void *end)
: start(static_cast<const unsigned char *>(start)),
end(static_cast<const unsigned char *>(end)), allocated(false)
{
}
MemoryRegion::MemoryRegion(const void *start, const size_t size)
: start(static_cast<const unsigned char *>(start)), end(this->start + size),
allocated(false)
{
}
bool
MemoryRegion::operator<(const MemoryRegion &other) const
{
return std::less<const void *>()(end, other.start);
}
//-----------------------------------------------------------------------------
// -- Packing Functions
//-----------------------------------------------------------------------------
// {{{
bool
is_compact_interleaved(const conduit::Node &array)
{
const unsigned char *min_start = nullptr;
const unsigned char *max_end = nullptr;
if(array.number_of_children() == 0)
{
min_start = static_cast<const unsigned char *>(array.data_ptr());
max_end = min_start + array.dtype().spanned_bytes();
}
else
{
for(const std::string &component : array.child_names())
{
const conduit::Node &n_component = array[component];
if(min_start == nullptr || max_end == nullptr)
{
min_start = static_cast<const unsigned char *>(n_component.data_ptr());
max_end = min_start + array.dtype().spanned_bytes();
}
else
{
const unsigned char *new_start =
static_cast<const unsigned char *>(n_component.data_ptr());
min_start =
std::min(min_start, new_start, std::less<const unsigned char *>());
max_end = std::max(max_end,
new_start + n_component.dtype().spanned_bytes(),
std::less<const unsigned char *>());
}
}
}
return (max_end - min_start) == array.total_bytes_compact();
}
// Compacts an array (generates a contigous schema) so that only one
// allocation is needed. Code generation will read this schema from
// array_code. The array in args is a set_external to the original data so we
// can copy to the device later.
void
pack_array(const conduit::Node &array,
const std::string &name,
conduit::Node &args,
ArrayCode &array_code)
{
args[name].set_external(array);
if(array.is_compact() ||
is_compact_interleaved(array) /* || array is on the device */)
{
// copy the existing schema
array_code.array_map.insert(
std::make_pair(name, SchemaBool(array.schema(), false)));
}
else
{
const int num_components = array.number_of_children();
size_t size;
conduit::DataType::TypeID type_id;
if(num_components == 0)
{
type_id = static_cast<conduit::DataType::TypeID>(array.dtype().id());
size = array.dtype().number_of_elements();
}
else
{
type_id =
static_cast<conduit::DataType::TypeID>(array.child(0).dtype().id());
size = array.child(0).dtype().number_of_elements();
}
conduit::Schema s;
// TODO for now, if we need to copy we copy to contiguous
schemaFactory("contiguous", type_id, size, array.child_names(), s);
array_code.array_map.insert(std::make_pair(name, SchemaBool(s, false)));
}
}
void
pack_topology(const std::string &topo_name,
const conduit::Node &domain,
conduit::Node &args,
ArrayCode &array_code)
{
const conduit::Node &topo = domain["topologies/" + topo_name];
const std::string &topo_type = topo["type"].as_string();
const conduit::Node &coords =
domain["coordsets/" + topo["coordset"].as_string()];
const size_t num_dims = topo_dim(topo_name, domain);
if(topo_type == "uniform")
{
for(size_t i = 0; i < num_dims; ++i)
{
const std::string dim = std::string(1, 'i' + i);
const std::string coord = std::string(1, 'x' + i);
args[topo_name + "_dims_" + dim] = coords["dims"].child(i);
args[topo_name + "_spacing_d" + coord] = coords["spacing"].child(i);
args[topo_name + "_origin_" + coord] = coords["origin"].child(i);
}
}
else if(topo_type == "rectilinear")
{
for(size_t i = 0; i < num_dims; ++i)
{
const std::string dim = std::string(1, 'i' + i);
args[topo_name + "_dims_" + dim] =
coords["values"].child(i).dtype().number_of_elements();
}
pack_array(coords["values"], topo_name + "_coords", args, array_code);
}
else if(topo_type == "structured")
{
for(size_t i = 0; i < num_dims; ++i)
{
const std::string dim = std::string(1, 'i' + i);
args[topo_name + "_dims_" + dim] =
topo["elements/dims"].child(i).to_int64() + 1;
}
pack_array(coords["values"], topo_name + "_coords", args, array_code);
}
else if(topo_type == "unstructured")
{
const conduit::Node &elements = topo["elements"];
pack_array(coords["values"], topo_name + "_coords", args, array_code);
pack_array(elements["connectivity"],
topo_name + "_connectivity",
args,
array_code);
const std::string &shape = elements["shape"].as_string();
if(shape == "polygonal")
{
pack_array(elements["sizes"], topo_name + "_sizes", args, array_code);
pack_array(elements["offsets"], topo_name + "_offsets", args, array_code);
}
else if(shape == "polyhedral")
{
// TODO polyhedral needs to pack additional things
}
else
{
// single shape
// no additional packing
}
}
}
//-----------------------------------------------------------------------------
// -- JitExecutionPolicy
//-----------------------------------------------------------------------------
//{{{
JitExecutionPolicy::JitExecutionPolicy()
{
}
// fuse policy
bool
FusePolicy::should_execute(const Jitable &jitable) const
{
return false;
}
// unique name
std::string
FusePolicy::get_name() const
{
return "fuse";
}
// roundtrip policy
bool
RoundtripPolicy::should_execute(const Jitable &jitable) const
{
return jitable.can_execute();
}
std::string
RoundtripPolicy::get_name() const
{
return "roundtrip";
}
// Used when we need to execute (e.g. for a top-level JitFilter or a JitFilter
// feeding into a reduction)
bool
AlwaysExecutePolicy::should_execute(const Jitable &jitable) const
{
return true;
}
std::string
AlwaysExecutePolicy::get_name() const
{
return "always_execute";
}
// I pass in args because I want execute to generate new args and also be
// const so it can't just update the object's args
std::string
Jitable::generate_kernel(const int dom_idx, const conduit::Node &args) const
{
const conduit::Node &cur_dom_info = dom_info.child(dom_idx);
const Kernel &kernel = kernels.at(cur_dom_info["kernel_type"].as_string());
std::string kernel_string;
kernel_string += kernel.functions.accumulate();
kernel_string += "@kernel void map(";
const int num_args = args.number_of_children();
bool first = true;
for(int i = 0; i < num_args; ++i)
{
const conduit::Node &arg = args.child(i);
std::string type;
// array type was already determined in device_alloc_array
if(!arg.has_path("index"))
{
type = "const " + detail::type_string(arg.dtype()) + " ";
}
if(!first)
{
kernel_string += " ";
}
kernel_string += type + arg.name() + (i == num_args - 1 ? ")\n{\n" : ",\n");
first = false;
}
kernel_string += kernel.kernel_body.accumulate();
kernel_string += kernel.generate_loop("output", arrays[dom_idx], "entries");
kernel_string += "}";
return detail::indent_code(kernel_string, 0);
}
void
Jitable::fuse_vars(const Jitable &from)
{
// none is set when we try to fuse kernels with different topologies or
// associations. This allows the expression to have multiple topologies but
// we'll need a way of figuring out where to output things can't infer it
// anymore. The derived_field() function can be used to explicitly specify
// the topology and association.
if(!from.topology.empty())
{
if(topology.empty())
{
topology = from.topology;
}
else if(topology != from.topology)
{
topology = "none";
}
}
if(!from.association.empty())
{
if(association.empty())
{
association = from.association;
}
else if(association != from.association)
{
association = "none";
}
}
int num_domains = from.dom_info.number_of_children();
for(int dom_idx = 0; dom_idx < num_domains; ++dom_idx)
{
// fuse entries, ensure they are the same
const conduit::Node &src_dom_info = from.dom_info.child(dom_idx);
conduit::Node &dest_dom_info = dom_info.child(dom_idx);
if(src_dom_info.has_path("entries"))
{
if(dest_dom_info.has_path("entries"))
{
if(dest_dom_info["entries"].to_int64() !=
src_dom_info["entries"].to_int64())
{
ASCENT_ERROR("JIT: Failed to fuse kernels due to an incompatible "
"number of entries: "
<< dest_dom_info["entries"].to_int64() << " versus "
<< src_dom_info["entries"].to_int64());
}
}
else
{
dest_dom_info["entries"] = src_dom_info["entries"];
}
}
// copy kernel_type
// This will be overwritten in all cases except when func="execute" in
// JitFilter::execute
dest_dom_info["kernel_type"] = src_dom_info["kernel_type"];
// fuse args, set_external arrays and copy other arguments
if(src_dom_info.has_path("args"))
{
conduit::NodeConstIterator arg_itr = src_dom_info["args"].children();
while(arg_itr.has_next())
{
const conduit::Node &arg = arg_itr.next();
conduit::Node &dest_args = dest_dom_info["args"];
if(!dest_args.has_path(arg.name()))
{
if(arg.number_of_children() != 0 ||
arg.dtype().number_of_elements() > 1)
{
dest_args[arg.name()].set_external(arg);
}
else
{
dest_args[arg.name()].set(arg);
}
}
}
}
// fuse array_code
for(size_t i = 0; i < from.arrays.size(); ++i)
{
arrays[i].array_map.insert(from.arrays[i].array_map.begin(),
from.arrays[i].array_map.end());
}
}
}
bool
Jitable::can_execute() const
{
return !(topology.empty() || topology == "none") &&
!(association.empty() || association == "none") &&
!kernels.begin()->second.expr.empty();
}
//-----------------------------------------------------------------------------
// How to Debug OCCA Kernels with LLDB
//-----------------------------------------------------------------------------
// 1. occa::setDevice("mode: 'Serial'");
// 2. export CXXFLAGS="-g" OCCA_VERBOSE=1
// OCCA_CUDA_COMPILER_FLAGS
// OCCA_CXXFLAGS
// 3. Run ascent (e.g. ./tests/ascent/t_ascent_derived)
// 4. Occa will print the path to the kernel binaries
// (e.g. ~/.occa/cache/e1da5a95477a48db/build)
// 5. Run lldb on the kernel binary
// (e.g. lldb ~/.occa/cache/e1da5a95477a48db/build)
// 6. In lldb: 'image lookup -r -F map'
// assuming the occa kernel is named 'map'
// 7. Copy that function name and quit lldb
// (e.g. "::map(const int &, const double *, const double &, double *)")
// 8 lldb ./tests/ascent/t_ascent_derived
// 9. break at the function name found above and run
// (e.g. "b ::map(const int &, const double *, const double &, double
// *)")
// we put the field on the mesh when calling execute and delete it later if
// it's an intermediate field
void
Jitable::execute(conduit::Node &dataset, const std::string &field_name)
{
#ifdef ASCENT_JIT_ENABLED
// There are a lot of possible code paths that each rank/domain could
// follow. All JIT code should not contain any MPI calls, but things
// after JIT can call MPI, so its important that we globally catch errors
// and halt exectution on any error. Otherwise, we will deadlock
conduit::Node errors;
try
{
ASCENT_DATA_OPEN("jitable_execute");
// TODO set this during initialization not here
static bool init = false;
if(!init)
{
// running this in a loop segfaults...
init_occa();
init = true;
}
occa::device &device = occa::getDevice();
ASCENT_DATA_ADD("occa device", device.mode());
occa::kernel occa_kernel;
// we need an association and topo so we can put the field back on the mesh
if(topology.empty() || topology == "none")
{
ASCENT_ERROR("Error while executing derived field: Could not infer the "
"topology. Try using the derived_field function to set it "
"explicitely.");
}
if(association.empty() || association == "none")
{
ASCENT_ERROR("Error while executing derived field: Could not determine the "
"association. Try using the derived_field function to set it "
"explicitely.");
}
const int num_domains = dataset.number_of_children();
for(int dom_idx = 0; dom_idx < num_domains; ++dom_idx)
{
ASCENT_DATA_OPEN("domain execute");
conduit::Node &dom = dataset.child(dom_idx);
conduit::Node &cur_dom_info = dom_info.child(dom_idx);
const Kernel &kernel = kernels.at(cur_dom_info["kernel_type"].as_string());
if(kernel.expr.empty())
{
ASCENT_ERROR("Cannot compile a kernel with an empty expr field. This "
"shouldn't happen, call someone.");
}
// the final number of entries
const int entries = cur_dom_info["entries"].to_int64();
// pass entries into args just before we need to execute
cur_dom_info["args/entries"] = entries;
// create output array schema and put it in array_map
conduit::Schema output_schema;
// TODO output to the host is always interleaved
schemaFactory("interleaved",
conduit::DataType::FLOAT64_ID,
entries,
kernel.num_components,
output_schema);
arrays[dom_idx].array_map.insert(
std::make_pair("output", SchemaBool(output_schema, false)));
// allocate the output array in conduit
conduit::Node &n_output = dom["fields/" + field_name];
n_output["association"] = association;
n_output["topology"] = topology;
ASCENT_DATA_OPEN("host output alloc");
n_output["values"].set(output_schema);
unsigned char *output_ptr =
static_cast<unsigned char *>(n_output["values"].data_ptr());
// output to the host will always be compact
ASCENT_DATA_ADD("bytes", output_schema.total_bytes_compact());
ASCENT_DATA_CLOSE();
// these are reference counted
// need to keep the mem in scope or bad things happen
std::vector<Array<unsigned char>> array_buffers;
// slice is {index in array_buffers, offset, size}
std::vector<detail::slice_t> slices;
ASCENT_DATA_OPEN("host array alloc");
// allocate arrays
size_t output_index;
conduit::Node new_args;
for(const auto &array : arrays[dom_idx].array_map)
{
if(array.second.codegen_array)
{
// codegen_arrays are false arrays used by the codegen
continue;
}
if(cur_dom_info["args"].has_path(array.first))
{
detail::device_alloc_array(cur_dom_info["args/" + array.first],
array.second.schema,
new_args,
array_buffers,
slices);
}
else
{
// not in args so doesn't point to any data, allocate a temporary
if(array.first == "output")
{
output_index = array_buffers.size();
}
if(array.first == "output" &&
(device.mode() == "Serial" || device.mode() == "OpenMP"))
{
// in Serial and OpenMP we don't need a separate output array for
// the device, so just pass it conduit's array
detail::device_alloc_temporary(array.first,
array.second.schema,
new_args,
array_buffers,
slices,
output_ptr);
}
else
{
detail::device_alloc_temporary(array.first,
array.second.schema,
new_args,
array_buffers,
slices,
nullptr);
}
}
}
// copy the non-array types to new_args
const int original_num_args = cur_dom_info["args"].number_of_children();
for(int i = 0; i < original_num_args; ++i)
{
const conduit::Node &arg = cur_dom_info["args"].child(i);
if(arg.dtype().number_of_elements() == 1 &&
arg.number_of_children() == 0 && !arg.dtype().is_string())
{
new_args[arg.name()] = arg;
}
}
ASCENT_DATA_CLOSE();
// generate and compile the kernel
const std::string kernel_string = generate_kernel(dom_idx, new_args);
//std::cout << kernel_string << std::endl;
// store kernels so that we don't have to recompile, even loading a cached
// kernel from disk is slow
static std::unordered_map<std::string, occa::kernel> kernel_map;
try
{
flow::Timer kernel_compile_timer;
auto kernel_it = kernel_map.find(kernel_string);
if(kernel_it == kernel_map.end())
{
occa_kernel = device.buildKernelFromString(kernel_string, "map");
kernel_map[kernel_string] = occa_kernel;
}
else
{
occa_kernel = kernel_it->second;
}
ASCENT_DATA_ADD("kernel compile", kernel_compile_timer.elapsed());
}
catch(const occa::exception &e)
{
ASCENT_ERROR("Jitable: Expression compilation failed:\n"
<< e.what() << "\n\n"
<< kernel_string);
}
catch(...)
{
ASCENT_ERROR("Jitable: Expression compilation failed with an unknown "
"error.\n\n"
<< kernel_string);
}
// pass input arguments
occa_kernel.clearArgs();
// get occa mem for devices
std::vector<occa::memory> array_memories;
detail::get_occa_mem(array_buffers, slices, array_memories);
flow::Timer push_args_timer;
const int num_new_args = new_args.number_of_children();
for(int i = 0; i < num_new_args; ++i)
{
const conduit::Node &arg = new_args.child(i);
if(arg.dtype().is_integer())
{
occa_kernel.pushArg(arg.to_int64());
}
else if(arg.dtype().is_float64())
{
occa_kernel.pushArg(arg.to_float64());
}
else if(arg.dtype().is_float32())
{
occa_kernel.pushArg(arg.to_float32());
}
else if(arg.has_path("index"))
{
occa_kernel.pushArg(array_memories[arg["index"].to_int32()]);
}
else
{
ASCENT_ERROR("JIT: Unknown argument type of argument: " << arg.name());
}
}
ASCENT_DATA_ADD("push_input_args", push_args_timer.elapsed());
flow::Timer kernel_run_timer;
occa_kernel.run();
ASCENT_DATA_ADD("kernel runtime", kernel_run_timer.elapsed());
// copy back
flow::Timer copy_back_timer;
if(device.mode() != "Serial" && device.mode() != "OpenMP")
{
array_memories[output_index].copyTo(output_ptr);
}
ASCENT_DATA_ADD("copy to host", copy_back_timer.elapsed());
// dom["fields/" + field_name].print();
ASCENT_DATA_CLOSE();
}
ASCENT_DATA_CLOSE();
}
catch(conduit::Error &e)
{
errors.append() = e.what();
}
catch(std::exception &e)
{
errors.append() = e.what();
}
catch(...)
{
errors.append() = "Unknown error occured in JIT";
}
bool error = errors.number_of_children() > 0;
error = global_someone_agrees(error);
if(error)
{
std::set<std::string> error_strs;
for(int i = 0; i < errors.number_of_children(); ++i)
{
error_strs.insert(errors.child(i).as_string());
}
gather_strings(error_strs);
conduit::Node n_errors;
for(auto e : error_strs)
{
n_errors.append() = e;
}
ASCENT_ERROR("Jit errors: "<<n_errors.to_string());
}
#else
ASCENT_ERROR("JIT compilation for derived fields requires OCCA support"<<
" but Ascent was not compiled with OCCA.");
#endif
}
void Jitable::init_occa()
{
#ifdef ASCENT_JIT_ENABLED
// running this in a loop segfaults...
#ifdef ASCENT_CUDA_ENABLED
if(m_cuda_device_id == -1)
{
// the ascent runtime should tell us what to use, otherwise just
// get the current device to tell occa
cudaGetDevice(&m_cuda_device_id);
}
occa::setDevice({{"mode", "CUDA"}, {"device_id", m_cuda_device_id}});
#elif defined(ASCENT_USE_OPENMP)
occa::setDevice({{"mode", "OpenMP"}});
#else
occa::setDevice({{"mode", "Serial"}});
#endif
occa::env::setOccaCacheDir(::ascent::runtime::filters::output_dir(".occa"));
#endif
}
int Jitable::num_cuda_devices()
{
int device_count = 0;
#ifdef ASCENT_CUDA_ENABLED
cudaError_t res = cudaGetDeviceCount(&device_count);
if(res != cudaSuccess)
{
std::stringstream msg;
msg << "Failed to get CUDA device count" << std::endl
<< "CUDA Error Message: "
<< cudaGetErrorString(res);
ASCENT_ERROR(msg.str());
}
#endif
return device_count;
}
void Jitable::set_cuda_device(int device_id)
{
m_cuda_device_id = device_id;
}
//-----------------------------------------------------------------------------
};
//-----------------------------------------------------------------------------
// -- end ascent::runtime::expressions--
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
};
//-----------------------------------------------------------------------------
// -- end ascent::runtime --
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
};
//-----------------------------------------------------------------------------
// -- end ascent:: --
//-----------------------------------------------------------------------------
| 31.791928 | 82 | 0.575858 | [
"mesh",
"object",
"shape",
"vector"
] |
46566ae55533b9565de9c783302e3190310feaf7 | 3,093 | cpp | C++ | src/game/src/states/editor/EditorMenuStateTest.cpp | walter-strazak/chimarrao | b4c9f9d726eb5e46d61b33e10b7579cc5512cd09 | [
"MIT"
] | 6 | 2021-04-20T10:32:29.000Z | 2021-06-05T11:48:56.000Z | src/game/src/states/editor/EditorMenuStateTest.cpp | walter-strazak/chimarrao | b4c9f9d726eb5e46d61b33e10b7579cc5512cd09 | [
"MIT"
] | 1 | 2021-05-18T21:00:12.000Z | 2021-06-02T07:59:03.000Z | src/game/src/states/editor/EditorMenuStateTest.cpp | walter-strazak/chimarrao | b4c9f9d726eb5e46d61b33e10b7579cc5512cd09 | [
"MIT"
] | 3 | 2020-09-12T08:54:04.000Z | 2021-04-17T11:16:36.000Z | #include "EditorMenuState.h"
#include <memory>
#include "gtest/gtest.h"
#include "FileAccessMock.h"
#include "InputMock.h"
#include "RendererPoolMock.h"
#include "StatesMock.h"
#include "TileMapMock.h"
#include "UIManagerMock.h"
#include "WindowMock.h"
using namespace game;
using namespace components::ui;
using namespace ::testing;
namespace
{
const auto buttonColor = graphics::Color{65, 105, 200};
const auto buttonHoverColor = graphics::Color(4, 8, 97);
}
class EditorMenuStateTest_Base : public Test
{
public:
EditorMenuStateTest_Base()
{
EXPECT_CALL(*window, registerObserver(_));
EXPECT_CALL(*window, removeObserver(_));
EXPECT_CALL(*uiManager, createUI(_));
expectHideAllIcons();
EXPECT_CALL(*uiManager, activateComponent("editorMenuIcon1Image"));
EXPECT_CALL(*uiManager, setColor("editorMenuBackToEditorButton", buttonHoverColor));
}
void expectHideAllIcons()
{
EXPECT_CALL(*uiManager, deactivateComponent("editorMenuIcon1Image"));
EXPECT_CALL(*uiManager, deactivateComponent("editorMenuIcon2Image"));
EXPECT_CALL(*uiManager, deactivateComponent("editorMenuIcon3Image"));
EXPECT_CALL(*uiManager, deactivateComponent("editorMenuIcon4Image"));
EXPECT_CALL(*uiManager, deactivateComponent("editorMenuIcon5Image"));
}
std::shared_ptr<StrictMock<window::WindowMock>> window =
std::make_shared<StrictMock<window::WindowMock>>();
std::shared_ptr<StrictMock<graphics::RendererPoolMock>> rendererPool =
std::make_shared<StrictMock<graphics::RendererPoolMock>>();
std::shared_ptr<StrictMock<utils::FileAccessMock>> fileAccess =
std::make_shared<StrictMock<utils::FileAccessMock>>();
StrictMock<StatesMock> states;
std::shared_ptr<StrictMock<components::ui::UIManagerMock>> uiManager{
std::make_shared<StrictMock<components::ui::UIManagerMock>>()};
const utils::DeltaTime deltaTime{1.0};
StrictMock<input::InputMock> input;
};
class EditorMenuStateTest : public EditorMenuStateTest_Base
{
public:
std::shared_ptr<StrictMock<TileMapMock>> tileMap = std::make_shared<StrictMock<TileMapMock>>();
EditorMenuState editorMenuState{window, rendererPool, fileAccess, states, uiManager, tileMap};
};
TEST_F(EditorMenuStateTest, activate_shouldActivateUI)
{
EXPECT_CALL(*uiManager, activate());
expectHideAllIcons();
EXPECT_CALL(*uiManager, activateComponent("editorMenuIcon1Image"));
editorMenuState.activate();
}
TEST_F(EditorMenuStateTest, deactivate_shouldDeactivateUI)
{
EXPECT_CALL(*uiManager, deactivate());
editorMenuState.deactivate();
}
TEST_F(EditorMenuStateTest, getType_shouldReturnChooseMap)
{
ASSERT_EQ(editorMenuState.getType(), StateType::EditorMenu);
}
TEST_F(EditorMenuStateTest, render_shouldRenderAllFromRendererPool)
{
EXPECT_CALL(*rendererPool, renderAll());
editorMenuState.render();
}
TEST_F(EditorMenuStateTest, update_shouldUpdateUI)
{
EXPECT_CALL(*uiManager, update(deltaTime, Ref(input)));
editorMenuState.update(deltaTime, input);
} | 30.93 | 99 | 0.743938 | [
"render"
] |
465b394035374577169c9ef01b8d636aee218020 | 25,685 | cpp | C++ | Runtime/MP1/World/CMagdolite.cpp | henriquegemignani/urde | 78185e682e16c3e1b41294d92f2841357272acb2 | [
"MIT"
] | 1 | 2020-06-09T07:49:34.000Z | 2020-06-09T07:49:34.000Z | Runtime/MP1/World/CMagdolite.cpp | henriquegemignani/urde | 78185e682e16c3e1b41294d92f2841357272acb2 | [
"MIT"
] | 6 | 2020-06-09T07:49:45.000Z | 2021-04-06T22:19:57.000Z | Runtime/MP1/World/CMagdolite.cpp | henriquegemignani/urde | 78185e682e16c3e1b41294d92f2841357272acb2 | [
"MIT"
] | null | null | null | #include "Runtime/MP1/World/CMagdolite.hpp"
#include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/Collision/CCollisionActorManager.hpp"
#include "Runtime/Collision/CJointCollisionDescription.hpp"
#include "Runtime/Graphics/CSkinnedModel.hpp"
#include "Runtime/Weapon/CFlameThrower.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "Runtime/World/CScriptWater.hpp"
#include "Runtime/World/CScriptWaypoint.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CStateManager.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
#include <array>
namespace urde::MP1 {
namespace {
constexpr std::array<SSphereJointInfo, 5> skSpineJoints{{
{"spine1", 0.75f},
{"spine3", 0.75f},
{"spine5", 0.75f},
{"spine7", 0.75f},
{"spine9", 0.75f},
}};
constexpr std::array<SOBBJointInfo, 2> skHeadJoints{{
{"head", "Top_LCTR", {1.f, 0.15f, 0.5f}},
{"head", "Bottom_LCTR", {0.75f, 0.15f, 0.25f}},
}};
} // namespace
CMagdolite::CMagdolite(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, float f1,
float f2, const CDamageInfo& dInfo1, const CDamageInfo& dInfo2,
const CDamageVulnerability& dVuln1, const CDamageVulnerability& dVuln2, CAssetId modelId,
CAssetId skinId, float f3, float f4, float f5, float f6, const CFlameInfo& magData, float f7,
float f8, float f9)
: CPatterned(ECharacter::Magdolite, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
EMovementType::Flyer, EColliderType::One, EBodyType::BiPedal, actParms, EKnockBackVariant::Large)
, x568_initialDelay(f4)
, x56c_minDelay(f5)
, x570_maxDelay(f6)
, x574_minHp(f3)
, x578_losMaxDistance(std::cos(zeus::degToRad(f2)))
, x57c_(f1)
, x584_boneTracker(*GetModelData()->GetAnimationData(), "head"sv, zeus::degToRad(f1), zeus::degToRad(90.f),
EBoneTrackingFlags::ParentIk)
, x5bc_instaKillVulnerability(dVuln1)
, x624_normalVulnerability(dVuln2)
, x690_headlessModel(
CToken(TObjOwnerDerivedFromIObj<CSkinnedModel>::GetNewDerivedObject(std::make_unique<CSkinnedModel>(
g_SimplePool->GetObj({SBIG('CMDL'), modelId}), g_SimplePool->GetObj({SBIG('CSKR'), skinId}),
x64_modelData->GetAnimationData()->GetModelData()->GetLayoutInfo(), 1, 1))))
, x6a8_flameInfo(magData)
, x6cc_flameThrowerDesc(g_SimplePool->GetObj("FlameThrower"sv))
, x6d4_flameThrowerDamage(dInfo1)
, x6f0_headContactDamage(dInfo2)
, x71c_attackTarget(xf.origin)
, x744_(f7)
, x748_(f8)
, x74c_(f9) {
x460_knockBackController.SetAutoResetImpulse(false);
x460_knockBackController.SetEnableBurn(false);
// redundant
// x690_headlessModel->SetLayoutInfo(GetModelData()->GetAnimationData()->GetModelData()->GetLayoutInfo());
}
void CMagdolite::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
switch (msg) {
case EScriptObjectMessage::Touched:
ApplyContactDamage(uid, mgr);
break;
case EScriptObjectMessage::Damage:
case EScriptObjectMessage::InvulnDamage:
if (TCastToConstPtr<CGameProjectile> proj = mgr.GetObjectById(uid)) {
if (proj->GetOwnerId() == mgr.GetPlayer().GetUniqueId()) {
if (GetBodyController()->GetPercentageFrozen() <= 0.f ||
x5bc_instaKillVulnerability.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) ==
EVulnerability::Deflect) {
float hp = HealthInfo(mgr)->GetHP();
if (x70c_curHealth - hp <= x574_minHp) {
if (x624_normalVulnerability.GetVulnerability(proj->GetDamageInfo().GetWeaponMode(), false) !=
EVulnerability::Deflect) {
x400_24_hitByPlayerProjectile = true;
}
} else {
x70c_curHealth = hp;
x754_24_retreat = true;
}
} else if (x400_24_hitByPlayerProjectile) {
x754_26_lostMyHead = true;
x401_30_pendingDeath = true;
}
}
}
return;
case EScriptObjectMessage::SuspendedMove:
if (x580_collisionManager) {
x580_collisionManager->SetMovable(mgr, false);
}
break;
case EScriptObjectMessage::Registered: {
x450_bodyController->Activate(mgr);
RemoveMaterial(EMaterialTypes::Solid, mgr);
AddMaterial(EMaterialTypes::NonSolidDamageable, mgr);
x584_boneTracker.SetActive(false);
CreateShadow(false);
const zeus::CVector3f boxExtents = GetBoundingBox().extents();
SetBoundingBox({-boxExtents, boxExtents});
SetupCollisionActors(mgr);
x330_stateMachineState.SetDelay(0.f);
CreateFlameThrower(mgr);
x70c_curHealth = GetHealthInfo(mgr)->GetHP();
break;
}
case EScriptObjectMessage::Deleted:
x580_collisionManager->Destroy(mgr);
if (x6c8_flameThrowerId != kInvalidUniqueId) {
mgr.FreeScriptObject(x6c8_flameThrowerId);
x6c8_flameThrowerId = kInvalidUniqueId;
}
break;
default:
break;
}
CPatterned::AcceptScriptMsg(msg, uid, mgr);
}
void CMagdolite::ApplyContactDamage(TUniqueId uid, CStateManager& mgr) {
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) {
if (!IsAlive()) {
return;
}
CDamageInfo dInfo = GetContactDamage();
for (TUniqueId testId : x69c_) {
if (testId == colAct->GetUniqueId()) {
dInfo = x6f0_headContactDamage;
break;
}
}
if (colAct->GetLastTouchedObject() == mgr.GetPlayer().GetUniqueId() && x420_curDamageRemTime <= 0.f) {
mgr.ApplyDamage(GetUniqueId(), mgr.GetPlayer().GetUniqueId(), GetUniqueId(), dInfo,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
x420_curDamageRemTime = x424_damageWaitTime;
}
}
}
void CMagdolite::SetupCollisionActors(CStateManager& mgr) {
std::vector<CJointCollisionDescription> joints;
joints.reserve(8);
const CAnimData* animData = GetModelData()->GetAnimationData();
for (const auto& info : skSpineJoints) {
joints.push_back(CJointCollisionDescription::SphereCollision(animData->GetLocatorSegId(info.name), info.radius,
info.name, 200.f));
}
for (const auto& info : skHeadJoints) {
joints.push_back(CJointCollisionDescription::OBBAutoSizeCollision(
animData->GetLocatorSegId(info.from), animData->GetLocatorSegId(info.to), info.bounds,
CJointCollisionDescription::EOrientationType::One, info.to, 200.f));
}
x580_collisionManager =
std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), joints, GetActive());
for (int i = 0; i < x580_collisionManager->GetNumCollisionActors(); ++i) {
const auto& desc = x580_collisionManager->GetCollisionDescFromIndex(i);
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(desc.GetCollisionActorId())) {
colAct->AddMaterial(EMaterialTypes::AIJoint, mgr);
}
}
for (int i = 0; i < x580_collisionManager->GetNumCollisionActors(); ++i) {
const auto& desc = x580_collisionManager->GetCollisionDescFromIndex(i);
if (desc.GetName() == "Top_LCTR"sv || desc.GetName() == "Bottom_LCTR"sv) {
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(desc.GetCollisionActorId())) {
colAct->AddMaterial(EMaterialTypes::ProjectilePassthrough, mgr);
x69c_.push_back(colAct->GetUniqueId());
}
}
}
}
void CMagdolite::CreateFlameThrower(CStateManager& mgr) {
if (x6c8_flameThrowerId != kInvalidUniqueId) {
return;
}
x6c8_flameThrowerId = mgr.AllocateUniqueId();
mgr.AddObject(new CFlameThrower(x6cc_flameThrowerDesc, "Magdolite_Flame"sv, EWeaponType::Plasma, x6a8_flameInfo, {},
EMaterialTypes::CollisionActor, x6d4_flameThrowerDamage, x6c8_flameThrowerId,
GetAreaIdAlways(), GetUniqueId(), EProjectileAttrib::None, CAssetId(), -1,
CAssetId()));
}
void CMagdolite::LaunchFlameThrower(CStateManager& mgr, bool fire) {
if ((!fire || x754_30_inProjectileAttack) && IsAlive()) {
if (auto* fl = static_cast<CFlameThrower*>(mgr.ObjectById(x6c8_flameThrowerId))) {
if (!fire) {
fl->Reset(mgr, false);
} else {
fl->Fire(GetTransform(), mgr, false);
}
}
x754_27_flameThrowerActive = fire;
}
}
void CMagdolite::Think(float dt, CStateManager& mgr) {
CPatterned::Think(dt, mgr);
if (!GetActive()) {
return;
}
x758_ += dt;
if (GetBodyController()->GetPercentageFrozen() > 0.f && x754_27_flameThrowerActive) {
LaunchFlameThrower(mgr, false);
}
if (!IsAlive()) {
if (auto* fl = static_cast<CFlameThrower*>(mgr.ObjectById(x6c8_flameThrowerId))) {
fl->SetTransform(GetLctrTransform("LCTR_MAGMOUTH"sv), dt);
}
}
zeus::CVector3f plPos = mgr.GetPlayer().GetTranslation();
zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f);
zeus::CTransform xf = GetLctrTransform("LCTR_MAGMOUTH"sv);
zeus::CVector3f aimDir = (aimPos - xf.origin).normalized();
float angleDiff = zeus::CVector3f::getAngleDiff(xf.frontVector(), aimDir);
float dVar7 = std::min(angleDiff, zeus::degToRad(x57c_));
if (xf.upVector().dot(aimDir) < 0.f) {
dVar7 = -dVar7;
}
float dVar8 = dVar7 + zeus::degToRad(x57c_) / 2.f * zeus::degToRad(x57c_);
float dVar2 = 1.f - dVar8;
x710_attackOffset = plPos * dVar2 + (aimPos * dVar8);
if (GetActive()) { // lol tautologies
if (IsAlive()) {
GetModelData()->GetAnimationData()->PreRender();
x584_boneTracker.Update(dt);
x584_boneTracker.PreRender(mgr, *GetModelData()->GetAnimationData(), GetTransform(), GetModelData()->GetScale(),
*GetBodyController());
if (auto* fl = static_cast<CFlameThrower*>(mgr.ObjectById(x6c8_flameThrowerId))) {
fl->SetTransform(GetLctrTransform("LCTR_MAGMOUTH"sv), dt);
}
}
x580_collisionManager->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
zeus::CTransform headXf = GetLocatorTransform("head"sv);
MoveCollisionPrimitive(GetTransform().rotate(GetModelData()->GetScale() * headXf.origin));
xe4_27_notInSortedLists = true;
}
if (x750_aiStage == 2) {
if (x738_ * 0.5f <= x734_) {
x740_ -= x73c_ * dt;
} else {
x740_ += x73c_ * dt;
}
x734_ += x740_ * dt;
SetTranslation(GetTranslation() - zeus::CVector3f{0.f, 0.f, x740_ * dt});
if (GetTranslation().z() < x728_cachedTarget.z()) {
SetTranslation(x728_cachedTarget);
x750_aiStage = 0;
}
} else if (x750_aiStage == 1) {
if (x738_ * 0.5f <= x734_) {
x740_ -= x73c_ * dt;
} else {
x740_ += x73c_ * dt;
}
x734_ += x740_ * dt;
SetTranslation(GetTranslation() + zeus::CVector3f{0.f, 0.f, x740_ * dt});
if (GetTranslation().z() > x728_cachedTarget.z()) {
SetTranslation(x728_cachedTarget);
x750_aiStage = 0;
}
}
}
void CMagdolite::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
if (type == EUserEventType::DamageOff) {
LaunchFlameThrower(mgr, false);
} else if (type == EUserEventType::DamageOn) {
LaunchFlameThrower(mgr, true);
} else if (type == EUserEventType::BreakLockOn) {
RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
mgr.GetPlayer().SetOrbitRequestForTarget(GetUniqueId(), CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
return;
}
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
}
void CMagdolite::Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) {
if (!IsAlive()) {
return;
}
zeus::CTransform tmpXf = GetTransform();
SetTransform(GetLctrTransform("head"sv));
SendScriptMsgs(EScriptObjectState::MassiveDeath, mgr, EScriptObjectMessage::None);
GenerateDeathExplosion(mgr);
SetTransform(tmpXf);
GetModelData()->GetAnimationData()->SubstituteModelData(x690_headlessModel);
x460_knockBackController.SetEnableFreeze(false);
GetBodyController()->UnFreeze();
if (!x754_26_lostMyHead) {
x460_knockBackController.SetSeverity(pas::ESeverity::Two);
} else {
GetModelData()->GetAnimationData()->SubstituteModelData(x690_headlessModel);
}
CPatterned::Death(mgr, direction, state);
}
void CMagdolite::FluidFXThink(EFluidState state, CScriptWater& water, CStateManager& mgr) {
if (x754_28_alert && state == EFluidState::InFluid) {
CFluidPlaneManager* flMgr = mgr.GetFluidPlaneManager();
if (flMgr->GetLastRippleDeltaTime(GetUniqueId()) >= 2.3f) {
zeus::CVector3f center = GetTranslation();
center.z() = float(water.GetTriggerBoundsWR().max.z());
water.GetFluidPlane().AddRipple(3.f, GetUniqueId(), center, water, mgr);
}
}
}
void CMagdolite::SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Update) {
TUniqueId targetId = FindSuitableTarget(mgr, EScriptObjectState::Attack, EScriptObjectMessage::Follow);
if (targetId != kInvalidUniqueId) {
if (TCastToConstPtr<CScriptWaypoint> wp = mgr.GetObjectById(targetId)) {
SetTransform(wp->GetTransform());
x71c_attackTarget = GetTranslation();
}
}
} else if (msg == EStateMsg::Deactivate) {
UpdateOrientation(mgr);
}
}
void CMagdolite::Generate(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x754_24_retreat = false;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerate, 0);
if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
}
}
void CMagdolite::Deactivate(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x754_24_retreat = false;
x584_boneTracker.SetActive(false);
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryStep, int(pas::EStepDirection::Down));
if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7);
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
}
}
void CMagdolite::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x584_boneTracker.SetActive(false);
zeus::CVector3f plPos = mgr.GetPlayer().GetTranslation();
zeus::CTransform headXf = GetLctrTransform("head"sv);
float zDiff = headXf.origin.z() - plPos.z();
float fVar1 = (zDiff - x74c_);
float fVar2 = 0.f;
if (fVar1 >= 0.f) {
fVar2 = fVar1;
if (x748_ < fVar1) {
fVar2 = x748_;
}
}
x728_cachedTarget = x71c_attackTarget - zeus::CVector3f(0.f, 0.f, fVar1 - fVar2);
x740_ = 0.f;
x734_ = 0.f;
x738_ = fVar2;
x73c_ = (2.f * x738_) / (x744_ * x744_);
if (GetTranslation().z() <= x728_cachedTarget.z()) {
x750_aiStage = 1;
} else {
x750_aiStage = 2;
}
x754_30_inProjectileAttack = true;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1);
zeus::CVector3f direction = (mgr.GetPlayer().GetTranslation().toVec2f() - GetTranslation().toVec2f()).normalized();
float angle = zeus::CVector3f::getAngleDiff(GetTransform().frontVector(), direction);
if (GetTransform().rightVector().dot(direction) > 0.f) {
angle *= -1.f;
}
if ((57.29f * angle) <= x3b8_turnSpeed && (57.29f * angle) < -x3b8_turnSpeed) {
angle = zeus::degToRad(-x3b8_turnSpeed);
} else {
angle = zeus::degToRad(x3b8_turnSpeed);
}
RotateInOneFrameOR(zeus::CQuaternion::fromAxisAngle({0.f, 0.f, 1.f}, angle), arg);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
LaunchFlameThrower(mgr, false);
x750_aiStage = 1;
x728_cachedTarget = x71c_attackTarget;
x740_ = 0.f;
x744_ = 0.f;
x738_ = x728_cachedTarget.z() - GetTranslation().z();
x73c_ = (2.f * x738_) / (x744_ * x744_);
x754_30_inProjectileAttack = false;
}
}
void CMagdolite::Active(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Lurk);
x584_boneTracker.SetActive(true);
x584_boneTracker.SetTarget(mgr.GetPlayer().GetUniqueId());
x400_24_hitByPlayerProjectile = false;
x754_29_useDetectionRange = false;
x330_stateMachineState.SetDelay(x568_initialDelay);
} else if (msg == EStateMsg::Update) {
zeus::CVector3f posDiff = (mgr.GetPlayer().GetTranslation().toVec2f() - GetTranslation().toVec2f());
if (posDiff.canBeNormalized()) {
posDiff.normalize();
if (GetTransform().frontVector().dot(posDiff) < x578_losMaxDistance) {
GetBodyController()->GetCommandMgr().DeliverCmd(CBCLocomotionCmd({}, posDiff, 1.f));
}
}
} else if (msg == EStateMsg::Deactivate) {
x330_stateMachineState.SetDelay(((x570_maxDelay - x56c_minDelay) * mgr.GetActiveRandom()->Float()) + x56c_minDelay);
}
}
void CMagdolite::InActive(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
xe7_27_enableRender = false;
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7);
RemoveMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
} else if (msg == EStateMsg::Deactivate) {
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
x754_25_up = false;
UpdateOrientation(mgr);
xe7_27_enableRender = true;
}
}
void CMagdolite::GetUp(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x754_24_retreat = false;
x754_28_alert = true;
AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
} else if (msg == EStateMsg::Update) {
if (!x754_25_up) {
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryStep, int(pas::EStepDirection::Forward));
} else {
TryCommand(mgr, pas::EAnimationState::Step, &CPatterned::TryStep, int(pas::EStepDirection::Up));
}
if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Lurk);
}
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
x754_28_alert = false;
}
}
void CMagdolite::Taunt(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x584_boneTracker.SetActive(true);
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Taunt, &CPatterned::TryTaunt, 1);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
x584_boneTracker.SetActive(false);
}
}
void CMagdolite::Lurk(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Relaxed);
x584_boneTracker.SetActive(false);
x330_stateMachineState.SetDelay(0.f);
AddMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
} else if (msg == EStateMsg::Deactivate) {
x754_25_up = true;
}
}
void CMagdolite::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
LaunchFlameThrower(mgr, true);
x584_boneTracker.SetActive(true);
x584_boneTracker.SetNoHorizontalAim(true);
x584_boneTracker.SetTarget(kInvalidUniqueId);
x754_30_inProjectileAttack = true;
} else if (msg == EStateMsg::Update) {
if (TooClose(mgr, 0.f)) {
TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, 0);
} else {
TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, 1);
}
x584_boneTracker.SetTargetPosition(x710_attackOffset);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
LaunchFlameThrower(mgr, false);
x584_boneTracker.SetActive(false);
x584_boneTracker.SetNoHorizontalAim(false);
x754_30_inProjectileAttack = false;
x584_boneTracker.SetTarget(mgr.GetPlayer().GetUniqueId());
}
}
void CMagdolite::Flinch(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x400_24_hitByPlayerProjectile = false;
x584_boneTracker.SetActive(false);
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::KnockBack, &CPatterned::TryKnockBack, 0);
} else if (msg == EStateMsg::Deactivate) {
x32c_animState = EAnimState::NotReady;
}
}
void CMagdolite::Retreat(CStateManager& mgr, EStateMsg msg, float arg) {
if (msg == EStateMsg::Activate) {
x32c_animState = EAnimState::Ready;
x754_24_retreat = false;
x584_boneTracker.SetActive(false);
GetBodyController()->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
x754_28_alert = true;
} else if (msg == EStateMsg::Update) {
TryCommand(mgr, pas::EAnimationState::Generate, &CPatterned::TryGenerateNoXf, 1);
if (x32c_animState == EAnimState::Repeat) {
GetBodyController()->SetLocomotionType(pas::ELocomotionType::Internal7);
}
} else if (msg == EStateMsg::Deactivate) {
x754_28_alert = false;
x32c_animState = EAnimState::NotReady;
}
}
bool CMagdolite::InAttackPosition(CStateManager& mgr, float arg) {
zeus::CTransform xf = GetLctrTransform("head"sv);
zeus::CVector3f plAimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f);
zeus::CVector3f diff = (plAimPos - GetTranslation());
if (GetTranslation().z() < plAimPos.z() && plAimPos.z() < xf.origin.z()) {
diff.z() = 0.f;
}
if (std::fabs(diff.magnitude()) >= FLT_EPSILON) {
return ((1.f / diff.magnitude()) * diff).dot(GetTransform().frontVector()) < x578_losMaxDistance;
}
return false;
}
bool CMagdolite::Leash(CStateManager& mgr, float arg) {
float dist = (GetTranslation() - mgr.GetPlayer().GetTranslation()).magSquared();
bool ret = dist < x3c8_leashRadius * x3c8_leashRadius;
return ret;
}
bool CMagdolite::HasAttackPattern(CStateManager& mgr, float arg) {
return FindSuitableTarget(mgr, EScriptObjectState::Attack, EScriptObjectMessage::Follow) != kInvalidUniqueId;
}
bool CMagdolite::LineOfSight(CStateManager& mgr, float arg) {
zeus::CTransform mouthXf = GetLctrTransform("LCTR_MAGMOUTH"sv);
zeus::CVector3f diff = x710_attackOffset - mouthXf.origin;
if (diff.canBeNormalized()) {
diff.normalize();
if (diff.dot(GetTransform().frontVector()) < x578_losMaxDistance) {
return false;
}
}
bool ret = mgr.RayCollideWorld(
mouthXf.origin, x710_attackOffset,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid, EMaterialTypes::Character},
{EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough}),
this);
return ret;
}
bool CMagdolite::ShouldRetreat(CStateManager& mgr, float arg) { return x754_24_retreat; }
void CMagdolite::UpdateOrientation(CStateManager& mgr) {
zeus::CVector3f plDiff = (mgr.GetPlayer().GetTranslation().toVec2f() - GetTranslation().toVec2f());
plDiff = plDiff.normalized();
float angle = zeus::CVector3f::getAngleDiff(GetTransform().frontVector(), plDiff);
if (GetTransform().rightVector().dot(plDiff) > 0.f) {
angle *= -1.f;
}
zeus::CQuaternion q = GetTransform().basis;
q.rotateZ(angle);
SetTransform(q.toTransform(GetTranslation()));
}
TUniqueId CMagdolite::FindSuitableTarget(CStateManager& mgr, EScriptObjectState state, EScriptObjectMessage msg) {
float lastDistance = FLT_MAX;
int wpCount = 0;
float maxDistanceSq =
x754_29_useDetectionRange ? x3bc_detectionRange * x3bc_detectionRange : x300_maxAttackRange * x300_maxAttackRange;
TUniqueId tmpId = kInvalidUniqueId;
for (const auto& conn : x20_conns) {
if (conn.x0_state != state || conn.x4_msg != msg) {
continue;
}
TUniqueId uid = mgr.GetIdForScript(conn.x8_objId);
if (const CEntity* ent = mgr.GetObjectById(uid)) {
if (!ent->GetActive()) {
continue;
}
if (TCastToConstPtr<CScriptWaypoint> wp = ent) {
++wpCount;
const float dist = (wp->GetTranslation() - mgr.GetPlayer().GetTranslation()).magSquared();
if (dist < maxDistanceSq) {
if (dist < lastDistance) {
lastDistance = dist;
tmpId = uid;
}
}
}
}
}
if (!x754_29_useDetectionRange) {
int skipCount = mgr.GetActiveRandom()->Next();
skipCount = skipCount - (skipCount / wpCount) * wpCount;
for (const auto& conn : x20_conns) {
if (conn.x0_state != state || conn.x4_msg != msg) {
continue;
}
TUniqueId uid = mgr.GetIdForScript(conn.x8_objId);
if (const CEntity* ent = mgr.GetObjectById(uid)) {
if (!ent->GetActive()) {
continue;
}
if (TCastToConstPtr<CScriptWaypoint>(ent)) {
tmpId = uid;
if (skipCount == 0) {
break;
}
--skipCount;
}
}
}
}
return tmpId;
}
} // namespace urde::MP1
| 37.772059 | 120 | 0.680125 | [
"vector",
"solid"
] |
4665b84430b55fc9400bcf0331856223c78513c5 | 4,636 | hpp | C++ | third_party/omr/compiler/infra/CriticalSection.hpp | xiacijie/omr-wala-linkage | a1aff7aef9ed131a45555451abde4615a04412c1 | [
"Apache-2.0"
] | null | null | null | third_party/omr/compiler/infra/CriticalSection.hpp | xiacijie/omr-wala-linkage | a1aff7aef9ed131a45555451abde4615a04412c1 | [
"Apache-2.0"
] | null | null | null | third_party/omr/compiler/infra/CriticalSection.hpp | xiacijie/omr-wala-linkage | a1aff7aef9ed131a45555451abde4615a04412c1 | [
"Apache-2.0"
] | null | null | null | /*******************************************************************************
* Copyright (c) 2000, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at http://eclipse.org/legal/epl-2.0
* or the Apache License, Version 2.0 which accompanies this distribution
* and is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/
#ifndef OMR_CRITICALSECTION_INCL
#define OMR_CRITICALSECTION_INCL
#include <algorithm>
#include "infra/Monitor.hpp"
namespace OMR
{
/**
* @brief The OMR::CriticalSection class wraps TR::Monitors with RAII functionality
* to help automate the lifetime of a monitor acquisition.
*/
class CriticalSection
{
public:
/**
* @brief Declare the beginning of a critical section, constructing the OMR::CriticalSection
* object and entering the monitor.
* @param monitor The TR::Monitor object used to guard concurrent access
*/
CriticalSection(TR::Monitor *monitor)
: _monitor(monitor)
{
_monitor->enter();
}
/**
* @brief Copy an existing critical section. Both OMR::CriticalSection objects'
* lifetimes must expire before the monitor is fully exited. This requires that
* the monitor be re-entrant.
*
* This function exists mainly to facilitate the ability to extend the lifespan
* of critical sections by passing and returning them by value.
*
* @param copy The existing OMR::CriticalSection object being used to guard the
* critical section.
*/
CriticalSection(const CriticalSection ©)
: _monitor(copy._monitor)
{
_monitor->enter();
}
/**
* @brief Automatically notify the end of the critical section, destroying the OMR::CriticalSection
* object and exiting the monitor.
*/
~CriticalSection()
{
_monitor->exit();
}
/**
* @brief Reconcile a given critical section with another, redirecting the monitor
* of interest to that of the other critical section. Holds both monitors temporarily.
* Releases the currently held monitor.
* @param rValue OMR::CriticalSection object containing the new monitor of interest
* @return const reference to this object
*/
const CriticalSection & operator =(CriticalSection rValue)
{
swap(*this, rValue);
return *this;
}
/**
* @brief Swaps the monitors of interest being of two OMR::CriticalSection objects
* @param left the first OMR::CriticalSection object. This object will have its
* monitor replaced with the monitor of the second object.
* @param right the second OMR::CriticalSection object. This object will have its
* monitor replaced with the monitor of the first object.
*/
friend void swap(CriticalSection &left, CriticalSection &right)
{
using std::swap;
swap(left._monitor, right._monitor);
}
/**
* @brief Compares two OMR::CriticalSection objects
* @param left first OMR::CriticalSection for comparison.
* @param right second OMR::CriticalSection for comparison.
* @return true if both OMR::CriticalSection objects are using the same monitor, false otherwise
*/
friend bool operator ==(const CriticalSection &left, const CriticalSection &right)
{
return left._monitor == right._monitor;
}
/**
* @brief Compares two OMR::CriticalSection objects
* @param left first OMR::CriticalSection for comparison.
* @param right second OMR::CriticalSection for comparison.
* @return false if both OMR::CriticalSection objects are using the same monitor, true otherwise
*/
friend bool operator !=(const CriticalSection &left, const CriticalSection &right)
{
return !(left == right);
}
private:
TR::Monitor *_monitor;
};
}
#endif
| 34.857143 | 135 | 0.677739 | [
"object"
] |
4667b368890de582fe8afb57cd64d09668434ac0 | 43,840 | cpp | C++ | spine/Reactor.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 1 | 2017-03-13T03:34:32.000Z | 2017-03-13T03:34:32.000Z | spine/Reactor.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 3 | 2017-11-02T16:30:29.000Z | 2020-05-27T13:46:14.000Z | spine/Reactor.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 1 | 2017-05-15T09:04:13.000Z | 2017-05-15T09:04:13.000Z | // ======================================================================
/*!
* \brief Implementation of class Reactor
*/
// ======================================================================
#include "Reactor.h"
#include "ConfigTools.h"
#include "Convenience.h"
#include "DynamicPlugin.h"
#include "FmiApiKey.h"
#include "Names.h"
#include "Options.h"
#include "SmartMet.h"
#include "SmartMetEngine.h"
// sleep?t=n queries only in debug mode
#ifndef NDEBUG
#include "Convenience.h"
#endif
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/locale.hpp>
#include <boost/make_shared.hpp>
#include <boost/process/child.hpp>
#include <boost/timer/timer.hpp>
#include <macgyver/AnsiEscapeCodes.h>
#include <macgyver/Exception.h>
#include <macgyver/StringConversion.h>
#include <algorithm>
#include <dlfcn.h>
#include <functional>
#include <iostream>
#include <mysql.h>
#include <stdexcept>
#include <string>
extern "C"
{
#include <unistd.h>
}
namespace fs = boost::filesystem;
namespace
{
std::atomic_bool gIsShuttingDown{false};
void absolutize_path(std::string& file_name)
{
if (!file_name.empty() && fs::exists(file_name))
{
fs::path path(file_name);
if (!path.is_absolute())
{
path = fs::canonical(path);
file_name = path.string();
}
}
}
int is_file_readable(std::string& file_name)
{
int handle;
// Open appears to be the only practical solution
// Use POSIX syscalls here for most efficient solution
if ((handle = open(file_name.c_str(), O_RDONLY)) >= 0)
{
// Open is not enough: directory might be opened but is not readable
// On NFS: open(2) man page says reading might fail even if open succeeds
const std::size_t nbytes = 1;
char buf[nbytes];
auto rdtest = read(handle, static_cast<void*>(buf), nbytes);
close(handle);
if (rdtest < 0) // 0 bytes might be returned, if file has no data
return errno;
return 0;
}
return errno;
}
} // namespace
namespace SmartMet
{
namespace Spine
{
// ----------------------------------------------------------------------
/*!
* \brief Destructor
*/
// ----------------------------------------------------------------------
Reactor::~Reactor()
{
// Debug output
std::cout << "SmartMet Server stopping..." << std::endl;
// Manual cleanup
itsInitTasks->stop();
itsInitTasks.reset();
itsHandlers.clear();
itsPlugins.clear();
itsEngines.clear();
}
// ----------------------------------------------------------------------
/*!
* \brief Construct from given options
*/
// ----------------------------------------------------------------------
Reactor::Reactor(Options& options) : itsOptions(options), itsInitTasks(new Fmi::AsyncTaskGroup)
{
try
{
// Startup message
if (!itsOptions.quiet)
{
std::cout << ANSI_ITALIC_ON << "+ SmartMet Server "
<< "(compiled on " __DATE__ " " __TIME__ ")" << std::endl
<< " Copyright (c) Finnish Meteorological Institute" << ANSI_ITALIC_OFF
<< std::endl
<< std::endl;
}
if (itsOptions.verbose)
itsOptions.report();
// Initial limit for simultaneous active requests
itsActiveRequestsLimit = itsOptions.throttle.start_limit;
// This has to be done before threading starts
mysql_library_init(0, nullptr, nullptr);
// Initialize the locale before engines are loaded
boost::locale::generator gen;
std::locale::global(gen(itsOptions.locale));
std::cout.imbue(std::locale());
itsInitTasks->stop_on_error(true);
itsInitTasks->on_task_error(
[this](const std::string& name)
{
if (!isShuttingDown())
{
Fmi::Exception::Trace(BCP, "Operation failed").printError();
std::cout << __FILE__ << ":" << __LINE__ << ": init task " << name << " failed"
<< std::endl;
}
});
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
void Reactor::init()
{
try
{
// Load engines - all or just the requested ones
const auto& config = itsOptions.itsConfig;
if (!config.exists("engines"))
{
std::cerr << "Warning: engines setting missing from the server configuration file - are you "
"sure you do not need any?"
<< std::endl;
}
else
{
auto libs = findLibraries("engine");
itsEngineCount = libs.size();
for (const auto& libfile : libs)
loadEngine(libfile, itsOptions.verbose);
}
// Load plugins
if (!config.exists("plugins"))
{
throw Fmi::Exception(BCP, "plugins setting missing from the server configuration file");
}
auto libs = findLibraries("plugin");
itsPluginCount = libs.size();
// Then load them in parallel, keeping track of how many have been loaded
for (const auto& libfile : libs)
loadPlugin(libfile, itsOptions.verbose);
try
{
itsInitTasks->wait();
}
catch (...)
{
std::cout << "Initialization failed" << std::endl;
exit(1); // NOLINT not thread safe
}
// Set ContentEngine default logging. Do this after plugins are loaded so handlers are
// recognized
setLogging(itsOptions.defaultlogging);
itsInitializing = false;
}
catch (...)
{
// Inform engines and plugings polling the status that we're going down
gIsShuttingDown = true;
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Find enabled libraries or plugins from the configuration
*/
// ----------------------------------------------------------------------
std::vector<std::string> Reactor::findLibraries(const std::string& theName) const
{
const auto& name = theName;
const auto names = theName + "s";
const auto moduledir = itsOptions.directory + "/" + names;
const auto& config = itsOptions.itsConfig;
const auto& modules = config.lookup(names);
if (!modules.isGroup())
throw Fmi::Exception(BCP, names + "-setting must be a group of settings");
// Collect all enabled modules
std::vector<std::string> libs;
for (int i = 0; i < modules.getLength(); i++)
{
auto& settings = modules[i];
if (!settings.isGroup())
throw Fmi::Exception(BCP, name + " settings must be groups");
if (settings.getName() == nullptr)
throw Fmi::Exception(BCP, name + " settings must have names");
std::string module_name = settings.getName();
std::string libfile = moduledir + "/" + module_name + ".so";
lookupPathSetting(config, libfile, names + "." + module_name + ".libfile");
bool disabled = false;
lookupHostSetting(itsOptions.itsConfig, disabled, names + "." + module_name + ".disabled");
if (!disabled)
libs.push_back(libfile);
else if (itsOptions.verbose)
{
std::cout << Spine::log_time_str() << ANSI_FG_YELLOW << "\t + [Ignoring " << name << " '"
<< module_name << "' since disabled flag is true]" << ANSI_FG_DEFAULT << std::endl;
}
}
return libs;
}
// ----------------------------------------------------------------------
/*!
* \brief Required API version
*/
// ----------------------------------------------------------------------
int Reactor::getRequiredAPIVersion() const
{
return APIVersion;
}
// ----------------------------------------------------------------------
/*!
* \brief Method to register new public URI/CallBackFunction association.
*
* Handler added using this method is visible through getURIMap() method
*/
// ----------------------------------------------------------------------
bool Reactor::addContentHandler(SmartMetPlugin* thePlugin,
const std::string& theDir,
ContentHandler theCallBackFunction)
{
return addContentHandlerImpl(false, thePlugin, theDir, theCallBackFunction);
}
// ----------------------------------------------------------------------
/*!
* \brief Method to register new private URI/CallBackFunction association.
*
* Handler added using this method is not visible through getURIMap() method
*/
// ----------------------------------------------------------------------
bool Reactor::addPrivateContentHandler(SmartMetPlugin* thePlugin,
const std::string& theDir,
ContentHandler theCallBackFunction)
{
return addContentHandlerImpl(true, thePlugin, theDir, theCallBackFunction);
}
// ----------------------------------------------------------------------
/*!
* \brief Implementation of registeration of new private URI/CallBackFunction association.
*
*/
// ----------------------------------------------------------------------
bool Reactor::addContentHandlerImpl(bool isPrivate,
SmartMetPlugin* thePlugin,
const std::string& theUri,
ContentHandler theHandler)
{
try
{
if (isShuttingDown())
return true;
WriteLock lock(itsContentMutex);
WriteLock lock2(itsLoggingMutex);
std::string pluginName = thePlugin->getPluginName();
auto itsFilter = itsIPFilters.find(Fmi::ascii_tolower_copy(pluginName));
boost::shared_ptr<IPFilter::IPFilter> filter;
if (itsFilter != itsIPFilters.end())
{
filter = itsFilter->second;
}
HandlerPtr theView(new HandlerView(theHandler,
filter,
thePlugin,
theUri,
itsLoggingEnabled,
isPrivate,
itsOptions.accesslogdir));
std::cout << Spine::log_time_str() << ANSI_BOLD_ON << ANSI_FG_GREEN << " Registered "
<< (isPrivate ? "private " : "") << "URI " << theUri << " for plugin "
<< thePlugin->getPluginName() << ANSI_BOLD_OFF << ANSI_FG_DEFAULT << std::endl;
// Set the handler and filter
return itsHandlers.insert(Handlers::value_type(theUri, theView)).second;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!").addParameter("URI", theUri);
}
}
// ----------------------------------------------------------------------
/*!
* \brief Set the handler for unrecognized requests
*/
// ----------------------------------------------------------------------
bool Reactor::setNoMatchHandler(ContentHandler theHandler)
{
try
{
WriteLock lock(itsContentMutex);
// Catch everything that is specifically not added elsewhere.
if (theHandler != nullptr)
{
// Set the data members
HandlerPtr theView(new HandlerView(theHandler));
itsCatchNoMatchHandler = theView;
itsCatchNoMatch = true;
}
else
{
// If function pointer was 0, disable catching hook.
itsCatchNoMatch = false;
}
return itsCatchNoMatch;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Removes all handlers that use specified plugin.
*/
// ----------------------------------------------------------------------
std::size_t Reactor::removeContentHandlers(SmartMetPlugin* thePlugin)
{
std::size_t count = 0;
WriteLock lock(itsContentMutex);
for (auto it = itsHandlers.begin(); it != itsHandlers.end();)
{
auto curr = it++;
if (curr->second and curr->second->usesPlugin(thePlugin))
{
const std::string uri = curr->second->getResource();
const std::string name = curr->second->getPluginName();
itsHandlers.erase(curr);
count++;
WriteLock lock2(itsLoggingMutex);
std::cout << Spine::log_time_str() << ANSI_BOLD_ON << ANSI_FG_GREEN << " Removed URI " << uri
<< " handled by plugin " << name << ANSI_BOLD_OFF << ANSI_FG_DEFAULT << std::endl;
}
}
return count;
}
// ----------------------------------------------------------------------
/*!
* \brief Obtain the Handler view corresponding to the given request
*/
// ----------------------------------------------------------------------
boost::optional<HandlerView&> Reactor::getHandlerView(const HTTP::Request& theRequest)
{
try
{
ReadLock lock(itsContentMutex);
// Try to find a content handler
auto it = itsHandlers.find(theRequest.getResource());
if (it == itsHandlers.end())
{
// No specific match found, decide what we should do
if (itsCatchNoMatch)
{
// Return with true, as this was catched by external handler
return boost::optional<HandlerView&>(*itsCatchNoMatchHandler);
}
// No match found -- return with failure
return boost::optional<HandlerView&>();
}
return boost::optional<HandlerView&>(*(it->second));
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Getting logging mode
*/
// ----------------------------------------------------------------------
bool Reactor::getLogging() const
{
return itsLoggingEnabled;
}
// ----------------------------------------------------------------------
/*!
* \brief Getting logging mode
*/
// ----------------------------------------------------------------------
bool Reactor::lazyLinking() const
{
return itsOptions.lazylinking;
}
// ----------------------------------------------------------------------
/*!
* \brief Get copy of the log
*/
// ----------------------------------------------------------------------
AccessLogStruct Reactor::getLoggedRequests() const
{
try
{
if (itsLoggingEnabled)
{
LoggedRequests requests;
ReadLock lock(itsContentMutex);
for (const auto& handler : itsHandlers)
{
requests.insert(std::make_pair(handler.first, handler.second->getLoggedRequests()));
}
return std::make_tuple(true, requests, itsLogLastCleaned);
}
return std::make_tuple(false, LoggedRequests(), boost::posix_time::ptime());
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Return true if the load is high
*/
// ----------------------------------------------------------------------
bool Reactor::isLoadHigh() const
{
return itsHighLoadFlag;
}
// ----------------------------------------------------------------------
/*!
* \brief Get a copy of active requests
*/
// ----------------------------------------------------------------------
ActiveRequests::Requests Reactor::getActiveRequests() const
{
return itsActiveRequests.requests();
}
// ----------------------------------------------------------------------
/*!
* \brief Print the given request list
*/
// ----------------------------------------------------------------------
void print_requests(const Spine::ActiveRequests::Requests& requests)
{
// Based on Admin::Plugin::requestActiveRequests
auto now = boost::posix_time::microsec_clock::universal_time();
std::cout << "Printing active requests due to high load:\n"
<< "Number\tID\tTime\tDuration\tIP\tAPIKEY\t\tURI\n";
std::size_t row = 0;
for (const auto& id_info : requests)
{
const auto id = id_info.first;
const auto& time = id_info.second.time;
const auto& req = id_info.second.request;
auto duration = now - time;
const bool check_access_token = false;
auto apikey = FmiApiKey::getFmiApiKey(req, check_access_token);
// clang-format off
std::cout << row++ << "\t"
<< Fmi::to_string(id) << "\t"
<< Fmi::to_iso_extended_string(time.time_of_day()) << "\t"
<< Fmi::to_string(duration.total_milliseconds() / 1000.0) << "\t"
<< req.getClientIP() << "\t"
<< (apikey ? *apikey : "-\t") << "\t"
<< req.getURI() << "\n";
// clang-format on
}
std::cout << std::flush;
}
// ----------------------------------------------------------------------
/*!
* \brief Add a new active request
*/
// ----------------------------------------------------------------------
std::size_t Reactor::insertActiveRequest(const HTTP::Request& theRequest)
{
auto key = itsActiveRequests.insert(theRequest);
auto n = itsActiveRequests.size();
// Run alert script if needed
if (n >= itsOptions.throttle.alert_limit && !itsOptions.throttle.alert_script.empty())
{
if (itsActiveRequestsLimit < itsOptions.throttle.limit)
{
// Do nothing when ramping up
}
else if (itsRunningAlertScript)
{
// This turns out to be a bit too verbose
// if (itsOptions.verbose)
// std::cerr << Spine::log_time_str() << " Alert script already running" << std::endl;
}
else
{
itsRunningAlertScript = true;
// First print the active requests since the alert script may be slow
if (itsOptions.verbose)
print_requests(getActiveRequests());
if (!boost::filesystem::exists(itsOptions.throttle.alert_script))
{
std::cerr << Spine::log_time_str() << " Configured alert script "
<< itsOptions.throttle.alert_script << " does not exist" << std::endl;
}
else
{
// Run the alert script in a separate thread not to delay the user response too much
if (itsOptions.verbose)
std::cerr << Spine::log_time_str() << " Running alert script "
<< itsOptions.throttle.alert_script << std::endl;
std::thread thr(
[this]
{
try
{
boost::process::child cld(itsOptions.throttle.alert_script);
cld.wait();
}
catch (...)
{
std::cerr << Spine::log_time_str() << " Running alert script "
<< itsOptions.throttle.alert_script << " failed!" << std::endl;
}
itsRunningAlertScript = false;
});
thr.detach();
}
}
}
// Check if we should report high load
if (n < itsActiveRequestsLimit)
{
itsHighLoadFlag = false;
return key;
}
// Load is now high
itsActiveRequestsCounter = 0; // now new finished active requests yet
itsHighLoadFlag = true;
if (itsOptions.verbose)
std::cerr << Spine::log_time_str() << " " << itsActiveRequests.size()
<< " active requests, limit is " << itsActiveRequestsLimit << "/"
<< itsOptions.throttle.limit << std::endl;
// Reduce the limit back down unless already smaller due to being just started
if (itsActiveRequestsLimit > itsOptions.throttle.restart_limit)
{
itsActiveRequestsLimit = itsOptions.throttle.restart_limit;
if (itsOptions.verbose)
std::cerr << Spine::log_time_str() << " dropping active requests limit to "
<< itsOptions.throttle.restart_limit << "/" << itsOptions.throttle.limit
<< std::endl;
}
return key;
}
// ----------------------------------------------------------------------
/*!
* \brief Remove an old active request
*/
// ----------------------------------------------------------------------
void Reactor::removeActiveRequest(std::size_t theKey, HTTP::Status theStatusCode)
{
itsActiveRequests.remove(theKey);
if (itsActiveRequests.size() < itsActiveRequestsLimit)
itsHighLoadFlag = false;
// Update current limit for simultaneous requests only if the request was a success
//
// We also ignore the 204 No content response, which the backend uses to indicate
// the etagged result is still valid, since generating no content successfully
// does not mean the server is not having load problems for example due to i/o issues.
if (theStatusCode != HTTP::ok)
return;
if (++itsActiveRequestsCounter % itsOptions.throttle.increase_rate == 0)
{
if (itsActiveRequestsLimit < itsOptions.throttle.limit)
{
auto new_limit = ++itsActiveRequestsLimit;
if (itsOptions.verbose)
std::cerr << Spine::log_time_str() << " increased active requests limit to " << new_limit
<< "/" << itsOptions.throttle.limit << std::endl;
}
}
}
// ----------------------------------------------------------------------
/*!
* \brief Start a new active request to a backend
*/
// ----------------------------------------------------------------------
void Reactor::startBackendRequest(const std::string& theHost, int thePort)
{
itsActiveBackends.start(theHost, thePort);
}
// ----------------------------------------------------------------------
/*!
* \brief Stop a request to a backend
*/
// ----------------------------------------------------------------------
void Reactor::stopBackendRequest(const std::string& theHost, int thePort)
{
itsActiveBackends.stop(theHost, thePort);
}
// ----------------------------------------------------------------------
/*!
* \brief Reset request count to a backend
*/
// ----------------------------------------------------------------------
void Reactor::resetBackendRequest(const std::string& theHost, int thePort)
{
itsActiveBackends.reset(theHost, thePort);
}
// ----------------------------------------------------------------------
/*!
* \brief Get the counts for active backend requests
*/
// ----------------------------------------------------------------------
ActiveBackends::Status Reactor::getBackendRequestStatus() const
{
return itsActiveBackends.status();
}
// ----------------------------------------------------------------------
/*!
* \brief Get registered URIs
*/
// ----------------------------------------------------------------------
URIMap Reactor::getURIMap() const
{
try
{
ReadLock lock(itsContentMutex);
URIMap theMap;
for (const auto& handlerPair : itsHandlers)
{
// Getting plugin names during shutdown may throw due to a call to a pure virtual method.
// This mitigates the problem, but does not solve it. The shutdown flag should be
// locked for the duration of this loop.
if (isShuttingDown())
return {};
if (not handlerPair.second->isPrivate())
{
theMap.insert(std::make_pair(handlerPair.first, handlerPair.second->getPluginName()));
}
}
return theMap;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Clean the log of old entries
*/
// ----------------------------------------------------------------------
/* [[noreturn]] */ void Reactor::cleanLog()
{
try
{
// This function must be called as an argument to the cleaner thread
auto maxAge = boost::posix_time::hours(24); // Here we give the maximum log time span, 24 hours
while (!isShuttingDown())
{
// Sleep for some time
boost::this_thread::sleep(boost::posix_time::seconds(5));
auto firstValidTime = boost::posix_time::second_clock::local_time() - maxAge;
for (auto& handlerPair : itsHandlers)
{
if (isShuttingDown())
return;
handlerPair.second->cleanLog(firstValidTime);
handlerPair.second->flushLog();
}
if (itsLogLastCleaned < firstValidTime)
{
itsLogLastCleaned = firstValidTime;
}
}
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "cleanLog operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Set request logging activity on or off. Only call after the handlers are registered
*/
// ----------------------------------------------------------------------
void Reactor::setLogging(bool loggingEnabled)
{
try
{
WriteLock lock(itsLoggingMutex);
// Check for no change in status
if (itsLoggingEnabled == loggingEnabled)
return;
itsLoggingEnabled = loggingEnabled;
if (itsLoggingEnabled)
{
// See if cleaner thread is running for some reason
if (itsLogCleanerThread.get() != nullptr && itsLogCleanerThread->joinable())
{
// Kill any remaining thread
itsLogCleanerThread->interrupt();
itsLogCleanerThread->join();
}
// Launch log cleaner thread
itsLogCleanerThread.reset(new boost::thread(boost::bind(&Reactor::cleanLog, this)));
// Set log cleanup time
itsLogLastCleaned = boost::posix_time::second_clock::local_time();
}
else
{
// Status set to false, make the transition true->false
// Erase log, stop cleaning thread
itsLogCleanerThread->interrupt();
itsLogCleanerThread->join();
}
// Set logging status for ALL plugins
for (auto& handlerPair : itsHandlers)
{
handlerPair.second->setLogging(itsLoggingEnabled);
}
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief List the names of the loaded plugins
*/
// ----------------------------------------------------------------------
void Reactor::listPlugins() const
{
try
{
// List all plugins
std::cout << std::endl << "List of plugins:" << std::endl;
for (const auto& plugin : itsPlugins)
{
std::cout << " " << plugin->filename() << '\t' << plugin->pluginname() << '\t'
<< plugin->apiversion() << std::endl;
}
// Number of plugins
std::cout << itsPlugins.size() << " plugin(s) loaded in memory." << std::endl << std::endl;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Load a new plugin
*/
// ----------------------------------------------------------------------
bool Reactor::loadPlugin(const std::string& theFilename, bool /* verbose */)
{
try
{
std::string pluginname = Names::plugin_name(theFilename);
std::string configfile;
lookupConfigSetting(itsOptions.itsConfig, configfile, "plugins." + pluginname);
if (!configfile.empty())
{
absolutize_path(configfile);
if (is_file_readable(configfile) != 0)
throw Fmi::Exception(BCP,
"plugin " + pluginname + " config " + configfile + " is unreadable: " +
std::strerror(errno)); // NOLINT not thread safe
}
// Find the ip filters
std::vector<std::string> filterTokens;
lookupHostStringSettings(
itsOptions.itsConfig, filterTokens, "plugins." + pluginname + ".ip_filters");
if (not filterTokens.empty())
{
boost::shared_ptr<IPFilter::IPFilter> theFilter;
try
{
theFilter.reset(new IPFilter::IPFilter(filterTokens));
std::cout << "IP Filter registered for plugin: " << pluginname << std::endl;
}
catch (std::runtime_error& err)
{
// No IP filter for this plugin
std::cout << "No IP filter for plugin: " << pluginname << ". Reason: " << err.what()
<< std::endl;
}
auto inserted = itsIPFilters.insert(std::make_pair(pluginname, theFilter));
if (!inserted.second)
{
// Plugin name is not unique
std::cout << "No IP filter for plugin: " << pluginname << ". Reason: plugin name not unique"
<< std::endl;
}
}
boost::shared_ptr<DynamicPlugin> plugin(new DynamicPlugin(theFilename, configfile, *this));
if (plugin.get() != nullptr)
{
// Start to initialize the plugin
itsInitTasks->add("Load plugin[" + theFilename + "]",
[this, plugin, pluginname]()
{ initializePlugin(plugin.get(), pluginname); });
itsPlugins.push_back(plugin);
return true;
}
return false; // Should we throw??
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!").addParameter("Filename", theFilename);
}
}
// ----------------------------------------------------------------------
/*!
* \brief Method to create a new instance of loaded class
*/
// ----------------------------------------------------------------------
void* Reactor::newInstance(const std::string& theClassName, void* user_data)
{
try
{
// Search for the class creator
auto it = itsEngines.find(theClassName);
if (it == itsEngines.end())
{
std::cerr << ANSI_FG_RED << "Unable to create a new instance of engine class '"
<< theClassName << "'" << std::endl
<< "No such class was found loaded in the EngineHood" << ANSI_FG_DEFAULT
<< std::endl;
return nullptr;
}
// config names are all lower case
std::string name = Fmi::ascii_tolower_copy(theClassName);
std::string configfile = itsEngineConfigs.find(name)->second;
// Construct the new engine instance
void* engineInstance = it->second(configfile.c_str(), user_data);
auto* theEngine = reinterpret_cast<SmartMetEngine*>(engineInstance);
// Fire the initialization thread
itsInitTasks->add("New engine instance[" + theClassName + "]",
[this, theEngine, theClassName]()
{ initializeEngine(theEngine, theClassName); });
return engineInstance;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!").addParameter("Class", theClassName);
}
}
// ----------------------------------------------------------------------
/*!
* \brief Method to create a new instance of loaded class
*/
// ----------------------------------------------------------------------
SmartMetEngine* Reactor::getSingleton(const std::string& theClassName, void* /* user_data */)
{
try
{
if (isShuttingDown())
{
// Notice that this exception most likely terminates a plugin's initialization
// phase when the plugin requests an engine. This exception is usually
// caught in the plugin's initPlugin() method.
throw Fmi::Exception(BCP, "Shutdown active!").disableStackTrace();
}
// Search for the singleton in
auto it = itsSingletons.find(theClassName);
if (it == itsSingletons.end())
{
// Log error and return with zero
std::cout << ANSI_FG_RED << "No engine '" << theClassName << "' was found loaded in memory."
<< ANSI_FG_DEFAULT << std::endl;
return nullptr;
}
// Found it, return the already-created instance of class.
auto* engine = it->second;
// Engines must be wait() - ed before use, do it here so plugins don't have worry about it
engine->wait();
return isShuttingDown() ? nullptr : engine;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!").addParameter("ClassName", theClassName);
}
}
// ----------------------------------------------------------------------
/*!
* \brief Dynamic Engine loader
*/
// ----------------------------------------------------------------------
bool Reactor::loadEngine(const std::string& theFilename, bool /* verbose */)
{
try
{
// Open the dynamic library specified by private data
// member module_filename
std::string enginename = Names::engine_name(theFilename);
std::string configfile;
lookupConfigSetting(itsOptions.itsConfig, configfile, "engines." + enginename);
if (configfile != "")
{
absolutize_path(configfile);
if (is_file_readable(configfile) != 0)
throw Fmi::Exception(BCP,
"engine " + enginename + " config " + configfile + " is unreadable: " +
std::strerror(errno)); // NOLINT not thread safe
}
itsEngineConfigs.insert(ConfigList::value_type(enginename, configfile));
void* itsHandle = dlopen(theFilename.c_str(), RTLD_NOW | RTLD_GLOBAL);
if (itsHandle == nullptr)
{
// Error occurred while opening the dynamic library
throw Fmi::Exception(BCP,
"Unable to load dynamic engine class library: " +
std::string(dlerror())); // NOLINT not thread safe
}
// Load the symbols (pointers to functions in dynamic library)
auto itsNamePointer = reinterpret_cast<EngineNamePointer>(dlsym(itsHandle, "engine_name"));
auto itsCreatorPointer =
reinterpret_cast<EngineInstanceCreator>(dlsym(itsHandle, "engine_class_creator"));
// Check that pointers to function were loaded succesfully
if (itsNamePointer == nullptr || itsCreatorPointer == nullptr)
{
throw Fmi::Exception(BCP,
"Cannot resolve dynamic library symbols: " +
std::string(dlerror())); // NOLINT not thread safe
}
// Create a permanent string out of engines human readable name
if (!itsEngines
.insert(EngineList::value_type((*itsNamePointer)(),
static_cast<EngineInstanceCreator>(itsCreatorPointer)))
.second)
return false;
// Begin constructing the engine
auto* singleton = newInstance(itsNamePointer(), nullptr);
// Check whether the preliminary creation succeeded
if (singleton == nullptr)
{
// Log error and return with zero
std::cout << ANSI_FG_RED << "No engine '" << itsNamePointer()
<< "' was found loaded in memory." << ANSI_FG_DEFAULT << std::endl;
return false;
}
auto* engine = reinterpret_cast<SmartMetEngine*>(singleton);
itsSingletons.insert(SingletonList::value_type(itsNamePointer(), engine));
return true;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!").addParameter("Filename", theFilename);
}
}
// ----------------------------------------------------------------------
/*!
* \brief Initialize an engine
*/
// ----------------------------------------------------------------------
void Reactor::initializeEngine(SmartMetEngine* theEngine, const std::string& theName)
{
boost::timer::cpu_timer timer;
theEngine->construct(theName, this);
timer.stop();
auto now_initialized = itsInitializedEngineCount.fetch_add(1) + 1;
std::string report =
(std::string(ANSI_FG_GREEN) + "Engine [" + theName +
"] initialized in %t sec CPU, %w sec real (" + std::to_string(now_initialized) + "/" +
std::to_string(itsEngineCount) + ")" + ANSI_FG_DEFAULT);
std::cout << Spine::log_time_str() << " " << timer.format(2, report) << std::endl;
if (now_initialized == itsEngineCount)
std::cout << log_time_str()
<< std::string(ANSI_FG_GREEN) + std::string(" *** All ") +
std::to_string(itsEngineCount) + " engines initialized" + ANSI_FG_DEFAULT
<< std::endl;
}
// ----------------------------------------------------------------------
/*!
* \brief Initialize a plugin
*/
// ----------------------------------------------------------------------
void Reactor::initializePlugin(DynamicPlugin* thePlugin, const std::string& theName)
{
boost::timer::cpu_timer timer;
thePlugin->initializePlugin();
timer.stop();
auto now_initialized = itsInitializedPluginCount.fetch_add(1) + 1;
std::string report =
(std::string(ANSI_FG_GREEN) + "Plugin [" + theName +
"] initialized in %t sec CPU, %w sec real (" + std::to_string(now_initialized) + "/" +
std::to_string(itsPluginCount) + ")" + ANSI_FG_DEFAULT);
std::cout << Spine::log_time_str() << " " << timer.format(2, report) << std::endl;
if (now_initialized == itsPluginCount)
std::cout << log_time_str()
<< std::string(ANSI_FG_GREEN) + std::string(" *** All ") +
std::to_string(itsPluginCount) + " plugins initialized" + ANSI_FG_DEFAULT
<< std::endl;
}
// ----------------------------------------------------------------------
/*!
* \brief List the names of the loaded engines
*/
// ----------------------------------------------------------------------
void Reactor::listEngines() const
{
try
{
std::cout << std::endl << "List of engines:" << std::endl;
for (const auto& engine : itsEngines)
{
std::cout << " " << engine.first << std::endl;
}
// Number of engines
std::cout << itsEngines.size() << " engines(s) loaded in memory." << std::endl << std::endl;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
bool Reactor::addClientConnectionStartedHook(const std::string& hookName,
ClientConnectionStartedHook theHook)
{
try
{
WriteLock lock(itsHookMutex);
return itsClientConnectionStartedHooks.insert(std::make_pair(hookName, theHook)).second;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
bool Reactor::addBackendConnectionFinishedHook(const std::string& hookName,
BackendConnectionFinishedHook theHook)
{
try
{
WriteLock lock(itsHookMutex);
return itsBackendConnectionFinishedHooks.insert(std::make_pair(hookName, theHook)).second;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
bool Reactor::addClientConnectionFinishedHook(const std::string& hookName,
ClientConnectionFinishedHook theHook)
{
try
{
WriteLock lock(itsHookMutex);
return itsClientConnectionFinishedHooks.insert(std::make_pair(hookName, theHook)).second;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
void Reactor::callClientConnectionStartedHooks(const std::string& theClientIP)
{
try
{
ReadLock lock(itsHookMutex);
for (auto& pair : itsClientConnectionStartedHooks)
{
pair.second(theClientIP);
}
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
void Reactor::callBackendConnectionFinishedHooks(
const std::string& theHostName,
int thePort,
Spine::HTTP::ContentStreamer::StreamerStatus theStatus)
{
try
{
ReadLock lock(itsHookMutex);
for (auto& pair : itsBackendConnectionFinishedHooks)
{
pair.second(theHostName, thePort, theStatus);
}
}
catch (...)
{
// This is called by the Connection destructor, hence we must not throw
Fmi::Exception ex(BCP, "Connections destructing, not calling hooks anymore", nullptr);
ex.printError();
// Fall through to the destructor
}
}
void Reactor::callClientConnectionFinishedHooks(const std::string& theClientIP,
const boost::system::error_code& theError)
{
try
{
ReadLock lock(itsHookMutex);
for (auto& pair : itsClientConnectionFinishedHooks)
{
pair.second(theClientIP, theError);
}
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
SmartMetEngine* Reactor::getEnginePtr(const std::string& theClassName, void* user_data)
{
auto* ptr = getSingleton(theClassName, user_data);
if (ptr != nullptr)
return ptr;
if (isShuttingDown())
{
throw Fmi::Exception::Trace(
BCP, "Shutdown in progress - engine " + theClassName + " is not available")
.disableStackTrace();
}
throw Fmi::Exception::Trace(BCP, "No " + theClassName + " engine available");
}
bool Reactor::isShuttingDown()
{
return gIsShuttingDown;
}
bool Reactor::isInitializing() const
{
return itsInitializing;
}
void Reactor::shutdown()
{
try
{
// We are no more interested about init task errors when shutdown has been requested
itsInitTasks->stop_on_error(false);
gIsShuttingDown = true;
Fmi::AsyncTaskGroup shutdownTasks;
// Requesting all plugins to shutdown. Notice that now the plugins know
// how many requests they have received and how many responses they have sent.
// In the other words, the plugins wait until the number of responses equals to
// the number of the requests. This was implemented on the top level, because
// this way we can relatively safely shutdown all plugins even if the do not
// implement their own shutdown() method.
std::cout << ANSI_FG_RED << ANSI_BOLD_ON << "\nShutdown plugins" << ANSI_BOLD_OFF
<< ANSI_FG_DEFAULT << std::endl;
for (auto& plugin : itsPlugins)
{
std::cout << ANSI_FG_RED << "* Plugin [" << plugin->pluginname() << "] shutting down\n"
<< ANSI_FG_DEFAULT;
shutdownTasks.add("Plugin [" + plugin->pluginname() + "] shutdown",
[&plugin]()
{
plugin->shutdownPlugin();
plugin.reset();
});
}
shutdownTasks.wait();
std::cout << ANSI_FG_RED << "* Plugin shutdown completed" << ANSI_FG_DEFAULT << std::endl;
// STEP 4: Requesting all engines to shutdown.
std::cout << ANSI_FG_RED << ANSI_BOLD_ON << "\nShutdown engines" << ANSI_BOLD_OFF
<< ANSI_FG_DEFAULT << std::endl;
for (auto& singleton : itsSingletons)
{
std::ostringstream tmp1;
tmp1 << ANSI_FG_RED << "* Engine [" << singleton.first << "] shutting down" << ANSI_FG_DEFAULT
<< '\n';
std::cout << tmp1.str() << std::flush;
auto* engine = singleton.second;
shutdownTasks.add("Engine [" + singleton.first + "] shutdown",
[&engine, singleton]()
{
engine->shutdownEngine();
std::ostringstream tmp2;
tmp2 << ANSI_FG_MAGENTA << "* Engine [" << singleton.first
<< "] shutdown complete" << ANSI_FG_DEFAULT << '\n';
std::cout << tmp2.str() << std::flush;
});
}
shutdownTasks.wait();
// STEP 5: Deleting engines. We should not delete engines before they are all shutted down
// because they might use other engines (for example, obsengine => geoengine).
std::cout << ANSI_FG_RED << ANSI_BOLD_ON << "\nDeleting engines" << ANSI_BOLD_OFF
<< ANSI_FG_DEFAULT << std::endl;
for (auto& singleton : itsSingletons)
{
std::cout << ANSI_FG_RED << "* Deleting engine [" << singleton.first << "]\n"
<< ANSI_FG_DEFAULT;
auto* engine = singleton.second;
boost::this_thread::disable_interruption do_not_disturb;
delete engine;
}
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Shutdown operation failed!");
}
}
Fmi::Cache::CacheStatistics Reactor::getCacheStats() const
{
Fmi::Cache::CacheStatistics ret;
// Engines
for (auto engine_item : itsSingletons)
{
auto* engine = engine_item.second;
if (engine && engine->ready())
{
Fmi::Cache::CacheStatistics engine_stats = engine->getCacheStats();
if (!engine_stats.empty())
ret.insert(engine_stats.begin(), engine_stats.end());
}
}
// Plugins
for (auto plugin_item : itsPlugins)
{
auto* smartmet_plugin = plugin_item->getPlugin();
if (smartmet_plugin && !smartmet_plugin->isInitActive())
{
Fmi::Cache::CacheStatistics plugin_stats = smartmet_plugin->getCacheStats();
ret.insert(plugin_stats.begin(), plugin_stats.end());
}
}
return ret;
}
} // namespace Spine
} // namespace SmartMet
| 29.521886 | 100 | 0.549749 | [
"vector"
] |
46688c009f947cf7788fef0ca1e37b97f78d2f92 | 9,765 | hpp | C++ | include/notima/sparse_array.hpp | drtconway/notima | fb542096b435bdc3246192fd7e4ba86080952afd | [
"MIT"
] | null | null | null | include/notima/sparse_array.hpp | drtconway/notima | fb542096b435bdc3246192fd7e4ba86080952afd | [
"MIT"
] | null | null | null | include/notima/sparse_array.hpp | drtconway/notima | fb542096b435bdc3246192fd7e4ba86080952afd | [
"MIT"
] | null | null | null | #ifndef NOTIMA_SPARSE_ARRAY_HPP
#define NOTIMA_SPARSE_ARRAY_HPP
#include <cmath>
#include <memory>
#include <notima/integer_array.hpp>
#include <notima/poppy.hpp>
#include <notima/internal/stats.hpp>
namespace notima
{
namespace detail
{
}
// namespace detail
template <size_t B, size_t N>
struct compute_d
{
static constexpr size_t D = compute_d<B - 1, (N >> 1)>::D;
};
template <size_t B>
struct compute_d<B, 1>
{
static constexpr size_t D = B;
};
template <size_t D>
struct sparse_array_d
{
static constexpr size_t hi_shift = D;
static constexpr uint64_t lo_mask = (1ULL << D) - 1;
const size_t B;
const size_t N;
notima::integer_array<D> lo_bits;
notima::poppy hi_bits;
sparse_array_d(const size_t p_B, const size_t p_N,
const std::vector<uint64_t>& p_items)
: B(p_B), N(p_N), hi_bits(make(p_B, lo_bits, p_items.begin(), p_items.end()))
{
}
template <typename Itr>
sparse_array_d(const size_t p_B, const size_t p_N, Itr p_begin, Itr p_end)
: B(p_B), N(p_N), hi_bits(make(p_B, lo_bits, p_begin, p_end))
{
}
uint64_t size() const
{
return 1ULL << B;
}
size_t count() const
{
return N;
}
size_t rank(uint64_t p_x) const
{
uint64_t hi_part = p_x >> hi_shift;
uint64_t lo_part = p_x & lo_mask;
size_t hi_rnk_0 = hi_bits.rank0(hi_bits.select(hi_part));
size_t hi_rnk_1 = hi_bits.rank0(hi_bits.select(hi_part + 1));
size_t lo_pos = scan_lo_bits(hi_rnk_0, hi_rnk_1, lo_part);
return lo_pos;
}
uint64_t select(size_t p_r) const
{
uint64_t hi_part = hi_bits.rank(hi_bits.select0(p_r)) - 1;
return (hi_part << hi_shift) | lo_bits[p_r];
}
template <typename Itr>
static std::vector<uint64_t> make(size_t p_B, notima::integer_array<D>& p_lo_bits, Itr p_begin, Itr p_end)
{
notima::integer_array<1> bitvec;
const uint64_t max_hi_part = (1ULL << (p_B - hi_shift)) - 1;
uint64_t curr_hi_part = 0;
bitvec.push_back(1);
for (auto itr = p_begin; itr != p_end; ++itr)
{
uint64_t x = *itr;
uint64_t hi_part = x >> hi_shift;
uint64_t lo_part = x & lo_mask;
while (curr_hi_part < hi_part)
{
bitvec.push_back(1);
curr_hi_part += 1;
}
bitvec.push_back(0);
p_lo_bits.push_back(lo_part);
}
while (curr_hi_part <= max_hi_part)
{
bitvec.push_back(1);
curr_hi_part += 1;
}
bitvec.push_back(1);
return bitvec.words;
}
private:
size_t scan_lo_bits(size_t p_begin, size_t p_end, uint64_t p_x) const
{
if (p_end - p_begin > 16)
{
return lower_bound(p_begin, p_end, p_x);
}
for (size_t r = p_begin; r < p_end; ++r)
{
if (lo_bits[r] >= p_x)
{
return r;
}
}
return p_end;
}
size_t lower_bound(size_t p_begin, size_t p_end, uint64_t p_x) const
{
size_t lo = p_begin;
size_t hi = p_end;
while (lo < hi)
{
size_t mid = (lo + hi) / 2;
if (lo_bits[mid] < p_x)
{
lo = mid + 1;
}
else
{
hi = mid;
}
}
return lo;
}
};
struct sparse_array
{
static size_t compute_d(size_t B, size_t N)
{
while (N > 1)
{
B -= 1;
N >>= 1;
}
return B;
}
struct array_interface
{
virtual ~array_interface() {}
virtual size_t rank(uint64_t p_x) const = 0;
virtual uint64_t select(size_t p_r) const = 0;
};
using array_ptr = std::shared_ptr<array_interface>;
template <size_t D>
struct sparse_array_impl : array_interface
{
const sparse_array_d<D> arr;
template <typename Itr>
sparse_array_impl(const size_t p_B, const size_t p_N,
Itr p_begin, Itr p_end)
: arr(p_B, p_N, p_begin, p_end)
{
}
virtual size_t rank(uint64_t p_x) const
{
return arr.rank(p_x);
}
virtual uint64_t select(size_t p_r) const
{
return arr.select(p_r);
}
};
sparse_array(const size_t p_B, const std::vector<uint64_t>& p_items)
: B(p_B), N(p_items.size()), D(compute_d(B, N)),
m_array(make<1,typename std::vector<uint64_t>::const_iterator>(B, N, D, p_items.begin(), p_items.end()))
{
}
template <typename Itr>
sparse_array(const size_t p_B, const size_t p_N, Itr p_begin, Itr p_end)
: B(p_B), N(p_N), D(compute_d(B, N)),
m_array(make<1,Itr>(B, N, D, p_begin, p_end))
{
}
uint64_t size() const
{
return (1ULL << B);
}
size_t count() const
{
return N;
}
size_t rank(uint64_t p_x) const
{
return m_array->rank(p_x);
}
uint64_t select(size_t p_r) const
{
return m_array->select(p_r);
}
template <size_t D, typename Itr>
static typename std::enable_if<(D < 64),array_ptr>::type
make(size_t p_B, size_t p_N, size_t p_D, Itr p_begin, Itr p_end)
{
if (p_D == D)
{
return array_ptr(new sparse_array_impl<D>(p_B, p_N, p_begin, p_end));
}
else
{
return make<D+1,Itr>(p_B, p_N, p_D, p_begin, p_end);
}
}
template <size_t D, typename Itr>
static typename std::enable_if<(D >= 64),array_ptr>::type
make(size_t p_B, size_t p_N, size_t p_D, Itr p_begin, Itr p_end)
{
throw std::runtime_error("Cannot create array");
}
template <typename X>
void with(X p_func)
{
with<1>(*this, p_func);
}
template <size_t D, typename X>
static
typename std::enable_if<(D < 64), void>::type
with(const sparse_array& p_arr, X p_func)
{
using impl = notima::sparse_array::sparse_array_impl<D>;
const impl* ptr = dynamic_cast<const impl*>(p_arr.m_array.get());
if (ptr)
{
p_func(ptr->arr);
}
else
{
with<D+1,X>(p_arr, p_func);
}
}
template <size_t D, typename X>
static
typename std::enable_if<(D >= 64), void>::type
with(const sparse_array& p_arr, X p_func)
{
throw std::runtime_error("gather_sparse: D out of range");
}
const size_t B;
const size_t N;
const size_t D;
array_ptr m_array;
};
namespace internal
{
template <size_t D>
struct gather<notima::sparse_array_d<D>>
{
nlohmann::json operator()(const notima::sparse_array_d<D>& p_obj) const
{
nlohmann::json s;
s["sparse"]["D"] = D;
s["sparse"]["size"] = p_obj.size();
s["sparse"]["count"] = p_obj.count();
s["sparse"]["hi"] = notima::internal::stats::gather(p_obj.hi_bits);
s["sparse"]["lo"] = notima::internal::stats::gather(p_obj.lo_bits);
uint64_t m = 0;
m += s["sparse"]["hi"]["poppy"]["memory"].get<uint64_t>();
m += s["sparse"]["lo"]["iarray"]["memory"].get<uint64_t>();
s["sparse"]["memory"] = m;
return s;
}
};
template <size_t D>
struct gather_sparse_helper
{
static nlohmann::json gather_sparse(const notima::sparse_array::array_interface& p_obj)
{
using impl = notima::sparse_array::sparse_array_impl<D>;
const impl* ptr = dynamic_cast<const impl*>(&p_obj);
if (ptr)
{
return notima::internal::stats::gather(ptr->arr);
}
else
{
return gather_sparse_helper<D+1>::gather_sparse(p_obj);
}
}
};
template <>
struct gather_sparse_helper<64>
{
static nlohmann::json gather_sparse(const notima::sparse_array::array_interface& p_obj)
{
throw std::runtime_error("gather_sparse: D out of range");
}
};
template <>
struct gather<notima::sparse_array>
{
nlohmann::json operator()(const notima::sparse_array& p_obj) const
{
return gather_sparse_helper<1>::gather_sparse(*p_obj.m_array);
}
};
}
// namespace internal
}
// namespace notima
#endif // NOTIMA_SPARSE_ARRAY_HPP
| 27.584746 | 118 | 0.483052 | [
"vector"
] |
466b2240864af9386f5cbd80b67d8c80f02a2e0d | 18,360 | cpp | C++ | src/likelihood.cpp | mrc-ide/malariaModelFit | 2a1e3e53cb38d786f0f163d9f4a2a546d28a526e | [
"MIT"
] | 4 | 2019-12-03T14:07:51.000Z | 2020-05-07T21:25:29.000Z | src/likelihood.cpp | mrc-ide/malariaModelFit | 2a1e3e53cb38d786f0f163d9f4a2a546d28a526e | [
"MIT"
] | 12 | 2019-12-09T13:00:05.000Z | 2020-01-28T08:39:29.000Z | src/likelihood.cpp | mrc-ide/malariaModelFit | 2a1e3e53cb38d786f0f163d9f4a2a546d28a526e | [
"MIT"
] | null | null | null | #include <Rcpp.h>
// [[Rcpp::export]]
SEXP loglikelihood(std::vector<double> params, std::vector<double> x){
// Unpack data ///////////////////////////////////////////////////////////////
// Data input vector format:
// Output type
// Number of studies
// Number of sites
// Vector of site study index
// Vector of site group number
// List of age prop for each site
// List of age r for each site
// List of age age days midpoint for each site
// List of age psi for each site
// Vector of age 20 year old for each site
// Number of heterogeneity classes
// Vector of Gaussian quadrature nodes
// Vector of Gaussian quadrature weights
// List of site data denominators (Number of persons or person years)
// List of site data numerators (Number +ve or cases)
// Vector of prevalence or incidence indicator
// Vector of case detection indices
// List of age brackets
//Rcpp::Rcout << "Unpacking data" << std::endl;
// Index of data vector
int di = 0;
// output_type
int output_type = x[di];
di++;
// Rcpp::Rcout << "output_type " << output_type << std::endl;
// Number of studies
int study_n = x[di];
di++;
// Rcpp::Rcout << "study_n " << study_n << std::endl;
// Number of sites
int site_n = x[di];
di++;
// Rcpp::Rcout << "site_n " << site_n << std::endl;
// Study index for each site
std::vector<int> study(site_n);
for(int i = 0; i < site_n; ++i){
study[i] = x[di];
di++;
}
// Rcpp::Rcout << "study 1 " << study[0] << std::endl;
// Site group number
std::vector<int> ng(site_n);
for(int i = 0; i < site_n; ++i){
ng[i] = x[di];
di++;
}
// Rcpp::Rcout << "ng 1 " << ng[0] << std::endl;
// Empty template site_n X group_n
std::vector<std::vector<double> > template_dbl(site_n);
for(int i = 0; i < site_n; ++i){
template_dbl[i].resize(ng[i]);
}
// Age prop for each site
std::vector<std::vector<double> > prop = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < ng[i]; ++j){
prop[i][j] = x[di];
di++;
}
}
// Rcpp::Rcout << "prop 1 " << prop[0][0] << std::endl;
// Age r for each site
std::vector<std::vector<double> > r = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < ng[i]; ++j){
r[i][j] = x[di];
di++;
}
}
// Rcpp::Rcout << "r 1 " << r[0][0] << std::endl;
// Age day midpoint for each site
std::vector<std::vector<double> > age_days_midpoint = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < ng[i]; ++j){
age_days_midpoint[i][j] = x[di];
di++;
}
}
// Rcpp::Rcout << "age_days_midpoint 1 " << age_days_midpoint[0][0] << std::endl;
// Age psi for each site
std::vector<std::vector<double> > psi = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < ng[i]; ++j){
psi[i][j] = x[di];
di++;
}
}
// Rcpp::Rcout << "psi 1 " << psi[0][0] << std::endl;
// Index of 20 year old age for each site
std::vector<int> age20(site_n);
for(int i = 0; i < site_n; ++i){
age20[i] = x[di];
di++;
}
// Rcpp::Rcout << "age20 1 " << age20[0] << std::endl;
// Gaussian quadrature nodes and weights
int nh = x[di];
di++;
std::vector<double> nodes(nh);
std::vector<double> weights(nh);
for(int i = 0; i < nh; ++i){
nodes[i] = x[di];
di++;
}
for(int i = 0; i < nh; ++i){
weights[i] = x[di];
di++;
}
// Data numerators
std::vector<std::vector<double> > numer = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < (ng[i] - 1); ++j){
numer[i][j] = x[di];
di++;
}
}
// Rcpp::Rcout << "numer 1 " << numer[0][0] << std::endl;
// Data denominators
std::vector<std::vector<double> > denom = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < (ng[i] - 1); ++j){
denom[i][j] = x[di];
// Rcpp::Rcout << "denom in " << denom[i][j] << std::endl;
di++;
}
}
// Rcpp::Rcout << "denom 1 " << denom[0][0] << std::endl;
// Prevalence or incidence
std::vector<int> type(site_n);
for(int i = 0; i < site_n; ++i){
type[i] = x[di];
// Rcpp::Rcout << "Type in " << type[i] << std::endl;
di++;
}
// Case detection
std::vector<int> case_detection(site_n);
for(int i = 0; i < site_n; ++i){
case_detection[i] = x[di];
di++;
}
// Age bracket (random effect group)
std::vector<std::vector<double> > age_bracket = template_dbl;
for(int i = 0; i < site_n; ++i){
for(int j = 0; j < ng[i]; ++j){
age_bracket[i][j] = x[di];
di++;
}
}
//////////////////////////////////////////////////////////////////////////////
// Unpack parameters /////////////////////////////////////////////////////////
//Rcpp::Rcout << "Unpacking parameters" << std::endl;
// Index of parameter vectors
int pi = 0;
// age, heterogeneity in exposure
double eta = params[pi];
pi++;
double rho = params[pi];
pi++;
double a0 = params[pi];
pi++;
double s2 = params[pi];
pi++;
// rate of leaving infection states
double prA = params[pi];
pi++;
double prT = params[pi];
pi++;
double prD = params[pi];
pi++;
double prU = params[pi];
pi++;
double prP = params[pi];
pi++;
// human latent period and time lag from asexual parasites to infectiousness
// double dE = params[pi]; Unused (but input)
pi++;
// double tl = params[pi]; Unused (but input)
pi++;
// infectiousness to mosquitoes
double cD = params[pi];
pi++;
double cT = params[pi];
pi++;
double cU = params[pi];
pi++;
double g_inf = params[pi];
pi++;
// anti-parasite immunity
double d1 = params[pi];
pi++;
double dd = params[pi];
pi++;
double ID0 = params[pi];
pi++;
double kd = params[pi];
pi++;
double ud = params[pi];
pi++;
double ad0 = params[pi];
pi++;
double fd0 = params[pi];
pi++;
double gd = params[pi];
pi++;
double aA = params[pi];
pi++;
double aU = params[pi];
pi++;
// anti-infection immunity
double b0 = params[pi];
pi++;
double b1 = params[pi];
pi++;
double db = params[pi];
pi++;
double IB0 = params[pi];
pi++;
double kb = params[pi];
pi++;
double ub = params[pi];
pi++;
// clinical immunity
double phi0 = params[pi];
pi++;
double phi1 = params[pi];
pi++;
double dc = params[pi];
pi++;
double IC0 = params[pi];
pi++;
double kc = params[pi];
pi++;
double uc = params[pi];
pi++;
double PM = params[pi];
pi++;
double dm = params[pi];
pi++;
// mosquito parameters
// double tau = params[pi]; Unused (but input)
pi++;
// double mu = params[pi] ; Unused (but input)
pi++;
double f = params[pi];
pi++;
double Q0 = params[pi];
pi++;
// case detection parameters
double cd_w = 1.0;//= params[pi++];
double cd_p = 1.0; //params[pi++];
// EIR
std::vector<double> EIR(site_n);
for(int i = 0; i < site_n; ++i){
EIR[i] = params[pi];
//Rcpp::Rcout << "EIR " << EIR[i] << std::endl;
pi++;
}
// Treatment coverage
std::vector<double> ft(study_n);
for(int i = 0; i < study_n; ++i){
ft[i] = params[pi];
//Rcpp::Rcout << "ft " << ft[i] << std::endl;
pi++;
}
// Fitting hyper-parameters
double sigma_c = params[pi++];
double alpha_c = params[pi++];
double sigma_p = params[pi++];
double theta = params[pi++];
//Rcpp::Rcout << "sigma_c " << sigma_c << std::endl;
//Rcpp::Rcout << "alpha_c " << alpha_c << std::endl;
//Rcpp::Rcout << "sigma_p " << sigma_p << std::endl;
//Rcpp::Rcout << "theta " << theta << std::endl;
// Study-level random effects (either u or w, depending on data)
std::vector<double> study_re(study_n);
for(int i = 0; i < study_n; ++i){
//study_re[i] = 0;
study_re[i] = params[pi];
//Rcpp::Rcout << "RE " << study_re[i] << std::endl;
pi++;
}
//////////////////////////////////////////////////////////////////////////////
// Initialise output variables for all sites /////////////////////////////////
std::vector<std::vector<double> > S_out = template_dbl;
std::vector<std::vector<double> > T_out = template_dbl;
std::vector<std::vector<double> > D_out = template_dbl;
std::vector<std::vector<double> > A_out = template_dbl;
std::vector<std::vector<double> > U_out = template_dbl;
std::vector<std::vector<double> > P_out = template_dbl;
std::vector<std::vector<double> > pos_M_out = template_dbl;
std::vector<std::vector<double> > pos_PCR_out = template_dbl;
std::vector<std::vector<double> > inf_out = template_dbl;
std::vector<std::vector<double> > inc_out = template_dbl;
std::vector<double> FOIM(site_n);
//////////////////////////////////////////////////////////////////////////////
for(int s = 0; s < site_n; ++s){
// Initialise output variables for a single site /////////////////////////////
std::vector<std::vector<double> > pos_M(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > pos_PCR(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > inc(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > inf(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > S(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > T(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > P(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > D(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > A(nh, std::vector<double>(ng[s], 0));
std::vector<std::vector<double> > U(nh, std::vector<double>(ng[s], 0));
double zeta;
double rA;
double rU;
//////////////////////////////////////////////////////////////////////////////
// Equilbrium ////////////////////////////////////////////////////////////////
//Rcpp::Rcout << "Running EQ" << std::endl;
// loop through all Gaussian quadrature nodes
for(int n = 0; n < nh; ++n){
zeta = exp(-s2 * 0.5 + std::sqrt(s2) * nodes[n]);
double EIR_cur = EIR[s] / 365 * zeta;
// Human EQ no-het:
double IB = 0;
double IC = 0;
double ID = 0;
std::vector<double> ICA(ng[s], 0);
std::vector<double> FOI(ng[s], 0);
std::vector<double> q(ng[s], 0);
std::vector<double> cA(ng[s], 0);
double re;
double eps;
double b;
double fd;
double IM0;
std::vector<double> ICM(ng[s], 0);
double ICM_prev;
std::vector<double> phi(ng[s], 0);
//Rcpp::Rcout << "Starting NA" << std::endl;
for(int a = 0; a < ng[s]; ++a){
re = r[s][a] + eta;
eps = EIR_cur * psi[s][a];
IB = (eps / (eps * ub + 1) + re * IB) / (1 / db + re);
b = b0 * (b1 + (1 - b1) / (1 + std::pow((IB / IB0), kb)));
FOI[a] = b * eps;
IC = (FOI[a] / (FOI[a] * uc + 1) + re * IC) / (1 / dc + re);
ICA[a] = IC;
ID = (FOI[a] / (FOI[a] * ud + 1) + re * ID) / (1 / dd + re);
fd = 1 - (1 - fd0) / (1 + std::pow((age_days_midpoint[s][a] / ad0), gd));
q[a] = d1 + (1 - d1) / (1 + std::pow((ID / ID0), kd) * fd);
cA[a] = cU + (cD - cU) * std::pow(q[a], g_inf);
}
// Rcpp::Rcout << "Starting prev1" << std::endl;
IM0 = ICA[age20[s]] * PM;
for(int a = 0; a < ng[s]; ++a){
re = r[s][a] + eta;
if (a == 0) {
ICM_prev = IM0;
} else {
ICM_prev = ICM[a - 1];
}
ICM[a] = ICM_prev * re / (1 / dm + re);
}
// Rcpp::Rcout << "Starting phi" << std::endl;
for(int a = 0; a < ng[s]; ++a){
phi[a] = phi0 * (phi1 + (1 - phi1) / (1 + (std::pow((ICA[a] + ICM[a]) / IC0, kc))));
}
double betaT;
double betaD;
double betaA;
double betaU;
double betaP;
double aT;
double aP;
double aD;
double bT;
double bP;
double bD;
double Y;
// Rcpp::Rcout << "Starting states" << std::endl;
for(int a = 0; a < ng[s]; ++a){
re = r[s][a] + eta;
betaT = prT + re;
betaD = prD + re;
betaA = FOI[a]*phi[a] + prA + re;
betaU = FOI[a] + prU + re;
betaP = prP + re;
aT = ft[study[s]-1] * phi[a] * FOI[a] / betaT;
aP = prT * aT / betaP;
aD = (1 - ft[study[s]-1]) * phi[a] * FOI[a] / betaD;
if (a == 0){
bT = 0;
bD = 0;
bP = 0;
} else {
bT = r[s][a - 1] * T[n][a - 1] / betaT;
bD = r[s][a - 1] * D[n][a - 1] / betaD;
bP = prT * bT + r[s][a - 1] * P[n][a - 1] / betaP;
}
Y = (prop[s][a] - (bT + bD + bP)) / (1 + aT + aD + aP);
T[n][a] = aT * Y + bT;
D[n][a] = aD * Y + bD;
P[n][a] = aP * Y + bP;
if (a == 0){
rA = 0;
rU = 0;
} else {
rA = r[s][a - 1] * A[n][a - 1];
rU = r[s][a - 1] * U[n][a - 1];
}
A[n][a] = (rA + (1 - phi[a]) * Y * FOI[a] + prD * D[n][a]) / (betaA + (1 - phi[a]) * FOI[a]);
U[n][a] = (rU + prA * A[n][a]) / betaU;
S[n][a] = Y - A[n][a] - U[n][a];
pos_M[n][a] = D[n][a] + T[n][a] + A[n][a] * q[a];
pos_PCR[n][a] = D[n][a] + T[n][a] + A[n][a] * std::pow(q[a], aA) + U[n][a] * std::pow(q[a], aU);
inc[n][a] = Y * FOI[a] * phi[a];
}
for(int a = 0; a < ng[s]; ++a){
inf[n][a] = cD * D[n][a] + cT * T[n][a] + cA[a] * A[n][a] + cU * U[n][a];
}
}
// Average over nodes
for(int n = 0; n < nh; ++n){
zeta = exp(-s2 * 0.5 + std::sqrt(s2) * nodes[n]);
for(int a = 0; a < ng[s]; ++a){
S_out[s][a] += S[n][a] * weights[n];
T_out[s][a] += T[n][a] * weights[n];
D_out[s][a] += D[n][a] * weights[n];
A_out[s][a] += A[n][a] * weights[n];
U_out[s][a] += U[n][a] * weights[n];
P_out[s][a] += P[n][a] * weights[n];
pos_M_out[s][a] += pos_M[n][a] * weights[n];
pos_PCR_out[s][a] += pos_PCR[n][a] * weights[n];
inf_out[s][a] += inf[n][a] * weights[n];
inc_out[s][a] += inc[n][a] * weights[n];
FOIM[s] += inf[n][a] * psi[s][a] * weights[n] * zeta;
}
}
double omega = 1 - rho * eta / (eta + 1 / a0);
double alpha = f * Q0;
FOIM[s] *= alpha/omega;
}
//Rcpp::Rcout << "Outer" << std::endl;
if(output_type == 1){
return Rcpp::List::create(
Rcpp::Named("S") = S_out,
Rcpp::Named("T") = T_out,
Rcpp::Named("D") = D_out,
Rcpp::Named("A") = A_out,
Rcpp::Named("U") = U_out,
Rcpp::Named("P") = P_out,
Rcpp::Named("inf") = inf_out,
Rcpp::Named("prop") = prop,
Rcpp::Named("psi") = psi,
Rcpp::Named("pos_M") = pos_M_out,
Rcpp::Named("pos_PCR") = pos_PCR_out,
Rcpp::Named("inc") = inc_out,
Rcpp::Named("FOIM") = FOIM);
}
//////////////////////////////////////////////////////////////////////////////
// Likelihood ////////////////////////////////////////////////////////////////
//Rcpp::Rcout << "Likelihood" << std::endl;
std::vector<std::vector<double> > case_matrix(site_n, std::vector<double>(4));
std::vector<std::vector<double> > inc_matrix(site_n, std::vector<double>(4));
std::vector< std::vector<double> > const_matrix(site_n, std::vector<double>(4));
// Pre calculate value for likelihood function
for(int s = 0; s < site_n; ++s){
// define case detection rate for this site
double cd_rate;
switch(case_detection[s]) {
case 1:
cd_rate = 1.0;
break;
case 2:
cd_rate = cd_w;
break;
case 3:
cd_rate = cd_p;
break;
default:
break;
}
// For each age group
for(int a = 0; a < (ng[s] -1); ++a){
// Rcpp::Rcout << "type " << type[s] << std::endl;
switch(type[s]) {
// Incidence calculation
case 1:{
int k = age_bracket[s][a] - 1;
case_matrix[s][k] += numer[s][a];
double temp_inc = cd_rate * exp(study_re[study[s]-1]) * denom[s][a] * inc_out[s][a];
//Rcpp::Rcout << "A " << cd_rate << std::endl;
//Rcpp::Rcout << "B " << exp(study_re[study[s]-1]) << std::endl;
//Rcpp::Rcout << "C " << denom[s][a] << std::endl;
//Rcpp::Rcout << "D " << inc_out[s][a] << std::endl;
//Rcpp::Rcout << "temp_inc " << temp_inc << std::endl;
inc_matrix[s][k] += temp_inc;
const_matrix[s][k] += numer[s][a] * log(temp_inc) - lgamma(numer[s][a] + 1);
//Rcpp::Rcout << "numer " << numer[s][a] << std::endl;
//Rcpp::Rcout << "case_matrix " << case_matrix[s][k] << std::endl;
//Rcpp::Rcout << "const_matrix " << const_matrix[s][k] << std::endl;
}
break;
// Prevalence calculation
case 2:
break;
default:
break;
}
}
}
// Calculate likelihood (currently incidence for all sites as sites with no likelihood data = 1)
double lL = 0;
double alpha_c_inv = 1 / alpha_c;
for(int s = 0; s < site_n; ++s){
for(int k = 0; k < 4; ++k){
lL += (alpha_c_inv) * log(alpha_c_inv) - (alpha_c_inv + case_matrix[s][k]) * log(alpha_c_inv + inc_matrix[s][k]) +
lgamma(alpha_c_inv + case_matrix[s][k]) - lgamma(alpha_c_inv) + const_matrix[s][k];
}
}
//////////////////////////////////////////////////////////////////////////////
return Rcpp::wrap(lL);
}
// loglikelihood_end" | 32.727273 | 120 | 0.466449 | [
"vector"
] |
466f552274431025e0633cec48925396ffde76ae | 9,895 | cpp | C++ | Firmware/Marlin/src/module/delta.cpp | PavelTajdus/Anet-A8-PLUS-Dual-Color-Rebuild | 76ce07b6c8f52962c1251d40beb6de26301409ef | [
"MIT"
] | 1 | 2019-10-22T11:04:05.000Z | 2019-10-22T11:04:05.000Z | Firmware/Marlin/src/module/delta.cpp | PavelTajdus/Anet-A8-PLUS-Dual-Color-Rebuild | 76ce07b6c8f52962c1251d40beb6de26301409ef | [
"MIT"
] | null | null | null | Firmware/Marlin/src/module/delta.cpp | PavelTajdus/Anet-A8-PLUS-Dual-Color-Rebuild | 76ce07b6c8f52962c1251d40beb6de26301409ef | [
"MIT"
] | 2 | 2019-07-22T20:31:15.000Z | 2021-08-01T00:15:38.000Z | /**
* Marlin 3D Printer Firmware
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* delta.cpp
*/
#include "../inc/MarlinConfig.h"
#if ENABLED(DELTA)
#include "delta.h"
#include "motion.h"
// For homing:
#include "planner.h"
#include "endstops.h"
#include "../lcd/ultralcd.h"
#include "../Marlin.h"
#if HAS_BED_PROBE
#include "probe.h"
#endif
#if ENABLED(SENSORLESS_HOMING)
#include "../feature/tmc_util.h"
#include "stepper_indirection.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h"
// Initialized by settings.load()
float delta_height,
delta_endstop_adj[ABC] = { 0 },
delta_radius,
delta_diagonal_rod,
delta_segments_per_second,
delta_calibration_radius,
delta_tower_angle_trim[ABC];
float delta_tower[ABC][2],
delta_diagonal_rod_2_tower[ABC],
delta_clip_start_height = Z_MAX_POS;
float delta_safe_distance_from_top();
/**
* Recalculate factors used for delta kinematics whenever
* settings have been changed (e.g., by M665).
*/
void recalc_delta_settings() {
const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER,
drt[ABC] = DELTA_DIAGONAL_ROD_TRIM_TOWER;
delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (delta_radius + trt[A_AXIS]); // front left tower
delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (delta_radius + trt[A_AXIS]);
delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (delta_radius + trt[B_AXIS]); // front right tower
delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (delta_radius + trt[B_AXIS]);
delta_tower[C_AXIS][X_AXIS] = cos(RADIANS( 90 + delta_tower_angle_trim[C_AXIS])) * (delta_radius + trt[C_AXIS]); // back middle tower
delta_tower[C_AXIS][Y_AXIS] = sin(RADIANS( 90 + delta_tower_angle_trim[C_AXIS])) * (delta_radius + trt[C_AXIS]);
delta_diagonal_rod_2_tower[A_AXIS] = sq(delta_diagonal_rod + drt[A_AXIS]);
delta_diagonal_rod_2_tower[B_AXIS] = sq(delta_diagonal_rod + drt[B_AXIS]);
delta_diagonal_rod_2_tower[C_AXIS] = sq(delta_diagonal_rod + drt[C_AXIS]);
update_software_endstops(Z_AXIS);
set_all_unhomed();
}
/**
* Delta Inverse Kinematics
*
* Calculate the tower positions for a given machine
* position, storing the result in the delta[] array.
*
* This is an expensive calculation, requiring 3 square
* roots per segmented linear move, and strains the limits
* of a Mega2560 with a Graphical Display.
*
* Suggested optimizations include:
*
* - Disable the home_offset (M206) and/or position_shift (G92)
* features to remove up to 12 float additions.
*/
#define DELTA_DEBUG(VAR) do { \
SERIAL_ECHOPAIR("cartesian X:", VAR[X_AXIS]); \
SERIAL_ECHOPAIR(" Y:", VAR[Y_AXIS]); \
SERIAL_ECHOLNPAIR(" Z:", VAR[Z_AXIS]); \
SERIAL_ECHOPAIR("delta A:", delta[A_AXIS]); \
SERIAL_ECHOPAIR(" B:", delta[B_AXIS]); \
SERIAL_ECHOLNPAIR(" C:", delta[C_AXIS]); \
}while(0)
void inverse_kinematics(const float (&raw)[XYZ]) {
#if HAS_HOTEND_OFFSET
// Delta hotend offsets must be applied in Cartesian space with no "spoofing"
const float pos[XYZ] = {
raw[X_AXIS] - hotend_offset[X_AXIS][active_extruder],
raw[Y_AXIS] - hotend_offset[Y_AXIS][active_extruder],
raw[Z_AXIS]
};
DELTA_IK(pos);
//DELTA_DEBUG(pos);
#else
DELTA_IK(raw);
//DELTA_DEBUG(raw);
#endif
}
/**
* Calculate the highest Z position where the
* effector has the full range of XY motion.
*/
float delta_safe_distance_from_top() {
float cartesian[XYZ] = { 0, 0, 0 };
inverse_kinematics(cartesian);
float centered_extent = delta[A_AXIS];
cartesian[Y_AXIS] = DELTA_PRINTABLE_RADIUS;
inverse_kinematics(cartesian);
return ABS(centered_extent - delta[A_AXIS]);
}
/**
* Delta Forward Kinematics
*
* See the Wikipedia article "Trilateration"
* https://en.wikipedia.org/wiki/Trilateration
*
* Establish a new coordinate system in the plane of the
* three carriage points. This system has its origin at
* tower1, with tower2 on the X axis. Tower3 is in the X-Y
* plane with a Z component of zero.
* We will define unit vectors in this coordinate system
* in our original coordinate system. Then when we calculate
* the Xnew, Ynew and Znew values, we can translate back into
* the original system by moving along those unit vectors
* by the corresponding values.
*
* Variable names matched to Marlin, c-version, and avoid the
* use of any vector library.
*
* by Andreas Hardtung 2016-06-07
* based on a Java function from "Delta Robot Kinematics V3"
* by Steve Graves
*
* The result is stored in the cartes[] array.
*/
void forward_kinematics_DELTA(const float &z1, const float &z2, const float &z3) {
// Create a vector in old coordinates along x axis of new coordinate
const float p12[3] = { delta_tower[B_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[B_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z2 - z1 },
// Get the reciprocal of Magnitude of vector.
d2 = sq(p12[0]) + sq(p12[1]) + sq(p12[2]), inv_d = RSQRT(d2),
// Create unit vector by multiplying by the inverse of the magnitude.
ex[3] = { p12[0] * inv_d, p12[1] * inv_d, p12[2] * inv_d },
// Get the vector from the origin of the new system to the third point.
p13[3] = { delta_tower[C_AXIS][X_AXIS] - delta_tower[A_AXIS][X_AXIS], delta_tower[C_AXIS][Y_AXIS] - delta_tower[A_AXIS][Y_AXIS], z3 - z1 },
// Use the dot product to find the component of this vector on the X axis.
i = ex[0] * p13[0] + ex[1] * p13[1] + ex[2] * p13[2],
// Create a vector along the x axis that represents the x component of p13.
iex[3] = { ex[0] * i, ex[1] * i, ex[2] * i };
// Subtract the X component from the original vector leaving only Y. We use the
// variable that will be the unit vector after we scale it.
float ey[3] = { p13[0] - iex[0], p13[1] - iex[1], p13[2] - iex[2] };
// The magnitude and the inverse of the magnitude of Y component
const float j2 = sq(ey[0]) + sq(ey[1]) + sq(ey[2]), inv_j = RSQRT(j2);
// Convert to a unit vector
ey[0] *= inv_j; ey[1] *= inv_j; ey[2] *= inv_j;
// The cross product of the unit x and y is the unit z
// float[] ez = vectorCrossProd(ex, ey);
const float ez[3] = {
ex[1] * ey[2] - ex[2] * ey[1],
ex[2] * ey[0] - ex[0] * ey[2],
ex[0] * ey[1] - ex[1] * ey[0]
},
// We now have the d, i and j values defined in Wikipedia.
// Plug them into the equations defined in Wikipedia for Xnew, Ynew and Znew
Xnew = (delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[B_AXIS] + d2) * inv_d * 0.5,
Ynew = ((delta_diagonal_rod_2_tower[A_AXIS] - delta_diagonal_rod_2_tower[C_AXIS] + sq(i) + j2) * 0.5 - i * Xnew) * inv_j,
Znew = SQRT(delta_diagonal_rod_2_tower[A_AXIS] - HYPOT2(Xnew, Ynew));
// Start from the origin of the old coordinates and add vectors in the
// old coords that represent the Xnew, Ynew and Znew to find the point
// in the old system.
cartes[X_AXIS] = delta_tower[A_AXIS][X_AXIS] + ex[0] * Xnew + ey[0] * Ynew - ez[0] * Znew;
cartes[Y_AXIS] = delta_tower[A_AXIS][Y_AXIS] + ex[1] * Xnew + ey[1] * Ynew - ez[1] * Znew;
cartes[Z_AXIS] = z1 + ex[2] * Xnew + ey[2] * Ynew - ez[2] * Znew;
}
/**
* A delta can only safely home all axes at the same time
* This is like quick_home_xy() but for 3 towers.
*/
void home_delta() {
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
// Init the current position of all carriages to 0,0,0
ZERO(current_position);
ZERO(destination);
sync_plan_position();
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states { false, false, false, false, false, false, false };
stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY);
stealth_states.z = tmc_enable_stallguard(stepperZ);
#endif
// Move all carriages together linearly until an endstop is hit.
destination[Z_AXIS] = (delta_height
#if HAS_BED_PROBE
- zprobe_zoffset
#endif
+ 10);
buffer_line_to_destination(homing_feedrate(X_AXIS));
planner.synchronize();
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
tmc_disable_stallguard(stepperX, stealth_states.x);
tmc_disable_stallguard(stepperY, stealth_states.y);
tmc_disable_stallguard(stepperZ, stealth_states.z);
#endif
endstops.validate_homing_move();
// At least one carriage has reached the top.
// Now re-home each carriage separately.
homeaxis(A_AXIS);
homeaxis(B_AXIS);
homeaxis(C_AXIS);
// Set all carriages to their home positions
// Do this here all at once for Delta, because
// XYZ isn't ABC. Applying this per-tower would
// give the impression that they are the same.
LOOP_XYZ(i) set_axis_is_at_home((AxisEnum)i);
sync_plan_position();
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
}
#endif // DELTA
| 36.378676 | 153 | 0.697726 | [
"vector",
"3d"
] |
4673975f64815362873c0a8566558734fcc214ed | 4,349 | hpp | C++ | blast/include/algo/blast/api/deltablast_options.hpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | 31 | 2016-12-09T04:56:59.000Z | 2021-12-31T17:19:10.000Z | blast/include/algo/blast/api/deltablast_options.hpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | 6 | 2017-03-10T17:25:13.000Z | 2021-09-22T15:49:49.000Z | blast/include/algo/blast/api/deltablast_options.hpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | 20 | 2015-01-04T02:15:17.000Z | 2021-12-03T02:31:43.000Z | #ifndef ALGO_BLAST_API___DELTABLAST_OPTIONS__HPP
#define ALGO_BLAST_API___DELTABLAST_OPTIONS__HPP
/* $Id: deltablast_options.hpp 349728 2012-01-12 18:51:12Z boratyng $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Authors: Greg Boratyn
*
*/
/// @file deltablast_options.hpp
/// Declares the CDeltaBlastOptionsHandle class.
#include <algo/blast/api/psiblast_options.hpp>
/** @addtogroup AlgoBlast
*
* @{
*/
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(blast)
/// Handle to the protein-protein options to the BLAST algorithm.
///
/// Adapter class for protein-protein BLAST comparisons.
/// Exposes an interface to allow manipulation the options that are relevant to
/// this type of search.
class NCBI_XBLAST_EXPORT CDeltaBlastOptionsHandle : public CPSIBlastOptionsHandle
{
public:
/// Creates object with default options set
CDeltaBlastOptionsHandle(EAPILocality locality = CBlastOptions::eLocal);
/// Destructor
~CDeltaBlastOptionsHandle() {}
/******************* DELTA BLAST options ***********************/
/// Get e-value threshold for including domains in Pssm calculation
/// @return E-value cutoff for domains
double GetDomainInclusionThreshold(void) const
{ return m_Opts->GetDomainInclusionThreshold(); }
/// Set e-value threshold for including domains in Pssm calculation
/// @param th E-value cutoff for domains [in]
void SetDomainInclusionThreshold(double th)
{ m_Opts->SetDomainInclusionThreshold(th); }
/// Get e-value threshold for including sequences in Pssm calculation
/// @return E-value cutoff for sequences
///
/// Same as GetInclusionThreshold().It was added for clear distinction
/// between Psi and Delta Blast inclusion thresholds
double GetPSIInclusionThreshold(void) const
{return GetInclusionThreshold(); }
/// Set e-value threshold for including sequences in Pssm calculation
/// @param th E-value cutoff for sequences [in]
///
/// Same as SetInclusionThreshold().It was added for clear distinction
/// between Psi and Delta Blast inclusion thresholds
void SetPSIInclusionThreshold(double th)
{ SetInclusionThreshold(th); }
protected:
/// Set the program and service name for remote blast
virtual void SetRemoteProgramAndService_Blast3()
{
m_Opts->SetRemoteProgramAndService_Blast3("blastp", "delta_blast");
}
/// Override the parent class' default for filtering query sequence (i.e.:
/// no filtering applied to the query by default)
virtual void SetQueryOptionDefaults();
/// Override the parent class' defaults for gapped extension (i.e.:
/// composition based statistics 1)
virtual void SetGappedExtensionDefaults();
/// Sets Delta Blast defaults
void SetDeltaBlastDefaults();
private:
/// Disallow copy constructor
CDeltaBlastOptionsHandle(const CDeltaBlastOptionsHandle& rhs);
/// Disallow assignment operator
CDeltaBlastOptionsHandle& operator=(const CDeltaBlastOptionsHandle& rhs);
};
END_SCOPE(blast)
END_NCBI_SCOPE
/* @} */
#endif /* ALGO_BLAST_API___DELTABLAST_OPTIONS__HPP */
| 35.647541 | 81 | 0.696022 | [
"object"
] |
468234bb68c83b3bf96a109d48642d323e335359 | 624 | cpp | C++ | 202011/12/_922_SortArrayByParity2.cpp | uaniheng/leetcode-cpp | d7b4c9ef43cca8ecb703da5a910d79af61eb3394 | [
"Apache-2.0"
] | null | null | null | 202011/12/_922_SortArrayByParity2.cpp | uaniheng/leetcode-cpp | d7b4c9ef43cca8ecb703da5a910d79af61eb3394 | [
"Apache-2.0"
] | null | null | null | 202011/12/_922_SortArrayByParity2.cpp | uaniheng/leetcode-cpp | d7b4c9ef43cca8ecb703da5a910d79af61eb3394 | [
"Apache-2.0"
] | null | null | null | //
// Created by gyc on 2020/11/12.
//
#include "../../common.h"
class Solution {
public:
vector<int> sortArrayByParityII(vector<int> &A) {
// [4,2,5,7]
for(int i = 0, j = 1; i < A.size(); i += 2) {
if (A[i] % 2) {
while (A[j] % 2) {
j += 2;
}
int temp = A[i];
A[i] = A[j];
A[j] = temp;
}
}
return A;
}
};
int main() {
vector<int> v{4,2,5,7};
auto res = Solution().sortArrayByParityII(v);
for(auto i: res) {
cout << i << endl;
}
} | 18.352941 | 53 | 0.371795 | [
"vector"
] |
468e7cb492e661d074825c44d55bdecbcd3ec2c2 | 2,170 | cc | C++ | quickbi-public/src/model/QueryEmbeddedInfoResult.cc | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-02-02T03:54:39.000Z | 2021-12-13T01:32:55.000Z | quickbi-public/src/model/QueryEmbeddedInfoResult.cc | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 89 | 2018-03-14T07:44:54.000Z | 2021-11-26T07:43:25.000Z | quickbi-public/src/model/QueryEmbeddedInfoResult.cc | aliyun/aliyun-openapi-cpp-sdk | 0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36 | [
"Apache-2.0"
] | 69 | 2018-01-22T09:45:52.000Z | 2022-03-28T07:58:38.000Z | /*
* Copyright 2009-2017 Alibaba Cloud 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 <alibabacloud/quickbi-public/model/QueryEmbeddedInfoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Quickbi_public;
using namespace AlibabaCloud::Quickbi_public::Model;
QueryEmbeddedInfoResult::QueryEmbeddedInfoResult() :
ServiceResult()
{}
QueryEmbeddedInfoResult::QueryEmbeddedInfoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryEmbeddedInfoResult::~QueryEmbeddedInfoResult()
{}
void QueryEmbeddedInfoResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto resultNode = value["Result"];
if(!resultNode["MaxCount"].isNull())
result_.maxCount = std::stoi(resultNode["MaxCount"].asString());
if(!resultNode["EmbeddedCount"].isNull())
result_.embeddedCount = std::stoi(resultNode["EmbeddedCount"].asString());
auto detailNode = resultNode["Detail"];
if(!detailNode["Report"].isNull())
result_.detail.report = std::stoi(detailNode["Report"].asString());
if(!detailNode["Page"].isNull())
result_.detail.page = std::stoi(detailNode["Page"].asString());
if(!detailNode["DashboardOfflineQuery"].isNull())
result_.detail.dashboardOfflineQuery = std::stoi(detailNode["DashboardOfflineQuery"].asString());
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
}
bool QueryEmbeddedInfoResult::getSuccess()const
{
return success_;
}
QueryEmbeddedInfoResult::Result QueryEmbeddedInfoResult::getResult()const
{
return result_;
}
| 31.449275 | 99 | 0.74977 | [
"model"
] |
46aa856ca6ad9601c4cc1d7fa5f0e7cd005afa53 | 1,845 | hpp | C++ | inc/dcs/testbed/base_system_manager.hpp | sguazt/dcsxx-testbed | e7210f0c7f54256d5bf0c90297e0c4f9eaf82da0 | [
"Apache-2.0"
] | null | null | null | inc/dcs/testbed/base_system_manager.hpp | sguazt/dcsxx-testbed | e7210f0c7f54256d5bf0c90297e0c4f9eaf82da0 | [
"Apache-2.0"
] | null | null | null | inc/dcs/testbed/base_system_manager.hpp | sguazt/dcsxx-testbed | e7210f0c7f54256d5bf0c90297e0c4f9eaf82da0 | [
"Apache-2.0"
] | null | null | null | /**
* \file dcs/testbed/base_system_manager.hpp
*
* \brief Base class for system managers.
*
* \author Marco Guazzone (marco.guazzone@gmail.com)
*
* <hr/>
*
* Copyright 2012 Marco Guazzone (marco.guazzone@gmail.com)
*
* 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.
*/
#ifndef DCS_TESTBED_BASE_SYSTEM_MANAGER_HPP
#define DCS_TESTBED_BASE_SYSTEM_MANAGER_HPP
#include <boost/shared_ptr.hpp>
#include <dcs/testbed/base_virtual_machine.hpp>
#include <vector>
namespace dcs { namespace testbed {
/**
* \brief Base class for system managers.
*
* \tparam TraitsT Traits type.
*
* \author Marco Guazzone (marco.guazzone@gmail.com)
*/
template <typename TraitsT>
class base_system_manager
{
public: typedef TraitsT traits_type;
protected: typedef base_virtual_machine<traits_type> vm_type;
protected: typedef ::boost::shared_ptr<vm_type> vm_pointer;
protected: base_system_manager()
{
// Empty
}
public: virtual ~base_system_manager()
{
// Empty
}
/// Manages the given VMs
public: template <typename IterT>
void manage(IterT first, IterT last)
{
::std::vector<vm_pointer> vms(first, last);
this->do_manage(vms);
}
private: virtual void do_manage(::std::vector<vm_pointer> const& vms) = 0;
}; // base_system_manager
}} // Namespace dcs::testbed
#endif // DCS_TESTBED_BASE_SYSTEM_MANAGER_HPP
| 24.276316 | 75 | 0.736043 | [
"vector"
] |
9e4de2ad8c37f7d3726a2ab50bfaa374845d686e | 565,705 | cpp | C++ | GCG_Source.build/module.django.utils.regex_helper.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | GCG_Source.build/module.django.utils.regex_helper.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | GCG_Source.build/module.django.utils.regex_helper.cpp | Pckool/GCG | cee786d04ea30f3995e910bca82635f442b2a6a8 | [
"MIT"
] | null | null | null | /* Generated code for Python source for module 'django.utils.regex_helper'
* created by Nuitka version 0.5.28.2
*
* This code is in part copyright 2017 Kay Hayen.
*
* 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 "nuitka/prelude.h"
#include "__helpers.h"
/* The _module_django$utils$regex_helper is a Python object pointer of module type. */
/* Note: For full compatibility with CPython, every module variable access
* needs to go through it except for cases where the module cannot possibly
* have changed in the mean time.
*/
PyObject *module_django$utils$regex_helper;
PyDictObject *moduledict_django$utils$regex_helper;
/* The module constants used, if any. */
extern PyObject *const_str_plain_warn;
static PyObject *const_str_digest_8775c6ae130d9f57dfa9e69322ef25fb;
extern PyObject *const_str_plain_inner;
extern PyObject *const_str_plain_result;
extern PyObject *const_str_plain_metaclass;
extern PyObject *const_str_plain___spec__;
static PyObject *const_str_plain_next_char;
extern PyObject *const_str_plain_piece;
extern PyObject *const_str_chr_43;
extern PyObject *const_str_chr_60;
extern PyObject *const_str_plain_zip;
extern PyObject *const_dict_empty;
extern PyObject *const_str_plain_i;
extern PyObject *const_str_plain___file__;
extern PyObject *const_str_plain_contains;
extern PyObject *const_str_plain_elt;
extern PyObject *const_str_plain_args;
static PyObject *const_str_plain_i_args;
static PyObject *const_str_plain_result_args;
extern PyObject *const_int_neg_1;
extern PyObject *const_tuple_str_chr_44_tuple;
static PyObject *const_str_digest_c11027ebc10328edd138147ca6c3ab0c;
extern PyObject *const_str_plain_param;
static PyObject *const_str_digest_96725db95255737aede2ef71506ea5dc;
extern PyObject *const_str_chr_36;
extern PyObject *const_str_chr_61;
static PyObject *const_str_plain_get_quantifier;
static PyObject *const_str_plain_ch2;
static PyObject *const_str_plain_num_args;
extern PyObject *const_str_plain_join;
extern PyObject *const_str_plain_start;
extern PyObject *const_str_chr_63;
static PyObject *const_tuple_str_chr_60_str_chr_61_tuple;
extern PyObject *const_str_plain_pos;
extern PyObject *const_str_plain___doc__;
extern PyObject *const_str_dot;
static PyObject *const_tuple_690b4cc15b4673579575726d212053d8_tuple;
extern PyObject *const_str_plain_extend;
extern PyObject *const_str_chr_62;
extern PyObject *const_str_plain_res;
static PyObject *const_str_digest_5b09b80325ee0dd36701426ec342c9bd;
extern PyObject *const_str_plain___package__;
extern PyObject *const_str_chr_41;
static PyObject *const_str_digest_47ede3e9e40e72a92a9b251ac59f4561;
static PyObject *const_str_digest_34d3fc0379cf220a09fdb62a2f778f4a;
extern PyObject *const_str_plain_warnings;
static PyObject *const_str_digest_c69f2b067cdf07201bc3975c96201d5b;
static PyObject *const_str_digest_644fec29c44d261ee7e2a542cb88bf54;
extern PyObject *const_tuple_list_empty_list_empty_tuple;
extern PyObject *const_str_chr_44;
extern PyObject *const_str_plain___qualname__;
static PyObject *const_str_plain_Group;
static PyObject *const_str_digest_c7add12e81e11b6579532211d8018bf7;
static PyObject *const_str_digest_399fdd57f20fe67e84d491ef4faca851;
extern PyObject *const_str_plain_item;
extern PyObject *const_str_plain_string_types;
extern PyObject *const_str_plain_six;
static PyObject *const_str_plain_Choice;
static PyObject *const_str_digest_0bee88bea05a6d16838bce17fe2050b5;
extern PyObject *const_str_plain_pattern;
extern PyObject *const_str_chr_91;
extern PyObject *const_tuple_str_dot_tuple;
extern PyObject *const_str_digest_f3705ed203bc8405b0735fb4179b32a8;
extern PyObject *const_tuple_empty;
static PyObject *const_str_plain_representative;
extern PyObject *const_str_digest_467c9722f19d9d40d148689532cdc0b1;
extern PyObject *const_str_plain_RemovedInDjango21Warning;
extern PyObject *const_str_plain_append;
static PyObject *const_str_plain_inner_args;
extern PyObject *const_str_plain_escaped;
extern PyObject *const_str_plain___loader__;
extern PyObject *const_str_chr_125;
static PyObject *const_str_digest_d133d79f8748aeb03e369bb8d2d4ca37;
extern PyObject *const_str_plain_name;
static PyObject *const_str_plain_input_iter;
extern PyObject *const_str_plain_P;
extern PyObject *const_str_chr_92;
extern PyObject *const_tuple_str_empty_list_empty_tuple;
static PyObject *const_str_digest_b71502c89ee784d5a03569ff0d277a2c;
static PyObject *const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple;
static PyObject *const_str_digest_d2b1e71f80ff0eb6146579dadccb1242;
extern PyObject *const_str_plain_split;
static PyObject *const_str_plain_pattern_iter;
extern PyObject *const_str_plain_ModuleSpec;
static PyObject *const_str_plain_new_args;
static PyObject *const_str_plain_walk_to_end;
extern PyObject *const_tuple_type_list_tuple;
static PyObject *const_str_digest_0cc74035e3304fdafd801e7471c953bb;
static PyObject *const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple;
static PyObject *const_str_digest_4ab076c21dc625da225cadcb02dfcdcd;
extern PyObject *const_str_plain_count;
extern PyObject *const_str_plain_pop;
extern PyObject *const_int_0;
static PyObject *const_str_plain_new_result;
static PyObject *const_str_plain_ESCAPE_MAPPINGS;
static PyObject *const_str_plain_NonCapture;
static PyObject *const_str_digest_825a1a2d5c880398bce5ad8725f5f619;
static PyObject *const_list_tuple_str_empty_list_empty_tuple_list;
static PyObject *const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple;
extern PyObject *const_list_str_empty_list;
extern PyObject *const_str_chr_58;
static PyObject *const_dict_83f7070578e4aca9ff6c13b95a921246;
static PyObject *const_list_list_empty_list;
extern PyObject *const_str_chr_40;
static PyObject *const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple;
extern PyObject *const_str_plain_normalize;
extern PyObject *const_str_chr_93;
static PyObject *const_tuple_list_str_empty_list_list_list_empty_list_tuple;
extern PyObject *const_str_plain___cached__;
extern PyObject *const_str_chr_124;
static PyObject *const_str_digest_71d281045ab49b6004d8c8a2f9bdfcd5;
static PyObject *const_str_plain_non_capturing_groups;
extern PyObject *const_str_plain___module__;
extern PyObject *const_str_plain_source;
extern PyObject *const_str_plain_unicode_literals;
extern PyObject *const_str_plain_params;
extern PyObject *const_slice_none_int_neg_1_none;
extern PyObject *const_int_pos_1;
extern PyObject *const_str_plain_values;
extern PyObject *const_str_plain_last;
static PyObject *const_str_plain_nesting;
static PyObject *const_str_plain_inner_result;
extern PyObject *const_str_plain___prepare__;
extern PyObject *const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955;
static PyObject *const_tuple_f2358bed1bf0ce46167769523c27405b_tuple;
extern PyObject *const_str_plain_inst;
extern PyObject *const_slice_none_none_none;
extern PyObject *const_tuple_str_plain_RemovedInDjango21Warning_tuple;
extern PyObject *const_tuple_str_plain_six_tuple;
extern PyObject *const_str_chr_94;
static PyObject *const_str_digest_f74ac0a4b057cc0e7e74828e5c76763f;
extern PyObject *const_list_empty;
static PyObject *const_str_plain_consume_next;
extern PyObject *const_str_plain_get;
extern PyObject *const_str_plain_ch;
static PyObject *const_str_plain_terminal_char;
extern PyObject *const_str_plain_quant;
static PyObject *const_str_plain_i_item;
extern PyObject *const_tuple_str_plain_zip_tuple;
extern PyObject *const_str_empty;
extern PyObject *const_str_digest_34af11cfb02a76cc23098f7dbc1d08c8;
extern PyObject *const_str_digest_6fed4619fa8d4c69fdb5c74f190acfee;
static PyObject *const_str_digest_a3517a037e3b11b7706c9f5a5b4bf823;
static PyObject *const_str_plain_flatten_result;
static PyObject *const_str_digest_84851487bbd5b8a25f43ba060167b190;
static PyObject *module_filename_obj;
static bool constants_created = false;
static void createModuleConstants( void )
{
const_str_digest_8775c6ae130d9f57dfa9e69322ef25fb = UNSTREAM_STRING( &constant_bin[ 1195500 ], 34, 0 );
const_str_plain_next_char = UNSTREAM_STRING( &constant_bin[ 1195534 ], 9, 1 );
const_str_plain_i_args = UNSTREAM_STRING( &constant_bin[ 1195543 ], 6, 1 );
const_str_plain_result_args = UNSTREAM_STRING( &constant_bin[ 1195549 ], 11, 1 );
const_str_digest_c11027ebc10328edd138147ca6c3ab0c = UNSTREAM_STRING( &constant_bin[ 1195560 ], 213, 0 );
const_str_digest_96725db95255737aede2ef71506ea5dc = UNSTREAM_STRING( &constant_bin[ 1195773 ], 39, 0 );
const_str_plain_get_quantifier = UNSTREAM_STRING( &constant_bin[ 1195812 ], 14, 1 );
const_str_plain_ch2 = UNSTREAM_STRING( &constant_bin[ 1195826 ], 3, 1 );
const_str_plain_num_args = UNSTREAM_STRING( &constant_bin[ 1195829 ], 8, 1 );
const_tuple_str_chr_60_str_chr_61_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_str_chr_60_str_chr_61_tuple, 0, const_str_chr_60 ); Py_INCREF( const_str_chr_60 );
PyTuple_SET_ITEM( const_tuple_str_chr_60_str_chr_61_tuple, 1, const_str_chr_61 ); Py_INCREF( const_str_chr_61 );
const_tuple_690b4cc15b4673579575726d212053d8_tuple = PyTuple_New( 19 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 0, const_str_plain_source ); Py_INCREF( const_str_plain_source );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 1, const_str_plain_params ); Py_INCREF( const_str_plain_params );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 2, const_str_plain_result ); Py_INCREF( const_str_plain_result );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 3, const_str_plain_result_args ); Py_INCREF( const_str_plain_result_args );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 4, const_str_plain_pos ); Py_INCREF( const_str_plain_pos );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 5, const_str_plain_last ); Py_INCREF( const_str_plain_last );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 6, const_str_plain_elt ); Py_INCREF( const_str_plain_elt );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 7, const_str_plain_piece ); Py_INCREF( const_str_plain_piece );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 8, const_str_plain_param ); Py_INCREF( const_str_plain_param );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 9, const_str_plain_i ); Py_INCREF( const_str_plain_i );
const_str_plain_inner_result = UNSTREAM_STRING( &constant_bin[ 1195837 ], 12, 1 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 10, const_str_plain_inner_result ); Py_INCREF( const_str_plain_inner_result );
const_str_plain_inner_args = UNSTREAM_STRING( &constant_bin[ 1195849 ], 10, 1 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 11, const_str_plain_inner_args ); Py_INCREF( const_str_plain_inner_args );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 12, const_str_plain_item ); Py_INCREF( const_str_plain_item );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 13, const_str_plain_res ); Py_INCREF( const_str_plain_res );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 14, const_str_plain_args ); Py_INCREF( const_str_plain_args );
const_str_plain_new_result = UNSTREAM_STRING( &constant_bin[ 1195859 ], 10, 1 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 15, const_str_plain_new_result ); Py_INCREF( const_str_plain_new_result );
const_str_plain_new_args = UNSTREAM_STRING( &constant_bin[ 1195869 ], 8, 1 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 16, const_str_plain_new_args ); Py_INCREF( const_str_plain_new_args );
const_str_plain_i_item = UNSTREAM_STRING( &constant_bin[ 1195877 ], 6, 1 );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 17, const_str_plain_i_item ); Py_INCREF( const_str_plain_i_item );
PyTuple_SET_ITEM( const_tuple_690b4cc15b4673579575726d212053d8_tuple, 18, const_str_plain_i_args ); Py_INCREF( const_str_plain_i_args );
const_str_digest_5b09b80325ee0dd36701426ec342c9bd = UNSTREAM_STRING( &constant_bin[ 1195883 ], 3, 0 );
const_str_digest_47ede3e9e40e72a92a9b251ac59f4561 = UNSTREAM_STRING( &constant_bin[ 1195886 ], 44, 0 );
const_str_digest_34d3fc0379cf220a09fdb62a2f778f4a = UNSTREAM_STRING( &constant_bin[ 1195930 ], 28, 0 );
const_str_digest_c69f2b067cdf07201bc3975c96201d5b = UNSTREAM_STRING( &constant_bin[ 1195958 ], 295, 0 );
const_str_digest_644fec29c44d261ee7e2a542cb88bf54 = UNSTREAM_STRING( &constant_bin[ 1196253 ], 38, 0 );
const_str_plain_Group = UNSTREAM_STRING( &constant_bin[ 103853 ], 5, 1 );
const_str_digest_c7add12e81e11b6579532211d8018bf7 = UNSTREAM_STRING( &constant_bin[ 1196291 ], 6, 0 );
const_str_digest_399fdd57f20fe67e84d491ef4faca851 = UNSTREAM_STRING( &constant_bin[ 1196297 ], 1015, 0 );
const_str_plain_Choice = UNSTREAM_STRING( &constant_bin[ 1009813 ], 6, 1 );
const_str_digest_0bee88bea05a6d16838bce17fe2050b5 = UNSTREAM_STRING( &constant_bin[ 1197312 ], 3, 0 );
const_str_plain_representative = UNSTREAM_STRING( &constant_bin[ 1197315 ], 14, 1 );
const_str_digest_d133d79f8748aeb03e369bb8d2d4ca37 = UNSTREAM_STRING( &constant_bin[ 1197329 ], 68, 0 );
const_str_plain_input_iter = UNSTREAM_STRING( &constant_bin[ 1196181 ], 10, 1 );
const_str_digest_b71502c89ee784d5a03569ff0d277a2c = UNSTREAM_STRING( &constant_bin[ 1197397 ], 273, 0 );
const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple = PyTuple_New( 6 );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 0, const_str_plain_ch ); Py_INCREF( const_str_plain_ch );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 1, const_str_plain_input_iter ); Py_INCREF( const_str_plain_input_iter );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 2, const_str_plain_ch2 ); Py_INCREF( const_str_plain_ch2 );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 3, const_str_plain_escaped ); Py_INCREF( const_str_plain_escaped );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 4, const_str_plain_quant ); Py_INCREF( const_str_plain_quant );
PyTuple_SET_ITEM( const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 5, const_str_plain_values ); Py_INCREF( const_str_plain_values );
const_str_digest_d2b1e71f80ff0eb6146579dadccb1242 = UNSTREAM_STRING( &constant_bin[ 1197670 ], 3, 0 );
const_str_plain_pattern_iter = UNSTREAM_STRING( &constant_bin[ 1197673 ], 12, 1 );
const_str_plain_walk_to_end = UNSTREAM_STRING( &constant_bin[ 1197685 ], 11, 1 );
const_str_digest_0cc74035e3304fdafd801e7471c953bb = UNSTREAM_STRING( &constant_bin[ 1197696 ], 4, 0 );
const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple, 0, const_str_plain_source ); Py_INCREF( const_str_plain_source );
PyTuple_SET_ITEM( const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple, 1, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
PyTuple_SET_ITEM( const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple, 2, const_str_plain_elt ); Py_INCREF( const_str_plain_elt );
const_str_digest_4ab076c21dc625da225cadcb02dfcdcd = UNSTREAM_STRING( &constant_bin[ 1197700 ], 426, 0 );
const_str_plain_ESCAPE_MAPPINGS = UNSTREAM_STRING( &constant_bin[ 1198126 ], 15, 1 );
const_str_plain_NonCapture = UNSTREAM_STRING( &constant_bin[ 1198141 ], 10, 1 );
const_str_digest_825a1a2d5c880398bce5ad8725f5f619 = UNSTREAM_STRING( &constant_bin[ 1198151 ], 189, 0 );
const_list_tuple_str_empty_list_empty_tuple_list = PyList_New( 1 );
PyList_SET_ITEM( const_list_tuple_str_empty_list_empty_tuple_list, 0, const_tuple_str_empty_list_empty_tuple ); Py_INCREF( const_tuple_str_empty_list_empty_tuple );
const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple = PyTuple_New( 3 );
PyTuple_SET_ITEM( const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple, 0, const_str_plain_input_iter ); Py_INCREF( const_str_plain_input_iter );
PyTuple_SET_ITEM( const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple, 1, const_str_plain_ch ); Py_INCREF( const_str_plain_ch );
PyTuple_SET_ITEM( const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple, 2, const_str_plain_representative ); Py_INCREF( const_str_plain_representative );
const_dict_83f7070578e4aca9ff6c13b95a921246 = PyMarshal_ReadObjectFromString( (char *)&constant_bin[ 1198340 ], 58 );
const_list_list_empty_list = PyList_New( 1 );
PyList_SET_ITEM( const_list_list_empty_list, 0, const_list_empty ); Py_INCREF( const_list_empty );
const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple = PyTuple_New( 14 );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 0, const_str_plain_pattern ); Py_INCREF( const_str_plain_pattern );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 1, const_str_plain_result ); Py_INCREF( const_str_plain_result );
const_str_plain_non_capturing_groups = UNSTREAM_STRING( &constant_bin[ 1198398 ], 20, 1 );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 2, const_str_plain_non_capturing_groups ); Py_INCREF( const_str_plain_non_capturing_groups );
const_str_plain_consume_next = UNSTREAM_STRING( &constant_bin[ 1198418 ], 12, 1 );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 3, const_str_plain_consume_next ); Py_INCREF( const_str_plain_consume_next );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 4, const_str_plain_pattern_iter ); Py_INCREF( const_str_plain_pattern_iter );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 5, const_str_plain_num_args ); Py_INCREF( const_str_plain_num_args );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 6, const_str_plain_ch ); Py_INCREF( const_str_plain_ch );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 7, const_str_plain_escaped ); Py_INCREF( const_str_plain_escaped );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 8, const_str_plain_start ); Py_INCREF( const_str_plain_start );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 9, const_str_plain_inner ); Py_INCREF( const_str_plain_inner );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 10, const_str_plain_name ); Py_INCREF( const_str_plain_name );
const_str_plain_terminal_char = UNSTREAM_STRING( &constant_bin[ 1198430 ], 13, 1 );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 11, const_str_plain_terminal_char ); Py_INCREF( const_str_plain_terminal_char );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 12, const_str_plain_param ); Py_INCREF( const_str_plain_param );
PyTuple_SET_ITEM( const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 13, const_str_plain_count ); Py_INCREF( const_str_plain_count );
const_tuple_list_str_empty_list_list_list_empty_list_tuple = PyTuple_New( 2 );
PyTuple_SET_ITEM( const_tuple_list_str_empty_list_list_list_empty_list_tuple, 0, const_list_str_empty_list ); Py_INCREF( const_list_str_empty_list );
PyTuple_SET_ITEM( const_tuple_list_str_empty_list_list_list_empty_list_tuple, 1, const_list_list_empty_list ); Py_INCREF( const_list_list_empty_list );
const_str_digest_71d281045ab49b6004d8c8a2f9bdfcd5 = UNSTREAM_STRING( &constant_bin[ 1198443 ], 92, 0 );
const_str_plain_nesting = UNSTREAM_STRING( &constant_bin[ 735315 ], 7, 1 );
const_tuple_f2358bed1bf0ce46167769523c27405b_tuple = PyTuple_New( 4 );
PyTuple_SET_ITEM( const_tuple_f2358bed1bf0ce46167769523c27405b_tuple, 0, const_str_plain_ch ); Py_INCREF( const_str_plain_ch );
PyTuple_SET_ITEM( const_tuple_f2358bed1bf0ce46167769523c27405b_tuple, 1, const_str_plain_input_iter ); Py_INCREF( const_str_plain_input_iter );
PyTuple_SET_ITEM( const_tuple_f2358bed1bf0ce46167769523c27405b_tuple, 2, const_str_plain_nesting ); Py_INCREF( const_str_plain_nesting );
PyTuple_SET_ITEM( const_tuple_f2358bed1bf0ce46167769523c27405b_tuple, 3, const_str_plain_escaped ); Py_INCREF( const_str_plain_escaped );
const_str_digest_f74ac0a4b057cc0e7e74828e5c76763f = UNSTREAM_STRING( &constant_bin[ 1198535 ], 23, 0 );
const_str_digest_a3517a037e3b11b7706c9f5a5b4bf823 = UNSTREAM_STRING( &constant_bin[ 1198558 ], 182, 0 );
const_str_plain_flatten_result = UNSTREAM_STRING( &constant_bin[ 1198740 ], 14, 1 );
const_str_digest_84851487bbd5b8a25f43ba060167b190 = UNSTREAM_STRING( &constant_bin[ 1198754 ], 72, 0 );
constants_created = true;
}
#ifndef __NUITKA_NO_ASSERT__
void checkModuleConstants_django$utils$regex_helper( void )
{
// The module may not have been used at all.
if (constants_created == false) return;
}
#endif
// The module code objects.
static PyCodeObject *codeobj_c62028e7d60a3f369a063311f731c3e3;
static PyCodeObject *codeobj_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0;
static PyCodeObject *codeobj_b69da881308ae3bcb5e98ce16ab3a067;
static PyCodeObject *codeobj_1e148640a480b197863191e98c3d7616;
static PyCodeObject *codeobj_7cd0a752e57b56d66ee85502e645ad13;
static PyCodeObject *codeobj_02dd3cdeef3510cc872d2bde3cdfe4f3;
static PyCodeObject *codeobj_3064079d76426a0e23f26ffe15c6dc56;
static void createModuleCodeObjects(void)
{
module_filename_obj = MAKE_RELATIVE_PATH( const_str_digest_34d3fc0379cf220a09fdb62a2f778f4a );
codeobj_c62028e7d60a3f369a063311f731c3e3 = MAKE_CODEOBJ( module_filename_obj, const_str_digest_8775c6ae130d9f57dfa9e69322ef25fb, 1, const_tuple_empty, 0, 0, CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_contains, 291, const_tuple_str_plain_source_str_plain_inst_str_plain_elt_tuple, 2, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_b69da881308ae3bcb5e98ce16ab3a067 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_flatten_result, 305, const_tuple_690b4cc15b4673579575726d212053d8_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_1e148640a480b197863191e98c3d7616 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_get_quantifier, 254, const_tuple_9bd62078312f23d7aed6ba8722f2f8ad_tuple, 2, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_7cd0a752e57b56d66ee85502e645ad13 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_next_char, 212, const_tuple_str_plain_input_iter_str_plain_ch_str_plain_representative_tuple, 1, 0, CO_GENERATOR | CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_02dd3cdeef3510cc872d2bde3cdfe4f3 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_normalize, 53, const_tuple_58e799a1b33e0941f6471aa8621510aa_tuple, 1, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
codeobj_3064079d76426a0e23f26ffe15c6dc56 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_walk_to_end, 233, const_tuple_f2358bed1bf0ce46167769523c27405b_tuple, 2, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE | CO_FUTURE_UNICODE_LITERALS );
}
// The module function declarations.
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value );
#else
static void django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_context( struct Nuitka_GeneratorObject *generator );
#endif
NUITKA_CROSS_MODULE PyObject *impl___internal__$$$function_4_complex_call_helper_star_list( PyObject **python_pars );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_1_normalize( );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_2_next_char( );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_3_walk_to_end( );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_4_get_quantifier( );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_5_contains( );
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_6_flatten_result( );
// The module function definitions.
static PyObject *impl_django$utils$regex_helper$$$function_1_normalize( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_pattern = python_pars[ 0 ];
PyObject *var_result = NULL;
PyObject *var_non_capturing_groups = NULL;
PyObject *var_consume_next = NULL;
PyObject *var_pattern_iter = NULL;
PyObject *var_num_args = NULL;
PyObject *var_ch = NULL;
PyObject *var_escaped = NULL;
PyObject *var_start = NULL;
PyObject *var_inner = NULL;
PyObject *var_name = NULL;
PyObject *var_terminal_char = NULL;
PyObject *var_param = NULL;
PyObject *var_count = NULL;
PyObject *tmp_tuple_unpack_10__element_1 = NULL;
PyObject *tmp_tuple_unpack_10__element_2 = NULL;
PyObject *tmp_tuple_unpack_10__source_iter = NULL;
PyObject *tmp_tuple_unpack_11__element_1 = NULL;
PyObject *tmp_tuple_unpack_11__element_2 = NULL;
PyObject *tmp_tuple_unpack_11__source_iter = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *tmp_tuple_unpack_2__element_1 = NULL;
PyObject *tmp_tuple_unpack_2__element_2 = NULL;
PyObject *tmp_tuple_unpack_2__source_iter = NULL;
PyObject *tmp_tuple_unpack_3__element_1 = NULL;
PyObject *tmp_tuple_unpack_3__element_2 = NULL;
PyObject *tmp_tuple_unpack_3__source_iter = NULL;
PyObject *tmp_tuple_unpack_4__element_1 = NULL;
PyObject *tmp_tuple_unpack_4__element_2 = NULL;
PyObject *tmp_tuple_unpack_4__source_iter = NULL;
PyObject *tmp_tuple_unpack_5__element_1 = NULL;
PyObject *tmp_tuple_unpack_5__element_2 = NULL;
PyObject *tmp_tuple_unpack_5__source_iter = NULL;
PyObject *tmp_tuple_unpack_6__element_1 = NULL;
PyObject *tmp_tuple_unpack_6__element_2 = NULL;
PyObject *tmp_tuple_unpack_6__source_iter = NULL;
PyObject *tmp_tuple_unpack_7__element_1 = NULL;
PyObject *tmp_tuple_unpack_7__element_2 = NULL;
PyObject *tmp_tuple_unpack_7__source_iter = NULL;
PyObject *tmp_tuple_unpack_8__element_1 = NULL;
PyObject *tmp_tuple_unpack_8__element_2 = NULL;
PyObject *tmp_tuple_unpack_8__source_iter = NULL;
PyObject *tmp_tuple_unpack_9__element_1 = NULL;
PyObject *tmp_tuple_unpack_9__element_2 = NULL;
PyObject *tmp_tuple_unpack_9__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
PyObject *exception_keeper_type_8;
PyObject *exception_keeper_value_8;
PyTracebackObject *exception_keeper_tb_8;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_8;
PyObject *exception_keeper_type_9;
PyObject *exception_keeper_value_9;
PyTracebackObject *exception_keeper_tb_9;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_9;
PyObject *exception_keeper_type_10;
PyObject *exception_keeper_value_10;
PyTracebackObject *exception_keeper_tb_10;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_10;
PyObject *exception_keeper_type_11;
PyObject *exception_keeper_value_11;
PyTracebackObject *exception_keeper_tb_11;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_11;
PyObject *exception_keeper_type_12;
PyObject *exception_keeper_value_12;
PyTracebackObject *exception_keeper_tb_12;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_12;
PyObject *exception_keeper_type_13;
PyObject *exception_keeper_value_13;
PyTracebackObject *exception_keeper_tb_13;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_13;
PyObject *exception_keeper_type_14;
PyObject *exception_keeper_value_14;
PyTracebackObject *exception_keeper_tb_14;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_14;
PyObject *exception_keeper_type_15;
PyObject *exception_keeper_value_15;
PyTracebackObject *exception_keeper_tb_15;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_15;
PyObject *exception_keeper_type_16;
PyObject *exception_keeper_value_16;
PyTracebackObject *exception_keeper_tb_16;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_16;
PyObject *exception_keeper_type_17;
PyObject *exception_keeper_value_17;
PyTracebackObject *exception_keeper_tb_17;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_17;
PyObject *exception_keeper_type_18;
PyObject *exception_keeper_value_18;
PyTracebackObject *exception_keeper_tb_18;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_18;
PyObject *exception_keeper_type_19;
PyObject *exception_keeper_value_19;
PyTracebackObject *exception_keeper_tb_19;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_19;
PyObject *exception_keeper_type_20;
PyObject *exception_keeper_value_20;
PyTracebackObject *exception_keeper_tb_20;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_20;
PyObject *exception_keeper_type_21;
PyObject *exception_keeper_value_21;
PyTracebackObject *exception_keeper_tb_21;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_21;
PyObject *exception_keeper_type_22;
PyObject *exception_keeper_value_22;
PyTracebackObject *exception_keeper_tb_22;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_22;
PyObject *exception_keeper_type_23;
PyObject *exception_keeper_value_23;
PyTracebackObject *exception_keeper_tb_23;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_23;
PyObject *exception_keeper_type_24;
PyObject *exception_keeper_value_24;
PyTracebackObject *exception_keeper_tb_24;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_24;
PyObject *exception_keeper_type_25;
PyObject *exception_keeper_value_25;
PyTracebackObject *exception_keeper_tb_25;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_25;
PyObject *exception_keeper_type_26;
PyObject *exception_keeper_value_26;
PyTracebackObject *exception_keeper_tb_26;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_26;
PyObject *exception_keeper_type_27;
PyObject *exception_keeper_value_27;
PyTracebackObject *exception_keeper_tb_27;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_27;
PyObject *exception_preserved_type_1;
PyObject *exception_preserved_value_1;
PyTracebackObject *exception_preserved_tb_1;
PyObject *exception_preserved_type_2;
PyObject *exception_preserved_value_2;
PyTracebackObject *exception_preserved_tb_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_args_element_name_6;
PyObject *tmp_args_element_name_7;
PyObject *tmp_args_element_name_8;
PyObject *tmp_args_element_name_9;
PyObject *tmp_args_element_name_10;
PyObject *tmp_args_element_name_11;
PyObject *tmp_args_element_name_12;
PyObject *tmp_args_element_name_13;
PyObject *tmp_args_element_name_14;
PyObject *tmp_args_element_name_15;
PyObject *tmp_args_element_name_16;
PyObject *tmp_args_element_name_17;
PyObject *tmp_args_element_name_18;
PyObject *tmp_args_element_name_19;
PyObject *tmp_args_element_name_20;
PyObject *tmp_args_element_name_21;
PyObject *tmp_args_element_name_22;
PyObject *tmp_args_element_name_23;
PyObject *tmp_args_element_name_24;
PyObject *tmp_args_element_name_25;
PyObject *tmp_args_element_name_26;
PyObject *tmp_args_element_name_27;
PyObject *tmp_args_element_name_28;
PyObject *tmp_args_element_name_29;
PyObject *tmp_args_element_name_30;
PyObject *tmp_args_element_name_31;
PyObject *tmp_ass_subscribed_1;
PyObject *tmp_ass_subscript_1;
int tmp_ass_subscript_res_1;
PyObject *tmp_ass_subvalue_1;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
PyObject *tmp_assign_source_12;
PyObject *tmp_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_assign_source_26;
PyObject *tmp_assign_source_27;
PyObject *tmp_assign_source_28;
PyObject *tmp_assign_source_29;
PyObject *tmp_assign_source_30;
PyObject *tmp_assign_source_31;
PyObject *tmp_assign_source_32;
PyObject *tmp_assign_source_33;
PyObject *tmp_assign_source_34;
PyObject *tmp_assign_source_35;
PyObject *tmp_assign_source_36;
PyObject *tmp_assign_source_37;
PyObject *tmp_assign_source_38;
PyObject *tmp_assign_source_39;
PyObject *tmp_assign_source_40;
PyObject *tmp_assign_source_41;
PyObject *tmp_assign_source_42;
PyObject *tmp_assign_source_43;
PyObject *tmp_assign_source_44;
PyObject *tmp_assign_source_45;
PyObject *tmp_assign_source_46;
PyObject *tmp_assign_source_47;
PyObject *tmp_assign_source_48;
PyObject *tmp_assign_source_49;
PyObject *tmp_assign_source_50;
PyObject *tmp_assign_source_51;
PyObject *tmp_assign_source_52;
PyObject *tmp_assign_source_53;
PyObject *tmp_assign_source_54;
PyObject *tmp_assign_source_55;
PyObject *tmp_assign_source_56;
PyObject *tmp_assign_source_57;
PyObject *tmp_assign_source_58;
PyObject *tmp_assign_source_59;
PyObject *tmp_assign_source_60;
PyObject *tmp_assign_source_61;
PyObject *tmp_assign_source_62;
PyObject *tmp_assign_source_63;
PyObject *tmp_assign_source_64;
PyObject *tmp_assign_source_65;
PyObject *tmp_assign_source_66;
PyObject *tmp_assign_source_67;
PyObject *tmp_assign_source_68;
PyObject *tmp_assign_source_69;
PyObject *tmp_assign_source_70;
PyObject *tmp_assign_source_71;
PyObject *tmp_called_instance_1;
PyObject *tmp_called_instance_2;
PyObject *tmp_called_instance_3;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_called_name_6;
PyObject *tmp_called_name_7;
PyObject *tmp_called_name_8;
PyObject *tmp_called_name_9;
PyObject *tmp_called_name_10;
PyObject *tmp_called_name_11;
PyObject *tmp_called_name_12;
PyObject *tmp_called_name_13;
PyObject *tmp_called_name_14;
PyObject *tmp_called_name_15;
PyObject *tmp_called_name_16;
PyObject *tmp_called_name_17;
PyObject *tmp_called_name_18;
PyObject *tmp_called_name_19;
PyObject *tmp_called_name_20;
PyObject *tmp_called_name_21;
PyObject *tmp_called_name_22;
PyObject *tmp_called_name_23;
PyObject *tmp_called_name_24;
int tmp_cmp_Eq_1;
int tmp_cmp_Eq_2;
int tmp_cmp_Eq_3;
int tmp_cmp_Eq_4;
int tmp_cmp_Eq_5;
int tmp_cmp_Eq_6;
int tmp_cmp_Eq_7;
int tmp_cmp_Eq_8;
int tmp_cmp_Eq_9;
int tmp_cmp_Eq_10;
int tmp_cmp_Gt_1;
int tmp_cmp_In_1;
int tmp_cmp_In_2;
int tmp_cmp_In_3;
int tmp_cmp_NotEq_1;
int tmp_cmp_NotEq_2;
int tmp_cmp_NotEq_3;
int tmp_cmp_NotIn_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_left_4;
PyObject *tmp_compare_left_5;
PyObject *tmp_compare_left_6;
PyObject *tmp_compare_left_7;
PyObject *tmp_compare_left_8;
PyObject *tmp_compare_left_9;
PyObject *tmp_compare_left_10;
PyObject *tmp_compare_left_11;
PyObject *tmp_compare_left_12;
PyObject *tmp_compare_left_13;
PyObject *tmp_compare_left_14;
PyObject *tmp_compare_left_15;
PyObject *tmp_compare_left_16;
PyObject *tmp_compare_left_17;
PyObject *tmp_compare_left_18;
PyObject *tmp_compare_left_19;
PyObject *tmp_compare_left_20;
PyObject *tmp_compare_left_21;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
PyObject *tmp_compare_right_4;
PyObject *tmp_compare_right_5;
PyObject *tmp_compare_right_6;
PyObject *tmp_compare_right_7;
PyObject *tmp_compare_right_8;
PyObject *tmp_compare_right_9;
PyObject *tmp_compare_right_10;
PyObject *tmp_compare_right_11;
PyObject *tmp_compare_right_12;
PyObject *tmp_compare_right_13;
PyObject *tmp_compare_right_14;
PyObject *tmp_compare_right_15;
PyObject *tmp_compare_right_16;
PyObject *tmp_compare_right_17;
PyObject *tmp_compare_right_18;
PyObject *tmp_compare_right_19;
PyObject *tmp_compare_right_20;
PyObject *tmp_compare_right_21;
PyObject *tmp_compexpr_left_1;
PyObject *tmp_compexpr_left_2;
PyObject *tmp_compexpr_right_1;
PyObject *tmp_compexpr_right_2;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
int tmp_cond_truth_4;
int tmp_cond_truth_5;
int tmp_cond_truth_6;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_cond_value_4;
PyObject *tmp_cond_value_5;
PyObject *tmp_cond_value_6;
PyObject *tmp_dircall_arg1_1;
PyObject *tmp_dircall_arg2_1;
int tmp_exc_match_exception_match_1;
int tmp_exc_match_exception_match_2;
int tmp_exc_match_exception_match_3;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iter_arg_4;
PyObject *tmp_iter_arg_5;
PyObject *tmp_iter_arg_6;
PyObject *tmp_iter_arg_7;
PyObject *tmp_iter_arg_8;
PyObject *tmp_iter_arg_9;
PyObject *tmp_iter_arg_10;
PyObject *tmp_iter_arg_11;
PyObject *tmp_iter_arg_12;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_iterator_name_2;
PyObject *tmp_iterator_name_3;
PyObject *tmp_iterator_name_4;
PyObject *tmp_iterator_name_5;
PyObject *tmp_iterator_name_6;
PyObject *tmp_iterator_name_7;
PyObject *tmp_iterator_name_8;
PyObject *tmp_iterator_name_9;
PyObject *tmp_iterator_name_10;
PyObject *tmp_iterator_name_11;
PyObject *tmp_left_name_1;
PyObject *tmp_left_name_2;
PyObject *tmp_left_name_3;
PyObject *tmp_left_name_4;
PyObject *tmp_left_name_5;
PyObject *tmp_left_name_6;
PyObject *tmp_left_name_7;
PyObject *tmp_left_name_8;
PyObject *tmp_left_name_9;
PyObject *tmp_left_name_10;
PyObject *tmp_left_name_11;
PyObject *tmp_len_arg_1;
PyObject *tmp_list_arg_1;
PyObject *tmp_list_element_1;
PyObject *tmp_list_element_2;
PyObject *tmp_list_element_3;
PyObject *tmp_make_exception_arg_1;
PyObject *tmp_make_exception_arg_2;
PyObject *tmp_make_exception_arg_3;
int tmp_or_left_truth_1;
int tmp_or_left_truth_2;
PyObject *tmp_or_left_value_1;
PyObject *tmp_or_left_value_2;
PyObject *tmp_or_right_value_1;
PyObject *tmp_or_right_value_2;
PyObject *tmp_raise_type_1;
PyObject *tmp_raise_type_2;
PyObject *tmp_raise_type_3;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
PyObject *tmp_right_name_2;
PyObject *tmp_right_name_3;
PyObject *tmp_right_name_4;
PyObject *tmp_right_name_5;
PyObject *tmp_right_name_6;
PyObject *tmp_right_name_7;
PyObject *tmp_right_name_8;
PyObject *tmp_right_name_9;
PyObject *tmp_right_name_10;
PyObject *tmp_right_name_11;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
PyObject *tmp_source_name_5;
PyObject *tmp_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_source_name_9;
PyObject *tmp_source_name_10;
PyObject *tmp_source_name_11;
PyObject *tmp_start_name_1;
PyObject *tmp_start_name_2;
PyObject *tmp_step_name_1;
PyObject *tmp_step_name_2;
PyObject *tmp_stop_name_1;
PyObject *tmp_stop_name_2;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscribed_name_3;
PyObject *tmp_subscribed_name_4;
PyObject *tmp_subscribed_name_5;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_subscript_name_3;
PyObject *tmp_subscript_name_4;
PyObject *tmp_subscript_name_5;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
PyObject *tmp_unpack_3;
PyObject *tmp_unpack_4;
PyObject *tmp_unpack_5;
PyObject *tmp_unpack_6;
PyObject *tmp_unpack_7;
PyObject *tmp_unpack_8;
PyObject *tmp_unpack_9;
PyObject *tmp_unpack_10;
PyObject *tmp_unpack_11;
PyObject *tmp_unpack_12;
PyObject *tmp_unpack_13;
PyObject *tmp_unpack_14;
PyObject *tmp_unpack_15;
PyObject *tmp_unpack_16;
PyObject *tmp_unpack_17;
PyObject *tmp_unpack_18;
PyObject *tmp_unpack_19;
PyObject *tmp_unpack_20;
PyObject *tmp_unpack_21;
PyObject *tmp_unpack_22;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
PyObject *tmp_value_name_1;
PyObject *tmp_value_name_2;
PyObject *tmp_value_name_3;
PyObject *tmp_value_name_4;
PyObject *tmp_value_name_5;
PyObject *tmp_value_name_6;
PyObject *tmp_value_name_7;
PyObject *tmp_value_name_8;
PyObject *tmp_value_name_9;
PyObject *tmp_value_name_10;
static struct Nuitka_FrameObject *cache_frame_02dd3cdeef3510cc872d2bde3cdfe4f3 = NULL;
struct Nuitka_FrameObject *frame_02dd3cdeef3510cc872d2bde3cdfe4f3;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
tmp_assign_source_1 = PyList_New( 0 );
assert( var_result == NULL );
var_result = tmp_assign_source_1;
tmp_assign_source_2 = PyList_New( 0 );
assert( var_non_capturing_groups == NULL );
var_non_capturing_groups = tmp_assign_source_2;
tmp_assign_source_3 = Py_True;
assert( var_consume_next == NULL );
Py_INCREF( tmp_assign_source_3 );
var_consume_next = tmp_assign_source_3;
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_02dd3cdeef3510cc872d2bde3cdfe4f3, codeobj_02dd3cdeef3510cc872d2bde3cdfe4f3, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_02dd3cdeef3510cc872d2bde3cdfe4f3 = cache_frame_02dd3cdeef3510cc872d2bde3cdfe4f3;
// Push the new frame as the currently active one.
pushFrameStack( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 ) == 2 ); // Frame stack
// Framed code:
tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_next_char );
if (unlikely( tmp_called_name_1 == NULL ))
{
tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_next_char );
}
if ( tmp_called_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "next_char" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 79;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
tmp_iter_arg_1 = par_pattern;
CHECK_OBJECT( tmp_iter_arg_1 );
tmp_args_element_name_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_args_element_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 79;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 79;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_assign_source_4 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_args_element_name_1 );
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 79;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
assert( var_pattern_iter == NULL );
var_pattern_iter = tmp_assign_source_4;
tmp_assign_source_5 = const_int_0;
assert( var_num_args == NULL );
Py_INCREF( tmp_assign_source_5 );
var_num_args = tmp_assign_source_5;
// Tried code:
// Tried code:
tmp_value_name_1 = var_pattern_iter;
CHECK_OBJECT( tmp_value_name_1 );
tmp_iter_arg_2 = ITERATOR_NEXT( tmp_value_name_1 );
if ( tmp_iter_arg_2 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 86;
goto try_except_handler_3;
}
tmp_assign_source_6 = MAKE_ITERATOR( tmp_iter_arg_2 );
Py_DECREF( tmp_iter_arg_2 );
if ( tmp_assign_source_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 86;
type_description_1 = "oooooooooooooo";
goto try_except_handler_3;
}
assert( tmp_tuple_unpack_1__source_iter == NULL );
tmp_tuple_unpack_1__source_iter = tmp_assign_source_6;
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_7 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_7 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 86;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_1 == NULL );
tmp_tuple_unpack_1__element_1 = tmp_assign_source_7;
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_8 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_8 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 86;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_2 == NULL );
tmp_tuple_unpack_1__element_2 = tmp_assign_source_8;
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 86;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 86;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
goto try_end_3;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Preserve existing published exception.
exception_preserved_type_1 = PyThreadState_GET()->exc_type;
Py_XINCREF( exception_preserved_type_1 );
exception_preserved_value_1 = PyThreadState_GET()->exc_value;
Py_XINCREF( exception_preserved_value_1 );
exception_preserved_tb_1 = (PyTracebackObject *)PyThreadState_GET()->exc_traceback;
Py_XINCREF( exception_preserved_tb_1 );
if ( exception_keeper_tb_3 == NULL )
{
exception_keeper_tb_3 = MAKE_TRACEBACK( frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_keeper_lineno_3 );
}
else if ( exception_keeper_lineno_3 != 0 )
{
exception_keeper_tb_3 = ADD_TRACEBACK( exception_keeper_tb_3, frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_keeper_lineno_3 );
}
NORMALIZE_EXCEPTION( &exception_keeper_type_3, &exception_keeper_value_3, &exception_keeper_tb_3 );
PyException_SetTraceback( exception_keeper_value_3, (PyObject *)exception_keeper_tb_3 );
PUBLISH_EXCEPTION( &exception_keeper_type_3, &exception_keeper_value_3, &exception_keeper_tb_3 );
// Tried code:
tmp_compare_left_1 = PyThreadState_GET()->exc_type;
tmp_compare_right_1 = PyExc_StopIteration;
tmp_exc_match_exception_match_1 = EXCEPTION_MATCH_BOOL( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_exc_match_exception_match_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 87;
type_description_1 = "oooooooooooooo";
goto try_except_handler_5;
}
if ( tmp_exc_match_exception_match_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_return_value = DEEP_COPY( const_list_tuple_str_empty_list_empty_tuple_list );
goto try_return_handler_5;
goto branch_end_1;
branch_no_1:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 85;
}
if (exception_tb && exception_tb->tb_frame == &frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame) frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "oooooooooooooo";
goto try_except_handler_5;
branch_end_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_1_normalize );
return NULL;
// Return handler code:
try_return_handler_5:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto frame_exception_exit_1;
// End of try:
// End of try:
try_end_3:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_9 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_9 );
assert( var_ch == NULL );
Py_INCREF( tmp_assign_source_9 );
var_ch = tmp_assign_source_9;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_10 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_10 );
assert( var_escaped == NULL );
Py_INCREF( tmp_assign_source_10 );
var_escaped = tmp_assign_source_10;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Tried code:
loop_start_1:;
tmp_cond_value_1 = var_escaped;
if ( tmp_cond_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "escaped" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 92;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 92;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_source_name_1 = var_result;
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 93;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 93;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_2 = var_ch;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 93;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 93;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 93;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_2;
branch_no_2:;
tmp_compare_left_2 = var_ch;
if ( tmp_compare_left_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 94;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_2 = const_str_dot;
tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_2, tmp_compare_right_2 );
if ( tmp_cmp_Eq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 94;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_1 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_called_instance_1 = var_result;
if ( tmp_called_instance_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 96;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 96;
tmp_unused = CALL_METHOD_WITH_ARGS1( tmp_called_instance_1, const_str_plain_append, &PyTuple_GET_ITEM( const_tuple_str_dot_tuple, 0 ) );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 96;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_3;
branch_no_3:;
tmp_compare_left_3 = var_ch;
if ( tmp_compare_left_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 97;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_3 = const_str_chr_124;
tmp_cmp_Eq_2 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_3, tmp_compare_right_3 );
if ( tmp_cmp_Eq_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 97;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_2 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
tmp_make_exception_arg_1 = const_str_digest_f74ac0a4b057cc0e7e74828e5c76763f;
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 99;
{
PyObject *call_args[] = { tmp_make_exception_arg_1 };
tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( PyExc_NotImplementedError, call_args );
}
assert( tmp_raise_type_1 != NULL );
exception_type = tmp_raise_type_1;
exception_lineno = 99;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
goto branch_end_4;
branch_no_4:;
tmp_compare_left_4 = var_ch;
if ( tmp_compare_left_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 100;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_4 = const_str_chr_94;
tmp_cmp_Eq_3 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_4, tmp_compare_right_4 );
if ( tmp_cmp_Eq_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 100;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_3 == 1 )
{
goto branch_no_5;
}
else
{
goto branch_yes_5;
}
branch_yes_5:;
tmp_compare_left_5 = var_ch;
if ( tmp_compare_left_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 102;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_5 = const_str_chr_36;
tmp_cmp_Eq_4 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_5, tmp_compare_right_5 );
if ( tmp_cmp_Eq_4 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 102;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_4 == 1 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
goto loop_end_1;
goto branch_end_6;
branch_no_6:;
tmp_compare_left_6 = var_ch;
if ( tmp_compare_left_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 104;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_6 = const_str_chr_41;
tmp_cmp_Eq_5 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_6, tmp_compare_right_6 );
if ( tmp_cmp_Eq_5 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 104;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_5 == 1 )
{
goto branch_yes_7;
}
else
{
goto branch_no_7;
}
branch_yes_7:;
tmp_called_instance_2 = var_non_capturing_groups;
if ( tmp_called_instance_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "non_capturing_groups" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 111;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 111;
tmp_assign_source_11 = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_pop );
if ( tmp_assign_source_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 111;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_start;
var_start = tmp_assign_source_11;
Py_XDECREF( old );
}
tmp_called_name_3 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_NonCapture );
if (unlikely( tmp_called_name_3 == NULL ))
{
tmp_called_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_NonCapture );
}
if ( tmp_called_name_3 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "NonCapture" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 112;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_subscribed_name_1 = var_result;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 112;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_start_name_1 = var_start;
CHECK_OBJECT( tmp_start_name_1 );
tmp_stop_name_1 = Py_None;
tmp_step_name_1 = Py_None;
tmp_subscript_name_1 = MAKE_SLICEOBJ3( tmp_start_name_1, tmp_stop_name_1, tmp_step_name_1 );
assert( tmp_subscript_name_1 != NULL );
tmp_args_element_name_3 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
Py_DECREF( tmp_subscript_name_1 );
if ( tmp_args_element_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 112;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 112;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_assign_source_12 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_args_element_name_3 );
if ( tmp_assign_source_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 112;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_inner;
var_inner = tmp_assign_source_12;
Py_XDECREF( old );
}
tmp_subscribed_name_2 = var_result;
if ( tmp_subscribed_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 113;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_start_name_2 = Py_None;
tmp_stop_name_2 = var_start;
if ( tmp_stop_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "start" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 113;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_step_name_2 = Py_None;
tmp_subscript_name_2 = MAKE_SLICEOBJ3( tmp_start_name_2, tmp_stop_name_2, tmp_step_name_2 );
assert( tmp_subscript_name_2 != NULL );
tmp_left_name_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
Py_DECREF( tmp_subscript_name_2 );
if ( tmp_left_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 113;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_right_name_1 = PyList_New( 1 );
tmp_list_element_1 = var_inner;
if ( tmp_list_element_1 == NULL )
{
Py_DECREF( tmp_left_name_1 );
Py_DECREF( tmp_right_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inner" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 113;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_INCREF( tmp_list_element_1 );
PyList_SET_ITEM( tmp_right_name_1, 0, tmp_list_element_1 );
tmp_assign_source_13 = BINARY_OPERATION_ADD( tmp_left_name_1, tmp_right_name_1 );
Py_DECREF( tmp_left_name_1 );
Py_DECREF( tmp_right_name_1 );
if ( tmp_assign_source_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 113;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_result;
var_result = tmp_assign_source_13;
Py_XDECREF( old );
}
goto branch_end_7;
branch_no_7:;
tmp_compare_left_7 = var_ch;
if ( tmp_compare_left_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 114;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_7 = const_str_chr_91;
tmp_cmp_Eq_6 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_7, tmp_compare_right_7 );
if ( tmp_cmp_Eq_6 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 114;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_6 == 1 )
{
goto branch_yes_8;
}
else
{
goto branch_no_8;
}
branch_yes_8:;
// Tried code:
tmp_value_name_2 = var_pattern_iter;
if ( tmp_value_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 116;
type_description_1 = "oooooooooooooo";
goto try_except_handler_7;
}
tmp_iter_arg_3 = ITERATOR_NEXT( tmp_value_name_2 );
if ( tmp_iter_arg_3 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 116;
goto try_except_handler_7;
}
tmp_assign_source_14 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 116;
type_description_1 = "oooooooooooooo";
goto try_except_handler_7;
}
{
PyObject *old = tmp_tuple_unpack_2__source_iter;
tmp_tuple_unpack_2__source_iter = tmp_assign_source_14;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_3 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_3 );
tmp_assign_source_15 = UNPACK_NEXT( tmp_unpack_3, 0, 2 );
if ( tmp_assign_source_15 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 116;
goto try_except_handler_8;
}
{
PyObject *old = tmp_tuple_unpack_2__element_1;
tmp_tuple_unpack_2__element_1 = tmp_assign_source_15;
Py_XDECREF( old );
}
tmp_unpack_4 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_4 );
tmp_assign_source_16 = UNPACK_NEXT( tmp_unpack_4, 1, 2 );
if ( tmp_assign_source_16 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 116;
goto try_except_handler_8;
}
{
PyObject *old = tmp_tuple_unpack_2__element_2;
tmp_tuple_unpack_2__element_2 = tmp_assign_source_16;
Py_XDECREF( old );
}
tmp_iterator_name_2 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_iterator_name_2 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_2 ); assert( HAS_ITERNEXT( tmp_iterator_name_2 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_2 )->tp_iternext)( tmp_iterator_name_2 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 116;
goto try_except_handler_8;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 116;
goto try_except_handler_8;
}
goto try_end_4;
// Exception handler code:
try_except_handler_8:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto try_except_handler_7;
// End of try:
try_end_4:;
goto try_end_5;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto try_except_handler_6;
// End of try:
try_end_5:;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
tmp_assign_source_17 = tmp_tuple_unpack_2__element_1;
CHECK_OBJECT( tmp_assign_source_17 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_17;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
tmp_assign_source_18 = tmp_tuple_unpack_2__element_2;
CHECK_OBJECT( tmp_assign_source_18 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_18;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
tmp_source_name_2 = var_result;
if ( tmp_source_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 117;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_append );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 117;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_4 = var_ch;
if ( tmp_args_element_name_4 == NULL )
{
Py_DECREF( tmp_called_name_4 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 117;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 117;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
Py_DECREF( tmp_called_name_4 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 117;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
// Tried code:
tmp_value_name_3 = var_pattern_iter;
if ( tmp_value_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 118;
type_description_1 = "oooooooooooooo";
goto try_except_handler_9;
}
tmp_iter_arg_4 = ITERATOR_NEXT( tmp_value_name_3 );
if ( tmp_iter_arg_4 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 118;
goto try_except_handler_9;
}
tmp_assign_source_19 = MAKE_ITERATOR( tmp_iter_arg_4 );
Py_DECREF( tmp_iter_arg_4 );
if ( tmp_assign_source_19 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 118;
type_description_1 = "oooooooooooooo";
goto try_except_handler_9;
}
{
PyObject *old = tmp_tuple_unpack_3__source_iter;
tmp_tuple_unpack_3__source_iter = tmp_assign_source_19;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_5 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_5 );
tmp_assign_source_20 = UNPACK_NEXT( tmp_unpack_5, 0, 2 );
if ( tmp_assign_source_20 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 118;
goto try_except_handler_10;
}
{
PyObject *old = tmp_tuple_unpack_3__element_1;
tmp_tuple_unpack_3__element_1 = tmp_assign_source_20;
Py_XDECREF( old );
}
tmp_unpack_6 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_6 );
tmp_assign_source_21 = UNPACK_NEXT( tmp_unpack_6, 1, 2 );
if ( tmp_assign_source_21 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 118;
goto try_except_handler_10;
}
{
PyObject *old = tmp_tuple_unpack_3__element_2;
tmp_tuple_unpack_3__element_2 = tmp_assign_source_21;
Py_XDECREF( old );
}
tmp_iterator_name_3 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_iterator_name_3 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_3 ); assert( HAS_ITERNEXT( tmp_iterator_name_3 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_3 )->tp_iternext)( tmp_iterator_name_3 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 118;
goto try_except_handler_10;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 118;
goto try_except_handler_10;
}
goto try_end_6;
// Exception handler code:
try_except_handler_10:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto try_except_handler_9;
// End of try:
try_end_6:;
goto try_end_7;
// Exception handler code:
try_except_handler_9:;
exception_keeper_type_8 = exception_type;
exception_keeper_value_8 = exception_value;
exception_keeper_tb_8 = exception_tb;
exception_keeper_lineno_8 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_8;
exception_value = exception_keeper_value_8;
exception_tb = exception_keeper_tb_8;
exception_lineno = exception_keeper_lineno_8;
goto try_except_handler_6;
// End of try:
try_end_7:;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
tmp_assign_source_22 = tmp_tuple_unpack_3__element_1;
CHECK_OBJECT( tmp_assign_source_22 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_22;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
tmp_assign_source_23 = tmp_tuple_unpack_3__element_2;
CHECK_OBJECT( tmp_assign_source_23 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_23;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
loop_start_2:;
tmp_or_left_value_1 = var_escaped;
if ( tmp_or_left_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "escaped" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_or_left_truth_1 = CHECK_IF_TRUE( tmp_or_left_value_1 );
if ( tmp_or_left_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_or_left_truth_1 == 1 )
{
goto or_left_1;
}
else
{
goto or_right_1;
}
or_right_1:;
tmp_compexpr_left_1 = var_ch;
if ( tmp_compexpr_left_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compexpr_right_1 = const_str_chr_93;
tmp_or_right_value_1 = RICH_COMPARE_NE( tmp_compexpr_left_1, tmp_compexpr_right_1 );
if ( tmp_or_right_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_value_2 = tmp_or_right_value_1;
goto or_end_1;
or_left_1:;
Py_INCREF( tmp_or_left_value_1 );
tmp_cond_value_2 = tmp_or_left_value_1;
or_end_1:;
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_2 );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_9;
}
else
{
goto branch_yes_9;
}
branch_yes_9:;
goto loop_end_2;
branch_no_9:;
// Tried code:
tmp_value_name_4 = var_pattern_iter;
if ( tmp_value_name_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 120;
type_description_1 = "oooooooooooooo";
goto try_except_handler_11;
}
tmp_iter_arg_5 = ITERATOR_NEXT( tmp_value_name_4 );
if ( tmp_iter_arg_5 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 120;
goto try_except_handler_11;
}
tmp_assign_source_24 = MAKE_ITERATOR( tmp_iter_arg_5 );
Py_DECREF( tmp_iter_arg_5 );
if ( tmp_assign_source_24 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 120;
type_description_1 = "oooooooooooooo";
goto try_except_handler_11;
}
{
PyObject *old = tmp_tuple_unpack_4__source_iter;
tmp_tuple_unpack_4__source_iter = tmp_assign_source_24;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_7 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_7 );
tmp_assign_source_25 = UNPACK_NEXT( tmp_unpack_7, 0, 2 );
if ( tmp_assign_source_25 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 120;
goto try_except_handler_12;
}
{
PyObject *old = tmp_tuple_unpack_4__element_1;
tmp_tuple_unpack_4__element_1 = tmp_assign_source_25;
Py_XDECREF( old );
}
tmp_unpack_8 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_8 );
tmp_assign_source_26 = UNPACK_NEXT( tmp_unpack_8, 1, 2 );
if ( tmp_assign_source_26 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 120;
goto try_except_handler_12;
}
{
PyObject *old = tmp_tuple_unpack_4__element_2;
tmp_tuple_unpack_4__element_2 = tmp_assign_source_26;
Py_XDECREF( old );
}
tmp_iterator_name_4 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_iterator_name_4 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_4 ); assert( HAS_ITERNEXT( tmp_iterator_name_4 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_4 )->tp_iternext)( tmp_iterator_name_4 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 120;
goto try_except_handler_12;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 120;
goto try_except_handler_12;
}
goto try_end_8;
// Exception handler code:
try_except_handler_12:;
exception_keeper_type_9 = exception_type;
exception_keeper_value_9 = exception_value;
exception_keeper_tb_9 = exception_tb;
exception_keeper_lineno_9 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_9;
exception_value = exception_keeper_value_9;
exception_tb = exception_keeper_tb_9;
exception_lineno = exception_keeper_lineno_9;
goto try_except_handler_11;
// End of try:
try_end_8:;
goto try_end_9;
// Exception handler code:
try_except_handler_11:;
exception_keeper_type_10 = exception_type;
exception_keeper_value_10 = exception_value;
exception_keeper_tb_10 = exception_tb;
exception_keeper_lineno_10 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_10;
exception_value = exception_keeper_value_10;
exception_tb = exception_keeper_tb_10;
exception_lineno = exception_keeper_lineno_10;
goto try_except_handler_6;
// End of try:
try_end_9:;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
tmp_assign_source_27 = tmp_tuple_unpack_4__element_1;
CHECK_OBJECT( tmp_assign_source_27 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_27;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
tmp_assign_source_28 = tmp_tuple_unpack_4__element_2;
CHECK_OBJECT( tmp_assign_source_28 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_28;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 119;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
goto loop_start_2;
loop_end_2:;
goto branch_end_8;
branch_no_8:;
tmp_compare_left_8 = var_ch;
if ( tmp_compare_left_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 121;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_8 = const_str_chr_40;
tmp_cmp_Eq_7 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_8, tmp_compare_right_8 );
if ( tmp_cmp_Eq_7 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 121;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_7 == 1 )
{
goto branch_yes_10;
}
else
{
goto branch_no_10;
}
branch_yes_10:;
// Tried code:
tmp_value_name_5 = var_pattern_iter;
if ( tmp_value_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 123;
type_description_1 = "oooooooooooooo";
goto try_except_handler_13;
}
tmp_iter_arg_6 = ITERATOR_NEXT( tmp_value_name_5 );
if ( tmp_iter_arg_6 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 123;
goto try_except_handler_13;
}
tmp_assign_source_29 = MAKE_ITERATOR( tmp_iter_arg_6 );
Py_DECREF( tmp_iter_arg_6 );
if ( tmp_assign_source_29 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 123;
type_description_1 = "oooooooooooooo";
goto try_except_handler_13;
}
{
PyObject *old = tmp_tuple_unpack_5__source_iter;
tmp_tuple_unpack_5__source_iter = tmp_assign_source_29;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_9 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_9 );
tmp_assign_source_30 = UNPACK_NEXT( tmp_unpack_9, 0, 2 );
if ( tmp_assign_source_30 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 123;
goto try_except_handler_14;
}
{
PyObject *old = tmp_tuple_unpack_5__element_1;
tmp_tuple_unpack_5__element_1 = tmp_assign_source_30;
Py_XDECREF( old );
}
tmp_unpack_10 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_10 );
tmp_assign_source_31 = UNPACK_NEXT( tmp_unpack_10, 1, 2 );
if ( tmp_assign_source_31 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 123;
goto try_except_handler_14;
}
{
PyObject *old = tmp_tuple_unpack_5__element_2;
tmp_tuple_unpack_5__element_2 = tmp_assign_source_31;
Py_XDECREF( old );
}
tmp_iterator_name_5 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_iterator_name_5 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_5 ); assert( HAS_ITERNEXT( tmp_iterator_name_5 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_5 )->tp_iternext)( tmp_iterator_name_5 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 123;
goto try_except_handler_14;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 123;
goto try_except_handler_14;
}
goto try_end_10;
// Exception handler code:
try_except_handler_14:;
exception_keeper_type_11 = exception_type;
exception_keeper_value_11 = exception_value;
exception_keeper_tb_11 = exception_tb;
exception_keeper_lineno_11 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_11;
exception_value = exception_keeper_value_11;
exception_tb = exception_keeper_tb_11;
exception_lineno = exception_keeper_lineno_11;
goto try_except_handler_13;
// End of try:
try_end_10:;
goto try_end_11;
// Exception handler code:
try_except_handler_13:;
exception_keeper_type_12 = exception_type;
exception_keeper_value_12 = exception_value;
exception_keeper_tb_12 = exception_tb;
exception_keeper_lineno_12 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_12;
exception_value = exception_keeper_value_12;
exception_tb = exception_keeper_tb_12;
exception_lineno = exception_keeper_lineno_12;
goto try_except_handler_6;
// End of try:
try_end_11:;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
tmp_assign_source_32 = tmp_tuple_unpack_5__element_1;
CHECK_OBJECT( tmp_assign_source_32 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_32;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
tmp_assign_source_33 = tmp_tuple_unpack_5__element_2;
CHECK_OBJECT( tmp_assign_source_33 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_33;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
tmp_compexpr_left_2 = var_ch;
if ( tmp_compexpr_left_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 124;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compexpr_right_2 = const_str_chr_63;
tmp_or_left_value_2 = RICH_COMPARE_NE( tmp_compexpr_left_2, tmp_compexpr_right_2 );
if ( tmp_or_left_value_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 124;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_or_left_truth_2 = CHECK_IF_TRUE( tmp_or_left_value_2 );
if ( tmp_or_left_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_or_left_value_2 );
exception_lineno = 124;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_or_left_truth_2 == 1 )
{
goto or_left_2;
}
else
{
goto or_right_2;
}
or_right_2:;
Py_DECREF( tmp_or_left_value_2 );
tmp_or_right_value_2 = var_escaped;
if ( tmp_or_right_value_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "escaped" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 124;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_INCREF( tmp_or_right_value_2 );
tmp_cond_value_3 = tmp_or_right_value_2;
goto or_end_2;
or_left_2:;
tmp_cond_value_3 = tmp_or_left_value_2;
or_end_2:;
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_3 );
exception_lineno = 124;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == 1 )
{
goto branch_yes_11;
}
else
{
goto branch_no_11;
}
branch_yes_11:;
tmp_left_name_2 = const_str_digest_0bee88bea05a6d16838bce17fe2050b5;
tmp_right_name_2 = var_num_args;
if ( tmp_right_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "num_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 126;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_assign_source_34 = BINARY_OPERATION_REMAINDER( tmp_left_name_2, tmp_right_name_2 );
if ( tmp_assign_source_34 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 126;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_name;
var_name = tmp_assign_source_34;
Py_XDECREF( old );
}
tmp_left_name_3 = var_num_args;
if ( tmp_left_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "num_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 127;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_right_name_3 = const_int_pos_1;
tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 );
tmp_assign_source_35 = tmp_left_name_3;
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 127;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
var_num_args = tmp_assign_source_35;
tmp_source_name_3 = var_result;
if ( tmp_source_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_5 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_append );
if ( tmp_called_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_6 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_called_name_6 == NULL ))
{
tmp_called_name_6 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_called_name_6 == NULL )
{
Py_DECREF( tmp_called_name_5 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_6 = PyTuple_New( 2 );
tmp_left_name_4 = const_str_digest_34af11cfb02a76cc23098f7dbc1d08c8;
tmp_right_name_4 = var_name;
if ( tmp_right_name_4 == NULL )
{
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_element_name_6 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "name" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_tuple_element_1 = BINARY_OPERATION_REMAINDER( tmp_left_name_4, tmp_right_name_4 );
if ( tmp_tuple_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_element_name_6 );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
PyTuple_SET_ITEM( tmp_args_element_name_6, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = var_name;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_element_name_6 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "name" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_element_name_6, 1, tmp_tuple_element_1 );
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 128;
{
PyObject *call_args[] = { tmp_args_element_name_6 };
tmp_args_element_name_5 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_6, call_args );
}
Py_DECREF( tmp_args_element_name_6 );
if ( tmp_args_element_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_5 );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 128;
{
PyObject *call_args[] = { tmp_args_element_name_5 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_5, call_args );
}
Py_DECREF( tmp_called_name_5 );
Py_DECREF( tmp_args_element_name_5 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 128;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
tmp_called_name_7 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_walk_to_end );
if (unlikely( tmp_called_name_7 == NULL ))
{
tmp_called_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_walk_to_end );
}
if ( tmp_called_name_7 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "walk_to_end" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 129;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_7 = var_ch;
if ( tmp_args_element_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 129;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_8 = var_pattern_iter;
if ( tmp_args_element_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 129;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 129;
{
PyObject *call_args[] = { tmp_args_element_name_7, tmp_args_element_name_8 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_7, call_args );
}
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 129;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_11;
branch_no_11:;
// Tried code:
tmp_value_name_6 = var_pattern_iter;
if ( tmp_value_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 131;
type_description_1 = "oooooooooooooo";
goto try_except_handler_15;
}
tmp_iter_arg_7 = ITERATOR_NEXT( tmp_value_name_6 );
if ( tmp_iter_arg_7 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 131;
goto try_except_handler_15;
}
tmp_assign_source_36 = MAKE_ITERATOR( tmp_iter_arg_7 );
Py_DECREF( tmp_iter_arg_7 );
if ( tmp_assign_source_36 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 131;
type_description_1 = "oooooooooooooo";
goto try_except_handler_15;
}
{
PyObject *old = tmp_tuple_unpack_6__source_iter;
tmp_tuple_unpack_6__source_iter = tmp_assign_source_36;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_11 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_unpack_11 );
tmp_assign_source_37 = UNPACK_NEXT( tmp_unpack_11, 0, 2 );
if ( tmp_assign_source_37 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 131;
goto try_except_handler_16;
}
{
PyObject *old = tmp_tuple_unpack_6__element_1;
tmp_tuple_unpack_6__element_1 = tmp_assign_source_37;
Py_XDECREF( old );
}
tmp_unpack_12 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_unpack_12 );
tmp_assign_source_38 = UNPACK_NEXT( tmp_unpack_12, 1, 2 );
if ( tmp_assign_source_38 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 131;
goto try_except_handler_16;
}
{
PyObject *old = tmp_tuple_unpack_6__element_2;
tmp_tuple_unpack_6__element_2 = tmp_assign_source_38;
Py_XDECREF( old );
}
tmp_iterator_name_6 = tmp_tuple_unpack_6__source_iter;
CHECK_OBJECT( tmp_iterator_name_6 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_6 ); assert( HAS_ITERNEXT( tmp_iterator_name_6 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_6 )->tp_iternext)( tmp_iterator_name_6 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 131;
goto try_except_handler_16;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 131;
goto try_except_handler_16;
}
goto try_end_12;
// Exception handler code:
try_except_handler_16:;
exception_keeper_type_13 = exception_type;
exception_keeper_value_13 = exception_value;
exception_keeper_tb_13 = exception_tb;
exception_keeper_lineno_13 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_6__source_iter );
tmp_tuple_unpack_6__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_13;
exception_value = exception_keeper_value_13;
exception_tb = exception_keeper_tb_13;
exception_lineno = exception_keeper_lineno_13;
goto try_except_handler_15;
// End of try:
try_end_12:;
goto try_end_13;
// Exception handler code:
try_except_handler_15:;
exception_keeper_type_14 = exception_type;
exception_keeper_value_14 = exception_value;
exception_keeper_tb_14 = exception_tb;
exception_keeper_lineno_14 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_14;
exception_value = exception_keeper_value_14;
exception_tb = exception_keeper_tb_14;
exception_lineno = exception_keeper_lineno_14;
goto try_except_handler_6;
// End of try:
try_end_13:;
Py_XDECREF( tmp_tuple_unpack_6__source_iter );
tmp_tuple_unpack_6__source_iter = NULL;
tmp_assign_source_39 = tmp_tuple_unpack_6__element_1;
CHECK_OBJECT( tmp_assign_source_39 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_39;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
tmp_assign_source_40 = tmp_tuple_unpack_6__element_2;
CHECK_OBJECT( tmp_assign_source_40 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_40;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_1 );
tmp_tuple_unpack_6__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_6__element_2 );
tmp_tuple_unpack_6__element_2 = NULL;
tmp_compare_left_9 = var_ch;
if ( tmp_compare_left_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 132;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_9 = const_str_digest_d2b1e71f80ff0eb6146579dadccb1242;
tmp_cmp_In_1 = PySequence_Contains( tmp_compare_right_9, tmp_compare_left_9 );
assert( !(tmp_cmp_In_1 == -1) );
if ( tmp_cmp_In_1 == 1 )
{
goto branch_yes_12;
}
else
{
goto branch_no_12;
}
branch_yes_12:;
tmp_called_name_8 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_walk_to_end );
if (unlikely( tmp_called_name_8 == NULL ))
{
tmp_called_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_walk_to_end );
}
if ( tmp_called_name_8 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "walk_to_end" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 135;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_9 = var_ch;
if ( tmp_args_element_name_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 135;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_10 = var_pattern_iter;
if ( tmp_args_element_name_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 135;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 135;
{
PyObject *call_args[] = { tmp_args_element_name_9, tmp_args_element_name_10 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_8, call_args );
}
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 135;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_12;
branch_no_12:;
tmp_compare_left_10 = var_ch;
if ( tmp_compare_left_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 136;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_10 = const_str_digest_c7add12e81e11b6579532211d8018bf7;
tmp_cmp_In_2 = PySequence_Contains( tmp_compare_right_10, tmp_compare_left_10 );
assert( !(tmp_cmp_In_2 == -1) );
if ( tmp_cmp_In_2 == 1 )
{
goto branch_yes_13;
}
else
{
goto branch_no_13;
}
branch_yes_13:;
tmp_source_name_4 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_warnings );
if (unlikely( tmp_source_name_4 == NULL ))
{
tmp_source_name_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_warnings );
}
if ( tmp_source_name_4 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "warnings" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 137;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_warn );
if ( tmp_called_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 137;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_left_name_5 = const_str_digest_47ede3e9e40e72a92a9b251ac59f4561;
tmp_right_name_5 = var_ch;
if ( tmp_right_name_5 == NULL )
{
Py_DECREF( tmp_called_name_9 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 138;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_11 = BINARY_OPERATION_REMAINDER( tmp_left_name_5, tmp_right_name_5 );
if ( tmp_args_element_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_9 );
exception_lineno = 138;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_12 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_RemovedInDjango21Warning );
if (unlikely( tmp_args_element_name_12 == NULL ))
{
tmp_args_element_name_12 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_RemovedInDjango21Warning );
}
if ( tmp_args_element_name_12 == NULL )
{
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_element_name_11 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "RemovedInDjango21Warning" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 139;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 137;
{
PyObject *call_args[] = { tmp_args_element_name_11, tmp_args_element_name_12 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_9, call_args );
}
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_element_name_11 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 137;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
tmp_called_name_10 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_walk_to_end );
if (unlikely( tmp_called_name_10 == NULL ))
{
tmp_called_name_10 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_walk_to_end );
}
if ( tmp_called_name_10 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "walk_to_end" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 141;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_13 = var_ch;
if ( tmp_args_element_name_13 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 141;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_14 = var_pattern_iter;
if ( tmp_args_element_name_14 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 141;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 141;
{
PyObject *call_args[] = { tmp_args_element_name_13, tmp_args_element_name_14 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_10, call_args );
}
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 141;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_13;
branch_no_13:;
tmp_compare_left_11 = var_ch;
if ( tmp_compare_left_11 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 142;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_11 = const_str_chr_58;
tmp_cmp_Eq_8 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_11, tmp_compare_right_11 );
if ( tmp_cmp_Eq_8 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 142;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_8 == 1 )
{
goto branch_yes_14;
}
else
{
goto branch_no_14;
}
branch_yes_14:;
tmp_source_name_5 = var_non_capturing_groups;
if ( tmp_source_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "non_capturing_groups" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 144;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_append );
if ( tmp_called_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 144;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_len_arg_1 = var_result;
if ( tmp_len_arg_1 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 144;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_15 = BUILTIN_LEN( tmp_len_arg_1 );
if ( tmp_args_element_name_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
exception_lineno = 144;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 144;
{
PyObject *call_args[] = { tmp_args_element_name_15 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_11, call_args );
}
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_15 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 144;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_14;
branch_no_14:;
tmp_compare_left_12 = var_ch;
if ( tmp_compare_left_12 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 145;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_12 = const_str_plain_P;
tmp_cmp_NotEq_1 = RICH_COMPARE_BOOL_NE( tmp_compare_left_12, tmp_compare_right_12 );
if ( tmp_cmp_NotEq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 145;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_NotEq_1 == 1 )
{
goto branch_yes_15;
}
else
{
goto branch_no_15;
}
branch_yes_15:;
tmp_left_name_6 = const_str_digest_644fec29c44d261ee7e2a542cb88bf54;
tmp_right_name_6 = var_ch;
if ( tmp_right_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 148;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_make_exception_arg_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_6, tmp_right_name_6 );
if ( tmp_make_exception_arg_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 148;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 148;
{
PyObject *call_args[] = { tmp_make_exception_arg_2 };
tmp_raise_type_2 = CALL_FUNCTION_WITH_ARGS1( PyExc_ValueError, call_args );
}
Py_DECREF( tmp_make_exception_arg_2 );
assert( tmp_raise_type_2 != NULL );
exception_type = tmp_raise_type_2;
exception_lineno = 148;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
goto branch_end_15;
branch_no_15:;
// Tried code:
tmp_value_name_7 = var_pattern_iter;
if ( tmp_value_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 150;
type_description_1 = "oooooooooooooo";
goto try_except_handler_17;
}
tmp_iter_arg_8 = ITERATOR_NEXT( tmp_value_name_7 );
if ( tmp_iter_arg_8 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 150;
goto try_except_handler_17;
}
tmp_assign_source_41 = MAKE_ITERATOR( tmp_iter_arg_8 );
Py_DECREF( tmp_iter_arg_8 );
if ( tmp_assign_source_41 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 150;
type_description_1 = "oooooooooooooo";
goto try_except_handler_17;
}
{
PyObject *old = tmp_tuple_unpack_7__source_iter;
tmp_tuple_unpack_7__source_iter = tmp_assign_source_41;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_13 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_unpack_13 );
tmp_assign_source_42 = UNPACK_NEXT( tmp_unpack_13, 0, 2 );
if ( tmp_assign_source_42 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 150;
goto try_except_handler_18;
}
{
PyObject *old = tmp_tuple_unpack_7__element_1;
tmp_tuple_unpack_7__element_1 = tmp_assign_source_42;
Py_XDECREF( old );
}
tmp_unpack_14 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_unpack_14 );
tmp_assign_source_43 = UNPACK_NEXT( tmp_unpack_14, 1, 2 );
if ( tmp_assign_source_43 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 150;
goto try_except_handler_18;
}
{
PyObject *old = tmp_tuple_unpack_7__element_2;
tmp_tuple_unpack_7__element_2 = tmp_assign_source_43;
Py_XDECREF( old );
}
tmp_iterator_name_7 = tmp_tuple_unpack_7__source_iter;
CHECK_OBJECT( tmp_iterator_name_7 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_7 ); assert( HAS_ITERNEXT( tmp_iterator_name_7 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_7 )->tp_iternext)( tmp_iterator_name_7 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 150;
goto try_except_handler_18;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 150;
goto try_except_handler_18;
}
goto try_end_14;
// Exception handler code:
try_except_handler_18:;
exception_keeper_type_15 = exception_type;
exception_keeper_value_15 = exception_value;
exception_keeper_tb_15 = exception_tb;
exception_keeper_lineno_15 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_7__source_iter );
tmp_tuple_unpack_7__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_15;
exception_value = exception_keeper_value_15;
exception_tb = exception_keeper_tb_15;
exception_lineno = exception_keeper_lineno_15;
goto try_except_handler_17;
// End of try:
try_end_14:;
goto try_end_15;
// Exception handler code:
try_except_handler_17:;
exception_keeper_type_16 = exception_type;
exception_keeper_value_16 = exception_value;
exception_keeper_tb_16 = exception_tb;
exception_keeper_lineno_16 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_16;
exception_value = exception_keeper_value_16;
exception_tb = exception_keeper_tb_16;
exception_lineno = exception_keeper_lineno_16;
goto try_except_handler_6;
// End of try:
try_end_15:;
Py_XDECREF( tmp_tuple_unpack_7__source_iter );
tmp_tuple_unpack_7__source_iter = NULL;
tmp_assign_source_44 = tmp_tuple_unpack_7__element_1;
CHECK_OBJECT( tmp_assign_source_44 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_44;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
tmp_assign_source_45 = tmp_tuple_unpack_7__element_2;
CHECK_OBJECT( tmp_assign_source_45 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_45;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_1 );
tmp_tuple_unpack_7__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_7__element_2 );
tmp_tuple_unpack_7__element_2 = NULL;
tmp_compare_left_13 = var_ch;
if ( tmp_compare_left_13 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 151;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_13 = const_tuple_str_chr_60_str_chr_61_tuple;
tmp_cmp_NotIn_1 = PySequence_Contains( tmp_compare_right_13, tmp_compare_left_13 );
assert( !(tmp_cmp_NotIn_1 == -1) );
if ( tmp_cmp_NotIn_1 == 0 )
{
goto branch_yes_16;
}
else
{
goto branch_no_16;
}
branch_yes_16:;
tmp_left_name_7 = const_str_digest_96725db95255737aede2ef71506ea5dc;
tmp_right_name_7 = var_ch;
if ( tmp_right_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 152;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_make_exception_arg_3 = BINARY_OPERATION_REMAINDER( tmp_left_name_7, tmp_right_name_7 );
if ( tmp_make_exception_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 152;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 152;
{
PyObject *call_args[] = { tmp_make_exception_arg_3 };
tmp_raise_type_3 = CALL_FUNCTION_WITH_ARGS1( PyExc_ValueError, call_args );
}
Py_DECREF( tmp_make_exception_arg_3 );
assert( tmp_raise_type_3 != NULL );
exception_type = tmp_raise_type_3;
exception_lineno = 152;
RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
branch_no_16:;
tmp_compare_left_14 = var_ch;
if ( tmp_compare_left_14 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 155;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_14 = const_str_chr_60;
tmp_cmp_Eq_9 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_14, tmp_compare_right_14 );
if ( tmp_cmp_Eq_9 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 155;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_9 == 1 )
{
goto branch_yes_17;
}
else
{
goto branch_no_17;
}
branch_yes_17:;
tmp_assign_source_46 = const_str_chr_62;
{
PyObject *old = var_terminal_char;
var_terminal_char = tmp_assign_source_46;
Py_INCREF( var_terminal_char );
Py_XDECREF( old );
}
goto branch_end_17;
branch_no_17:;
tmp_assign_source_47 = const_str_chr_41;
{
PyObject *old = var_terminal_char;
var_terminal_char = tmp_assign_source_47;
Py_INCREF( var_terminal_char );
Py_XDECREF( old );
}
branch_end_17:;
tmp_assign_source_48 = PyList_New( 0 );
{
PyObject *old = var_name;
var_name = tmp_assign_source_48;
Py_XDECREF( old );
}
// Tried code:
tmp_value_name_8 = var_pattern_iter;
if ( tmp_value_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 161;
type_description_1 = "oooooooooooooo";
goto try_except_handler_19;
}
tmp_iter_arg_9 = ITERATOR_NEXT( tmp_value_name_8 );
if ( tmp_iter_arg_9 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 161;
goto try_except_handler_19;
}
tmp_assign_source_49 = MAKE_ITERATOR( tmp_iter_arg_9 );
Py_DECREF( tmp_iter_arg_9 );
if ( tmp_assign_source_49 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 161;
type_description_1 = "oooooooooooooo";
goto try_except_handler_19;
}
{
PyObject *old = tmp_tuple_unpack_8__source_iter;
tmp_tuple_unpack_8__source_iter = tmp_assign_source_49;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_15 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_unpack_15 );
tmp_assign_source_50 = UNPACK_NEXT( tmp_unpack_15, 0, 2 );
if ( tmp_assign_source_50 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 161;
goto try_except_handler_20;
}
{
PyObject *old = tmp_tuple_unpack_8__element_1;
tmp_tuple_unpack_8__element_1 = tmp_assign_source_50;
Py_XDECREF( old );
}
tmp_unpack_16 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_unpack_16 );
tmp_assign_source_51 = UNPACK_NEXT( tmp_unpack_16, 1, 2 );
if ( tmp_assign_source_51 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 161;
goto try_except_handler_20;
}
{
PyObject *old = tmp_tuple_unpack_8__element_2;
tmp_tuple_unpack_8__element_2 = tmp_assign_source_51;
Py_XDECREF( old );
}
tmp_iterator_name_8 = tmp_tuple_unpack_8__source_iter;
CHECK_OBJECT( tmp_iterator_name_8 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_8 ); assert( HAS_ITERNEXT( tmp_iterator_name_8 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_8 )->tp_iternext)( tmp_iterator_name_8 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 161;
goto try_except_handler_20;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 161;
goto try_except_handler_20;
}
goto try_end_16;
// Exception handler code:
try_except_handler_20:;
exception_keeper_type_17 = exception_type;
exception_keeper_value_17 = exception_value;
exception_keeper_tb_17 = exception_tb;
exception_keeper_lineno_17 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_8__source_iter );
tmp_tuple_unpack_8__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_17;
exception_value = exception_keeper_value_17;
exception_tb = exception_keeper_tb_17;
exception_lineno = exception_keeper_lineno_17;
goto try_except_handler_19;
// End of try:
try_end_16:;
goto try_end_17;
// Exception handler code:
try_except_handler_19:;
exception_keeper_type_18 = exception_type;
exception_keeper_value_18 = exception_value;
exception_keeper_tb_18 = exception_tb;
exception_keeper_lineno_18 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_18;
exception_value = exception_keeper_value_18;
exception_tb = exception_keeper_tb_18;
exception_lineno = exception_keeper_lineno_18;
goto try_except_handler_6;
// End of try:
try_end_17:;
Py_XDECREF( tmp_tuple_unpack_8__source_iter );
tmp_tuple_unpack_8__source_iter = NULL;
tmp_assign_source_52 = tmp_tuple_unpack_8__element_1;
CHECK_OBJECT( tmp_assign_source_52 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_52;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
tmp_assign_source_53 = tmp_tuple_unpack_8__element_2;
CHECK_OBJECT( tmp_assign_source_53 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_53;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_1 );
tmp_tuple_unpack_8__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_8__element_2 );
tmp_tuple_unpack_8__element_2 = NULL;
loop_start_3:;
tmp_compare_left_15 = var_ch;
if ( tmp_compare_left_15 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 162;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_15 = var_terminal_char;
if ( tmp_compare_right_15 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "terminal_char" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 162;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cmp_NotEq_2 = RICH_COMPARE_BOOL_NE( tmp_compare_left_15, tmp_compare_right_15 );
if ( tmp_cmp_NotEq_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 162;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_NotEq_2 == 1 )
{
goto branch_no_18;
}
else
{
goto branch_yes_18;
}
branch_yes_18:;
goto loop_end_3;
branch_no_18:;
tmp_source_name_6 = var_name;
if ( tmp_source_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "name" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 163;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_12 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_append );
if ( tmp_called_name_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_16 = var_ch;
if ( tmp_args_element_name_16 == NULL )
{
Py_DECREF( tmp_called_name_12 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 163;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 163;
{
PyObject *call_args[] = { tmp_args_element_name_16 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_12, call_args );
}
Py_DECREF( tmp_called_name_12 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 163;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
// Tried code:
tmp_value_name_9 = var_pattern_iter;
if ( tmp_value_name_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 164;
type_description_1 = "oooooooooooooo";
goto try_except_handler_21;
}
tmp_iter_arg_10 = ITERATOR_NEXT( tmp_value_name_9 );
if ( tmp_iter_arg_10 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 164;
goto try_except_handler_21;
}
tmp_assign_source_54 = MAKE_ITERATOR( tmp_iter_arg_10 );
Py_DECREF( tmp_iter_arg_10 );
if ( tmp_assign_source_54 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 164;
type_description_1 = "oooooooooooooo";
goto try_except_handler_21;
}
{
PyObject *old = tmp_tuple_unpack_9__source_iter;
tmp_tuple_unpack_9__source_iter = tmp_assign_source_54;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_17 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_unpack_17 );
tmp_assign_source_55 = UNPACK_NEXT( tmp_unpack_17, 0, 2 );
if ( tmp_assign_source_55 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 164;
goto try_except_handler_22;
}
{
PyObject *old = tmp_tuple_unpack_9__element_1;
tmp_tuple_unpack_9__element_1 = tmp_assign_source_55;
Py_XDECREF( old );
}
tmp_unpack_18 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_unpack_18 );
tmp_assign_source_56 = UNPACK_NEXT( tmp_unpack_18, 1, 2 );
if ( tmp_assign_source_56 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 164;
goto try_except_handler_22;
}
{
PyObject *old = tmp_tuple_unpack_9__element_2;
tmp_tuple_unpack_9__element_2 = tmp_assign_source_56;
Py_XDECREF( old );
}
tmp_iterator_name_9 = tmp_tuple_unpack_9__source_iter;
CHECK_OBJECT( tmp_iterator_name_9 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_9 ); assert( HAS_ITERNEXT( tmp_iterator_name_9 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_9 )->tp_iternext)( tmp_iterator_name_9 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 164;
goto try_except_handler_22;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 164;
goto try_except_handler_22;
}
goto try_end_18;
// Exception handler code:
try_except_handler_22:;
exception_keeper_type_19 = exception_type;
exception_keeper_value_19 = exception_value;
exception_keeper_tb_19 = exception_tb;
exception_keeper_lineno_19 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_9__source_iter );
tmp_tuple_unpack_9__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_19;
exception_value = exception_keeper_value_19;
exception_tb = exception_keeper_tb_19;
exception_lineno = exception_keeper_lineno_19;
goto try_except_handler_21;
// End of try:
try_end_18:;
goto try_end_19;
// Exception handler code:
try_except_handler_21:;
exception_keeper_type_20 = exception_type;
exception_keeper_value_20 = exception_value;
exception_keeper_tb_20 = exception_tb;
exception_keeper_lineno_20 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_20;
exception_value = exception_keeper_value_20;
exception_tb = exception_keeper_tb_20;
exception_lineno = exception_keeper_lineno_20;
goto try_except_handler_6;
// End of try:
try_end_19:;
Py_XDECREF( tmp_tuple_unpack_9__source_iter );
tmp_tuple_unpack_9__source_iter = NULL;
tmp_assign_source_57 = tmp_tuple_unpack_9__element_1;
CHECK_OBJECT( tmp_assign_source_57 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_57;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
tmp_assign_source_58 = tmp_tuple_unpack_9__element_2;
CHECK_OBJECT( tmp_assign_source_58 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_58;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_1 );
tmp_tuple_unpack_9__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_9__element_2 );
tmp_tuple_unpack_9__element_2 = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 162;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
goto loop_start_3;
loop_end_3:;
tmp_source_name_7 = const_str_empty;
tmp_called_name_13 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_join );
assert( tmp_called_name_13 != NULL );
tmp_args_element_name_17 = var_name;
if ( tmp_args_element_name_17 == NULL )
{
Py_DECREF( tmp_called_name_13 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "name" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 165;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 165;
{
PyObject *call_args[] = { tmp_args_element_name_17 };
tmp_assign_source_59 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_13, call_args );
}
Py_DECREF( tmp_called_name_13 );
if ( tmp_assign_source_59 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 165;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
{
PyObject *old = var_param;
var_param = tmp_assign_source_59;
Py_XDECREF( old );
}
tmp_compare_left_16 = var_terminal_char;
if ( tmp_compare_left_16 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "terminal_char" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 168;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_16 = const_str_chr_41;
tmp_cmp_NotEq_3 = RICH_COMPARE_BOOL_NE( tmp_compare_left_16, tmp_compare_right_16 );
if ( tmp_cmp_NotEq_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 168;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_NotEq_3 == 1 )
{
goto branch_yes_19;
}
else
{
goto branch_no_19;
}
branch_yes_19:;
tmp_source_name_8 = var_result;
if ( tmp_source_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_14 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_append );
if ( tmp_called_name_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_15 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_called_name_15 == NULL ))
{
tmp_called_name_15 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_called_name_15 == NULL )
{
Py_DECREF( tmp_called_name_14 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_19 = PyTuple_New( 2 );
tmp_left_name_8 = const_str_digest_34af11cfb02a76cc23098f7dbc1d08c8;
tmp_right_name_8 = var_param;
if ( tmp_right_name_8 == NULL )
{
Py_DECREF( tmp_called_name_14 );
Py_DECREF( tmp_args_element_name_19 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "param" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_tuple_element_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_8, tmp_right_name_8 );
if ( tmp_tuple_element_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_14 );
Py_DECREF( tmp_args_element_name_19 );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
PyTuple_SET_ITEM( tmp_args_element_name_19, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = var_param;
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_called_name_14 );
Py_DECREF( tmp_args_element_name_19 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "param" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_element_name_19, 1, tmp_tuple_element_2 );
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 169;
{
PyObject *call_args[] = { tmp_args_element_name_19 };
tmp_args_element_name_18 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_15, call_args );
}
Py_DECREF( tmp_args_element_name_19 );
if ( tmp_args_element_name_18 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_14 );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 169;
{
PyObject *call_args[] = { tmp_args_element_name_18 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_14, call_args );
}
Py_DECREF( tmp_called_name_14 );
Py_DECREF( tmp_args_element_name_18 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 169;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
tmp_called_name_16 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_walk_to_end );
if (unlikely( tmp_called_name_16 == NULL ))
{
tmp_called_name_16 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_walk_to_end );
}
if ( tmp_called_name_16 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "walk_to_end" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 170;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_20 = var_ch;
if ( tmp_args_element_name_20 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 170;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_21 = var_pattern_iter;
if ( tmp_args_element_name_21 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 170;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 170;
{
PyObject *call_args[] = { tmp_args_element_name_20, tmp_args_element_name_21 };
tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_16, call_args );
}
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 170;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
goto branch_end_19;
branch_no_19:;
tmp_source_name_9 = var_result;
if ( tmp_source_name_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_17 = LOOKUP_ATTRIBUTE( tmp_source_name_9, const_str_plain_append );
if ( tmp_called_name_17 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_18 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_called_name_18 == NULL ))
{
tmp_called_name_18 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_called_name_18 == NULL )
{
Py_DECREF( tmp_called_name_17 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_23 = PyTuple_New( 2 );
tmp_left_name_9 = const_str_digest_34af11cfb02a76cc23098f7dbc1d08c8;
tmp_right_name_9 = var_param;
if ( tmp_right_name_9 == NULL )
{
Py_DECREF( tmp_called_name_17 );
Py_DECREF( tmp_args_element_name_23 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "param" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_tuple_element_3 = BINARY_OPERATION_REMAINDER( tmp_left_name_9, tmp_right_name_9 );
if ( tmp_tuple_element_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_17 );
Py_DECREF( tmp_args_element_name_23 );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
PyTuple_SET_ITEM( tmp_args_element_name_23, 0, tmp_tuple_element_3 );
tmp_tuple_element_3 = Py_None;
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_element_name_23, 1, tmp_tuple_element_3 );
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 172;
{
PyObject *call_args[] = { tmp_args_element_name_23 };
tmp_args_element_name_22 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_18, call_args );
}
Py_DECREF( tmp_args_element_name_23 );
if ( tmp_args_element_name_22 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_17 );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 172;
{
PyObject *call_args[] = { tmp_args_element_name_22 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_17, call_args );
}
Py_DECREF( tmp_called_name_17 );
Py_DECREF( tmp_args_element_name_22 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 172;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
branch_end_19:;
branch_end_15:;
branch_end_14:;
branch_end_13:;
branch_end_12:;
branch_end_11:;
goto branch_end_10;
branch_no_10:;
tmp_compare_left_17 = var_ch;
if ( tmp_compare_left_17 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 173;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_17 = const_str_digest_0cc74035e3304fdafd801e7471c953bb;
tmp_cmp_In_3 = PySequence_Contains( tmp_compare_right_17, tmp_compare_left_17 );
assert( !(tmp_cmp_In_3 == -1) );
if ( tmp_cmp_In_3 == 1 )
{
goto branch_yes_20;
}
else
{
goto branch_no_20;
}
branch_yes_20:;
// Tried code:
tmp_called_name_19 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_get_quantifier );
if (unlikely( tmp_called_name_19 == NULL ))
{
tmp_called_name_19 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_get_quantifier );
}
if ( tmp_called_name_19 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "get_quantifier" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 175;
type_description_1 = "oooooooooooooo";
goto try_except_handler_23;
}
tmp_args_element_name_24 = var_ch;
if ( tmp_args_element_name_24 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 175;
type_description_1 = "oooooooooooooo";
goto try_except_handler_23;
}
tmp_args_element_name_25 = var_pattern_iter;
if ( tmp_args_element_name_25 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 175;
type_description_1 = "oooooooooooooo";
goto try_except_handler_23;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 175;
{
PyObject *call_args[] = { tmp_args_element_name_24, tmp_args_element_name_25 };
tmp_iter_arg_11 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_19, call_args );
}
if ( tmp_iter_arg_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 175;
type_description_1 = "oooooooooooooo";
goto try_except_handler_23;
}
tmp_assign_source_60 = MAKE_ITERATOR( tmp_iter_arg_11 );
Py_DECREF( tmp_iter_arg_11 );
if ( tmp_assign_source_60 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 175;
type_description_1 = "oooooooooooooo";
goto try_except_handler_23;
}
{
PyObject *old = tmp_tuple_unpack_10__source_iter;
tmp_tuple_unpack_10__source_iter = tmp_assign_source_60;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_19 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_unpack_19 );
tmp_assign_source_61 = UNPACK_NEXT( tmp_unpack_19, 0, 2 );
if ( tmp_assign_source_61 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 175;
goto try_except_handler_24;
}
{
PyObject *old = tmp_tuple_unpack_10__element_1;
tmp_tuple_unpack_10__element_1 = tmp_assign_source_61;
Py_XDECREF( old );
}
tmp_unpack_20 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_unpack_20 );
tmp_assign_source_62 = UNPACK_NEXT( tmp_unpack_20, 1, 2 );
if ( tmp_assign_source_62 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 175;
goto try_except_handler_24;
}
{
PyObject *old = tmp_tuple_unpack_10__element_2;
tmp_tuple_unpack_10__element_2 = tmp_assign_source_62;
Py_XDECREF( old );
}
tmp_iterator_name_10 = tmp_tuple_unpack_10__source_iter;
CHECK_OBJECT( tmp_iterator_name_10 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_10 ); assert( HAS_ITERNEXT( tmp_iterator_name_10 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_10 )->tp_iternext)( tmp_iterator_name_10 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 175;
goto try_except_handler_24;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 175;
goto try_except_handler_24;
}
goto try_end_20;
// Exception handler code:
try_except_handler_24:;
exception_keeper_type_21 = exception_type;
exception_keeper_value_21 = exception_value;
exception_keeper_tb_21 = exception_tb;
exception_keeper_lineno_21 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_10__source_iter );
tmp_tuple_unpack_10__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_21;
exception_value = exception_keeper_value_21;
exception_tb = exception_keeper_tb_21;
exception_lineno = exception_keeper_lineno_21;
goto try_except_handler_23;
// End of try:
try_end_20:;
goto try_end_21;
// Exception handler code:
try_except_handler_23:;
exception_keeper_type_22 = exception_type;
exception_keeper_value_22 = exception_value;
exception_keeper_tb_22 = exception_tb;
exception_keeper_lineno_22 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_22;
exception_value = exception_keeper_value_22;
exception_tb = exception_keeper_tb_22;
exception_lineno = exception_keeper_lineno_22;
goto try_except_handler_6;
// End of try:
try_end_21:;
Py_XDECREF( tmp_tuple_unpack_10__source_iter );
tmp_tuple_unpack_10__source_iter = NULL;
tmp_assign_source_63 = tmp_tuple_unpack_10__element_1;
CHECK_OBJECT( tmp_assign_source_63 );
{
PyObject *old = var_count;
var_count = tmp_assign_source_63;
Py_INCREF( var_count );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
tmp_assign_source_64 = tmp_tuple_unpack_10__element_2;
CHECK_OBJECT( tmp_assign_source_64 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_64;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_1 );
tmp_tuple_unpack_10__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_10__element_2 );
tmp_tuple_unpack_10__element_2 = NULL;
tmp_cond_value_4 = var_ch;
if ( tmp_cond_value_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 176;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_4 = CHECK_IF_TRUE( tmp_cond_value_4 );
if ( tmp_cond_truth_4 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 176;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cond_truth_4 == 1 )
{
goto branch_yes_21;
}
else
{
goto branch_no_21;
}
branch_yes_21:;
tmp_assign_source_65 = Py_False;
{
PyObject *old = var_consume_next;
var_consume_next = tmp_assign_source_65;
Py_INCREF( var_consume_next );
Py_XDECREF( old );
}
branch_no_21:;
tmp_compare_left_18 = var_count;
if ( tmp_compare_left_18 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "count" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 182;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_18 = const_int_0;
tmp_cmp_Eq_10 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_18, tmp_compare_right_18 );
if ( tmp_cmp_Eq_10 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 182;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Eq_10 == 1 )
{
goto branch_yes_22;
}
else
{
goto branch_no_22;
}
branch_yes_22:;
tmp_called_name_20 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_contains );
if (unlikely( tmp_called_name_20 == NULL ))
{
tmp_called_name_20 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_contains );
}
if ( tmp_called_name_20 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "contains" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_subscribed_name_3 = var_result;
if ( tmp_subscribed_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_subscript_name_3 = const_int_neg_1;
tmp_args_element_name_26 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_3, tmp_subscript_name_3 );
if ( tmp_args_element_name_26 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_27 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_args_element_name_27 == NULL ))
{
tmp_args_element_name_27 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_args_element_name_27 == NULL )
{
Py_DECREF( tmp_args_element_name_26 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 183;
{
PyObject *call_args[] = { tmp_args_element_name_26, tmp_args_element_name_27 };
tmp_cond_value_5 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_20, call_args );
}
Py_DECREF( tmp_args_element_name_26 );
if ( tmp_cond_value_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_5 = CHECK_IF_TRUE( tmp_cond_value_5 );
if ( tmp_cond_truth_5 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_5 );
exception_lineno = 183;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_cond_value_5 );
if ( tmp_cond_truth_5 == 1 )
{
goto branch_yes_23;
}
else
{
goto branch_no_23;
}
branch_yes_23:;
tmp_called_name_21 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Choice );
if (unlikely( tmp_called_name_21 == NULL ))
{
tmp_called_name_21 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Choice );
}
if ( tmp_called_name_21 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Choice" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_28 = PyList_New( 2 );
tmp_list_element_2 = Py_None;
Py_INCREF( tmp_list_element_2 );
PyList_SET_ITEM( tmp_args_element_name_28, 0, tmp_list_element_2 );
tmp_subscribed_name_4 = var_result;
if ( tmp_subscribed_name_4 == NULL )
{
Py_DECREF( tmp_args_element_name_28 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_subscript_name_4 = const_int_neg_1;
tmp_list_element_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_4, tmp_subscript_name_4 );
if ( tmp_list_element_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_element_name_28 );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
PyList_SET_ITEM( tmp_args_element_name_28, 1, tmp_list_element_2 );
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 190;
{
PyObject *call_args[] = { tmp_args_element_name_28 };
tmp_ass_subvalue_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_21, call_args );
}
Py_DECREF( tmp_args_element_name_28 );
if ( tmp_ass_subvalue_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_ass_subscribed_1 = var_result;
if ( tmp_ass_subscribed_1 == NULL )
{
Py_DECREF( tmp_ass_subvalue_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_ass_subscript_1 = const_int_neg_1;
tmp_ass_subscript_res_1 = SET_SUBSCRIPT_CONST( tmp_ass_subscribed_1, tmp_ass_subscript_1, -1, tmp_ass_subvalue_1 );
Py_DECREF( tmp_ass_subvalue_1 );
if ( tmp_ass_subscript_res_1 == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 190;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
goto branch_end_23;
branch_no_23:;
tmp_called_instance_3 = var_result;
if ( tmp_called_instance_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 192;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 192;
tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_pop );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 192;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
branch_end_23:;
goto branch_end_22;
branch_no_22:;
tmp_compare_left_19 = var_count;
if ( tmp_compare_left_19 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "count" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 193;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_compare_right_19 = const_int_pos_1;
tmp_cmp_Gt_1 = RICH_COMPARE_BOOL_GT( tmp_compare_left_19, tmp_compare_right_19 );
if ( tmp_cmp_Gt_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 193;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cmp_Gt_1 == 1 )
{
goto branch_yes_24;
}
else
{
goto branch_no_24;
}
branch_yes_24:;
tmp_source_name_10 = var_result;
if ( tmp_source_name_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_22 = LOOKUP_ATTRIBUTE( tmp_source_name_10, const_str_plain_extend );
if ( tmp_called_name_22 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_left_name_10 = PyList_New( 1 );
tmp_subscribed_name_5 = var_result;
if ( tmp_subscribed_name_5 == NULL )
{
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_left_name_10 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_subscript_name_5 = const_int_neg_1;
tmp_list_element_3 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_5, tmp_subscript_name_5 );
if ( tmp_list_element_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_left_name_10 );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
PyList_SET_ITEM( tmp_left_name_10, 0, tmp_list_element_3 );
tmp_left_name_11 = var_count;
if ( tmp_left_name_11 == NULL )
{
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_left_name_10 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "count" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_right_name_11 = const_int_pos_1;
tmp_right_name_10 = BINARY_OPERATION_SUB( tmp_left_name_11, tmp_right_name_11 );
if ( tmp_right_name_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_left_name_10 );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_29 = BINARY_OPERATION_MUL( tmp_left_name_10, tmp_right_name_10 );
Py_DECREF( tmp_left_name_10 );
Py_DECREF( tmp_right_name_10 );
if ( tmp_args_element_name_29 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_22 );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 194;
{
PyObject *call_args[] = { tmp_args_element_name_29 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_22, call_args );
}
Py_DECREF( tmp_called_name_22 );
Py_DECREF( tmp_args_element_name_29 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 194;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
branch_no_24:;
branch_end_22:;
goto branch_end_20;
branch_no_20:;
tmp_source_name_11 = var_result;
if ( tmp_source_name_11 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 197;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_called_name_23 = LOOKUP_ATTRIBUTE( tmp_source_name_11, const_str_plain_append );
if ( tmp_called_name_23 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 197;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_args_element_name_30 = var_ch;
if ( tmp_args_element_name_30 == NULL )
{
Py_DECREF( tmp_called_name_23 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 197;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 197;
{
PyObject *call_args[] = { tmp_args_element_name_30 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_23, call_args );
}
Py_DECREF( tmp_called_name_23 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 197;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
Py_DECREF( tmp_unused );
branch_end_20:;
branch_end_10:;
branch_end_8:;
branch_end_7:;
branch_end_6:;
branch_no_5:;
branch_end_4:;
branch_end_3:;
branch_end_2:;
tmp_cond_value_6 = var_consume_next;
if ( tmp_cond_value_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "consume_next" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 199;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
tmp_cond_truth_6 = CHECK_IF_TRUE( tmp_cond_value_6 );
if ( tmp_cond_truth_6 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 199;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
if ( tmp_cond_truth_6 == 1 )
{
goto branch_yes_25;
}
else
{
goto branch_no_25;
}
branch_yes_25:;
// Tried code:
tmp_value_name_10 = var_pattern_iter;
if ( tmp_value_name_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pattern_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 200;
type_description_1 = "oooooooooooooo";
goto try_except_handler_25;
}
tmp_iter_arg_12 = ITERATOR_NEXT( tmp_value_name_10 );
if ( tmp_iter_arg_12 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 200;
goto try_except_handler_25;
}
tmp_assign_source_66 = MAKE_ITERATOR( tmp_iter_arg_12 );
Py_DECREF( tmp_iter_arg_12 );
if ( tmp_assign_source_66 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 200;
type_description_1 = "oooooooooooooo";
goto try_except_handler_25;
}
{
PyObject *old = tmp_tuple_unpack_11__source_iter;
tmp_tuple_unpack_11__source_iter = tmp_assign_source_66;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_21 = tmp_tuple_unpack_11__source_iter;
CHECK_OBJECT( tmp_unpack_21 );
tmp_assign_source_67 = UNPACK_NEXT( tmp_unpack_21, 0, 2 );
if ( tmp_assign_source_67 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 200;
goto try_except_handler_26;
}
{
PyObject *old = tmp_tuple_unpack_11__element_1;
tmp_tuple_unpack_11__element_1 = tmp_assign_source_67;
Py_XDECREF( old );
}
tmp_unpack_22 = tmp_tuple_unpack_11__source_iter;
CHECK_OBJECT( tmp_unpack_22 );
tmp_assign_source_68 = UNPACK_NEXT( tmp_unpack_22, 1, 2 );
if ( tmp_assign_source_68 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooooooooooo";
exception_lineno = 200;
goto try_except_handler_26;
}
{
PyObject *old = tmp_tuple_unpack_11__element_2;
tmp_tuple_unpack_11__element_2 = tmp_assign_source_68;
Py_XDECREF( old );
}
tmp_iterator_name_11 = tmp_tuple_unpack_11__source_iter;
CHECK_OBJECT( tmp_iterator_name_11 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_11 ); assert( HAS_ITERNEXT( tmp_iterator_name_11 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_11 )->tp_iternext)( tmp_iterator_name_11 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 200;
goto try_except_handler_26;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooooooooooo";
exception_lineno = 200;
goto try_except_handler_26;
}
goto try_end_22;
// Exception handler code:
try_except_handler_26:;
exception_keeper_type_23 = exception_type;
exception_keeper_value_23 = exception_value;
exception_keeper_tb_23 = exception_tb;
exception_keeper_lineno_23 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_11__source_iter );
tmp_tuple_unpack_11__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_23;
exception_value = exception_keeper_value_23;
exception_tb = exception_keeper_tb_23;
exception_lineno = exception_keeper_lineno_23;
goto try_except_handler_25;
// End of try:
try_end_22:;
goto try_end_23;
// Exception handler code:
try_except_handler_25:;
exception_keeper_type_24 = exception_type;
exception_keeper_value_24 = exception_value;
exception_keeper_tb_24 = exception_tb;
exception_keeper_lineno_24 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_11__element_1 );
tmp_tuple_unpack_11__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_11__element_2 );
tmp_tuple_unpack_11__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_24;
exception_value = exception_keeper_value_24;
exception_tb = exception_keeper_tb_24;
exception_lineno = exception_keeper_lineno_24;
goto try_except_handler_6;
// End of try:
try_end_23:;
Py_XDECREF( tmp_tuple_unpack_11__source_iter );
tmp_tuple_unpack_11__source_iter = NULL;
tmp_assign_source_69 = tmp_tuple_unpack_11__element_1;
CHECK_OBJECT( tmp_assign_source_69 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_69;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_11__element_1 );
tmp_tuple_unpack_11__element_1 = NULL;
tmp_assign_source_70 = tmp_tuple_unpack_11__element_2;
CHECK_OBJECT( tmp_assign_source_70 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_70;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_11__element_2 );
tmp_tuple_unpack_11__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_11__element_1 );
tmp_tuple_unpack_11__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_11__element_2 );
tmp_tuple_unpack_11__element_2 = NULL;
goto branch_end_25;
branch_no_25:;
tmp_assign_source_71 = Py_True;
{
PyObject *old = var_consume_next;
var_consume_next = tmp_assign_source_71;
Py_INCREF( var_consume_next );
Py_XDECREF( old );
}
branch_end_25:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 91;
type_description_1 = "oooooooooooooo";
goto try_except_handler_6;
}
goto loop_start_1;
loop_end_1:;
goto try_end_24;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_25 = exception_type;
exception_keeper_value_25 = exception_value;
exception_keeper_tb_25 = exception_tb;
exception_keeper_lineno_25 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Preserve existing published exception.
exception_preserved_type_2 = PyThreadState_GET()->exc_type;
Py_XINCREF( exception_preserved_type_2 );
exception_preserved_value_2 = PyThreadState_GET()->exc_value;
Py_XINCREF( exception_preserved_value_2 );
exception_preserved_tb_2 = (PyTracebackObject *)PyThreadState_GET()->exc_traceback;
Py_XINCREF( exception_preserved_tb_2 );
if ( exception_keeper_tb_25 == NULL )
{
exception_keeper_tb_25 = MAKE_TRACEBACK( frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_keeper_lineno_25 );
}
else if ( exception_keeper_lineno_25 != 0 )
{
exception_keeper_tb_25 = ADD_TRACEBACK( exception_keeper_tb_25, frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_keeper_lineno_25 );
}
NORMALIZE_EXCEPTION( &exception_keeper_type_25, &exception_keeper_value_25, &exception_keeper_tb_25 );
PyException_SetTraceback( exception_keeper_value_25, (PyObject *)exception_keeper_tb_25 );
PUBLISH_EXCEPTION( &exception_keeper_type_25, &exception_keeper_value_25, &exception_keeper_tb_25 );
// Tried code:
tmp_compare_left_20 = PyThreadState_GET()->exc_type;
tmp_compare_right_20 = PyExc_StopIteration;
tmp_exc_match_exception_match_2 = EXCEPTION_MATCH_BOOL( tmp_compare_left_20, tmp_compare_right_20 );
if ( tmp_exc_match_exception_match_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 203;
type_description_1 = "oooooooooooooo";
goto try_except_handler_27;
}
if ( tmp_exc_match_exception_match_2 == 1 )
{
goto branch_no_26;
}
else
{
goto branch_yes_26;
}
branch_yes_26:;
tmp_compare_left_21 = PyThreadState_GET()->exc_type;
tmp_compare_right_21 = PyExc_NotImplementedError;
tmp_exc_match_exception_match_3 = EXCEPTION_MATCH_BOOL( tmp_compare_left_21, tmp_compare_right_21 );
if ( tmp_exc_match_exception_match_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 205;
type_description_1 = "oooooooooooooo";
goto try_except_handler_27;
}
if ( tmp_exc_match_exception_match_3 == 1 )
{
goto branch_yes_27;
}
else
{
goto branch_no_27;
}
branch_yes_27:;
tmp_return_value = DEEP_COPY( const_list_tuple_str_empty_list_empty_tuple_list );
goto try_return_handler_27;
goto branch_end_27;
branch_no_27:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 90;
}
if (exception_tb && exception_tb->tb_frame == &frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame) frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "oooooooooooooo";
goto try_except_handler_27;
branch_end_27:;
branch_no_26:;
goto try_end_25;
// Return handler code:
try_return_handler_27:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_2, exception_preserved_value_2, exception_preserved_tb_2 );
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_27:;
exception_keeper_type_26 = exception_type;
exception_keeper_value_26 = exception_value;
exception_keeper_tb_26 = exception_tb;
exception_keeper_lineno_26 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_2, exception_preserved_value_2, exception_preserved_tb_2 );
// Re-raise.
exception_type = exception_keeper_type_26;
exception_value = exception_keeper_value_26;
exception_tb = exception_keeper_tb_26;
exception_lineno = exception_keeper_lineno_26;
goto frame_exception_exit_1;
// End of try:
try_end_25:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_2, exception_preserved_value_2, exception_preserved_tb_2 );
goto try_end_24;
// exception handler codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_1_normalize );
return NULL;
// End of try:
try_end_24:;
tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_zip );
if (unlikely( tmp_dircall_arg1_1 == NULL ))
{
tmp_dircall_arg1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_zip );
}
if ( tmp_dircall_arg1_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "zip" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
tmp_called_name_24 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_flatten_result );
if (unlikely( tmp_called_name_24 == NULL ))
{
tmp_called_name_24 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_flatten_result );
}
if ( tmp_called_name_24 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "flatten_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_31 = var_result;
if ( tmp_args_element_name_31 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame.f_lineno = 209;
{
PyObject *call_args[] = { tmp_args_element_name_31 };
tmp_dircall_arg2_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_24, call_args );
}
if ( tmp_dircall_arg2_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_dircall_arg1_1 );
{
PyObject *dir_call_args[] = {tmp_dircall_arg1_1, tmp_dircall_arg2_1};
tmp_list_arg_1 = impl___internal__$$$function_4_complex_call_helper_star_list( dir_call_args );
}
if ( tmp_list_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
tmp_return_value = PySequence_List( tmp_list_arg_1 );
Py_DECREF( tmp_list_arg_1 );
if ( tmp_return_value == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 209;
type_description_1 = "oooooooooooooo";
goto frame_exception_exit_1;
}
goto frame_return_exit_1;
#if 1
RESTORE_FRAME_EXCEPTION( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_02dd3cdeef3510cc872d2bde3cdfe4f3->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_02dd3cdeef3510cc872d2bde3cdfe4f3, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_02dd3cdeef3510cc872d2bde3cdfe4f3,
type_description_1,
par_pattern,
var_result,
var_non_capturing_groups,
var_consume_next,
var_pattern_iter,
var_num_args,
var_ch,
var_escaped,
var_start,
var_inner,
var_name,
var_terminal_char,
var_param,
var_count
);
// Release cached frame.
if ( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 == cache_frame_02dd3cdeef3510cc872d2bde3cdfe4f3 )
{
Py_DECREF( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
}
cache_frame_02dd3cdeef3510cc872d2bde3cdfe4f3 = NULL;
assertFrameObject( frame_02dd3cdeef3510cc872d2bde3cdfe4f3 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_1_normalize );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_pattern );
par_pattern = NULL;
Py_XDECREF( var_result );
var_result = NULL;
Py_XDECREF( var_non_capturing_groups );
var_non_capturing_groups = NULL;
Py_XDECREF( var_consume_next );
var_consume_next = NULL;
Py_XDECREF( var_pattern_iter );
var_pattern_iter = NULL;
Py_XDECREF( var_num_args );
var_num_args = NULL;
Py_XDECREF( var_ch );
var_ch = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
Py_XDECREF( var_start );
var_start = NULL;
Py_XDECREF( var_inner );
var_inner = NULL;
Py_XDECREF( var_name );
var_name = NULL;
Py_XDECREF( var_terminal_char );
var_terminal_char = NULL;
Py_XDECREF( var_param );
var_param = NULL;
Py_XDECREF( var_count );
var_count = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_27 = exception_type;
exception_keeper_value_27 = exception_value;
exception_keeper_tb_27 = exception_tb;
exception_keeper_lineno_27 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_pattern );
par_pattern = NULL;
Py_XDECREF( var_result );
var_result = NULL;
Py_XDECREF( var_non_capturing_groups );
var_non_capturing_groups = NULL;
Py_XDECREF( var_consume_next );
var_consume_next = NULL;
Py_XDECREF( var_pattern_iter );
var_pattern_iter = NULL;
Py_XDECREF( var_num_args );
var_num_args = NULL;
Py_XDECREF( var_ch );
var_ch = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
Py_XDECREF( var_start );
var_start = NULL;
Py_XDECREF( var_inner );
var_inner = NULL;
Py_XDECREF( var_name );
var_name = NULL;
Py_XDECREF( var_terminal_char );
var_terminal_char = NULL;
Py_XDECREF( var_param );
var_param = NULL;
Py_XDECREF( var_count );
var_count = NULL;
// Re-raise.
exception_type = exception_keeper_type_27;
exception_value = exception_keeper_value_27;
exception_tb = exception_keeper_tb_27;
exception_lineno = exception_keeper_lineno_27;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_1_normalize );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$utils$regex_helper$$$function_2_next_char( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
struct Nuitka_CellObject *par_input_iter = PyCell_NEW1( python_pars[ 0 ] );
PyObject *tmp_return_value;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
tmp_return_value = Nuitka_Generator_New(
django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_context,
module_django$utils$regex_helper,
const_str_plain_next_char,
#if PYTHON_VERSION >= 350
const_str_plain_next_char,
#endif
codeobj_7cd0a752e57b56d66ee85502e645ad13,
1
);
((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] = par_input_iter;
Py_INCREF( ((struct Nuitka_GeneratorObject *)tmp_return_value)->m_closure[0] );
assert( Py_SIZE( tmp_return_value ) >= 1 );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_2_next_char );
return NULL;
// Return handler code:
try_return_handler_1:;
CHECK_OBJECT( (PyObject *)par_input_iter );
Py_DECREF( par_input_iter );
par_input_iter = NULL;
goto function_return_exit;
// End of try:
CHECK_OBJECT( (PyObject *)par_input_iter );
Py_DECREF( par_input_iter );
par_input_iter = NULL;
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_2_next_char );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
struct django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_locals {
PyObject *var_ch
PyObject *var_representative
PyObject *tmp_for_loop_1__for_iterator
PyObject *tmp_for_loop_1__iter_value
PyObject *exception_type
PyObject *exception_value
PyTracebackObject *exception_tb
int exception_lineno
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
int exception_keeper_lineno_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_called_name_1;
int tmp_cmp_NotEq_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_expression_name_1;
PyObject *tmp_expression_name_2;
bool tmp_is_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_next_source_1;
PyObject *tmp_source_name_1;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_value_name_1;
char const *type_description_1
};
#endif
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
static PyObject *django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_context( struct Nuitka_GeneratorObject *generator, PyObject *yield_return_value )
#else
static void django$utils$regex_helper$$$function_2_next_char$$$genobj_1_next_char_context( struct Nuitka_GeneratorObject *generator )
#endif
{
CHECK_OBJECT( (PyObject *)generator );
assert( Nuitka_Generator_Check( (PyObject *)generator ) );
// Local variable initialization
PyObject *var_ch = NULL;
PyObject *var_representative = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_called_name_1;
int tmp_cmp_NotEq_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_expression_name_1;
PyObject *tmp_expression_name_2;
bool tmp_is_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_next_source_1;
PyObject *tmp_source_name_1;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
PyObject *tmp_value_name_1;
static struct Nuitka_FrameObject *cache_frame_generator = NULL;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
// Dispatch to yield based on return label index:
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_generator, codeobj_7cd0a752e57b56d66ee85502e645ad13, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *) );
generator->m_frame = cache_frame_generator;
// Mark the frame object as in use, ref count 1 will be up for reuse.
Py_INCREF( generator->m_frame );
assert( Py_REFCNT( generator->m_frame ) == 2 ); // Frame stack
#if PYTHON_VERSION >= 340
generator->m_frame->m_frame.f_gen = (PyObject *)generator;
#endif
Py_CLEAR( generator->m_frame->m_frame.f_back );
generator->m_frame->m_frame.f_back = PyThreadState_GET()->frame;
Py_INCREF( generator->m_frame->m_frame.f_back );
PyThreadState_GET()->frame = &generator->m_frame->m_frame;
Py_INCREF( generator->m_frame );
Nuitka_Frame_MarkAsExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
// Accept currently existing exception as the one to publish again when we
// yield or yield from.
PyThreadState *thread_state = PyThreadState_GET();
generator->m_frame->m_frame.f_exc_type = thread_state->exc_type;
if ( generator->m_frame->m_frame.f_exc_type == Py_None ) generator->m_frame->m_frame.f_exc_type = NULL;
Py_XINCREF( generator->m_frame->m_frame.f_exc_type );
generator->m_frame->m_frame.f_exc_value = thread_state->exc_value;
Py_XINCREF( generator->m_frame->m_frame.f_exc_value );
generator->m_frame->m_frame.f_exc_traceback = thread_state->exc_traceback;
Py_XINCREF( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Framed code:
if ( generator->m_closure[0] == NULL )
{
tmp_iter_arg_1 = NULL;
}
else
{
tmp_iter_arg_1 = PyCell_GET( generator->m_closure[0] );
}
if ( tmp_iter_arg_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "input_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 222;
type_description_1 = "coo";
goto frame_exception_exit_1;
}
tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 222;
type_description_1 = "coo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_1;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_2 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_2 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "coo";
exception_lineno = 222;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_2;
Py_XDECREF( old );
}
tmp_assign_source_3 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_3 );
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_3;
Py_INCREF( var_ch );
Py_XDECREF( old );
}
tmp_compare_left_1 = var_ch;
CHECK_OBJECT( tmp_compare_left_1 );
tmp_compare_right_1 = const_str_chr_92;
tmp_cmp_NotEq_1 = RICH_COMPARE_BOOL_NE( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_NotEq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 223;
type_description_1 = "coo";
goto try_except_handler_2;
}
if ( tmp_cmp_NotEq_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_expression_name_1 = PyTuple_New( 2 );
tmp_tuple_element_1 = var_ch;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_expression_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 224;
type_description_1 = "coo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_expression_name_1, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = Py_False;
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_expression_name_1, 1, tmp_tuple_element_1 );
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 224;
type_description_1 = "coo";
goto try_except_handler_2;
}
goto loop_start_1;
branch_no_1:;
if ( generator->m_closure[0] == NULL )
{
tmp_value_name_1 = NULL;
}
else
{
tmp_value_name_1 = PyCell_GET( generator->m_closure[0] );
}
if ( tmp_value_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "free variable '%s' referenced before assignment in enclosing scope", "input_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 226;
type_description_1 = "coo";
goto try_except_handler_2;
}
tmp_assign_source_4 = ITERATOR_NEXT( tmp_value_name_1 );
if ( tmp_assign_source_4 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "coo";
exception_lineno = 226;
goto try_except_handler_2;
}
{
PyObject *old = var_ch;
var_ch = tmp_assign_source_4;
Py_XDECREF( old );
}
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_ESCAPE_MAPPINGS );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_ESCAPE_MAPPINGS );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "ESCAPE_MAPPINGS" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 227;
type_description_1 = "coo";
goto try_except_handler_2;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_get );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 227;
type_description_1 = "coo";
goto try_except_handler_2;
}
tmp_args_element_name_1 = var_ch;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 227;
type_description_1 = "coo";
goto try_except_handler_2;
}
tmp_args_element_name_2 = var_ch;
if ( tmp_args_element_name_2 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 227;
type_description_1 = "coo";
goto try_except_handler_2;
}
generator->m_frame->m_frame.f_lineno = 227;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_assign_source_5 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_assign_source_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 227;
type_description_1 = "coo";
goto try_except_handler_2;
}
{
PyObject *old = var_representative;
var_representative = tmp_assign_source_5;
Py_XDECREF( old );
}
tmp_compare_left_2 = var_representative;
CHECK_OBJECT( tmp_compare_left_2 );
tmp_compare_right_2 = Py_None;
tmp_is_1 = ( tmp_compare_left_2 == tmp_compare_right_2 );
if ( tmp_is_1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
goto loop_start_1;
branch_no_2:;
tmp_expression_name_2 = PyTuple_New( 2 );
tmp_tuple_element_2 = var_representative;
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_expression_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "representative" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 230;
type_description_1 = "coo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_expression_name_2, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = Py_True;
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_expression_name_2, 1, tmp_tuple_element_2 );
tmp_unused = GENERATOR_YIELD( generator, tmp_expression_name_2 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 230;
type_description_1 = "coo";
goto try_except_handler_2;
}
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 222;
type_description_1 = "coo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Nuitka_Frame_MarkAsNotExecuting( generator->m_frame );
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
// Allow re-use of the frame again.
Py_DECREF( generator->m_frame );
goto frame_no_exception_1;
frame_exception_exit_1:;
// If it's not an exit exception, consider and create a traceback for it.
if ( !EXCEPTION_MATCH_GENERATOR( exception_type ) )
{
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( generator->m_frame, exception_lineno );
}
else if ( exception_tb->tb_frame != &generator->m_frame->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, generator->m_frame, exception_lineno );
}
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)generator->m_frame,
type_description_1,
generator->m_closure[0],
var_ch,
var_representative
);
// Release cached frame.
if ( generator->m_frame == cache_frame_generator )
{
Py_DECREF( generator->m_frame );
}
cache_frame_generator = NULL;
assertFrameObject( generator->m_frame );
}
#if PYTHON_VERSION >= 300
Py_CLEAR( generator->m_frame->m_frame.f_exc_type );
Py_CLEAR( generator->m_frame->m_frame.f_exc_value );
Py_CLEAR( generator->m_frame->m_frame.f_exc_traceback );
#endif
Py_DECREF( generator->m_frame );
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( var_ch );
var_ch = NULL;
Py_XDECREF( var_representative );
var_representative = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
try_end_2:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
Py_XDECREF( var_ch );
var_ch = NULL;
Py_XDECREF( var_representative );
var_representative = NULL;
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
#if _NUITKA_EXPERIMENTAL_GENERATOR_GOTO
return NULL;
#else
generator->m_yielded = NULL;
return;
#endif
}
static PyObject *impl_django$utils$regex_helper$$$function_3_walk_to_end( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_ch = python_pars[ 0 ];
PyObject *par_input_iter = python_pars[ 1 ];
PyObject *var_nesting = NULL;
PyObject *var_escaped = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
int tmp_cmp_Eq_1;
int tmp_cmp_Eq_2;
int tmp_cmp_Eq_3;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_left_name_1;
PyObject *tmp_left_name_2;
PyObject *tmp_next_source_1;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
PyObject *tmp_right_name_2;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
static struct Nuitka_FrameObject *cache_frame_3064079d76426a0e23f26ffe15c6dc56 = NULL;
struct Nuitka_FrameObject *frame_3064079d76426a0e23f26ffe15c6dc56;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_3064079d76426a0e23f26ffe15c6dc56, codeobj_3064079d76426a0e23f26ffe15c6dc56, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_3064079d76426a0e23f26ffe15c6dc56 = cache_frame_3064079d76426a0e23f26ffe15c6dc56;
// Push the new frame as the currently active one.
pushFrameStack( frame_3064079d76426a0e23f26ffe15c6dc56 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_3064079d76426a0e23f26ffe15c6dc56 ) == 2 ); // Frame stack
// Framed code:
tmp_compare_left_1 = par_ch;
CHECK_OBJECT( tmp_compare_left_1 );
tmp_compare_right_1 = const_str_chr_40;
tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_1, tmp_compare_right_1 );
if ( tmp_cmp_Eq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 239;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_Eq_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_assign_source_1 = const_int_pos_1;
assert( var_nesting == NULL );
Py_INCREF( tmp_assign_source_1 );
var_nesting = tmp_assign_source_1;
goto branch_end_1;
branch_no_1:;
tmp_assign_source_2 = const_int_0;
assert( var_nesting == NULL );
Py_INCREF( tmp_assign_source_2 );
var_nesting = tmp_assign_source_2;
branch_end_1:;
tmp_iter_arg_1 = par_input_iter;
if ( tmp_iter_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "input_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 243;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
tmp_assign_source_3 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_assign_source_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 243;
type_description_1 = "oooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_3;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_4 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_4 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooo";
exception_lineno = 243;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_4;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_2 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_iter_arg_2 );
tmp_assign_source_5 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 243;
type_description_1 = "oooo";
goto try_except_handler_3;
}
{
PyObject *old = tmp_tuple_unpack_1__source_iter;
tmp_tuple_unpack_1__source_iter = tmp_assign_source_5;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_6 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_6 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooo";
exception_lineno = 243;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_1;
tmp_tuple_unpack_1__element_1 = tmp_assign_source_6;
Py_XDECREF( old );
}
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_7 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_7 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooo";
exception_lineno = 243;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_2;
tmp_tuple_unpack_1__element_2 = tmp_assign_source_7;
Py_XDECREF( old );
}
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooo";
exception_lineno = 243;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooo";
exception_lineno = 243;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_8 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_8 );
{
PyObject *old = par_ch;
par_ch = tmp_assign_source_8;
Py_INCREF( par_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_9 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_9 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_9;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
tmp_cond_value_1 = var_escaped;
if ( tmp_cond_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "escaped" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 244;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 244;
type_description_1 = "oooo";
goto try_except_handler_2;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
goto loop_start_1;
goto branch_end_2;
branch_no_2:;
tmp_compare_left_2 = par_ch;
if ( tmp_compare_left_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 246;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_compare_right_2 = const_str_chr_40;
tmp_cmp_Eq_2 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_2, tmp_compare_right_2 );
if ( tmp_cmp_Eq_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 246;
type_description_1 = "oooo";
goto try_except_handler_2;
}
if ( tmp_cmp_Eq_2 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_left_name_1 = var_nesting;
if ( tmp_left_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "nesting" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 247;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_right_name_1 = const_int_pos_1;
tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_1, tmp_right_name_1 );
tmp_assign_source_10 = tmp_left_name_1;
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 247;
type_description_1 = "oooo";
goto try_except_handler_2;
}
var_nesting = tmp_assign_source_10;
goto branch_end_3;
branch_no_3:;
tmp_compare_left_3 = par_ch;
if ( tmp_compare_left_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 248;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_compare_right_3 = const_str_chr_41;
tmp_cmp_Eq_3 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_3, tmp_compare_right_3 );
if ( tmp_cmp_Eq_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 248;
type_description_1 = "oooo";
goto try_except_handler_2;
}
if ( tmp_cmp_Eq_3 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
tmp_cond_value_2 = var_nesting;
if ( tmp_cond_value_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "nesting" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 249;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 249;
type_description_1 = "oooo";
goto try_except_handler_2;
}
if ( tmp_cond_truth_2 == 1 )
{
goto branch_no_5;
}
else
{
goto branch_yes_5;
}
branch_yes_5:;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_2;
branch_no_5:;
tmp_left_name_2 = var_nesting;
if ( tmp_left_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "nesting" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 251;
type_description_1 = "oooo";
goto try_except_handler_2;
}
tmp_right_name_2 = const_int_pos_1;
tmp_result = BINARY_OPERATION_INPLACE( PyNumber_InPlaceSubtract, &tmp_left_name_2, tmp_right_name_2 );
tmp_assign_source_11 = tmp_left_name_2;
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 251;
type_description_1 = "oooo";
goto try_except_handler_2;
}
var_nesting = tmp_assign_source_11;
branch_no_4:;
branch_end_3:;
branch_end_2:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 243;
type_description_1 = "oooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_3;
// Return handler code:
try_return_handler_2:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3064079d76426a0e23f26ffe15c6dc56 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3064079d76426a0e23f26ffe15c6dc56 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3064079d76426a0e23f26ffe15c6dc56 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_3064079d76426a0e23f26ffe15c6dc56, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_3064079d76426a0e23f26ffe15c6dc56->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_3064079d76426a0e23f26ffe15c6dc56, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_3064079d76426a0e23f26ffe15c6dc56,
type_description_1,
par_ch,
par_input_iter,
var_nesting,
var_escaped
);
// Release cached frame.
if ( frame_3064079d76426a0e23f26ffe15c6dc56 == cache_frame_3064079d76426a0e23f26ffe15c6dc56 )
{
Py_DECREF( frame_3064079d76426a0e23f26ffe15c6dc56 );
}
cache_frame_3064079d76426a0e23f26ffe15c6dc56 = NULL;
assertFrameObject( frame_3064079d76426a0e23f26ffe15c6dc56 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_return_value = Py_None;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_3_walk_to_end );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_ch );
par_ch = NULL;
Py_XDECREF( par_input_iter );
par_input_iter = NULL;
Py_XDECREF( var_nesting );
var_nesting = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_ch );
par_ch = NULL;
Py_XDECREF( par_input_iter );
par_input_iter = NULL;
Py_XDECREF( var_nesting );
var_nesting = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_3_walk_to_end );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$utils$regex_helper$$$function_4_get_quantifier( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_ch = python_pars[ 0 ];
PyObject *par_input_iter = python_pars[ 1 ];
PyObject *var_ch2 = NULL;
PyObject *var_escaped = NULL;
PyObject *var_quant = NULL;
PyObject *var_values = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *tmp_tuple_unpack_2__element_1 = NULL;
PyObject *tmp_tuple_unpack_2__element_2 = NULL;
PyObject *tmp_tuple_unpack_2__source_iter = NULL;
PyObject *tmp_tuple_unpack_3__element_1 = NULL;
PyObject *tmp_tuple_unpack_3__element_2 = NULL;
PyObject *tmp_tuple_unpack_3__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
PyObject *exception_keeper_type_8;
PyObject *exception_keeper_value_8;
PyTracebackObject *exception_keeper_tb_8;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_8;
PyObject *exception_keeper_type_9;
PyObject *exception_keeper_value_9;
PyTracebackObject *exception_keeper_tb_9;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_9;
PyObject *exception_keeper_type_10;
PyObject *exception_keeper_value_10;
PyTracebackObject *exception_keeper_tb_10;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_10;
PyObject *exception_keeper_type_11;
PyObject *exception_keeper_value_11;
PyTracebackObject *exception_keeper_tb_11;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_11;
PyObject *exception_preserved_type_1;
PyObject *exception_preserved_value_1;
PyTracebackObject *exception_preserved_tb_1;
PyObject *exception_preserved_type_2;
PyObject *exception_preserved_value_2;
PyTracebackObject *exception_preserved_tb_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
PyObject *tmp_assign_source_12;
PyObject *tmp_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_called_instance_1;
PyObject *tmp_called_instance_2;
PyObject *tmp_called_name_1;
int tmp_cmp_Eq_1;
int tmp_cmp_Eq_2;
int tmp_cmp_Eq_3;
int tmp_cmp_In_1;
int tmp_cmp_NotEq_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_left_4;
PyObject *tmp_compare_left_5;
PyObject *tmp_compare_left_6;
PyObject *tmp_compare_left_7;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
PyObject *tmp_compare_right_4;
PyObject *tmp_compare_right_5;
PyObject *tmp_compare_right_6;
PyObject *tmp_compare_right_7;
int tmp_exc_match_exception_match_1;
int tmp_exc_match_exception_match_2;
PyObject *tmp_int_arg_1;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_iterator_name_2;
PyObject *tmp_iterator_name_3;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_source_name_1;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
PyObject *tmp_unpack_3;
PyObject *tmp_unpack_4;
PyObject *tmp_unpack_5;
PyObject *tmp_unpack_6;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
PyObject *tmp_value_name_1;
PyObject *tmp_value_name_2;
PyObject *tmp_value_name_3;
static struct Nuitka_FrameObject *cache_frame_1e148640a480b197863191e98c3d7616 = NULL;
struct Nuitka_FrameObject *frame_1e148640a480b197863191e98c3d7616;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_1e148640a480b197863191e98c3d7616, codeobj_1e148640a480b197863191e98c3d7616, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_1e148640a480b197863191e98c3d7616 = cache_frame_1e148640a480b197863191e98c3d7616;
// Push the new frame as the currently active one.
pushFrameStack( frame_1e148640a480b197863191e98c3d7616 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_1e148640a480b197863191e98c3d7616 ) == 2 ); // Frame stack
// Framed code:
tmp_compare_left_1 = par_ch;
CHECK_OBJECT( tmp_compare_left_1 );
tmp_compare_right_1 = const_str_digest_5b09b80325ee0dd36701426ec342c9bd;
tmp_cmp_In_1 = PySequence_Contains( tmp_compare_right_1, tmp_compare_left_1 );
assert( !(tmp_cmp_In_1 == -1) );
if ( tmp_cmp_In_1 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
// Tried code:
// Tried code:
tmp_value_name_1 = par_input_iter;
CHECK_OBJECT( tmp_value_name_1 );
tmp_iter_arg_1 = ITERATOR_NEXT( tmp_value_name_1 );
if ( tmp_iter_arg_1 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 265;
goto try_except_handler_3;
}
tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 265;
type_description_1 = "oooooo";
goto try_except_handler_3;
}
assert( tmp_tuple_unpack_1__source_iter == NULL );
tmp_tuple_unpack_1__source_iter = tmp_assign_source_1;
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_2 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_2 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 265;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_1 == NULL );
tmp_tuple_unpack_1__element_1 = tmp_assign_source_2;
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_3 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_3 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 265;
goto try_except_handler_4;
}
assert( tmp_tuple_unpack_1__element_2 == NULL );
tmp_tuple_unpack_1__element_2 = tmp_assign_source_3;
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 265;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 265;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_4 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_4 );
assert( var_ch2 == NULL );
Py_INCREF( tmp_assign_source_4 );
var_ch2 = tmp_assign_source_4;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_5 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_5 );
assert( var_escaped == NULL );
Py_INCREF( tmp_assign_source_5 );
var_escaped = tmp_assign_source_5;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
goto try_end_3;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Preserve existing published exception.
exception_preserved_type_1 = PyThreadState_GET()->exc_type;
Py_XINCREF( exception_preserved_type_1 );
exception_preserved_value_1 = PyThreadState_GET()->exc_value;
Py_XINCREF( exception_preserved_value_1 );
exception_preserved_tb_1 = (PyTracebackObject *)PyThreadState_GET()->exc_traceback;
Py_XINCREF( exception_preserved_tb_1 );
if ( exception_keeper_tb_3 == NULL )
{
exception_keeper_tb_3 = MAKE_TRACEBACK( frame_1e148640a480b197863191e98c3d7616, exception_keeper_lineno_3 );
}
else if ( exception_keeper_lineno_3 != 0 )
{
exception_keeper_tb_3 = ADD_TRACEBACK( exception_keeper_tb_3, frame_1e148640a480b197863191e98c3d7616, exception_keeper_lineno_3 );
}
NORMALIZE_EXCEPTION( &exception_keeper_type_3, &exception_keeper_value_3, &exception_keeper_tb_3 );
PyException_SetTraceback( exception_keeper_value_3, (PyObject *)exception_keeper_tb_3 );
PUBLISH_EXCEPTION( &exception_keeper_type_3, &exception_keeper_value_3, &exception_keeper_tb_3 );
// Tried code:
tmp_compare_left_2 = PyThreadState_GET()->exc_type;
tmp_compare_right_2 = PyExc_StopIteration;
tmp_exc_match_exception_match_1 = EXCEPTION_MATCH_BOOL( tmp_compare_left_2, tmp_compare_right_2 );
if ( tmp_exc_match_exception_match_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 266;
type_description_1 = "oooooo";
goto try_except_handler_5;
}
if ( tmp_exc_match_exception_match_1 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_assign_source_6 = Py_None;
assert( var_ch2 == NULL );
Py_INCREF( tmp_assign_source_6 );
var_ch2 = tmp_assign_source_6;
goto branch_end_2;
branch_no_2:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 264;
}
if (exception_tb && exception_tb->tb_frame == &frame_1e148640a480b197863191e98c3d7616->m_frame) frame_1e148640a480b197863191e98c3d7616->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "oooooo";
goto try_except_handler_5;
branch_end_2:;
goto try_end_4;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto frame_exception_exit_1;
// End of try:
try_end_4:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_1, exception_preserved_value_1, exception_preserved_tb_1 );
goto try_end_3;
// exception handler codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_4_get_quantifier );
return NULL;
// End of try:
try_end_3:;
tmp_compare_left_3 = var_ch2;
if ( tmp_compare_left_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch2" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 268;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_3 = const_str_chr_63;
tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_3, tmp_compare_right_3 );
if ( tmp_cmp_Eq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 268;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_Eq_1 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_assign_source_7 = Py_None;
{
PyObject *old = var_ch2;
var_ch2 = tmp_assign_source_7;
Py_INCREF( var_ch2 );
Py_XDECREF( old );
}
branch_no_3:;
tmp_compare_left_4 = par_ch;
if ( tmp_compare_left_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 270;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_4 = const_str_chr_43;
tmp_cmp_Eq_2 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_4, tmp_compare_right_4 );
if ( tmp_cmp_Eq_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 270;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_Eq_2 == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
tmp_return_value = PyTuple_New( 2 );
tmp_tuple_element_1 = const_int_pos_1;
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = var_ch2;
if ( tmp_tuple_element_1 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch2" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 271;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
goto frame_return_exit_1;
branch_no_4:;
tmp_return_value = PyTuple_New( 2 );
tmp_tuple_element_2 = const_int_0;
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = var_ch2;
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch2" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 272;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_2 );
goto frame_return_exit_1;
branch_no_1:;
tmp_assign_source_8 = PyList_New( 0 );
assert( var_quant == NULL );
var_quant = tmp_assign_source_8;
loop_start_1:;
tmp_compare_left_5 = par_ch;
if ( tmp_compare_left_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 275;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_5 = const_str_chr_125;
tmp_cmp_NotEq_1 = RICH_COMPARE_BOOL_NE( tmp_compare_left_5, tmp_compare_right_5 );
if ( tmp_cmp_NotEq_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 275;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_NotEq_1 == 1 )
{
goto branch_no_5;
}
else
{
goto branch_yes_5;
}
branch_yes_5:;
goto loop_end_1;
branch_no_5:;
// Tried code:
tmp_value_name_2 = par_input_iter;
if ( tmp_value_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "input_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 276;
type_description_1 = "oooooo";
goto try_except_handler_6;
}
tmp_iter_arg_2 = ITERATOR_NEXT( tmp_value_name_2 );
if ( tmp_iter_arg_2 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 276;
goto try_except_handler_6;
}
tmp_assign_source_9 = MAKE_ITERATOR( tmp_iter_arg_2 );
Py_DECREF( tmp_iter_arg_2 );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 276;
type_description_1 = "oooooo";
goto try_except_handler_6;
}
{
PyObject *old = tmp_tuple_unpack_2__source_iter;
tmp_tuple_unpack_2__source_iter = tmp_assign_source_9;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_3 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_3 );
tmp_assign_source_10 = UNPACK_NEXT( tmp_unpack_3, 0, 2 );
if ( tmp_assign_source_10 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 276;
goto try_except_handler_7;
}
{
PyObject *old = tmp_tuple_unpack_2__element_1;
tmp_tuple_unpack_2__element_1 = tmp_assign_source_10;
Py_XDECREF( old );
}
tmp_unpack_4 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_4 );
tmp_assign_source_11 = UNPACK_NEXT( tmp_unpack_4, 1, 2 );
if ( tmp_assign_source_11 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 276;
goto try_except_handler_7;
}
{
PyObject *old = tmp_tuple_unpack_2__element_2;
tmp_tuple_unpack_2__element_2 = tmp_assign_source_11;
Py_XDECREF( old );
}
tmp_iterator_name_2 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_iterator_name_2 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_2 ); assert( HAS_ITERNEXT( tmp_iterator_name_2 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_2 )->tp_iternext)( tmp_iterator_name_2 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 276;
goto try_except_handler_7;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 276;
goto try_except_handler_7;
}
goto try_end_5;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto try_except_handler_6;
// End of try:
try_end_5:;
goto try_end_6;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto frame_exception_exit_1;
// End of try:
try_end_6:;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
tmp_assign_source_12 = tmp_tuple_unpack_2__element_1;
CHECK_OBJECT( tmp_assign_source_12 );
{
PyObject *old = par_ch;
par_ch = tmp_assign_source_12;
Py_INCREF( par_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
tmp_assign_source_13 = tmp_tuple_unpack_2__element_2;
CHECK_OBJECT( tmp_assign_source_13 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_13;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
tmp_source_name_1 = var_quant;
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "quant" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 277;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_called_name_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_append );
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 277;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = par_ch;
if ( tmp_args_element_name_1 == NULL )
{
Py_DECREF( tmp_called_name_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 277;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
frame_1e148640a480b197863191e98c3d7616->m_frame.f_lineno = 277;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
Py_DECREF( tmp_called_name_1 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 277;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 275;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
goto loop_start_1;
loop_end_1:;
tmp_subscribed_name_1 = var_quant;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "quant" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 278;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_slice_none_int_neg_1_none;
tmp_assign_source_14 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_assign_source_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 278;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
{
PyObject *old = var_quant;
var_quant = tmp_assign_source_14;
Py_XDECREF( old );
}
tmp_called_instance_2 = const_str_empty;
tmp_args_element_name_2 = var_quant;
CHECK_OBJECT( tmp_args_element_name_2 );
frame_1e148640a480b197863191e98c3d7616->m_frame.f_lineno = 279;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_called_instance_1 = CALL_METHOD_WITH_ARGS1( tmp_called_instance_2, const_str_plain_join, call_args );
}
if ( tmp_called_instance_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 279;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
frame_1e148640a480b197863191e98c3d7616->m_frame.f_lineno = 279;
tmp_assign_source_15 = CALL_METHOD_WITH_ARGS1( tmp_called_instance_1, const_str_plain_split, &PyTuple_GET_ITEM( const_tuple_str_chr_44_tuple, 0 ) );
Py_DECREF( tmp_called_instance_1 );
if ( tmp_assign_source_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 279;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
assert( var_values == NULL );
var_values = tmp_assign_source_15;
// Tried code:
// Tried code:
tmp_value_name_3 = par_input_iter;
if ( tmp_value_name_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "input_iter" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 283;
type_description_1 = "oooooo";
goto try_except_handler_9;
}
tmp_iter_arg_3 = ITERATOR_NEXT( tmp_value_name_3 );
if ( tmp_iter_arg_3 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 283;
goto try_except_handler_9;
}
tmp_assign_source_16 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 283;
type_description_1 = "oooooo";
goto try_except_handler_9;
}
assert( tmp_tuple_unpack_3__source_iter == NULL );
tmp_tuple_unpack_3__source_iter = tmp_assign_source_16;
// Tried code:
tmp_unpack_5 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_5 );
tmp_assign_source_17 = UNPACK_NEXT( tmp_unpack_5, 0, 2 );
if ( tmp_assign_source_17 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 283;
goto try_except_handler_10;
}
assert( tmp_tuple_unpack_3__element_1 == NULL );
tmp_tuple_unpack_3__element_1 = tmp_assign_source_17;
tmp_unpack_6 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_6 );
tmp_assign_source_18 = UNPACK_NEXT( tmp_unpack_6, 1, 2 );
if ( tmp_assign_source_18 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "oooooo";
exception_lineno = 283;
goto try_except_handler_10;
}
assert( tmp_tuple_unpack_3__element_2 == NULL );
tmp_tuple_unpack_3__element_2 = tmp_assign_source_18;
tmp_iterator_name_3 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_iterator_name_3 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_3 ); assert( HAS_ITERNEXT( tmp_iterator_name_3 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_3 )->tp_iternext)( tmp_iterator_name_3 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 283;
goto try_except_handler_10;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "oooooo";
exception_lineno = 283;
goto try_except_handler_10;
}
goto try_end_7;
// Exception handler code:
try_except_handler_10:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto try_except_handler_9;
// End of try:
try_end_7:;
goto try_end_8;
// Exception handler code:
try_except_handler_9:;
exception_keeper_type_8 = exception_type;
exception_keeper_value_8 = exception_value;
exception_keeper_tb_8 = exception_tb;
exception_keeper_lineno_8 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_8;
exception_value = exception_keeper_value_8;
exception_tb = exception_keeper_tb_8;
exception_lineno = exception_keeper_lineno_8;
goto try_except_handler_8;
// End of try:
try_end_8:;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
tmp_assign_source_19 = tmp_tuple_unpack_3__element_1;
CHECK_OBJECT( tmp_assign_source_19 );
{
PyObject *old = par_ch;
par_ch = tmp_assign_source_19;
Py_INCREF( par_ch );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
tmp_assign_source_20 = tmp_tuple_unpack_3__element_2;
CHECK_OBJECT( tmp_assign_source_20 );
{
PyObject *old = var_escaped;
var_escaped = tmp_assign_source_20;
Py_INCREF( var_escaped );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
goto try_end_9;
// Exception handler code:
try_except_handler_8:;
exception_keeper_type_9 = exception_type;
exception_keeper_value_9 = exception_value;
exception_keeper_tb_9 = exception_tb;
exception_keeper_lineno_9 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Preserve existing published exception.
exception_preserved_type_2 = PyThreadState_GET()->exc_type;
Py_XINCREF( exception_preserved_type_2 );
exception_preserved_value_2 = PyThreadState_GET()->exc_value;
Py_XINCREF( exception_preserved_value_2 );
exception_preserved_tb_2 = (PyTracebackObject *)PyThreadState_GET()->exc_traceback;
Py_XINCREF( exception_preserved_tb_2 );
if ( exception_keeper_tb_9 == NULL )
{
exception_keeper_tb_9 = MAKE_TRACEBACK( frame_1e148640a480b197863191e98c3d7616, exception_keeper_lineno_9 );
}
else if ( exception_keeper_lineno_9 != 0 )
{
exception_keeper_tb_9 = ADD_TRACEBACK( exception_keeper_tb_9, frame_1e148640a480b197863191e98c3d7616, exception_keeper_lineno_9 );
}
NORMALIZE_EXCEPTION( &exception_keeper_type_9, &exception_keeper_value_9, &exception_keeper_tb_9 );
PyException_SetTraceback( exception_keeper_value_9, (PyObject *)exception_keeper_tb_9 );
PUBLISH_EXCEPTION( &exception_keeper_type_9, &exception_keeper_value_9, &exception_keeper_tb_9 );
// Tried code:
tmp_compare_left_6 = PyThreadState_GET()->exc_type;
tmp_compare_right_6 = PyExc_StopIteration;
tmp_exc_match_exception_match_2 = EXCEPTION_MATCH_BOOL( tmp_compare_left_6, tmp_compare_right_6 );
if ( tmp_exc_match_exception_match_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 284;
type_description_1 = "oooooo";
goto try_except_handler_11;
}
if ( tmp_exc_match_exception_match_2 == 1 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
tmp_assign_source_21 = Py_None;
{
PyObject *old = par_ch;
par_ch = tmp_assign_source_21;
Py_INCREF( par_ch );
Py_XDECREF( old );
}
goto branch_end_6;
branch_no_6:;
tmp_result = RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
if (unlikely( tmp_result == false ))
{
exception_lineno = 282;
}
if (exception_tb && exception_tb->tb_frame == &frame_1e148640a480b197863191e98c3d7616->m_frame) frame_1e148640a480b197863191e98c3d7616->m_frame.f_lineno = exception_tb->tb_lineno;
type_description_1 = "oooooo";
goto try_except_handler_11;
branch_end_6:;
goto try_end_10;
// Exception handler code:
try_except_handler_11:;
exception_keeper_type_10 = exception_type;
exception_keeper_value_10 = exception_value;
exception_keeper_tb_10 = exception_tb;
exception_keeper_lineno_10 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_2, exception_preserved_value_2, exception_preserved_tb_2 );
// Re-raise.
exception_type = exception_keeper_type_10;
exception_value = exception_keeper_value_10;
exception_tb = exception_keeper_tb_10;
exception_lineno = exception_keeper_lineno_10;
goto frame_exception_exit_1;
// End of try:
try_end_10:;
// Restore previous exception.
SET_CURRENT_EXCEPTION( exception_preserved_type_2, exception_preserved_value_2, exception_preserved_tb_2 );
goto try_end_9;
// exception handler codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_4_get_quantifier );
return NULL;
// End of try:
try_end_9:;
tmp_compare_left_7 = par_ch;
if ( tmp_compare_left_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 286;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_7 = const_str_chr_63;
tmp_cmp_Eq_3 = RICH_COMPARE_BOOL_EQ( tmp_compare_left_7, tmp_compare_right_7 );
if ( tmp_cmp_Eq_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 286;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_Eq_3 == 1 )
{
goto branch_yes_7;
}
else
{
goto branch_no_7;
}
branch_yes_7:;
tmp_assign_source_22 = Py_None;
{
PyObject *old = par_ch;
par_ch = tmp_assign_source_22;
Py_INCREF( par_ch );
Py_XDECREF( old );
}
branch_no_7:;
tmp_return_value = PyTuple_New( 2 );
tmp_subscribed_name_2 = var_values;
if ( tmp_subscribed_name_2 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "values" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 288;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_2 = const_int_0;
tmp_int_arg_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
if ( tmp_int_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
exception_lineno = 288;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
tmp_tuple_element_3 = PyNumber_Int( tmp_int_arg_1 );
Py_DECREF( tmp_int_arg_1 );
if ( tmp_tuple_element_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
exception_lineno = 288;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_3 );
tmp_tuple_element_3 = par_ch;
if ( tmp_tuple_element_3 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "ch" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 288;
type_description_1 = "oooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_3 );
goto frame_return_exit_1;
#if 1
RESTORE_FRAME_EXCEPTION( frame_1e148640a480b197863191e98c3d7616 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_1e148640a480b197863191e98c3d7616 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 1
RESTORE_FRAME_EXCEPTION( frame_1e148640a480b197863191e98c3d7616 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_1e148640a480b197863191e98c3d7616, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_1e148640a480b197863191e98c3d7616->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_1e148640a480b197863191e98c3d7616, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_1e148640a480b197863191e98c3d7616,
type_description_1,
par_ch,
par_input_iter,
var_ch2,
var_escaped,
var_quant,
var_values
);
// Release cached frame.
if ( frame_1e148640a480b197863191e98c3d7616 == cache_frame_1e148640a480b197863191e98c3d7616 )
{
Py_DECREF( frame_1e148640a480b197863191e98c3d7616 );
}
cache_frame_1e148640a480b197863191e98c3d7616 = NULL;
assertFrameObject( frame_1e148640a480b197863191e98c3d7616 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_4_get_quantifier );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_ch );
par_ch = NULL;
Py_XDECREF( par_input_iter );
par_input_iter = NULL;
Py_XDECREF( var_ch2 );
var_ch2 = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
Py_XDECREF( var_quant );
var_quant = NULL;
Py_XDECREF( var_values );
var_values = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_11 = exception_type;
exception_keeper_value_11 = exception_value;
exception_keeper_tb_11 = exception_tb;
exception_keeper_lineno_11 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_ch );
par_ch = NULL;
Py_XDECREF( par_input_iter );
par_input_iter = NULL;
Py_XDECREF( var_ch2 );
var_ch2 = NULL;
Py_XDECREF( var_escaped );
var_escaped = NULL;
Py_XDECREF( var_quant );
var_quant = NULL;
Py_XDECREF( var_values );
var_values = NULL;
// Re-raise.
exception_type = exception_keeper_type_11;
exception_value = exception_keeper_value_11;
exception_tb = exception_keeper_tb_11;
exception_lineno = exception_keeper_lineno_11;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_4_get_quantifier );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$utils$regex_helper$$$function_5_contains( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_source = python_pars[ 0 ];
PyObject *par_inst = python_pars[ 1 ];
PyObject *var_elt = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_called_name_1;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
PyObject *tmp_isinstance_cls_1;
PyObject *tmp_isinstance_cls_2;
PyObject *tmp_isinstance_inst_1;
PyObject *tmp_isinstance_inst_2;
PyObject *tmp_iter_arg_1;
PyObject *tmp_next_source_1;
int tmp_res;
PyObject *tmp_return_value;
static struct Nuitka_FrameObject *cache_frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 = NULL;
struct Nuitka_FrameObject *frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
MAKE_OR_REUSE_FRAME( cache_frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0, codeobj_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 = cache_frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0;
// Push the new frame as the currently active one.
pushFrameStack( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 ) == 2 ); // Frame stack
// Framed code:
tmp_isinstance_inst_1 = par_source;
CHECK_OBJECT( tmp_isinstance_inst_1 );
tmp_isinstance_cls_1 = par_inst;
CHECK_OBJECT( tmp_isinstance_cls_1 );
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_1, tmp_isinstance_cls_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 296;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
if ( tmp_res == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_return_value = Py_True;
Py_INCREF( tmp_return_value );
goto frame_return_exit_1;
branch_no_1:;
tmp_isinstance_inst_2 = par_source;
CHECK_OBJECT( tmp_isinstance_inst_2 );
tmp_isinstance_cls_2 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_NonCapture );
if (unlikely( tmp_isinstance_cls_2 == NULL ))
{
tmp_isinstance_cls_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_NonCapture );
}
if ( tmp_isinstance_cls_2 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "NonCapture" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 298;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_2, tmp_isinstance_cls_2 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 298;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
if ( tmp_res == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_iter_arg_1 = par_source;
CHECK_OBJECT( tmp_iter_arg_1 );
tmp_assign_source_1 = MAKE_ITERATOR( tmp_iter_arg_1 );
if ( tmp_assign_source_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_1;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_2 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_2 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooo";
exception_lineno = 299;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_2;
Py_XDECREF( old );
}
tmp_assign_source_3 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_assign_source_3 );
{
PyObject *old = var_elt;
var_elt = tmp_assign_source_3;
Py_INCREF( var_elt );
Py_XDECREF( old );
}
tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_contains );
if (unlikely( tmp_called_name_1 == NULL ))
{
tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_contains );
}
if ( tmp_called_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "contains" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 300;
type_description_1 = "ooo";
goto try_except_handler_2;
}
tmp_args_element_name_1 = var_elt;
CHECK_OBJECT( tmp_args_element_name_1 );
tmp_args_element_name_2 = par_inst;
if ( tmp_args_element_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 300;
type_description_1 = "ooo";
goto try_except_handler_2;
}
frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0->m_frame.f_lineno = 300;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
if ( tmp_cond_value_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 300;
type_description_1 = "ooo";
goto try_except_handler_2;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_cond_value_1 );
exception_lineno = 300;
type_description_1 = "ooo";
goto try_except_handler_2;
}
Py_DECREF( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_return_value = Py_True;
Py_INCREF( tmp_return_value );
goto try_return_handler_2;
branch_no_3:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 299;
type_description_1 = "ooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_1;
// Return handler code:
try_return_handler_2:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
goto frame_return_exit_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
branch_no_2:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0,
type_description_1,
par_source,
par_inst,
var_elt
);
// Release cached frame.
if ( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 == cache_frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 )
{
Py_DECREF( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
}
cache_frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 = NULL;
assertFrameObject( frame_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
tmp_return_value = Py_False;
Py_INCREF( tmp_return_value );
goto try_return_handler_1;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_5_contains );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_inst );
par_inst = NULL;
Py_XDECREF( var_elt );
var_elt = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( par_inst );
par_inst = NULL;
Py_XDECREF( var_elt );
var_elt = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_5_contains );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *impl_django$utils$regex_helper$$$function_6_flatten_result( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
{
// Preserve error status for checks
#ifndef __NUITKA_NO_ASSERT__
NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
#endif
// Local variable declarations.
PyObject *par_source = python_pars[ 0 ];
PyObject *var_params = NULL;
PyObject *var_result = NULL;
PyObject *var_result_args = NULL;
PyObject *var_pos = NULL;
PyObject *var_last = NULL;
PyObject *var_elt = NULL;
PyObject *var_piece = NULL;
PyObject *var_param = NULL;
PyObject *var_i = NULL;
PyObject *var_inner_result = NULL;
PyObject *var_inner_args = NULL;
PyObject *var_item = NULL;
PyObject *var_res = NULL;
PyObject *var_args = NULL;
PyObject *var_new_result = NULL;
PyObject *var_new_args = NULL;
PyObject *var_i_item = NULL;
PyObject *var_i_args = NULL;
PyObject *tmp_for_loop_1__for_iterator = NULL;
PyObject *tmp_for_loop_1__iter_value = NULL;
PyObject *tmp_for_loop_2__for_iterator = NULL;
PyObject *tmp_for_loop_2__iter_value = NULL;
PyObject *tmp_for_loop_3__for_iterator = NULL;
PyObject *tmp_for_loop_3__iter_value = NULL;
PyObject *tmp_for_loop_4__for_iterator = NULL;
PyObject *tmp_for_loop_4__iter_value = NULL;
PyObject *tmp_for_loop_5__for_iterator = NULL;
PyObject *tmp_for_loop_5__iter_value = NULL;
PyObject *tmp_for_loop_6__for_iterator = NULL;
PyObject *tmp_for_loop_6__iter_value = NULL;
PyObject *tmp_inplace_assign_subscr_1__subscript = NULL;
PyObject *tmp_inplace_assign_subscr_1__target = NULL;
PyObject *tmp_inplace_assign_subscr_2__subscript = NULL;
PyObject *tmp_inplace_assign_subscr_2__target = NULL;
PyObject *tmp_tuple_unpack_1__element_1 = NULL;
PyObject *tmp_tuple_unpack_1__element_2 = NULL;
PyObject *tmp_tuple_unpack_1__source_iter = NULL;
PyObject *tmp_tuple_unpack_2__element_1 = NULL;
PyObject *tmp_tuple_unpack_2__element_2 = NULL;
PyObject *tmp_tuple_unpack_2__source_iter = NULL;
PyObject *tmp_tuple_unpack_3__element_1 = NULL;
PyObject *tmp_tuple_unpack_3__element_2 = NULL;
PyObject *tmp_tuple_unpack_3__source_iter = NULL;
PyObject *tmp_tuple_unpack_4__element_1 = NULL;
PyObject *tmp_tuple_unpack_4__element_2 = NULL;
PyObject *tmp_tuple_unpack_4__source_iter = NULL;
PyObject *tmp_tuple_unpack_5__element_1 = NULL;
PyObject *tmp_tuple_unpack_5__element_2 = NULL;
PyObject *tmp_tuple_unpack_5__source_iter = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *exception_keeper_type_7;
PyObject *exception_keeper_value_7;
PyTracebackObject *exception_keeper_tb_7;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_7;
PyObject *exception_keeper_type_8;
PyObject *exception_keeper_value_8;
PyTracebackObject *exception_keeper_tb_8;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_8;
PyObject *exception_keeper_type_9;
PyObject *exception_keeper_value_9;
PyTracebackObject *exception_keeper_tb_9;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_9;
PyObject *exception_keeper_type_10;
PyObject *exception_keeper_value_10;
PyTracebackObject *exception_keeper_tb_10;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_10;
PyObject *exception_keeper_type_11;
PyObject *exception_keeper_value_11;
PyTracebackObject *exception_keeper_tb_11;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_11;
PyObject *exception_keeper_type_12;
PyObject *exception_keeper_value_12;
PyTracebackObject *exception_keeper_tb_12;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_12;
PyObject *exception_keeper_type_13;
PyObject *exception_keeper_value_13;
PyTracebackObject *exception_keeper_tb_13;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_13;
PyObject *exception_keeper_type_14;
PyObject *exception_keeper_value_14;
PyTracebackObject *exception_keeper_tb_14;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_14;
PyObject *exception_keeper_type_15;
PyObject *exception_keeper_value_15;
PyTracebackObject *exception_keeper_tb_15;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_15;
PyObject *exception_keeper_type_16;
PyObject *exception_keeper_value_16;
PyTracebackObject *exception_keeper_tb_16;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_16;
PyObject *exception_keeper_type_17;
PyObject *exception_keeper_value_17;
PyTracebackObject *exception_keeper_tb_17;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_17;
PyObject *exception_keeper_type_18;
PyObject *exception_keeper_value_18;
PyTracebackObject *exception_keeper_tb_18;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_18;
PyObject *exception_keeper_type_19;
PyObject *exception_keeper_value_19;
PyTracebackObject *exception_keeper_tb_19;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_19;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_element_name_3;
PyObject *tmp_args_element_name_4;
PyObject *tmp_args_element_name_5;
PyObject *tmp_args_element_name_6;
PyObject *tmp_args_element_name_7;
PyObject *tmp_args_element_name_8;
PyObject *tmp_args_element_name_9;
PyObject *tmp_args_element_name_10;
PyObject *tmp_args_element_name_11;
PyObject *tmp_args_element_name_12;
PyObject *tmp_args_element_name_13;
PyObject *tmp_ass_subscribed_1;
PyObject *tmp_ass_subscribed_2;
PyObject *tmp_ass_subscript_1;
PyObject *tmp_ass_subscript_2;
PyObject *tmp_ass_subvalue_1;
PyObject *tmp_ass_subvalue_2;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
PyObject *tmp_assign_source_12;
PyObject *tmp_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_assign_source_26;
PyObject *tmp_assign_source_27;
PyObject *tmp_assign_source_28;
PyObject *tmp_assign_source_29;
PyObject *tmp_assign_source_30;
PyObject *tmp_assign_source_31;
PyObject *tmp_assign_source_32;
PyObject *tmp_assign_source_33;
PyObject *tmp_assign_source_34;
PyObject *tmp_assign_source_35;
PyObject *tmp_assign_source_36;
PyObject *tmp_assign_source_37;
PyObject *tmp_assign_source_38;
PyObject *tmp_assign_source_39;
PyObject *tmp_assign_source_40;
PyObject *tmp_assign_source_41;
PyObject *tmp_assign_source_42;
PyObject *tmp_assign_source_43;
PyObject *tmp_assign_source_44;
PyObject *tmp_assign_source_45;
PyObject *tmp_assign_source_46;
PyObject *tmp_assign_source_47;
PyObject *tmp_assign_source_48;
PyObject *tmp_assign_source_49;
PyObject *tmp_assign_source_50;
PyObject *tmp_assign_source_51;
PyObject *tmp_assign_source_52;
PyObject *tmp_assign_source_53;
PyObject *tmp_assign_source_54;
PyObject *tmp_assign_source_55;
PyObject *tmp_assign_source_56;
PyObject *tmp_assign_source_57;
PyObject *tmp_assign_source_58;
PyObject *tmp_assign_source_59;
PyObject *tmp_assign_source_60;
PyObject *tmp_assign_source_61;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_called_name_6;
PyObject *tmp_called_name_7;
PyObject *tmp_called_name_8;
PyObject *tmp_called_name_9;
PyObject *tmp_called_name_10;
PyObject *tmp_called_name_11;
int tmp_cmp_GtE_1;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
int tmp_cond_truth_1;
PyObject *tmp_cond_value_1;
bool tmp_is_1;
bool tmp_is_2;
PyObject *tmp_isinstance_cls_1;
PyObject *tmp_isinstance_cls_2;
PyObject *tmp_isinstance_cls_3;
PyObject *tmp_isinstance_cls_4;
PyObject *tmp_isinstance_cls_5;
PyObject *tmp_isinstance_inst_1;
PyObject *tmp_isinstance_inst_2;
PyObject *tmp_isinstance_inst_3;
PyObject *tmp_isinstance_inst_4;
PyObject *tmp_isinstance_inst_5;
PyObject *tmp_iter_arg_1;
PyObject *tmp_iter_arg_2;
PyObject *tmp_iter_arg_3;
PyObject *tmp_iter_arg_4;
PyObject *tmp_iter_arg_5;
PyObject *tmp_iter_arg_6;
PyObject *tmp_iter_arg_7;
PyObject *tmp_iter_arg_8;
PyObject *tmp_iter_arg_9;
PyObject *tmp_iter_arg_10;
PyObject *tmp_iter_arg_11;
PyObject *tmp_iterator_attempt;
PyObject *tmp_iterator_name_1;
PyObject *tmp_iterator_name_2;
PyObject *tmp_iterator_name_3;
PyObject *tmp_iterator_name_4;
PyObject *tmp_iterator_name_5;
PyObject *tmp_left_name_1;
PyObject *tmp_left_name_2;
PyObject *tmp_left_name_3;
PyObject *tmp_left_name_4;
PyObject *tmp_left_name_5;
PyObject *tmp_left_name_6;
PyObject *tmp_len_arg_1;
PyObject *tmp_len_arg_2;
PyObject *tmp_list_element_1;
PyObject *tmp_list_element_2;
PyObject *tmp_list_element_3;
PyObject *tmp_list_element_4;
PyObject *tmp_next_source_1;
PyObject *tmp_next_source_2;
PyObject *tmp_next_source_3;
PyObject *tmp_next_source_4;
PyObject *tmp_next_source_5;
PyObject *tmp_next_source_6;
int tmp_res;
bool tmp_result;
PyObject *tmp_return_value;
PyObject *tmp_right_name_1;
PyObject *tmp_right_name_2;
PyObject *tmp_right_name_3;
PyObject *tmp_right_name_4;
PyObject *tmp_right_name_5;
PyObject *tmp_right_name_6;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_source_name_4;
PyObject *tmp_source_name_5;
PyObject *tmp_source_name_6;
PyObject *tmp_source_name_7;
PyObject *tmp_source_name_8;
PyObject *tmp_start_name_1;
PyObject *tmp_start_name_2;
PyObject *tmp_step_name_1;
PyObject *tmp_step_name_2;
PyObject *tmp_stop_name_1;
PyObject *tmp_stop_name_2;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscribed_name_3;
PyObject *tmp_subscribed_name_4;
PyObject *tmp_subscribed_name_5;
PyObject *tmp_subscribed_name_6;
PyObject *tmp_subscribed_name_7;
PyObject *tmp_subscribed_name_8;
PyObject *tmp_subscribed_name_9;
PyObject *tmp_subscribed_name_10;
PyObject *tmp_subscribed_name_11;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_subscript_name_3;
PyObject *tmp_subscript_name_4;
PyObject *tmp_subscript_name_5;
PyObject *tmp_subscript_name_6;
PyObject *tmp_subscript_name_7;
PyObject *tmp_subscript_name_8;
PyObject *tmp_subscript_name_9;
PyObject *tmp_subscript_name_10;
PyObject *tmp_subscript_name_11;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_unpack_1;
PyObject *tmp_unpack_2;
PyObject *tmp_unpack_3;
PyObject *tmp_unpack_4;
PyObject *tmp_unpack_5;
PyObject *tmp_unpack_6;
PyObject *tmp_unpack_7;
PyObject *tmp_unpack_8;
PyObject *tmp_unpack_9;
PyObject *tmp_unpack_10;
NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
PyObject *tmp_xrange_low_1;
PyObject *tmp_xrange_low_2;
static struct Nuitka_FrameObject *cache_frame_b69da881308ae3bcb5e98ce16ab3a067 = NULL;
struct Nuitka_FrameObject *frame_b69da881308ae3bcb5e98ce16ab3a067;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_return_value = NULL;
// Actual function code.
// Tried code:
tmp_compare_left_1 = par_source;
CHECK_OBJECT( tmp_compare_left_1 );
tmp_compare_right_1 = Py_None;
tmp_is_1 = ( tmp_compare_left_1 == tmp_compare_right_1 );
if ( tmp_is_1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_return_value = DEEP_COPY( const_tuple_list_str_empty_list_list_list_empty_list_tuple );
goto try_return_handler_1;
branch_no_1:;
MAKE_OR_REUSE_FRAME( cache_frame_b69da881308ae3bcb5e98ce16ab3a067, codeobj_b69da881308ae3bcb5e98ce16ab3a067, module_django$utils$regex_helper, sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *)+sizeof(void *) );
frame_b69da881308ae3bcb5e98ce16ab3a067 = cache_frame_b69da881308ae3bcb5e98ce16ab3a067;
// Push the new frame as the currently active one.
pushFrameStack( frame_b69da881308ae3bcb5e98ce16ab3a067 );
// Mark the frame object as in use, ref count 1 will be up for reuse.
assert( Py_REFCNT( frame_b69da881308ae3bcb5e98ce16ab3a067 ) == 2 ); // Frame stack
// Framed code:
tmp_isinstance_inst_1 = par_source;
if ( tmp_isinstance_inst_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 313;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_isinstance_cls_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_isinstance_cls_1 == NULL ))
{
tmp_isinstance_cls_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_isinstance_cls_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 313;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_1, tmp_isinstance_cls_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 313;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_res == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_subscribed_name_1 = par_source;
if ( tmp_subscribed_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 314;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_1 = const_int_pos_1;
tmp_compare_left_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_compare_left_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 314;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_2 = Py_None;
tmp_is_2 = ( tmp_compare_left_2 == tmp_compare_right_2 );
Py_DECREF( tmp_compare_left_2 );
if ( tmp_is_2 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_assign_source_1 = PyList_New( 0 );
assert( var_params == NULL );
var_params = tmp_assign_source_1;
goto branch_end_3;
branch_no_3:;
tmp_assign_source_2 = PyList_New( 1 );
tmp_subscribed_name_2 = par_source;
if ( tmp_subscribed_name_2 == NULL )
{
Py_DECREF( tmp_assign_source_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 317;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_2 = const_int_pos_1;
tmp_list_element_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
if ( tmp_list_element_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_assign_source_2 );
exception_lineno = 317;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
PyList_SET_ITEM( tmp_assign_source_2, 0, tmp_list_element_1 );
{
PyObject *old = var_params;
var_params = tmp_assign_source_2;
Py_XDECREF( old );
}
branch_end_3:;
tmp_return_value = PyTuple_New( 2 );
tmp_tuple_element_1 = PyList_New( 1 );
tmp_subscribed_name_3 = par_source;
if ( tmp_subscribed_name_3 == NULL )
{
Py_DECREF( tmp_return_value );
Py_DECREF( tmp_tuple_element_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 318;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_subscript_name_3 = const_int_0;
tmp_list_element_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_3, tmp_subscript_name_3 );
if ( tmp_list_element_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_return_value );
Py_DECREF( tmp_tuple_element_1 );
exception_lineno = 318;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
PyList_SET_ITEM( tmp_tuple_element_1, 0, tmp_list_element_2 );
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = PyList_New( 1 );
tmp_list_element_3 = var_params;
if ( tmp_list_element_3 == NULL )
{
Py_DECREF( tmp_return_value );
Py_DECREF( tmp_tuple_element_1 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "params" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 318;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_list_element_3 );
PyList_SET_ITEM( tmp_tuple_element_1, 0, tmp_list_element_3 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
goto frame_return_exit_1;
branch_no_2:;
tmp_assign_source_3 = LIST_COPY( const_list_str_empty_list );
assert( var_result == NULL );
var_result = tmp_assign_source_3;
tmp_assign_source_4 = DEEP_COPY( const_list_list_empty_list );
assert( var_result_args == NULL );
var_result_args = tmp_assign_source_4;
tmp_assign_source_5 = const_int_0;
assert( var_pos == NULL );
Py_INCREF( tmp_assign_source_5 );
var_pos = tmp_assign_source_5;
tmp_assign_source_6 = const_int_0;
assert( var_last == NULL );
Py_INCREF( tmp_assign_source_6 );
var_last = tmp_assign_source_6;
tmp_called_name_1 = (PyObject *)&PyEnum_Type;
tmp_args_element_name_1 = par_source;
if ( tmp_args_element_name_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 322;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 322;
{
PyObject *call_args[] = { tmp_args_element_name_1 };
tmp_iter_arg_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_1, call_args );
}
if ( tmp_iter_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 322;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_7 = MAKE_ITERATOR( tmp_iter_arg_1 );
Py_DECREF( tmp_iter_arg_1 );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 322;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_1__for_iterator == NULL );
tmp_for_loop_1__for_iterator = tmp_assign_source_7;
// Tried code:
loop_start_1:;
tmp_next_source_1 = tmp_for_loop_1__for_iterator;
CHECK_OBJECT( tmp_next_source_1 );
tmp_assign_source_8 = ITERATOR_NEXT( tmp_next_source_1 );
if ( tmp_assign_source_8 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_1;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 322;
goto try_except_handler_2;
}
}
{
PyObject *old = tmp_for_loop_1__iter_value;
tmp_for_loop_1__iter_value = tmp_assign_source_8;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_2 = tmp_for_loop_1__iter_value;
CHECK_OBJECT( tmp_iter_arg_2 );
tmp_assign_source_9 = MAKE_ITERATOR( tmp_iter_arg_2 );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 322;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_3;
}
{
PyObject *old = tmp_tuple_unpack_1__source_iter;
tmp_tuple_unpack_1__source_iter = tmp_assign_source_9;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_1 );
tmp_assign_source_10 = UNPACK_NEXT( tmp_unpack_1, 0, 2 );
if ( tmp_assign_source_10 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 322;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_1;
tmp_tuple_unpack_1__element_1 = tmp_assign_source_10;
Py_XDECREF( old );
}
tmp_unpack_2 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_unpack_2 );
tmp_assign_source_11 = UNPACK_NEXT( tmp_unpack_2, 1, 2 );
if ( tmp_assign_source_11 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 322;
goto try_except_handler_4;
}
{
PyObject *old = tmp_tuple_unpack_1__element_2;
tmp_tuple_unpack_1__element_2 = tmp_assign_source_11;
Py_XDECREF( old );
}
tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter;
CHECK_OBJECT( tmp_iterator_name_1 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 322;
goto try_except_handler_4;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 322;
goto try_except_handler_4;
}
goto try_end_1;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto try_except_handler_3;
// End of try:
try_end_1:;
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto try_except_handler_2;
// End of try:
try_end_2:;
Py_XDECREF( tmp_tuple_unpack_1__source_iter );
tmp_tuple_unpack_1__source_iter = NULL;
tmp_assign_source_12 = tmp_tuple_unpack_1__element_1;
CHECK_OBJECT( tmp_assign_source_12 );
{
PyObject *old = var_pos;
var_pos = tmp_assign_source_12;
Py_INCREF( var_pos );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
tmp_assign_source_13 = tmp_tuple_unpack_1__element_2;
CHECK_OBJECT( tmp_assign_source_13 );
{
PyObject *old = var_elt;
var_elt = tmp_assign_source_13;
Py_INCREF( var_elt );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_1 );
tmp_tuple_unpack_1__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_1__element_2 );
tmp_tuple_unpack_1__element_2 = NULL;
tmp_isinstance_inst_2 = var_elt;
if ( tmp_isinstance_inst_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 323;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_six );
if (unlikely( tmp_source_name_1 == NULL ))
{
tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_six );
}
if ( tmp_source_name_1 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "six" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 323;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_isinstance_cls_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_string_types );
if ( tmp_isinstance_cls_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 323;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_2, tmp_isinstance_cls_2 );
Py_DECREF( tmp_isinstance_cls_2 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 323;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
if ( tmp_res == 1 )
{
goto branch_yes_4;
}
else
{
goto branch_no_4;
}
branch_yes_4:;
goto loop_start_1;
branch_no_4:;
tmp_source_name_2 = const_str_empty;
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_join );
assert( tmp_called_name_2 != NULL );
tmp_subscribed_name_4 = par_source;
if ( tmp_subscribed_name_4 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 325;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_start_name_1 = var_last;
if ( tmp_start_name_1 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "last" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 325;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_stop_name_1 = var_pos;
if ( tmp_stop_name_1 == NULL )
{
Py_DECREF( tmp_called_name_2 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pos" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 325;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_step_name_1 = Py_None;
tmp_subscript_name_4 = MAKE_SLICEOBJ3( tmp_start_name_1, tmp_stop_name_1, tmp_step_name_1 );
assert( tmp_subscript_name_4 != NULL );
tmp_args_element_name_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_4, tmp_subscript_name_4 );
Py_DECREF( tmp_subscript_name_4 );
if ( tmp_args_element_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_2 );
exception_lineno = 325;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 325;
{
PyObject *call_args[] = { tmp_args_element_name_2 };
tmp_assign_source_14 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_2, call_args );
}
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_element_name_2 );
if ( tmp_assign_source_14 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 325;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_piece;
var_piece = tmp_assign_source_14;
Py_XDECREF( old );
}
tmp_isinstance_inst_3 = var_elt;
if ( tmp_isinstance_inst_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 326;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_isinstance_cls_3 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group );
if (unlikely( tmp_isinstance_cls_3 == NULL ))
{
tmp_isinstance_cls_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Group );
}
if ( tmp_isinstance_cls_3 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Group" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 326;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_3, tmp_isinstance_cls_3 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 326;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
if ( tmp_res == 1 )
{
goto branch_yes_5;
}
else
{
goto branch_no_5;
}
branch_yes_5:;
tmp_left_name_1 = var_piece;
CHECK_OBJECT( tmp_left_name_1 );
tmp_subscribed_name_5 = var_elt;
if ( tmp_subscribed_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 327;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_subscript_name_5 = const_int_0;
tmp_right_name_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_5, tmp_subscript_name_5 );
if ( tmp_right_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 327;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_1, tmp_right_name_1 );
tmp_assign_source_15 = tmp_left_name_1;
Py_DECREF( tmp_right_name_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 327;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
var_piece = tmp_assign_source_15;
tmp_subscribed_name_6 = var_elt;
if ( tmp_subscribed_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 328;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_subscript_name_6 = const_int_pos_1;
tmp_assign_source_16 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_6, tmp_subscript_name_6 );
if ( tmp_assign_source_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 328;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_param;
var_param = tmp_assign_source_16;
Py_XDECREF( old );
}
goto branch_end_5;
branch_no_5:;
tmp_assign_source_17 = Py_None;
{
PyObject *old = var_param;
var_param = tmp_assign_source_17;
Py_INCREF( var_param );
Py_XDECREF( old );
}
branch_end_5:;
tmp_left_name_2 = var_pos;
if ( tmp_left_name_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pos" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 331;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_right_name_2 = const_int_pos_1;
tmp_assign_source_18 = BINARY_OPERATION_ADD( tmp_left_name_2, tmp_right_name_2 );
if ( tmp_assign_source_18 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 331;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_last;
var_last = tmp_assign_source_18;
Py_XDECREF( old );
}
tmp_len_arg_1 = var_result;
if ( tmp_len_arg_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 332;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_xrange_low_1 = BUILTIN_LEN( tmp_len_arg_1 );
if ( tmp_xrange_low_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 332;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_iter_arg_3 = BUILTIN_XRANGE1( tmp_xrange_low_1 );
Py_DECREF( tmp_xrange_low_1 );
if ( tmp_iter_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 332;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_assign_source_19 = MAKE_ITERATOR( tmp_iter_arg_3 );
Py_DECREF( tmp_iter_arg_3 );
if ( tmp_assign_source_19 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 332;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = tmp_for_loop_2__for_iterator;
tmp_for_loop_2__for_iterator = tmp_assign_source_19;
Py_XDECREF( old );
}
// Tried code:
loop_start_2:;
tmp_next_source_2 = tmp_for_loop_2__for_iterator;
CHECK_OBJECT( tmp_next_source_2 );
tmp_assign_source_20 = ITERATOR_NEXT( tmp_next_source_2 );
if ( tmp_assign_source_20 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_2;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 332;
goto try_except_handler_5;
}
}
{
PyObject *old = tmp_for_loop_2__iter_value;
tmp_for_loop_2__iter_value = tmp_assign_source_20;
Py_XDECREF( old );
}
tmp_assign_source_21 = tmp_for_loop_2__iter_value;
CHECK_OBJECT( tmp_assign_source_21 );
{
PyObject *old = var_i;
var_i = tmp_assign_source_21;
Py_INCREF( var_i );
Py_XDECREF( old );
}
tmp_assign_source_22 = var_result;
if ( tmp_assign_source_22 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 333;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
{
PyObject *old = tmp_inplace_assign_subscr_1__target;
tmp_inplace_assign_subscr_1__target = tmp_assign_source_22;
Py_INCREF( tmp_inplace_assign_subscr_1__target );
Py_XDECREF( old );
}
tmp_assign_source_23 = var_i;
CHECK_OBJECT( tmp_assign_source_23 );
{
PyObject *old = tmp_inplace_assign_subscr_1__subscript;
tmp_inplace_assign_subscr_1__subscript = tmp_assign_source_23;
Py_INCREF( tmp_inplace_assign_subscr_1__subscript );
Py_XDECREF( old );
}
// Tried code:
tmp_subscribed_name_7 = tmp_inplace_assign_subscr_1__target;
CHECK_OBJECT( tmp_subscribed_name_7 );
tmp_subscript_name_7 = tmp_inplace_assign_subscr_1__subscript;
CHECK_OBJECT( tmp_subscript_name_7 );
tmp_left_name_3 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_7, tmp_subscript_name_7 );
if ( tmp_left_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 333;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_right_name_3 = var_piece;
if ( tmp_right_name_3 == NULL )
{
Py_DECREF( tmp_left_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "piece" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 333;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_ass_subvalue_1 = BINARY_OPERATION( PyNumber_InPlaceAdd, tmp_left_name_3, tmp_right_name_3 );
Py_DECREF( tmp_left_name_3 );
if ( tmp_ass_subvalue_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 333;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
tmp_ass_subscribed_1 = tmp_inplace_assign_subscr_1__target;
CHECK_OBJECT( tmp_ass_subscribed_1 );
tmp_ass_subscript_1 = tmp_inplace_assign_subscr_1__subscript;
CHECK_OBJECT( tmp_ass_subscript_1 );
tmp_result = SET_SUBSCRIPT( tmp_ass_subscribed_1, tmp_ass_subscript_1, tmp_ass_subvalue_1 );
Py_DECREF( tmp_ass_subvalue_1 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 333;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_6;
}
goto try_end_3;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_inplace_assign_subscr_1__target );
tmp_inplace_assign_subscr_1__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_1__subscript );
tmp_inplace_assign_subscr_1__subscript = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto try_except_handler_5;
// End of try:
try_end_3:;
Py_XDECREF( tmp_inplace_assign_subscr_1__target );
tmp_inplace_assign_subscr_1__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_1__subscript );
tmp_inplace_assign_subscr_1__subscript = NULL;
tmp_cond_value_1 = var_param;
if ( tmp_cond_value_1 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "param" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 334;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 334;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
if ( tmp_cond_truth_1 == 1 )
{
goto branch_yes_6;
}
else
{
goto branch_no_6;
}
branch_yes_6:;
tmp_subscribed_name_8 = var_result_args;
if ( tmp_subscribed_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_subscript_name_8 = var_i;
if ( tmp_subscript_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "i" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_source_name_3 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_8, tmp_subscript_name_8 );
if ( tmp_source_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_append );
Py_DECREF( tmp_source_name_3 );
if ( tmp_called_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
tmp_args_element_name_3 = var_param;
if ( tmp_args_element_name_3 == NULL )
{
Py_DECREF( tmp_called_name_3 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "param" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 335;
{
PyObject *call_args[] = { tmp_args_element_name_3 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, call_args );
}
Py_DECREF( tmp_called_name_3 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 335;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
Py_DECREF( tmp_unused );
branch_no_6:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 332;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_5;
}
goto loop_start_2;
loop_end_2:;
goto try_end_4;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto try_except_handler_2;
// End of try:
try_end_4:;
Py_XDECREF( tmp_for_loop_2__iter_value );
tmp_for_loop_2__iter_value = NULL;
Py_XDECREF( tmp_for_loop_2__for_iterator );
tmp_for_loop_2__for_iterator = NULL;
tmp_isinstance_inst_4 = var_elt;
if ( tmp_isinstance_inst_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 336;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_isinstance_cls_4 = PyTuple_New( 2 );
tmp_tuple_element_2 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Choice );
if (unlikely( tmp_tuple_element_2 == NULL ))
{
tmp_tuple_element_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_Choice );
}
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_isinstance_cls_4 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "Choice" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 336;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_isinstance_cls_4, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_NonCapture );
if (unlikely( tmp_tuple_element_2 == NULL ))
{
tmp_tuple_element_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_NonCapture );
}
if ( tmp_tuple_element_2 == NULL )
{
Py_DECREF( tmp_isinstance_cls_4 );
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "NonCapture" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 336;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_isinstance_cls_4, 1, tmp_tuple_element_2 );
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_4, tmp_isinstance_cls_4 );
Py_DECREF( tmp_isinstance_cls_4 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 336;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
if ( tmp_res == 1 )
{
goto branch_yes_7;
}
else
{
goto branch_no_7;
}
branch_yes_7:;
tmp_isinstance_inst_5 = var_elt;
if ( tmp_isinstance_inst_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 337;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_isinstance_cls_5 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_NonCapture );
if (unlikely( tmp_isinstance_cls_5 == NULL ))
{
tmp_isinstance_cls_5 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_NonCapture );
}
if ( tmp_isinstance_cls_5 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "NonCapture" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 337;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_res = Nuitka_IsInstance( tmp_isinstance_inst_5, tmp_isinstance_cls_5 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 337;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
if ( tmp_res == 1 )
{
goto branch_yes_8;
}
else
{
goto branch_no_8;
}
branch_yes_8:;
tmp_assign_source_24 = PyList_New( 1 );
tmp_list_element_4 = var_elt;
if ( tmp_list_element_4 == NULL )
{
Py_DECREF( tmp_assign_source_24 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 338;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
Py_INCREF( tmp_list_element_4 );
PyList_SET_ITEM( tmp_assign_source_24, 0, tmp_list_element_4 );
{
PyObject *old = var_elt;
var_elt = tmp_assign_source_24;
Py_XDECREF( old );
}
branch_no_8:;
tmp_iter_arg_4 = DEEP_COPY( const_tuple_list_empty_list_empty_tuple );
tmp_assign_source_25 = MAKE_ITERATOR( tmp_iter_arg_4 );
Py_DECREF( tmp_iter_arg_4 );
assert( tmp_assign_source_25 != NULL );
{
PyObject *old = tmp_tuple_unpack_2__source_iter;
tmp_tuple_unpack_2__source_iter = tmp_assign_source_25;
Py_XDECREF( old );
}
// Tried code:
// Tried code:
tmp_unpack_3 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_3 );
tmp_assign_source_26 = UNPACK_NEXT( tmp_unpack_3, 0, 2 );
if ( tmp_assign_source_26 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 339;
goto try_except_handler_8;
}
{
PyObject *old = tmp_tuple_unpack_2__element_1;
tmp_tuple_unpack_2__element_1 = tmp_assign_source_26;
Py_XDECREF( old );
}
tmp_unpack_4 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_unpack_4 );
tmp_assign_source_27 = UNPACK_NEXT( tmp_unpack_4, 1, 2 );
if ( tmp_assign_source_27 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 339;
goto try_except_handler_8;
}
{
PyObject *old = tmp_tuple_unpack_2__element_2;
tmp_tuple_unpack_2__element_2 = tmp_assign_source_27;
Py_XDECREF( old );
}
tmp_iterator_name_2 = tmp_tuple_unpack_2__source_iter;
CHECK_OBJECT( tmp_iterator_name_2 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_2 ); assert( HAS_ITERNEXT( tmp_iterator_name_2 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_2 )->tp_iternext)( tmp_iterator_name_2 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 339;
goto try_except_handler_8;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 339;
goto try_except_handler_8;
}
goto try_end_5;
// Exception handler code:
try_except_handler_8:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto try_except_handler_7;
// End of try:
try_end_5:;
goto try_end_6;
// Exception handler code:
try_except_handler_7:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto try_except_handler_2;
// End of try:
try_end_6:;
Py_XDECREF( tmp_tuple_unpack_2__source_iter );
tmp_tuple_unpack_2__source_iter = NULL;
tmp_assign_source_28 = tmp_tuple_unpack_2__element_1;
CHECK_OBJECT( tmp_assign_source_28 );
{
PyObject *old = var_inner_result;
var_inner_result = tmp_assign_source_28;
Py_INCREF( var_inner_result );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
tmp_assign_source_29 = tmp_tuple_unpack_2__element_2;
CHECK_OBJECT( tmp_assign_source_29 );
{
PyObject *old = var_inner_args;
var_inner_args = tmp_assign_source_29;
Py_INCREF( var_inner_args );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_1 );
tmp_tuple_unpack_2__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_2__element_2 );
tmp_tuple_unpack_2__element_2 = NULL;
tmp_iter_arg_5 = var_elt;
if ( tmp_iter_arg_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "elt" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 340;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_assign_source_30 = MAKE_ITERATOR( tmp_iter_arg_5 );
if ( tmp_assign_source_30 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 340;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = tmp_for_loop_3__for_iterator;
tmp_for_loop_3__for_iterator = tmp_assign_source_30;
Py_XDECREF( old );
}
// Tried code:
loop_start_3:;
tmp_next_source_3 = tmp_for_loop_3__for_iterator;
CHECK_OBJECT( tmp_next_source_3 );
tmp_assign_source_31 = ITERATOR_NEXT( tmp_next_source_3 );
if ( tmp_assign_source_31 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_3;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 340;
goto try_except_handler_9;
}
}
{
PyObject *old = tmp_for_loop_3__iter_value;
tmp_for_loop_3__iter_value = tmp_assign_source_31;
Py_XDECREF( old );
}
tmp_assign_source_32 = tmp_for_loop_3__iter_value;
CHECK_OBJECT( tmp_assign_source_32 );
{
PyObject *old = var_item;
var_item = tmp_assign_source_32;
Py_INCREF( var_item );
Py_XDECREF( old );
}
// Tried code:
tmp_called_name_4 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_flatten_result );
if (unlikely( tmp_called_name_4 == NULL ))
{
tmp_called_name_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_flatten_result );
}
if ( tmp_called_name_4 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "flatten_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 341;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_10;
}
tmp_args_element_name_4 = var_item;
CHECK_OBJECT( tmp_args_element_name_4 );
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 341;
{
PyObject *call_args[] = { tmp_args_element_name_4 };
tmp_iter_arg_6 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_4, call_args );
}
if ( tmp_iter_arg_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 341;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_10;
}
tmp_assign_source_33 = MAKE_ITERATOR( tmp_iter_arg_6 );
Py_DECREF( tmp_iter_arg_6 );
if ( tmp_assign_source_33 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 341;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_10;
}
{
PyObject *old = tmp_tuple_unpack_3__source_iter;
tmp_tuple_unpack_3__source_iter = tmp_assign_source_33;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_5 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_5 );
tmp_assign_source_34 = UNPACK_NEXT( tmp_unpack_5, 0, 2 );
if ( tmp_assign_source_34 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 341;
goto try_except_handler_11;
}
{
PyObject *old = tmp_tuple_unpack_3__element_1;
tmp_tuple_unpack_3__element_1 = tmp_assign_source_34;
Py_XDECREF( old );
}
tmp_unpack_6 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_unpack_6 );
tmp_assign_source_35 = UNPACK_NEXT( tmp_unpack_6, 1, 2 );
if ( tmp_assign_source_35 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 341;
goto try_except_handler_11;
}
{
PyObject *old = tmp_tuple_unpack_3__element_2;
tmp_tuple_unpack_3__element_2 = tmp_assign_source_35;
Py_XDECREF( old );
}
tmp_iterator_name_3 = tmp_tuple_unpack_3__source_iter;
CHECK_OBJECT( tmp_iterator_name_3 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_3 ); assert( HAS_ITERNEXT( tmp_iterator_name_3 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_3 )->tp_iternext)( tmp_iterator_name_3 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 341;
goto try_except_handler_11;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 341;
goto try_except_handler_11;
}
goto try_end_7;
// Exception handler code:
try_except_handler_11:;
exception_keeper_type_7 = exception_type;
exception_keeper_value_7 = exception_value;
exception_keeper_tb_7 = exception_tb;
exception_keeper_lineno_7 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_7;
exception_value = exception_keeper_value_7;
exception_tb = exception_keeper_tb_7;
exception_lineno = exception_keeper_lineno_7;
goto try_except_handler_10;
// End of try:
try_end_7:;
goto try_end_8;
// Exception handler code:
try_except_handler_10:;
exception_keeper_type_8 = exception_type;
exception_keeper_value_8 = exception_value;
exception_keeper_tb_8 = exception_tb;
exception_keeper_lineno_8 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_8;
exception_value = exception_keeper_value_8;
exception_tb = exception_keeper_tb_8;
exception_lineno = exception_keeper_lineno_8;
goto try_except_handler_9;
// End of try:
try_end_8:;
Py_XDECREF( tmp_tuple_unpack_3__source_iter );
tmp_tuple_unpack_3__source_iter = NULL;
tmp_assign_source_36 = tmp_tuple_unpack_3__element_1;
CHECK_OBJECT( tmp_assign_source_36 );
{
PyObject *old = var_res;
var_res = tmp_assign_source_36;
Py_INCREF( var_res );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
tmp_assign_source_37 = tmp_tuple_unpack_3__element_2;
CHECK_OBJECT( tmp_assign_source_37 );
{
PyObject *old = var_args;
var_args = tmp_assign_source_37;
Py_INCREF( var_args );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_1 );
tmp_tuple_unpack_3__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_3__element_2 );
tmp_tuple_unpack_3__element_2 = NULL;
tmp_source_name_4 = var_inner_result;
if ( tmp_source_name_4 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inner_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 342;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
tmp_called_name_5 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_extend );
if ( tmp_called_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 342;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
tmp_args_element_name_5 = var_res;
if ( tmp_args_element_name_5 == NULL )
{
Py_DECREF( tmp_called_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "res" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 342;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 342;
{
PyObject *call_args[] = { tmp_args_element_name_5 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_5, call_args );
}
Py_DECREF( tmp_called_name_5 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 342;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
Py_DECREF( tmp_unused );
tmp_source_name_5 = var_inner_args;
if ( tmp_source_name_5 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inner_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 343;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
tmp_called_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_5, const_str_plain_extend );
if ( tmp_called_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 343;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
tmp_args_element_name_6 = var_args;
if ( tmp_args_element_name_6 == NULL )
{
Py_DECREF( tmp_called_name_6 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 343;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 343;
{
PyObject *call_args[] = { tmp_args_element_name_6 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_6, call_args );
}
Py_DECREF( tmp_called_name_6 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 343;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 340;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_9;
}
goto loop_start_3;
loop_end_3:;
goto try_end_9;
// Exception handler code:
try_except_handler_9:;
exception_keeper_type_9 = exception_type;
exception_keeper_value_9 = exception_value;
exception_keeper_tb_9 = exception_tb;
exception_keeper_lineno_9 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_9;
exception_value = exception_keeper_value_9;
exception_tb = exception_keeper_tb_9;
exception_lineno = exception_keeper_lineno_9;
goto try_except_handler_2;
// End of try:
try_end_9:;
Py_XDECREF( tmp_for_loop_3__iter_value );
tmp_for_loop_3__iter_value = NULL;
Py_XDECREF( tmp_for_loop_3__for_iterator );
tmp_for_loop_3__for_iterator = NULL;
tmp_assign_source_38 = PyList_New( 0 );
{
PyObject *old = var_new_result;
var_new_result = tmp_assign_source_38;
Py_XDECREF( old );
}
tmp_assign_source_39 = PyList_New( 0 );
{
PyObject *old = var_new_args;
var_new_args = tmp_assign_source_39;
Py_XDECREF( old );
}
tmp_called_name_7 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_zip );
if (unlikely( tmp_called_name_7 == NULL ))
{
tmp_called_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_zip );
}
if ( tmp_called_name_7 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "zip" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_args_element_name_7 = var_result;
if ( tmp_args_element_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_args_element_name_8 = var_result_args;
if ( tmp_args_element_name_8 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 346;
{
PyObject *call_args[] = { tmp_args_element_name_7, tmp_args_element_name_8 };
tmp_iter_arg_7 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_7, call_args );
}
if ( tmp_iter_arg_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
tmp_assign_source_40 = MAKE_ITERATOR( tmp_iter_arg_7 );
Py_DECREF( tmp_iter_arg_7 );
if ( tmp_assign_source_40 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = tmp_for_loop_4__for_iterator;
tmp_for_loop_4__for_iterator = tmp_assign_source_40;
Py_XDECREF( old );
}
// Tried code:
loop_start_4:;
tmp_next_source_4 = tmp_for_loop_4__for_iterator;
CHECK_OBJECT( tmp_next_source_4 );
tmp_assign_source_41 = ITERATOR_NEXT( tmp_next_source_4 );
if ( tmp_assign_source_41 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_4;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 346;
goto try_except_handler_12;
}
}
{
PyObject *old = tmp_for_loop_4__iter_value;
tmp_for_loop_4__iter_value = tmp_assign_source_41;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_8 = tmp_for_loop_4__iter_value;
CHECK_OBJECT( tmp_iter_arg_8 );
tmp_assign_source_42 = MAKE_ITERATOR( tmp_iter_arg_8 );
if ( tmp_assign_source_42 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_13;
}
{
PyObject *old = tmp_tuple_unpack_4__source_iter;
tmp_tuple_unpack_4__source_iter = tmp_assign_source_42;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_7 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_7 );
tmp_assign_source_43 = UNPACK_NEXT( tmp_unpack_7, 0, 2 );
if ( tmp_assign_source_43 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 346;
goto try_except_handler_14;
}
{
PyObject *old = tmp_tuple_unpack_4__element_1;
tmp_tuple_unpack_4__element_1 = tmp_assign_source_43;
Py_XDECREF( old );
}
tmp_unpack_8 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_unpack_8 );
tmp_assign_source_44 = UNPACK_NEXT( tmp_unpack_8, 1, 2 );
if ( tmp_assign_source_44 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 346;
goto try_except_handler_14;
}
{
PyObject *old = tmp_tuple_unpack_4__element_2;
tmp_tuple_unpack_4__element_2 = tmp_assign_source_44;
Py_XDECREF( old );
}
tmp_iterator_name_4 = tmp_tuple_unpack_4__source_iter;
CHECK_OBJECT( tmp_iterator_name_4 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_4 ); assert( HAS_ITERNEXT( tmp_iterator_name_4 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_4 )->tp_iternext)( tmp_iterator_name_4 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 346;
goto try_except_handler_14;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 346;
goto try_except_handler_14;
}
goto try_end_10;
// Exception handler code:
try_except_handler_14:;
exception_keeper_type_10 = exception_type;
exception_keeper_value_10 = exception_value;
exception_keeper_tb_10 = exception_tb;
exception_keeper_lineno_10 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_10;
exception_value = exception_keeper_value_10;
exception_tb = exception_keeper_tb_10;
exception_lineno = exception_keeper_lineno_10;
goto try_except_handler_13;
// End of try:
try_end_10:;
goto try_end_11;
// Exception handler code:
try_except_handler_13:;
exception_keeper_type_11 = exception_type;
exception_keeper_value_11 = exception_value;
exception_keeper_tb_11 = exception_tb;
exception_keeper_lineno_11 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_11;
exception_value = exception_keeper_value_11;
exception_tb = exception_keeper_tb_11;
exception_lineno = exception_keeper_lineno_11;
goto try_except_handler_12;
// End of try:
try_end_11:;
Py_XDECREF( tmp_tuple_unpack_4__source_iter );
tmp_tuple_unpack_4__source_iter = NULL;
tmp_assign_source_45 = tmp_tuple_unpack_4__element_1;
CHECK_OBJECT( tmp_assign_source_45 );
{
PyObject *old = var_item;
var_item = tmp_assign_source_45;
Py_INCREF( var_item );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
tmp_assign_source_46 = tmp_tuple_unpack_4__element_2;
CHECK_OBJECT( tmp_assign_source_46 );
{
PyObject *old = var_args;
var_args = tmp_assign_source_46;
Py_INCREF( var_args );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_1 );
tmp_tuple_unpack_4__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_4__element_2 );
tmp_tuple_unpack_4__element_2 = NULL;
tmp_called_name_8 = GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_zip );
if (unlikely( tmp_called_name_8 == NULL ))
{
tmp_called_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_zip );
}
if ( tmp_called_name_8 == NULL )
{
exception_type = PyExc_NameError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "zip" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
tmp_args_element_name_9 = var_inner_result;
if ( tmp_args_element_name_9 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inner_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
tmp_args_element_name_10 = var_inner_args;
if ( tmp_args_element_name_10 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inner_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 347;
{
PyObject *call_args[] = { tmp_args_element_name_9, tmp_args_element_name_10 };
tmp_iter_arg_9 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_8, call_args );
}
if ( tmp_iter_arg_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
tmp_assign_source_47 = MAKE_ITERATOR( tmp_iter_arg_9 );
Py_DECREF( tmp_iter_arg_9 );
if ( tmp_assign_source_47 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
{
PyObject *old = tmp_for_loop_5__for_iterator;
tmp_for_loop_5__for_iterator = tmp_assign_source_47;
Py_XDECREF( old );
}
// Tried code:
loop_start_5:;
tmp_next_source_5 = tmp_for_loop_5__for_iterator;
CHECK_OBJECT( tmp_next_source_5 );
tmp_assign_source_48 = ITERATOR_NEXT( tmp_next_source_5 );
if ( tmp_assign_source_48 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_5;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 347;
goto try_except_handler_15;
}
}
{
PyObject *old = tmp_for_loop_5__iter_value;
tmp_for_loop_5__iter_value = tmp_assign_source_48;
Py_XDECREF( old );
}
// Tried code:
tmp_iter_arg_10 = tmp_for_loop_5__iter_value;
CHECK_OBJECT( tmp_iter_arg_10 );
tmp_assign_source_49 = MAKE_ITERATOR( tmp_iter_arg_10 );
if ( tmp_assign_source_49 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_16;
}
{
PyObject *old = tmp_tuple_unpack_5__source_iter;
tmp_tuple_unpack_5__source_iter = tmp_assign_source_49;
Py_XDECREF( old );
}
// Tried code:
tmp_unpack_9 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_9 );
tmp_assign_source_50 = UNPACK_NEXT( tmp_unpack_9, 0, 2 );
if ( tmp_assign_source_50 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 347;
goto try_except_handler_17;
}
{
PyObject *old = tmp_tuple_unpack_5__element_1;
tmp_tuple_unpack_5__element_1 = tmp_assign_source_50;
Py_XDECREF( old );
}
tmp_unpack_10 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_unpack_10 );
tmp_assign_source_51 = UNPACK_NEXT( tmp_unpack_10, 1, 2 );
if ( tmp_assign_source_51 == NULL )
{
if ( !ERROR_OCCURRED() )
{
exception_type = PyExc_StopIteration;
Py_INCREF( exception_type );
exception_value = NULL;
exception_tb = NULL;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
}
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 347;
goto try_except_handler_17;
}
{
PyObject *old = tmp_tuple_unpack_5__element_2;
tmp_tuple_unpack_5__element_2 = tmp_assign_source_51;
Py_XDECREF( old );
}
tmp_iterator_name_5 = tmp_tuple_unpack_5__source_iter;
CHECK_OBJECT( tmp_iterator_name_5 );
// Check if iterator has left-over elements.
CHECK_OBJECT( tmp_iterator_name_5 ); assert( HAS_ITERNEXT( tmp_iterator_name_5 ) );
tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_5 )->tp_iternext)( tmp_iterator_name_5 );
if (likely( tmp_iterator_attempt == NULL ))
{
PyObject *error = GET_ERROR_OCCURRED();
if ( error != NULL )
{
if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration ))
{
CLEAR_ERROR_OCCURRED();
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 347;
goto try_except_handler_17;
}
}
}
else
{
Py_DECREF( tmp_iterator_attempt );
// TODO: Could avoid PyErr_Format.
#if PYTHON_VERSION < 300
PyErr_Format( PyExc_ValueError, "too many values to unpack" );
#else
PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" );
#endif
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 347;
goto try_except_handler_17;
}
goto try_end_12;
// Exception handler code:
try_except_handler_17:;
exception_keeper_type_12 = exception_type;
exception_keeper_value_12 = exception_value;
exception_keeper_tb_12 = exception_tb;
exception_keeper_lineno_12 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
// Re-raise.
exception_type = exception_keeper_type_12;
exception_value = exception_keeper_value_12;
exception_tb = exception_keeper_tb_12;
exception_lineno = exception_keeper_lineno_12;
goto try_except_handler_16;
// End of try:
try_end_12:;
goto try_end_13;
// Exception handler code:
try_except_handler_16:;
exception_keeper_type_13 = exception_type;
exception_keeper_value_13 = exception_value;
exception_keeper_tb_13 = exception_tb;
exception_keeper_lineno_13 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
// Re-raise.
exception_type = exception_keeper_type_13;
exception_value = exception_keeper_value_13;
exception_tb = exception_keeper_tb_13;
exception_lineno = exception_keeper_lineno_13;
goto try_except_handler_15;
// End of try:
try_end_13:;
Py_XDECREF( tmp_tuple_unpack_5__source_iter );
tmp_tuple_unpack_5__source_iter = NULL;
tmp_assign_source_52 = tmp_tuple_unpack_5__element_1;
CHECK_OBJECT( tmp_assign_source_52 );
{
PyObject *old = var_i_item;
var_i_item = tmp_assign_source_52;
Py_INCREF( var_i_item );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
tmp_assign_source_53 = tmp_tuple_unpack_5__element_2;
CHECK_OBJECT( tmp_assign_source_53 );
{
PyObject *old = var_i_args;
var_i_args = tmp_assign_source_53;
Py_INCREF( var_i_args );
Py_XDECREF( old );
}
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_1 );
tmp_tuple_unpack_5__element_1 = NULL;
Py_XDECREF( tmp_tuple_unpack_5__element_2 );
tmp_tuple_unpack_5__element_2 = NULL;
tmp_source_name_6 = var_new_result;
if ( tmp_source_name_6 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_called_name_9 = LOOKUP_ATTRIBUTE( tmp_source_name_6, const_str_plain_append );
if ( tmp_called_name_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_left_name_4 = var_item;
if ( tmp_left_name_4 == NULL )
{
Py_DECREF( tmp_called_name_9 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "item" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_right_name_4 = var_i_item;
if ( tmp_right_name_4 == NULL )
{
Py_DECREF( tmp_called_name_9 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "i_item" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_args_element_name_11 = BINARY_OPERATION_ADD( tmp_left_name_4, tmp_right_name_4 );
if ( tmp_args_element_name_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_9 );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 348;
{
PyObject *call_args[] = { tmp_args_element_name_11 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_9, call_args );
}
Py_DECREF( tmp_called_name_9 );
Py_DECREF( tmp_args_element_name_11 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 348;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
Py_DECREF( tmp_unused );
tmp_source_name_7 = var_new_args;
if ( tmp_source_name_7 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_called_name_10 = LOOKUP_ATTRIBUTE( tmp_source_name_7, const_str_plain_append );
if ( tmp_called_name_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_subscribed_name_9 = var_args;
if ( tmp_subscribed_name_9 == NULL )
{
Py_DECREF( tmp_called_name_10 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_subscript_name_9 = const_slice_none_none_none;
tmp_left_name_5 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_9, tmp_subscript_name_9 );
if ( tmp_left_name_5 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_10 );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_right_name_5 = var_i_args;
if ( tmp_right_name_5 == NULL )
{
Py_DECREF( tmp_called_name_10 );
Py_DECREF( tmp_left_name_5 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "i_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
tmp_args_element_name_12 = BINARY_OPERATION_ADD( tmp_left_name_5, tmp_right_name_5 );
Py_DECREF( tmp_left_name_5 );
if ( tmp_args_element_name_12 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_10 );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 349;
{
PyObject *call_args[] = { tmp_args_element_name_12 };
tmp_unused = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_10, call_args );
}
Py_DECREF( tmp_called_name_10 );
Py_DECREF( tmp_args_element_name_12 );
if ( tmp_unused == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 349;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
Py_DECREF( tmp_unused );
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 347;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_15;
}
goto loop_start_5;
loop_end_5:;
goto try_end_14;
// Exception handler code:
try_except_handler_15:;
exception_keeper_type_14 = exception_type;
exception_keeper_value_14 = exception_value;
exception_keeper_tb_14 = exception_tb;
exception_keeper_lineno_14 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_5__iter_value );
tmp_for_loop_5__iter_value = NULL;
Py_XDECREF( tmp_for_loop_5__for_iterator );
tmp_for_loop_5__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_14;
exception_value = exception_keeper_value_14;
exception_tb = exception_keeper_tb_14;
exception_lineno = exception_keeper_lineno_14;
goto try_except_handler_12;
// End of try:
try_end_14:;
Py_XDECREF( tmp_for_loop_5__iter_value );
tmp_for_loop_5__iter_value = NULL;
Py_XDECREF( tmp_for_loop_5__for_iterator );
tmp_for_loop_5__for_iterator = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 346;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_12;
}
goto loop_start_4;
loop_end_4:;
goto try_end_15;
// Exception handler code:
try_except_handler_12:;
exception_keeper_type_15 = exception_type;
exception_keeper_value_15 = exception_value;
exception_keeper_tb_15 = exception_tb;
exception_keeper_lineno_15 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_15;
exception_value = exception_keeper_value_15;
exception_tb = exception_keeper_tb_15;
exception_lineno = exception_keeper_lineno_15;
goto try_except_handler_2;
// End of try:
try_end_15:;
Py_XDECREF( tmp_for_loop_4__iter_value );
tmp_for_loop_4__iter_value = NULL;
Py_XDECREF( tmp_for_loop_4__for_iterator );
tmp_for_loop_4__for_iterator = NULL;
tmp_assign_source_54 = var_new_result;
if ( tmp_assign_source_54 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 350;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_result;
var_result = tmp_assign_source_54;
Py_INCREF( var_result );
Py_XDECREF( old );
}
tmp_assign_source_55 = var_new_args;
if ( tmp_assign_source_55 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "new_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 351;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
{
PyObject *old = var_result_args;
var_result_args = tmp_assign_source_55;
Py_INCREF( var_result_args );
Py_XDECREF( old );
}
branch_no_7:;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 322;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_2;
}
goto loop_start_1;
loop_end_1:;
goto try_end_16;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_16 = exception_type;
exception_keeper_value_16 = exception_value;
exception_keeper_tb_16 = exception_tb;
exception_keeper_lineno_16 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_16;
exception_value = exception_keeper_value_16;
exception_tb = exception_keeper_tb_16;
exception_lineno = exception_keeper_lineno_16;
goto frame_exception_exit_1;
// End of try:
try_end_16:;
Py_XDECREF( tmp_for_loop_1__iter_value );
tmp_for_loop_1__iter_value = NULL;
Py_XDECREF( tmp_for_loop_1__for_iterator );
tmp_for_loop_1__for_iterator = NULL;
tmp_compare_left_3 = var_pos;
if ( tmp_compare_left_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "pos" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 352;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_compare_right_3 = var_last;
if ( tmp_compare_right_3 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "last" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 352;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_cmp_GtE_1 = RICH_COMPARE_BOOL_GE( tmp_compare_left_3, tmp_compare_right_3 );
if ( tmp_cmp_GtE_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 352;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
if ( tmp_cmp_GtE_1 == 1 )
{
goto branch_yes_9;
}
else
{
goto branch_no_9;
}
branch_yes_9:;
tmp_source_name_8 = const_str_empty;
tmp_called_name_11 = LOOKUP_ATTRIBUTE( tmp_source_name_8, const_str_plain_join );
assert( tmp_called_name_11 != NULL );
tmp_subscribed_name_10 = par_source;
if ( tmp_subscribed_name_10 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "source" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 353;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_start_name_2 = var_last;
if ( tmp_start_name_2 == NULL )
{
Py_DECREF( tmp_called_name_11 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "last" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 353;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_stop_name_2 = Py_None;
tmp_step_name_2 = Py_None;
tmp_subscript_name_10 = MAKE_SLICEOBJ3( tmp_start_name_2, tmp_stop_name_2, tmp_step_name_2 );
assert( tmp_subscript_name_10 != NULL );
tmp_args_element_name_13 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_10, tmp_subscript_name_10 );
Py_DECREF( tmp_subscript_name_10 );
if ( tmp_args_element_name_13 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_called_name_11 );
exception_lineno = 353;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame.f_lineno = 353;
{
PyObject *call_args[] = { tmp_args_element_name_13 };
tmp_assign_source_56 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_11, call_args );
}
Py_DECREF( tmp_called_name_11 );
Py_DECREF( tmp_args_element_name_13 );
if ( tmp_assign_source_56 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 353;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
{
PyObject *old = var_piece;
var_piece = tmp_assign_source_56;
Py_XDECREF( old );
}
tmp_len_arg_2 = var_result;
if ( tmp_len_arg_2 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 354;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_xrange_low_2 = BUILTIN_LEN( tmp_len_arg_2 );
if ( tmp_xrange_low_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 354;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_iter_arg_11 = BUILTIN_XRANGE1( tmp_xrange_low_2 );
Py_DECREF( tmp_xrange_low_2 );
if ( tmp_iter_arg_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 354;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
tmp_assign_source_57 = MAKE_ITERATOR( tmp_iter_arg_11 );
Py_DECREF( tmp_iter_arg_11 );
if ( tmp_assign_source_57 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 354;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
assert( tmp_for_loop_6__for_iterator == NULL );
tmp_for_loop_6__for_iterator = tmp_assign_source_57;
// Tried code:
loop_start_6:;
tmp_next_source_6 = tmp_for_loop_6__for_iterator;
CHECK_OBJECT( tmp_next_source_6 );
tmp_assign_source_58 = ITERATOR_NEXT( tmp_next_source_6 );
if ( tmp_assign_source_58 == NULL )
{
if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() )
{
goto loop_end_6;
}
else
{
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
type_description_1 = "ooooooooooooooooooo";
exception_lineno = 354;
goto try_except_handler_18;
}
}
{
PyObject *old = tmp_for_loop_6__iter_value;
tmp_for_loop_6__iter_value = tmp_assign_source_58;
Py_XDECREF( old );
}
tmp_assign_source_59 = tmp_for_loop_6__iter_value;
CHECK_OBJECT( tmp_assign_source_59 );
{
PyObject *old = var_i;
var_i = tmp_assign_source_59;
Py_INCREF( var_i );
Py_XDECREF( old );
}
tmp_assign_source_60 = var_result;
if ( tmp_assign_source_60 == NULL )
{
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 355;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_18;
}
{
PyObject *old = tmp_inplace_assign_subscr_2__target;
tmp_inplace_assign_subscr_2__target = tmp_assign_source_60;
Py_INCREF( tmp_inplace_assign_subscr_2__target );
Py_XDECREF( old );
}
tmp_assign_source_61 = var_i;
CHECK_OBJECT( tmp_assign_source_61 );
{
PyObject *old = tmp_inplace_assign_subscr_2__subscript;
tmp_inplace_assign_subscr_2__subscript = tmp_assign_source_61;
Py_INCREF( tmp_inplace_assign_subscr_2__subscript );
Py_XDECREF( old );
}
// Tried code:
tmp_subscribed_name_11 = tmp_inplace_assign_subscr_2__target;
CHECK_OBJECT( tmp_subscribed_name_11 );
tmp_subscript_name_11 = tmp_inplace_assign_subscr_2__subscript;
CHECK_OBJECT( tmp_subscript_name_11 );
tmp_left_name_6 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_11, tmp_subscript_name_11 );
if ( tmp_left_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 355;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_19;
}
tmp_right_name_6 = var_piece;
if ( tmp_right_name_6 == NULL )
{
Py_DECREF( tmp_left_name_6 );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "piece" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 355;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_19;
}
tmp_ass_subvalue_2 = BINARY_OPERATION( PyNumber_InPlaceAdd, tmp_left_name_6, tmp_right_name_6 );
Py_DECREF( tmp_left_name_6 );
if ( tmp_ass_subvalue_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 355;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_19;
}
tmp_ass_subscribed_2 = tmp_inplace_assign_subscr_2__target;
CHECK_OBJECT( tmp_ass_subscribed_2 );
tmp_ass_subscript_2 = tmp_inplace_assign_subscr_2__subscript;
CHECK_OBJECT( tmp_ass_subscript_2 );
tmp_result = SET_SUBSCRIPT( tmp_ass_subscribed_2, tmp_ass_subscript_2, tmp_ass_subvalue_2 );
Py_DECREF( tmp_ass_subvalue_2 );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 355;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_19;
}
goto try_end_17;
// Exception handler code:
try_except_handler_19:;
exception_keeper_type_17 = exception_type;
exception_keeper_value_17 = exception_value;
exception_keeper_tb_17 = exception_tb;
exception_keeper_lineno_17 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_inplace_assign_subscr_2__target );
tmp_inplace_assign_subscr_2__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_2__subscript );
tmp_inplace_assign_subscr_2__subscript = NULL;
// Re-raise.
exception_type = exception_keeper_type_17;
exception_value = exception_keeper_value_17;
exception_tb = exception_keeper_tb_17;
exception_lineno = exception_keeper_lineno_17;
goto try_except_handler_18;
// End of try:
try_end_17:;
Py_XDECREF( tmp_inplace_assign_subscr_2__target );
tmp_inplace_assign_subscr_2__target = NULL;
Py_XDECREF( tmp_inplace_assign_subscr_2__subscript );
tmp_inplace_assign_subscr_2__subscript = NULL;
if ( CONSIDER_THREADING() == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 354;
type_description_1 = "ooooooooooooooooooo";
goto try_except_handler_18;
}
goto loop_start_6;
loop_end_6:;
goto try_end_18;
// Exception handler code:
try_except_handler_18:;
exception_keeper_type_18 = exception_type;
exception_keeper_value_18 = exception_value;
exception_keeper_tb_18 = exception_tb;
exception_keeper_lineno_18 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_for_loop_6__iter_value );
tmp_for_loop_6__iter_value = NULL;
Py_XDECREF( tmp_for_loop_6__for_iterator );
tmp_for_loop_6__for_iterator = NULL;
// Re-raise.
exception_type = exception_keeper_type_18;
exception_value = exception_keeper_value_18;
exception_tb = exception_keeper_tb_18;
exception_lineno = exception_keeper_lineno_18;
goto frame_exception_exit_1;
// End of try:
try_end_18:;
Py_XDECREF( tmp_for_loop_6__iter_value );
tmp_for_loop_6__iter_value = NULL;
Py_XDECREF( tmp_for_loop_6__for_iterator );
tmp_for_loop_6__for_iterator = NULL;
branch_no_9:;
tmp_return_value = PyTuple_New( 2 );
tmp_tuple_element_3 = var_result;
if ( tmp_tuple_element_3 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 356;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_3 );
tmp_tuple_element_3 = var_result_args;
if ( tmp_tuple_element_3 == NULL )
{
Py_DECREF( tmp_return_value );
exception_type = PyExc_UnboundLocalError;
Py_INCREF( exception_type );
exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "result_args" );
exception_tb = NULL;
NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
CHAIN_EXCEPTION( exception_value );
exception_lineno = 356;
type_description_1 = "ooooooooooooooooooo";
goto frame_exception_exit_1;
}
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_3 );
goto frame_return_exit_1;
#if 0
RESTORE_FRAME_EXCEPTION( frame_b69da881308ae3bcb5e98ce16ab3a067 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto frame_no_exception_1;
frame_return_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_b69da881308ae3bcb5e98ce16ab3a067 );
#endif
// Put the previous frame back on top.
popFrameStack();
goto try_return_handler_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_b69da881308ae3bcb5e98ce16ab3a067 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_b69da881308ae3bcb5e98ce16ab3a067, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_b69da881308ae3bcb5e98ce16ab3a067->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_b69da881308ae3bcb5e98ce16ab3a067, exception_lineno );
}
// Attachs locals to frame if any.
Nuitka_Frame_AttachLocals(
(struct Nuitka_FrameObject *)frame_b69da881308ae3bcb5e98ce16ab3a067,
type_description_1,
par_source,
var_params,
var_result,
var_result_args,
var_pos,
var_last,
var_elt,
var_piece,
var_param,
var_i,
var_inner_result,
var_inner_args,
var_item,
var_res,
var_args,
var_new_result,
var_new_args,
var_i_item,
var_i_args
);
// Release cached frame.
if ( frame_b69da881308ae3bcb5e98ce16ab3a067 == cache_frame_b69da881308ae3bcb5e98ce16ab3a067 )
{
Py_DECREF( frame_b69da881308ae3bcb5e98ce16ab3a067 );
}
cache_frame_b69da881308ae3bcb5e98ce16ab3a067 = NULL;
assertFrameObject( frame_b69da881308ae3bcb5e98ce16ab3a067 );
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto try_except_handler_1;
frame_no_exception_1:;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_6_flatten_result );
return NULL;
// Return handler code:
try_return_handler_1:;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( var_params );
var_params = NULL;
Py_XDECREF( var_result );
var_result = NULL;
Py_XDECREF( var_result_args );
var_result_args = NULL;
Py_XDECREF( var_pos );
var_pos = NULL;
Py_XDECREF( var_last );
var_last = NULL;
Py_XDECREF( var_elt );
var_elt = NULL;
Py_XDECREF( var_piece );
var_piece = NULL;
Py_XDECREF( var_param );
var_param = NULL;
Py_XDECREF( var_i );
var_i = NULL;
Py_XDECREF( var_inner_result );
var_inner_result = NULL;
Py_XDECREF( var_inner_args );
var_inner_args = NULL;
Py_XDECREF( var_item );
var_item = NULL;
Py_XDECREF( var_res );
var_res = NULL;
Py_XDECREF( var_args );
var_args = NULL;
Py_XDECREF( var_new_result );
var_new_result = NULL;
Py_XDECREF( var_new_args );
var_new_args = NULL;
Py_XDECREF( var_i_item );
var_i_item = NULL;
Py_XDECREF( var_i_args );
var_i_args = NULL;
goto function_return_exit;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_19 = exception_type;
exception_keeper_value_19 = exception_value;
exception_keeper_tb_19 = exception_tb;
exception_keeper_lineno_19 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( par_source );
par_source = NULL;
Py_XDECREF( var_params );
var_params = NULL;
Py_XDECREF( var_result );
var_result = NULL;
Py_XDECREF( var_result_args );
var_result_args = NULL;
Py_XDECREF( var_pos );
var_pos = NULL;
Py_XDECREF( var_last );
var_last = NULL;
Py_XDECREF( var_elt );
var_elt = NULL;
Py_XDECREF( var_piece );
var_piece = NULL;
Py_XDECREF( var_param );
var_param = NULL;
Py_XDECREF( var_i );
var_i = NULL;
Py_XDECREF( var_inner_result );
var_inner_result = NULL;
Py_XDECREF( var_inner_args );
var_inner_args = NULL;
Py_XDECREF( var_item );
var_item = NULL;
Py_XDECREF( var_res );
var_res = NULL;
Py_XDECREF( var_args );
var_args = NULL;
Py_XDECREF( var_new_result );
var_new_result = NULL;
Py_XDECREF( var_new_args );
var_new_args = NULL;
Py_XDECREF( var_i_item );
var_i_item = NULL;
Py_XDECREF( var_i_args );
var_i_args = NULL;
// Re-raise.
exception_type = exception_keeper_type_19;
exception_value = exception_keeper_value_19;
exception_tb = exception_keeper_tb_19;
exception_lineno = exception_keeper_lineno_19;
goto function_exception_exit;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper$$$function_6_flatten_result );
return NULL;
function_exception_exit:
assert( exception_type );
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return NULL;
function_return_exit:
CHECK_OBJECT( tmp_return_value );
assert( had_error || !ERROR_OCCURRED() );
return tmp_return_value;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_1_normalize( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_1_normalize,
const_str_plain_normalize,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_02dd3cdeef3510cc872d2bde3cdfe4f3,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_399fdd57f20fe67e84d491ef4faca851,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_2_next_char( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_2_next_char,
const_str_plain_next_char,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_7cd0a752e57b56d66ee85502e645ad13,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_4ab076c21dc625da225cadcb02dfcdcd,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_3_walk_to_end( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_3_walk_to_end,
const_str_plain_walk_to_end,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_3064079d76426a0e23f26ffe15c6dc56,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_825a1a2d5c880398bce5ad8725f5f619,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_4_get_quantifier( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_4_get_quantifier,
const_str_plain_get_quantifier,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_1e148640a480b197863191e98c3d7616,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_c69f2b067cdf07201bc3975c96201d5b,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_5_contains( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_5_contains,
const_str_plain_contains,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_3a16fa7bc80c0b7cccb4ab8d5cd2b9b0,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_71d281045ab49b6004d8c8a2f9bdfcd5,
0
);
return (PyObject *)result;
}
static PyObject *MAKE_FUNCTION_django$utils$regex_helper$$$function_6_flatten_result( )
{
struct Nuitka_FunctionObject *result = Nuitka_Function_New(
impl_django$utils$regex_helper$$$function_6_flatten_result,
const_str_plain_flatten_result,
#if PYTHON_VERSION >= 330
NULL,
#endif
codeobj_b69da881308ae3bcb5e98ce16ab3a067,
NULL,
#if PYTHON_VERSION >= 300
NULL,
const_dict_empty,
#endif
module_django$utils$regex_helper,
const_str_digest_c11027ebc10328edd138147ca6c3ab0c,
0
);
return (PyObject *)result;
}
#if PYTHON_VERSION >= 300
static struct PyModuleDef mdef_django$utils$regex_helper =
{
PyModuleDef_HEAD_INIT,
"django.utils.regex_helper", /* m_name */
NULL, /* m_doc */
-1, /* m_size */
NULL, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
#endif
#if PYTHON_VERSION >= 300
extern PyObject *metapath_based_loader;
#endif
#if PYTHON_VERSION >= 330
extern PyObject *const_str_plain___loader__;
#endif
extern void _initCompiledCellType();
extern void _initCompiledGeneratorType();
extern void _initCompiledFunctionType();
extern void _initCompiledMethodType();
extern void _initCompiledFrameType();
#if PYTHON_VERSION >= 350
extern void _initCompiledCoroutineTypes();
#endif
#if PYTHON_VERSION >= 360
extern void _initCompiledAsyncgenTypes();
#endif
// The exported interface to CPython. On import of the module, this function
// gets called. It has to have an exact function name, in cases it's a shared
// library export. This is hidden behind the MOD_INIT_DECL.
MOD_INIT_DECL( django$utils$regex_helper )
{
#if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300
static bool _init_done = false;
// Modules might be imported repeatedly, which is to be ignored.
if ( _init_done )
{
return MOD_RETURN_VALUE( module_django$utils$regex_helper );
}
else
{
_init_done = true;
}
#endif
#ifdef _NUITKA_MODULE
// In case of a stand alone extension module, need to call initialization
// the init here because that's the first and only time we are going to get
// called here.
// Initialize the constant values used.
_initBuiltinModule();
createGlobalConstants();
/* Initialize the compiled types of Nuitka. */
_initCompiledCellType();
_initCompiledGeneratorType();
_initCompiledFunctionType();
_initCompiledMethodType();
_initCompiledFrameType();
#if PYTHON_VERSION >= 350
_initCompiledCoroutineTypes();
#endif
#if PYTHON_VERSION >= 360
_initCompiledAsyncgenTypes();
#endif
#if PYTHON_VERSION < 300
_initSlotCompare();
#endif
#if PYTHON_VERSION >= 270
_initSlotIternext();
#endif
patchBuiltinModule();
patchTypeComparison();
// Enable meta path based loader if not already done.
setupMetaPathBasedLoader();
#if PYTHON_VERSION >= 300
patchInspectModule();
#endif
#endif
/* The constants only used by this module are created now. */
#ifdef _NUITKA_TRACE
puts("django.utils.regex_helper: Calling createModuleConstants().");
#endif
createModuleConstants();
/* The code objects used by this module are created now. */
#ifdef _NUITKA_TRACE
puts("django.utils.regex_helper: Calling createModuleCodeObjects().");
#endif
createModuleCodeObjects();
// puts( "in initdjango$utils$regex_helper" );
// Create the module object first. There are no methods initially, all are
// added dynamically in actual code only. Also no "__doc__" is initially
// set at this time, as it could not contain NUL characters this way, they
// are instead set in early module code. No "self" for modules, we have no
// use for it.
#if PYTHON_VERSION < 300
module_django$utils$regex_helper = Py_InitModule4(
"django.utils.regex_helper", // Module Name
NULL, // No methods initially, all are added
// dynamically in actual module code only.
NULL, // No __doc__ is initially set, as it could
// not contain NUL this way, added early in
// actual code.
NULL, // No self for modules, we don't use it.
PYTHON_API_VERSION
);
#else
module_django$utils$regex_helper = PyModule_Create( &mdef_django$utils$regex_helper );
#endif
moduledict_django$utils$regex_helper = MODULE_DICT( module_django$utils$regex_helper );
CHECK_OBJECT( module_django$utils$regex_helper );
// Seems to work for Python2.7 out of the box, but for Python3, the module
// doesn't automatically enter "sys.modules", so do it manually.
#if PYTHON_VERSION >= 300
{
int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955, module_django$utils$regex_helper );
assert( r != -1 );
}
#endif
// For deep importing of a module we need to have "__builtins__", so we set
// it ourselves in the same way than CPython does. Note: This must be done
// before the frame object is allocated, or else it may fail.
if ( GET_STRING_DICT_VALUE( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___builtins__ ) == NULL )
{
PyObject *value = (PyObject *)builtin_module;
// Check if main module, not a dict then but the module itself.
#if !defined(_NUITKA_EXE) || !0
value = PyModule_GetDict( value );
#endif
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___builtins__, value );
}
#if PYTHON_VERSION >= 330
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___loader__, metapath_based_loader );
#endif
// Temp variables if any
PyObject *outline_0_var___class__ = NULL;
PyObject *outline_0_var___qualname__ = NULL;
PyObject *outline_0_var___module__ = NULL;
PyObject *outline_0_var___doc__ = NULL;
PyObject *outline_1_var___class__ = NULL;
PyObject *outline_1_var___qualname__ = NULL;
PyObject *outline_1_var___module__ = NULL;
PyObject *outline_1_var___doc__ = NULL;
PyObject *outline_2_var___class__ = NULL;
PyObject *outline_2_var___qualname__ = NULL;
PyObject *outline_2_var___module__ = NULL;
PyObject *outline_2_var___doc__ = NULL;
PyObject *tmp_class_creation_1__bases = NULL;
PyObject *tmp_class_creation_1__class_decl_dict = NULL;
PyObject *tmp_class_creation_1__metaclass = NULL;
PyObject *tmp_class_creation_1__prepared = NULL;
PyObject *tmp_class_creation_2__bases = NULL;
PyObject *tmp_class_creation_2__class_decl_dict = NULL;
PyObject *tmp_class_creation_2__metaclass = NULL;
PyObject *tmp_class_creation_2__prepared = NULL;
PyObject *tmp_class_creation_3__bases = NULL;
PyObject *tmp_class_creation_3__class_decl_dict = NULL;
PyObject *tmp_class_creation_3__metaclass = NULL;
PyObject *tmp_class_creation_3__prepared = NULL;
PyObject *exception_type = NULL;
PyObject *exception_value = NULL;
PyTracebackObject *exception_tb = NULL;
NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
PyObject *exception_keeper_type_1;
PyObject *exception_keeper_value_1;
PyTracebackObject *exception_keeper_tb_1;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
PyObject *exception_keeper_type_2;
PyObject *exception_keeper_value_2;
PyTracebackObject *exception_keeper_tb_2;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
PyObject *exception_keeper_type_3;
PyObject *exception_keeper_value_3;
PyTracebackObject *exception_keeper_tb_3;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
PyObject *exception_keeper_type_4;
PyObject *exception_keeper_value_4;
PyTracebackObject *exception_keeper_tb_4;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_4;
PyObject *exception_keeper_type_5;
PyObject *exception_keeper_value_5;
PyTracebackObject *exception_keeper_tb_5;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_5;
PyObject *exception_keeper_type_6;
PyObject *exception_keeper_value_6;
PyTracebackObject *exception_keeper_tb_6;
NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_6;
PyObject *tmp_args_element_name_1;
PyObject *tmp_args_element_name_2;
PyObject *tmp_args_name_1;
PyObject *tmp_args_name_2;
PyObject *tmp_args_name_3;
PyObject *tmp_args_name_4;
PyObject *tmp_args_name_5;
PyObject *tmp_args_name_6;
PyObject *tmp_assign_source_1;
PyObject *tmp_assign_source_2;
PyObject *tmp_assign_source_3;
PyObject *tmp_assign_source_4;
PyObject *tmp_assign_source_5;
PyObject *tmp_assign_source_6;
PyObject *tmp_assign_source_7;
PyObject *tmp_assign_source_8;
PyObject *tmp_assign_source_9;
PyObject *tmp_assign_source_10;
PyObject *tmp_assign_source_11;
PyObject *tmp_assign_source_12;
PyObject *tmp_assign_source_13;
PyObject *tmp_assign_source_14;
PyObject *tmp_assign_source_15;
PyObject *tmp_assign_source_16;
PyObject *tmp_assign_source_17;
PyObject *tmp_assign_source_18;
PyObject *tmp_assign_source_19;
PyObject *tmp_assign_source_20;
PyObject *tmp_assign_source_21;
PyObject *tmp_assign_source_22;
PyObject *tmp_assign_source_23;
PyObject *tmp_assign_source_24;
PyObject *tmp_assign_source_25;
PyObject *tmp_assign_source_26;
PyObject *tmp_assign_source_27;
PyObject *tmp_assign_source_28;
PyObject *tmp_assign_source_29;
PyObject *tmp_assign_source_30;
PyObject *tmp_assign_source_31;
PyObject *tmp_assign_source_32;
PyObject *tmp_assign_source_33;
PyObject *tmp_assign_source_34;
PyObject *tmp_assign_source_35;
PyObject *tmp_assign_source_36;
PyObject *tmp_assign_source_37;
PyObject *tmp_assign_source_38;
PyObject *tmp_assign_source_39;
PyObject *tmp_assign_source_40;
PyObject *tmp_assign_source_41;
PyObject *tmp_assign_source_42;
PyObject *tmp_assign_source_43;
PyObject *tmp_assign_source_44;
PyObject *tmp_assign_source_45;
PyObject *tmp_bases_name_1;
PyObject *tmp_bases_name_2;
PyObject *tmp_bases_name_3;
PyObject *tmp_called_name_1;
PyObject *tmp_called_name_2;
PyObject *tmp_called_name_3;
PyObject *tmp_called_name_4;
PyObject *tmp_called_name_5;
PyObject *tmp_called_name_6;
PyObject *tmp_called_name_7;
int tmp_cmp_In_1;
int tmp_cmp_In_2;
int tmp_cmp_In_3;
int tmp_cmp_In_4;
int tmp_cmp_In_5;
int tmp_cmp_In_6;
PyObject *tmp_compare_left_1;
PyObject *tmp_compare_left_2;
PyObject *tmp_compare_left_3;
PyObject *tmp_compare_left_4;
PyObject *tmp_compare_left_5;
PyObject *tmp_compare_left_6;
PyObject *tmp_compare_right_1;
PyObject *tmp_compare_right_2;
PyObject *tmp_compare_right_3;
PyObject *tmp_compare_right_4;
PyObject *tmp_compare_right_5;
PyObject *tmp_compare_right_6;
int tmp_cond_truth_1;
int tmp_cond_truth_2;
int tmp_cond_truth_3;
PyObject *tmp_cond_value_1;
PyObject *tmp_cond_value_2;
PyObject *tmp_cond_value_3;
PyObject *tmp_dict_name_1;
PyObject *tmp_dict_name_2;
PyObject *tmp_dict_name_3;
PyObject *tmp_dictdel_dict;
PyObject *tmp_dictdel_key;
PyObject *tmp_fromlist_name_1;
PyObject *tmp_fromlist_name_2;
PyObject *tmp_fromlist_name_3;
PyObject *tmp_fromlist_name_4;
PyObject *tmp_globals_name_1;
PyObject *tmp_globals_name_2;
PyObject *tmp_globals_name_3;
PyObject *tmp_globals_name_4;
PyObject *tmp_hasattr_attr_1;
PyObject *tmp_hasattr_attr_2;
PyObject *tmp_hasattr_attr_3;
PyObject *tmp_hasattr_source_1;
PyObject *tmp_hasattr_source_2;
PyObject *tmp_hasattr_source_3;
PyObject *tmp_import_name_from_1;
PyObject *tmp_import_name_from_2;
PyObject *tmp_import_name_from_3;
PyObject *tmp_import_name_from_4;
PyObject *tmp_key_name_1;
PyObject *tmp_key_name_2;
PyObject *tmp_key_name_3;
PyObject *tmp_kw_name_1;
PyObject *tmp_kw_name_2;
PyObject *tmp_kw_name_3;
PyObject *tmp_kw_name_4;
PyObject *tmp_kw_name_5;
PyObject *tmp_kw_name_6;
PyObject *tmp_level_name_1;
PyObject *tmp_level_name_2;
PyObject *tmp_level_name_3;
PyObject *tmp_level_name_4;
PyObject *tmp_locals_name_1;
PyObject *tmp_locals_name_2;
PyObject *tmp_locals_name_3;
PyObject *tmp_locals_name_4;
PyObject *tmp_metaclass_name_1;
PyObject *tmp_metaclass_name_2;
PyObject *tmp_metaclass_name_3;
PyObject *tmp_name_name_1;
PyObject *tmp_name_name_2;
PyObject *tmp_name_name_3;
PyObject *tmp_name_name_4;
PyObject *tmp_outline_return_value_1;
PyObject *tmp_outline_return_value_2;
PyObject *tmp_outline_return_value_3;
int tmp_res;
bool tmp_result;
PyObject *tmp_set_locals;
PyObject *tmp_source_name_1;
PyObject *tmp_source_name_2;
PyObject *tmp_source_name_3;
PyObject *tmp_subscribed_name_1;
PyObject *tmp_subscribed_name_2;
PyObject *tmp_subscribed_name_3;
PyObject *tmp_subscript_name_1;
PyObject *tmp_subscript_name_2;
PyObject *tmp_subscript_name_3;
PyObject *tmp_tuple_element_1;
PyObject *tmp_tuple_element_2;
PyObject *tmp_tuple_element_3;
PyObject *tmp_tuple_element_4;
PyObject *tmp_tuple_element_5;
PyObject *tmp_tuple_element_6;
PyObject *tmp_type_arg_1;
PyObject *tmp_type_arg_2;
PyObject *tmp_type_arg_3;
struct Nuitka_FrameObject *frame_c62028e7d60a3f369a063311f731c3e3;
NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
tmp_outline_return_value_1 = NULL;
tmp_outline_return_value_2 = NULL;
tmp_outline_return_value_3 = NULL;
// Locals dictionary setup.
PyObject *locals_dict_1 = PyDict_New();
// Locals dictionary setup.
PyObject *locals_dict_2 = PyDict_New();
// Locals dictionary setup.
PyObject *locals_dict_3 = PyDict_New();
// Module code.
tmp_assign_source_1 = const_str_digest_b71502c89ee784d5a03569ff0d277a2c;
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 );
tmp_assign_source_2 = module_filename_obj;
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 );
tmp_assign_source_3 = metapath_based_loader;
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___loader__, tmp_assign_source_3 );
// Frame without reuse.
frame_c62028e7d60a3f369a063311f731c3e3 = MAKE_MODULE_FRAME( codeobj_c62028e7d60a3f369a063311f731c3e3, module_django$utils$regex_helper );
// Push the new frame as the currently active one, and we should be exclusively
// owning it.
pushFrameStack( frame_c62028e7d60a3f369a063311f731c3e3 );
assert( Py_REFCNT( frame_c62028e7d60a3f369a063311f731c3e3 ) == 2 );
// Framed code:
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 1;
{
PyObject *module = PyImport_ImportModule("importlib._bootstrap");
if (likely( module != NULL ))
{
tmp_called_name_1 = PyObject_GetAttr( module, const_str_plain_ModuleSpec );
}
else
{
tmp_called_name_1 = NULL;
}
}
if ( tmp_called_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto frame_exception_exit_1;
}
tmp_args_element_name_1 = const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955;
tmp_args_element_name_2 = metapath_based_loader;
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 1;
{
PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 };
tmp_assign_source_4 = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_1, call_args );
}
if ( tmp_assign_source_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 1;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___spec__, tmp_assign_source_4 );
tmp_assign_source_5 = Py_None;
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_5 );
tmp_assign_source_6 = const_str_digest_467c9722f19d9d40d148689532cdc0b1;
UPDATE_STRING_DICT0( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_6 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 8;
tmp_import_name_from_1 = PyImport_ImportModule("__future__");
assert( tmp_import_name_from_1 != NULL );
tmp_assign_source_7 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_unicode_literals );
if ( tmp_assign_source_7 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 8;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_unicode_literals, tmp_assign_source_7 );
tmp_name_name_1 = const_str_plain_warnings;
tmp_globals_name_1 = (PyObject *)moduledict_django$utils$regex_helper;
tmp_locals_name_1 = Py_None;
tmp_fromlist_name_1 = Py_None;
tmp_level_name_1 = const_int_0;
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 10;
tmp_assign_source_8 = IMPORT_MODULE5( tmp_name_name_1, tmp_globals_name_1, tmp_locals_name_1, tmp_fromlist_name_1, tmp_level_name_1 );
if ( tmp_assign_source_8 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 10;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_warnings, tmp_assign_source_8 );
tmp_name_name_2 = const_str_digest_467c9722f19d9d40d148689532cdc0b1;
tmp_globals_name_2 = (PyObject *)moduledict_django$utils$regex_helper;
tmp_locals_name_2 = Py_None;
tmp_fromlist_name_2 = const_tuple_str_plain_six_tuple;
tmp_level_name_2 = const_int_0;
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 12;
tmp_import_name_from_2 = IMPORT_MODULE5( tmp_name_name_2, tmp_globals_name_2, tmp_locals_name_2, tmp_fromlist_name_2, tmp_level_name_2 );
if ( tmp_import_name_from_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 12;
goto frame_exception_exit_1;
}
tmp_assign_source_9 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain_six );
Py_DECREF( tmp_import_name_from_2 );
if ( tmp_assign_source_9 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 12;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_six, tmp_assign_source_9 );
tmp_name_name_3 = const_str_digest_f3705ed203bc8405b0735fb4179b32a8;
tmp_globals_name_3 = (PyObject *)moduledict_django$utils$regex_helper;
tmp_locals_name_3 = Py_None;
tmp_fromlist_name_3 = const_tuple_str_plain_RemovedInDjango21Warning_tuple;
tmp_level_name_3 = const_int_0;
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 13;
tmp_import_name_from_3 = IMPORT_MODULE5( tmp_name_name_3, tmp_globals_name_3, tmp_locals_name_3, tmp_fromlist_name_3, tmp_level_name_3 );
if ( tmp_import_name_from_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 13;
goto frame_exception_exit_1;
}
tmp_assign_source_10 = IMPORT_NAME( tmp_import_name_from_3, const_str_plain_RemovedInDjango21Warning );
Py_DECREF( tmp_import_name_from_3 );
if ( tmp_assign_source_10 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 13;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_RemovedInDjango21Warning, tmp_assign_source_10 );
tmp_name_name_4 = const_str_digest_6fed4619fa8d4c69fdb5c74f190acfee;
tmp_globals_name_4 = (PyObject *)moduledict_django$utils$regex_helper;
tmp_locals_name_4 = Py_None;
tmp_fromlist_name_4 = const_tuple_str_plain_zip_tuple;
tmp_level_name_4 = const_int_0;
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 14;
tmp_import_name_from_4 = IMPORT_MODULE5( tmp_name_name_4, tmp_globals_name_4, tmp_locals_name_4, tmp_fromlist_name_4, tmp_level_name_4 );
if ( tmp_import_name_from_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 14;
goto frame_exception_exit_1;
}
tmp_assign_source_11 = IMPORT_NAME( tmp_import_name_from_4, const_str_plain_zip );
Py_DECREF( tmp_import_name_from_4 );
if ( tmp_assign_source_11 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 14;
goto frame_exception_exit_1;
}
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_zip, tmp_assign_source_11 );
tmp_assign_source_12 = PyDict_Copy( const_dict_83f7070578e4aca9ff6c13b95a921246 );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_ESCAPE_MAPPINGS, tmp_assign_source_12 );
tmp_assign_source_13 = const_tuple_type_list_tuple;
assert( tmp_class_creation_1__bases == NULL );
Py_INCREF( tmp_assign_source_13 );
tmp_class_creation_1__bases = tmp_assign_source_13;
tmp_assign_source_14 = PyDict_New();
assert( tmp_class_creation_1__class_decl_dict == NULL );
tmp_class_creation_1__class_decl_dict = tmp_assign_source_14;
// Tried code:
tmp_compare_left_1 = const_str_plain_metaclass;
tmp_compare_right_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_1 );
tmp_cmp_In_1 = PySequence_Contains( tmp_compare_right_1, tmp_compare_left_1 );
assert( !(tmp_cmp_In_1 == -1) );
if ( tmp_cmp_In_1 == 1 )
{
goto condexpr_true_1;
}
else
{
goto condexpr_false_1;
}
condexpr_true_1:;
tmp_dict_name_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_dict_name_1 );
tmp_key_name_1 = const_str_plain_metaclass;
tmp_metaclass_name_1 = DICT_GET_ITEM( tmp_dict_name_1, tmp_key_name_1 );
if ( tmp_metaclass_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
goto condexpr_end_1;
condexpr_false_1:;
tmp_cond_value_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_cond_value_1 );
tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
if ( tmp_cond_truth_1 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
if ( tmp_cond_truth_1 == 1 )
{
goto condexpr_true_2;
}
else
{
goto condexpr_false_2;
}
condexpr_true_2:;
tmp_subscribed_name_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_subscribed_name_1 );
tmp_subscript_name_1 = const_int_0;
tmp_type_arg_1 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
if ( tmp_type_arg_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
tmp_metaclass_name_1 = BUILTIN_TYPE1( tmp_type_arg_1 );
Py_DECREF( tmp_type_arg_1 );
if ( tmp_metaclass_name_1 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
goto condexpr_end_2;
condexpr_false_2:;
tmp_metaclass_name_1 = (PyObject *)&PyType_Type;
Py_INCREF( tmp_metaclass_name_1 );
condexpr_end_2:;
condexpr_end_1:;
tmp_bases_name_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_bases_name_1 );
tmp_assign_source_15 = SELECT_METACLASS( tmp_metaclass_name_1, tmp_bases_name_1 );
if ( tmp_assign_source_15 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_metaclass_name_1 );
exception_lineno = 33;
goto try_except_handler_1;
}
Py_DECREF( tmp_metaclass_name_1 );
assert( tmp_class_creation_1__metaclass == NULL );
tmp_class_creation_1__metaclass = tmp_assign_source_15;
tmp_compare_left_2 = const_str_plain_metaclass;
tmp_compare_right_2 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_2 );
tmp_cmp_In_2 = PySequence_Contains( tmp_compare_right_2, tmp_compare_left_2 );
assert( !(tmp_cmp_In_2 == -1) );
if ( tmp_cmp_In_2 == 1 )
{
goto branch_yes_1;
}
else
{
goto branch_no_1;
}
branch_yes_1:;
tmp_dictdel_dict = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_dictdel_dict );
tmp_dictdel_key = const_str_plain_metaclass;
tmp_result = DICT_REMOVE_ITEM( tmp_dictdel_dict, tmp_dictdel_key );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
branch_no_1:;
tmp_hasattr_source_1 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_hasattr_source_1 );
tmp_hasattr_attr_1 = const_str_plain___prepare__;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_1, tmp_hasattr_attr_1 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
if ( tmp_res == 1 )
{
goto condexpr_true_3;
}
else
{
goto condexpr_false_3;
}
condexpr_true_3:;
tmp_source_name_1 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_source_name_1 );
tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain___prepare__ );
if ( tmp_called_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
tmp_args_name_1 = PyTuple_New( 2 );
tmp_tuple_element_1 = const_str_plain_Choice;
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_1 );
tmp_tuple_element_1 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_tuple_element_1 );
Py_INCREF( tmp_tuple_element_1 );
PyTuple_SET_ITEM( tmp_args_name_1, 1, tmp_tuple_element_1 );
tmp_kw_name_1 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_1 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 33;
tmp_assign_source_16 = CALL_FUNCTION( tmp_called_name_2, tmp_args_name_1, tmp_kw_name_1 );
Py_DECREF( tmp_called_name_2 );
Py_DECREF( tmp_args_name_1 );
if ( tmp_assign_source_16 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_1;
}
goto condexpr_end_3;
condexpr_false_3:;
tmp_assign_source_16 = PyDict_New();
condexpr_end_3:;
assert( tmp_class_creation_1__prepared == NULL );
tmp_class_creation_1__prepared = tmp_assign_source_16;
tmp_set_locals = tmp_class_creation_1__prepared;
CHECK_OBJECT( tmp_set_locals );
Py_DECREF(locals_dict_1);
locals_dict_1 = tmp_set_locals;
Py_INCREF( tmp_set_locals );
tmp_assign_source_18 = const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955;
assert( outline_0_var___module__ == NULL );
Py_INCREF( tmp_assign_source_18 );
outline_0_var___module__ = tmp_assign_source_18;
tmp_assign_source_19 = const_str_digest_a3517a037e3b11b7706c9f5a5b4bf823;
assert( outline_0_var___doc__ == NULL );
Py_INCREF( tmp_assign_source_19 );
outline_0_var___doc__ = tmp_assign_source_19;
tmp_assign_source_20 = const_str_plain_Choice;
assert( outline_0_var___qualname__ == NULL );
Py_INCREF( tmp_assign_source_20 );
outline_0_var___qualname__ = tmp_assign_source_20;
// Tried code:
tmp_called_name_3 = tmp_class_creation_1__metaclass;
CHECK_OBJECT( tmp_called_name_3 );
tmp_args_name_2 = PyTuple_New( 3 );
tmp_tuple_element_2 = const_str_plain_Choice;
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_name_2, 0, tmp_tuple_element_2 );
tmp_tuple_element_2 = tmp_class_creation_1__bases;
CHECK_OBJECT( tmp_tuple_element_2 );
Py_INCREF( tmp_tuple_element_2 );
PyTuple_SET_ITEM( tmp_args_name_2, 1, tmp_tuple_element_2 );
tmp_tuple_element_2 = locals_dict_1;
Py_INCREF( tmp_tuple_element_2 );
if ( outline_0_var___qualname__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_2,
const_str_plain___qualname__,
outline_0_var___qualname__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_2,
const_str_plain___qualname__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_2,
const_str_plain___qualname__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_2 );
exception_lineno = 33;
goto try_except_handler_2;
}
if ( outline_0_var___module__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_2,
const_str_plain___module__,
outline_0_var___module__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_2,
const_str_plain___module__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_2,
const_str_plain___module__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_2 );
exception_lineno = 33;
goto try_except_handler_2;
}
if ( outline_0_var___doc__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_2,
const_str_plain___doc__,
outline_0_var___doc__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_2,
const_str_plain___doc__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_2,
const_str_plain___doc__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_2 );
Py_DECREF( tmp_tuple_element_2 );
exception_lineno = 33;
goto try_except_handler_2;
}
PyTuple_SET_ITEM( tmp_args_name_2, 2, tmp_tuple_element_2 );
tmp_kw_name_2 = tmp_class_creation_1__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_2 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 33;
tmp_assign_source_21 = CALL_FUNCTION( tmp_called_name_3, tmp_args_name_2, tmp_kw_name_2 );
Py_DECREF( tmp_args_name_2 );
if ( tmp_assign_source_21 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 33;
goto try_except_handler_2;
}
assert( outline_0_var___class__ == NULL );
outline_0_var___class__ = tmp_assign_source_21;
tmp_outline_return_value_1 = outline_0_var___class__;
CHECK_OBJECT( tmp_outline_return_value_1 );
Py_INCREF( tmp_outline_return_value_1 );
goto try_return_handler_2;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
// Return handler code:
try_return_handler_2:;
CHECK_OBJECT( (PyObject *)outline_0_var___class__ );
Py_DECREF( outline_0_var___class__ );
outline_0_var___class__ = NULL;
Py_XDECREF( outline_0_var___qualname__ );
outline_0_var___qualname__ = NULL;
Py_XDECREF( outline_0_var___module__ );
outline_0_var___module__ = NULL;
Py_XDECREF( outline_0_var___doc__ );
outline_0_var___doc__ = NULL;
goto outline_result_1;
// Exception handler code:
try_except_handler_2:;
exception_keeper_type_1 = exception_type;
exception_keeper_value_1 = exception_value;
exception_keeper_tb_1 = exception_tb;
exception_keeper_lineno_1 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_0_var___qualname__ );
outline_0_var___qualname__ = NULL;
Py_XDECREF( outline_0_var___module__ );
outline_0_var___module__ = NULL;
Py_XDECREF( outline_0_var___doc__ );
outline_0_var___doc__ = NULL;
// Re-raise.
exception_type = exception_keeper_type_1;
exception_value = exception_keeper_value_1;
exception_tb = exception_keeper_tb_1;
exception_lineno = exception_keeper_lineno_1;
goto outline_exception_1;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
outline_exception_1:;
exception_lineno = 33;
goto try_except_handler_1;
outline_result_1:;
tmp_assign_source_17 = tmp_outline_return_value_1;
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Choice, tmp_assign_source_17 );
goto try_end_1;
// Exception handler code:
try_except_handler_1:;
exception_keeper_type_2 = exception_type;
exception_keeper_value_2 = exception_value;
exception_keeper_tb_2 = exception_tb;
exception_keeper_lineno_2 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_class_creation_1__bases );
tmp_class_creation_1__bases = NULL;
Py_XDECREF( tmp_class_creation_1__class_decl_dict );
tmp_class_creation_1__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_1__metaclass );
tmp_class_creation_1__metaclass = NULL;
Py_XDECREF( tmp_class_creation_1__prepared );
tmp_class_creation_1__prepared = NULL;
// Re-raise.
exception_type = exception_keeper_type_2;
exception_value = exception_keeper_value_2;
exception_tb = exception_keeper_tb_2;
exception_lineno = exception_keeper_lineno_2;
goto frame_exception_exit_1;
// End of try:
try_end_1:;
Py_XDECREF( tmp_class_creation_1__bases );
tmp_class_creation_1__bases = NULL;
Py_XDECREF( tmp_class_creation_1__class_decl_dict );
tmp_class_creation_1__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_1__metaclass );
tmp_class_creation_1__metaclass = NULL;
Py_XDECREF( tmp_class_creation_1__prepared );
tmp_class_creation_1__prepared = NULL;
tmp_assign_source_22 = const_tuple_type_list_tuple;
assert( tmp_class_creation_2__bases == NULL );
Py_INCREF( tmp_assign_source_22 );
tmp_class_creation_2__bases = tmp_assign_source_22;
tmp_assign_source_23 = PyDict_New();
assert( tmp_class_creation_2__class_decl_dict == NULL );
tmp_class_creation_2__class_decl_dict = tmp_assign_source_23;
// Tried code:
tmp_compare_left_3 = const_str_plain_metaclass;
tmp_compare_right_3 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_3 );
tmp_cmp_In_3 = PySequence_Contains( tmp_compare_right_3, tmp_compare_left_3 );
assert( !(tmp_cmp_In_3 == -1) );
if ( tmp_cmp_In_3 == 1 )
{
goto condexpr_true_4;
}
else
{
goto condexpr_false_4;
}
condexpr_true_4:;
tmp_dict_name_2 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_dict_name_2 );
tmp_key_name_2 = const_str_plain_metaclass;
tmp_metaclass_name_2 = DICT_GET_ITEM( tmp_dict_name_2, tmp_key_name_2 );
if ( tmp_metaclass_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
goto condexpr_end_4;
condexpr_false_4:;
tmp_cond_value_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_cond_value_2 );
tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 );
if ( tmp_cond_truth_2 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
if ( tmp_cond_truth_2 == 1 )
{
goto condexpr_true_5;
}
else
{
goto condexpr_false_5;
}
condexpr_true_5:;
tmp_subscribed_name_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_subscribed_name_2 );
tmp_subscript_name_2 = const_int_0;
tmp_type_arg_2 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_2, tmp_subscript_name_2 );
if ( tmp_type_arg_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
tmp_metaclass_name_2 = BUILTIN_TYPE1( tmp_type_arg_2 );
Py_DECREF( tmp_type_arg_2 );
if ( tmp_metaclass_name_2 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
goto condexpr_end_5;
condexpr_false_5:;
tmp_metaclass_name_2 = (PyObject *)&PyType_Type;
Py_INCREF( tmp_metaclass_name_2 );
condexpr_end_5:;
condexpr_end_4:;
tmp_bases_name_2 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_bases_name_2 );
tmp_assign_source_24 = SELECT_METACLASS( tmp_metaclass_name_2, tmp_bases_name_2 );
if ( tmp_assign_source_24 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_metaclass_name_2 );
exception_lineno = 41;
goto try_except_handler_3;
}
Py_DECREF( tmp_metaclass_name_2 );
assert( tmp_class_creation_2__metaclass == NULL );
tmp_class_creation_2__metaclass = tmp_assign_source_24;
tmp_compare_left_4 = const_str_plain_metaclass;
tmp_compare_right_4 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_4 );
tmp_cmp_In_4 = PySequence_Contains( tmp_compare_right_4, tmp_compare_left_4 );
assert( !(tmp_cmp_In_4 == -1) );
if ( tmp_cmp_In_4 == 1 )
{
goto branch_yes_2;
}
else
{
goto branch_no_2;
}
branch_yes_2:;
tmp_dictdel_dict = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_dictdel_dict );
tmp_dictdel_key = const_str_plain_metaclass;
tmp_result = DICT_REMOVE_ITEM( tmp_dictdel_dict, tmp_dictdel_key );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
branch_no_2:;
tmp_hasattr_source_2 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_hasattr_source_2 );
tmp_hasattr_attr_2 = const_str_plain___prepare__;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_2, tmp_hasattr_attr_2 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
if ( tmp_res == 1 )
{
goto condexpr_true_6;
}
else
{
goto condexpr_false_6;
}
condexpr_true_6:;
tmp_source_name_2 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_source_name_2 );
tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain___prepare__ );
if ( tmp_called_name_4 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
tmp_args_name_3 = PyTuple_New( 2 );
tmp_tuple_element_3 = const_str_plain_Group;
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_name_3, 0, tmp_tuple_element_3 );
tmp_tuple_element_3 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_tuple_element_3 );
Py_INCREF( tmp_tuple_element_3 );
PyTuple_SET_ITEM( tmp_args_name_3, 1, tmp_tuple_element_3 );
tmp_kw_name_3 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_3 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 41;
tmp_assign_source_25 = CALL_FUNCTION( tmp_called_name_4, tmp_args_name_3, tmp_kw_name_3 );
Py_DECREF( tmp_called_name_4 );
Py_DECREF( tmp_args_name_3 );
if ( tmp_assign_source_25 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_3;
}
goto condexpr_end_6;
condexpr_false_6:;
tmp_assign_source_25 = PyDict_New();
condexpr_end_6:;
assert( tmp_class_creation_2__prepared == NULL );
tmp_class_creation_2__prepared = tmp_assign_source_25;
tmp_set_locals = tmp_class_creation_2__prepared;
CHECK_OBJECT( tmp_set_locals );
Py_DECREF(locals_dict_2);
locals_dict_2 = tmp_set_locals;
Py_INCREF( tmp_set_locals );
tmp_assign_source_27 = const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955;
assert( outline_1_var___module__ == NULL );
Py_INCREF( tmp_assign_source_27 );
outline_1_var___module__ = tmp_assign_source_27;
tmp_assign_source_28 = const_str_digest_d133d79f8748aeb03e369bb8d2d4ca37;
assert( outline_1_var___doc__ == NULL );
Py_INCREF( tmp_assign_source_28 );
outline_1_var___doc__ = tmp_assign_source_28;
tmp_assign_source_29 = const_str_plain_Group;
assert( outline_1_var___qualname__ == NULL );
Py_INCREF( tmp_assign_source_29 );
outline_1_var___qualname__ = tmp_assign_source_29;
// Tried code:
tmp_called_name_5 = tmp_class_creation_2__metaclass;
CHECK_OBJECT( tmp_called_name_5 );
tmp_args_name_4 = PyTuple_New( 3 );
tmp_tuple_element_4 = const_str_plain_Group;
Py_INCREF( tmp_tuple_element_4 );
PyTuple_SET_ITEM( tmp_args_name_4, 0, tmp_tuple_element_4 );
tmp_tuple_element_4 = tmp_class_creation_2__bases;
CHECK_OBJECT( tmp_tuple_element_4 );
Py_INCREF( tmp_tuple_element_4 );
PyTuple_SET_ITEM( tmp_args_name_4, 1, tmp_tuple_element_4 );
tmp_tuple_element_4 = locals_dict_2;
Py_INCREF( tmp_tuple_element_4 );
if ( outline_1_var___qualname__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_4,
const_str_plain___qualname__,
outline_1_var___qualname__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_4,
const_str_plain___qualname__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_4,
const_str_plain___qualname__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_4 );
exception_lineno = 41;
goto try_except_handler_4;
}
if ( outline_1_var___module__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_4,
const_str_plain___module__,
outline_1_var___module__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_4,
const_str_plain___module__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_4,
const_str_plain___module__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_4 );
exception_lineno = 41;
goto try_except_handler_4;
}
if ( outline_1_var___doc__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_4,
const_str_plain___doc__,
outline_1_var___doc__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_4,
const_str_plain___doc__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_4,
const_str_plain___doc__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_4 );
Py_DECREF( tmp_tuple_element_4 );
exception_lineno = 41;
goto try_except_handler_4;
}
PyTuple_SET_ITEM( tmp_args_name_4, 2, tmp_tuple_element_4 );
tmp_kw_name_4 = tmp_class_creation_2__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_4 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 41;
tmp_assign_source_30 = CALL_FUNCTION( tmp_called_name_5, tmp_args_name_4, tmp_kw_name_4 );
Py_DECREF( tmp_args_name_4 );
if ( tmp_assign_source_30 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 41;
goto try_except_handler_4;
}
assert( outline_1_var___class__ == NULL );
outline_1_var___class__ = tmp_assign_source_30;
tmp_outline_return_value_2 = outline_1_var___class__;
CHECK_OBJECT( tmp_outline_return_value_2 );
Py_INCREF( tmp_outline_return_value_2 );
goto try_return_handler_4;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
// Return handler code:
try_return_handler_4:;
CHECK_OBJECT( (PyObject *)outline_1_var___class__ );
Py_DECREF( outline_1_var___class__ );
outline_1_var___class__ = NULL;
Py_XDECREF( outline_1_var___qualname__ );
outline_1_var___qualname__ = NULL;
Py_XDECREF( outline_1_var___module__ );
outline_1_var___module__ = NULL;
Py_XDECREF( outline_1_var___doc__ );
outline_1_var___doc__ = NULL;
goto outline_result_2;
// Exception handler code:
try_except_handler_4:;
exception_keeper_type_3 = exception_type;
exception_keeper_value_3 = exception_value;
exception_keeper_tb_3 = exception_tb;
exception_keeper_lineno_3 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_1_var___qualname__ );
outline_1_var___qualname__ = NULL;
Py_XDECREF( outline_1_var___module__ );
outline_1_var___module__ = NULL;
Py_XDECREF( outline_1_var___doc__ );
outline_1_var___doc__ = NULL;
// Re-raise.
exception_type = exception_keeper_type_3;
exception_value = exception_keeper_value_3;
exception_tb = exception_keeper_tb_3;
exception_lineno = exception_keeper_lineno_3;
goto outline_exception_2;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
outline_exception_2:;
exception_lineno = 41;
goto try_except_handler_3;
outline_result_2:;
tmp_assign_source_26 = tmp_outline_return_value_2;
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_Group, tmp_assign_source_26 );
goto try_end_2;
// Exception handler code:
try_except_handler_3:;
exception_keeper_type_4 = exception_type;
exception_keeper_value_4 = exception_value;
exception_keeper_tb_4 = exception_tb;
exception_keeper_lineno_4 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_class_creation_2__bases );
tmp_class_creation_2__bases = NULL;
Py_XDECREF( tmp_class_creation_2__class_decl_dict );
tmp_class_creation_2__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_2__metaclass );
tmp_class_creation_2__metaclass = NULL;
Py_XDECREF( tmp_class_creation_2__prepared );
tmp_class_creation_2__prepared = NULL;
// Re-raise.
exception_type = exception_keeper_type_4;
exception_value = exception_keeper_value_4;
exception_tb = exception_keeper_tb_4;
exception_lineno = exception_keeper_lineno_4;
goto frame_exception_exit_1;
// End of try:
try_end_2:;
Py_XDECREF( tmp_class_creation_2__bases );
tmp_class_creation_2__bases = NULL;
Py_XDECREF( tmp_class_creation_2__class_decl_dict );
tmp_class_creation_2__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_2__metaclass );
tmp_class_creation_2__metaclass = NULL;
Py_XDECREF( tmp_class_creation_2__prepared );
tmp_class_creation_2__prepared = NULL;
tmp_assign_source_31 = const_tuple_type_list_tuple;
assert( tmp_class_creation_3__bases == NULL );
Py_INCREF( tmp_assign_source_31 );
tmp_class_creation_3__bases = tmp_assign_source_31;
tmp_assign_source_32 = PyDict_New();
assert( tmp_class_creation_3__class_decl_dict == NULL );
tmp_class_creation_3__class_decl_dict = tmp_assign_source_32;
// Tried code:
tmp_compare_left_5 = const_str_plain_metaclass;
tmp_compare_right_5 = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_5 );
tmp_cmp_In_5 = PySequence_Contains( tmp_compare_right_5, tmp_compare_left_5 );
assert( !(tmp_cmp_In_5 == -1) );
if ( tmp_cmp_In_5 == 1 )
{
goto condexpr_true_7;
}
else
{
goto condexpr_false_7;
}
condexpr_true_7:;
tmp_dict_name_3 = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_dict_name_3 );
tmp_key_name_3 = const_str_plain_metaclass;
tmp_metaclass_name_3 = DICT_GET_ITEM( tmp_dict_name_3, tmp_key_name_3 );
if ( tmp_metaclass_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
goto condexpr_end_7;
condexpr_false_7:;
tmp_cond_value_3 = tmp_class_creation_3__bases;
CHECK_OBJECT( tmp_cond_value_3 );
tmp_cond_truth_3 = CHECK_IF_TRUE( tmp_cond_value_3 );
if ( tmp_cond_truth_3 == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
if ( tmp_cond_truth_3 == 1 )
{
goto condexpr_true_8;
}
else
{
goto condexpr_false_8;
}
condexpr_true_8:;
tmp_subscribed_name_3 = tmp_class_creation_3__bases;
CHECK_OBJECT( tmp_subscribed_name_3 );
tmp_subscript_name_3 = const_int_0;
tmp_type_arg_3 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_3, tmp_subscript_name_3 );
if ( tmp_type_arg_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
tmp_metaclass_name_3 = BUILTIN_TYPE1( tmp_type_arg_3 );
Py_DECREF( tmp_type_arg_3 );
if ( tmp_metaclass_name_3 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
goto condexpr_end_8;
condexpr_false_8:;
tmp_metaclass_name_3 = (PyObject *)&PyType_Type;
Py_INCREF( tmp_metaclass_name_3 );
condexpr_end_8:;
condexpr_end_7:;
tmp_bases_name_3 = tmp_class_creation_3__bases;
CHECK_OBJECT( tmp_bases_name_3 );
tmp_assign_source_33 = SELECT_METACLASS( tmp_metaclass_name_3, tmp_bases_name_3 );
if ( tmp_assign_source_33 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_metaclass_name_3 );
exception_lineno = 47;
goto try_except_handler_5;
}
Py_DECREF( tmp_metaclass_name_3 );
assert( tmp_class_creation_3__metaclass == NULL );
tmp_class_creation_3__metaclass = tmp_assign_source_33;
tmp_compare_left_6 = const_str_plain_metaclass;
tmp_compare_right_6 = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_compare_right_6 );
tmp_cmp_In_6 = PySequence_Contains( tmp_compare_right_6, tmp_compare_left_6 );
assert( !(tmp_cmp_In_6 == -1) );
if ( tmp_cmp_In_6 == 1 )
{
goto branch_yes_3;
}
else
{
goto branch_no_3;
}
branch_yes_3:;
tmp_dictdel_dict = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_dictdel_dict );
tmp_dictdel_key = const_str_plain_metaclass;
tmp_result = DICT_REMOVE_ITEM( tmp_dictdel_dict, tmp_dictdel_key );
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
branch_no_3:;
tmp_hasattr_source_3 = tmp_class_creation_3__metaclass;
CHECK_OBJECT( tmp_hasattr_source_3 );
tmp_hasattr_attr_3 = const_str_plain___prepare__;
tmp_res = PyObject_HasAttr( tmp_hasattr_source_3, tmp_hasattr_attr_3 );
if ( tmp_res == -1 )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
if ( tmp_res == 1 )
{
goto condexpr_true_9;
}
else
{
goto condexpr_false_9;
}
condexpr_true_9:;
tmp_source_name_3 = tmp_class_creation_3__metaclass;
CHECK_OBJECT( tmp_source_name_3 );
tmp_called_name_6 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain___prepare__ );
if ( tmp_called_name_6 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
tmp_args_name_5 = PyTuple_New( 2 );
tmp_tuple_element_5 = const_str_plain_NonCapture;
Py_INCREF( tmp_tuple_element_5 );
PyTuple_SET_ITEM( tmp_args_name_5, 0, tmp_tuple_element_5 );
tmp_tuple_element_5 = tmp_class_creation_3__bases;
CHECK_OBJECT( tmp_tuple_element_5 );
Py_INCREF( tmp_tuple_element_5 );
PyTuple_SET_ITEM( tmp_args_name_5, 1, tmp_tuple_element_5 );
tmp_kw_name_5 = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_5 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 47;
tmp_assign_source_34 = CALL_FUNCTION( tmp_called_name_6, tmp_args_name_5, tmp_kw_name_5 );
Py_DECREF( tmp_called_name_6 );
Py_DECREF( tmp_args_name_5 );
if ( tmp_assign_source_34 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_5;
}
goto condexpr_end_9;
condexpr_false_9:;
tmp_assign_source_34 = PyDict_New();
condexpr_end_9:;
assert( tmp_class_creation_3__prepared == NULL );
tmp_class_creation_3__prepared = tmp_assign_source_34;
tmp_set_locals = tmp_class_creation_3__prepared;
CHECK_OBJECT( tmp_set_locals );
Py_DECREF(locals_dict_3);
locals_dict_3 = tmp_set_locals;
Py_INCREF( tmp_set_locals );
tmp_assign_source_36 = const_str_digest_3953b7f7fc11ef7abbd9bc7f67bd6955;
assert( outline_2_var___module__ == NULL );
Py_INCREF( tmp_assign_source_36 );
outline_2_var___module__ = tmp_assign_source_36;
tmp_assign_source_37 = const_str_digest_84851487bbd5b8a25f43ba060167b190;
assert( outline_2_var___doc__ == NULL );
Py_INCREF( tmp_assign_source_37 );
outline_2_var___doc__ = tmp_assign_source_37;
tmp_assign_source_38 = const_str_plain_NonCapture;
assert( outline_2_var___qualname__ == NULL );
Py_INCREF( tmp_assign_source_38 );
outline_2_var___qualname__ = tmp_assign_source_38;
// Tried code:
tmp_called_name_7 = tmp_class_creation_3__metaclass;
CHECK_OBJECT( tmp_called_name_7 );
tmp_args_name_6 = PyTuple_New( 3 );
tmp_tuple_element_6 = const_str_plain_NonCapture;
Py_INCREF( tmp_tuple_element_6 );
PyTuple_SET_ITEM( tmp_args_name_6, 0, tmp_tuple_element_6 );
tmp_tuple_element_6 = tmp_class_creation_3__bases;
CHECK_OBJECT( tmp_tuple_element_6 );
Py_INCREF( tmp_tuple_element_6 );
PyTuple_SET_ITEM( tmp_args_name_6, 1, tmp_tuple_element_6 );
tmp_tuple_element_6 = locals_dict_3;
Py_INCREF( tmp_tuple_element_6 );
if ( outline_2_var___qualname__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_6,
const_str_plain___qualname__,
outline_2_var___qualname__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_6,
const_str_plain___qualname__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_6,
const_str_plain___qualname__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_6 );
Py_DECREF( tmp_tuple_element_6 );
exception_lineno = 47;
goto try_except_handler_6;
}
if ( outline_2_var___module__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_6,
const_str_plain___module__,
outline_2_var___module__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_6,
const_str_plain___module__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_6,
const_str_plain___module__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_6 );
Py_DECREF( tmp_tuple_element_6 );
exception_lineno = 47;
goto try_except_handler_6;
}
if ( outline_2_var___doc__ != NULL )
{
int res = PyObject_SetItem(
tmp_tuple_element_6,
const_str_plain___doc__,
outline_2_var___doc__
);
tmp_result = res == 0;
}
else
{
PyObject *test_value = PyObject_GetItem(
tmp_tuple_element_6,
const_str_plain___doc__
);
if ( test_value )
{
Py_DECREF( test_value );
int res = PyObject_DelItem(
tmp_tuple_element_6,
const_str_plain___doc__
);
tmp_result = res == 0;
}
else
{
CLEAR_ERROR_OCCURRED();
tmp_result = true;
}
}
if ( tmp_result == false )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
Py_DECREF( tmp_args_name_6 );
Py_DECREF( tmp_tuple_element_6 );
exception_lineno = 47;
goto try_except_handler_6;
}
PyTuple_SET_ITEM( tmp_args_name_6, 2, tmp_tuple_element_6 );
tmp_kw_name_6 = tmp_class_creation_3__class_decl_dict;
CHECK_OBJECT( tmp_kw_name_6 );
frame_c62028e7d60a3f369a063311f731c3e3->m_frame.f_lineno = 47;
tmp_assign_source_39 = CALL_FUNCTION( tmp_called_name_7, tmp_args_name_6, tmp_kw_name_6 );
Py_DECREF( tmp_args_name_6 );
if ( tmp_assign_source_39 == NULL )
{
assert( ERROR_OCCURRED() );
FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
exception_lineno = 47;
goto try_except_handler_6;
}
assert( outline_2_var___class__ == NULL );
outline_2_var___class__ = tmp_assign_source_39;
tmp_outline_return_value_3 = outline_2_var___class__;
CHECK_OBJECT( tmp_outline_return_value_3 );
Py_INCREF( tmp_outline_return_value_3 );
goto try_return_handler_6;
// tried codes exits in all cases
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
// Return handler code:
try_return_handler_6:;
CHECK_OBJECT( (PyObject *)outline_2_var___class__ );
Py_DECREF( outline_2_var___class__ );
outline_2_var___class__ = NULL;
Py_XDECREF( outline_2_var___qualname__ );
outline_2_var___qualname__ = NULL;
Py_XDECREF( outline_2_var___module__ );
outline_2_var___module__ = NULL;
Py_XDECREF( outline_2_var___doc__ );
outline_2_var___doc__ = NULL;
goto outline_result_3;
// Exception handler code:
try_except_handler_6:;
exception_keeper_type_5 = exception_type;
exception_keeper_value_5 = exception_value;
exception_keeper_tb_5 = exception_tb;
exception_keeper_lineno_5 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( outline_2_var___qualname__ );
outline_2_var___qualname__ = NULL;
Py_XDECREF( outline_2_var___module__ );
outline_2_var___module__ = NULL;
Py_XDECREF( outline_2_var___doc__ );
outline_2_var___doc__ = NULL;
// Re-raise.
exception_type = exception_keeper_type_5;
exception_value = exception_keeper_value_5;
exception_tb = exception_keeper_tb_5;
exception_lineno = exception_keeper_lineno_5;
goto outline_exception_3;
// End of try:
// Return statement must have exited already.
NUITKA_CANNOT_GET_HERE( django$utils$regex_helper );
return MOD_RETURN_VALUE( NULL );
outline_exception_3:;
exception_lineno = 47;
goto try_except_handler_5;
outline_result_3:;
tmp_assign_source_35 = tmp_outline_return_value_3;
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_NonCapture, tmp_assign_source_35 );
goto try_end_3;
// Exception handler code:
try_except_handler_5:;
exception_keeper_type_6 = exception_type;
exception_keeper_value_6 = exception_value;
exception_keeper_tb_6 = exception_tb;
exception_keeper_lineno_6 = exception_lineno;
exception_type = NULL;
exception_value = NULL;
exception_tb = NULL;
exception_lineno = 0;
Py_XDECREF( tmp_class_creation_3__bases );
tmp_class_creation_3__bases = NULL;
Py_XDECREF( tmp_class_creation_3__class_decl_dict );
tmp_class_creation_3__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_3__metaclass );
tmp_class_creation_3__metaclass = NULL;
Py_XDECREF( tmp_class_creation_3__prepared );
tmp_class_creation_3__prepared = NULL;
// Re-raise.
exception_type = exception_keeper_type_6;
exception_value = exception_keeper_value_6;
exception_tb = exception_keeper_tb_6;
exception_lineno = exception_keeper_lineno_6;
goto frame_exception_exit_1;
// End of try:
try_end_3:;
// Restore frame exception if necessary.
#if 0
RESTORE_FRAME_EXCEPTION( frame_c62028e7d60a3f369a063311f731c3e3 );
#endif
popFrameStack();
assertFrameObject( frame_c62028e7d60a3f369a063311f731c3e3 );
goto frame_no_exception_1;
frame_exception_exit_1:;
#if 0
RESTORE_FRAME_EXCEPTION( frame_c62028e7d60a3f369a063311f731c3e3 );
#endif
if ( exception_tb == NULL )
{
exception_tb = MAKE_TRACEBACK( frame_c62028e7d60a3f369a063311f731c3e3, exception_lineno );
}
else if ( exception_tb->tb_frame != &frame_c62028e7d60a3f369a063311f731c3e3->m_frame )
{
exception_tb = ADD_TRACEBACK( exception_tb, frame_c62028e7d60a3f369a063311f731c3e3, exception_lineno );
}
// Put the previous frame back on top.
popFrameStack();
// Return the error.
goto module_exception_exit;
frame_no_exception_1:;
Py_XDECREF( tmp_class_creation_3__bases );
tmp_class_creation_3__bases = NULL;
Py_XDECREF( tmp_class_creation_3__class_decl_dict );
tmp_class_creation_3__class_decl_dict = NULL;
Py_XDECREF( tmp_class_creation_3__metaclass );
tmp_class_creation_3__metaclass = NULL;
Py_XDECREF( tmp_class_creation_3__prepared );
tmp_class_creation_3__prepared = NULL;
tmp_assign_source_40 = MAKE_FUNCTION_django$utils$regex_helper$$$function_1_normalize( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_normalize, tmp_assign_source_40 );
tmp_assign_source_41 = MAKE_FUNCTION_django$utils$regex_helper$$$function_2_next_char( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_next_char, tmp_assign_source_41 );
tmp_assign_source_42 = MAKE_FUNCTION_django$utils$regex_helper$$$function_3_walk_to_end( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_walk_to_end, tmp_assign_source_42 );
tmp_assign_source_43 = MAKE_FUNCTION_django$utils$regex_helper$$$function_4_get_quantifier( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_get_quantifier, tmp_assign_source_43 );
tmp_assign_source_44 = MAKE_FUNCTION_django$utils$regex_helper$$$function_5_contains( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_contains, tmp_assign_source_44 );
tmp_assign_source_45 = MAKE_FUNCTION_django$utils$regex_helper$$$function_6_flatten_result( );
UPDATE_STRING_DICT1( moduledict_django$utils$regex_helper, (Nuitka_StringObject *)const_str_plain_flatten_result, tmp_assign_source_45 );
return MOD_RETURN_VALUE( module_django$utils$regex_helper );
module_exception_exit:
RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb );
return MOD_RETURN_VALUE( NULL );
}
| 31.951709 | 434 | 0.696183 | [
"object"
] |
9e536db55e9b55e439eb903840b11dd81f16ff3a | 1,746 | cpp | C++ | boboleetcode/Play-Leetcode-master/1080-Insufficient-Nodes-in-Root-to-Leaf-Paths/cpp-1080/main.cpp | yaominzh/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | 2 | 2021-03-25T05:26:55.000Z | 2021-04-20T03:33:24.000Z | boboleetcode/Play-Leetcode-master/1080-Insufficient-Nodes-in-Root-to-Leaf-Paths/cpp-1080/main.cpp | mcuallen/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | 6 | 2019-12-04T06:08:32.000Z | 2021-05-10T20:22:47.000Z | boboleetcode/Play-Leetcode-master/1080-Insufficient-Nodes-in-Root-to-Leaf-Paths/cpp-1080/main.cpp | mcuallen/CodeLrn2019 | adc727d92904c5c5d445a2621813dfa99474206d | [
"Apache-2.0"
] | null | null | null | /// Source : https://leetcode.com/problems/insufficient-nodes-in-root-to-leaf-paths/
/// Author : liuyubobobo
/// Time : 2019-06-08
#include <iostream>
#include <unordered_map>
#include <vector>
#include <cassert>
using namespace std;
/// DFS
/// Time Complexity: O(n)
/// Space Complexity: O(h)
/// Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* sufficientSubset(TreeNode* root, int limit) {
unordered_map<TreeNode*, vector<int>> map;
vector<TreeNode*> path;
return dfs(root, 0, path, map, limit);
}
private:
TreeNode* dfs(TreeNode* node, int cur_sum, vector<TreeNode*>& path,
unordered_map<TreeNode*, vector<int>>& map, int limit){
path.push_back(node);
cur_sum += node->val;
if(!node->left && !node->right){
for(TreeNode* t: path)
map[t].push_back(cur_sum);
}
else{
if(node->left)
node->left = dfs(node->left, cur_sum, path, map, limit);
if(node->right)
node->right = dfs(node->right, cur_sum, path, map, limit);
}
path.pop_back();
if(insufficient(map[node], limit)){
if(node->left && node->right) assert(false);
else if(node->left) return node->left;
else if(node->right) return node->right;
return NULL;
}
return node;
}
bool insufficient(const vector<int>& vec, int limit){
for(int e: vec)
if(e >= limit) return false;
return true;
}
};
int main() {
return 0;
} | 23.28 | 84 | 0.562428 | [
"vector"
] |
9e64a996e74dc41f12be4934b52da338ece3a188 | 548 | hpp | C++ | parser/parser.hpp | XenotriX1337/TRPL-Interpreter | 976962090b2c2d0ade9d02567b83bd643e4ab9d2 | [
"MIT"
] | null | null | null | parser/parser.hpp | XenotriX1337/TRPL-Interpreter | 976962090b2c2d0ade9d02567b83bd643e4ab9d2 | [
"MIT"
] | null | null | null | parser/parser.hpp | XenotriX1337/TRPL-Interpreter | 976962090b2c2d0ade9d02567b83bd643e4ab9d2 | [
"MIT"
] | null | null | null | #pragma once
#include "parser.hxx"
#include <functional>
class Parser
{
public:
std::vector<ast::Statement*> parse(const std::string&) const;
std::vector<ast::Statement*> parse(std::istream* in) const;
void addEventListener(std::function<void (int)>);
private:
void requestMore(int) const;
std::vector<std::function<void (int)>> listeners;
struct myParserOutput : ParserOutput
{
std::vector<ast::Statement*> stmts;
void addStatement(ast::Statement* stmt) override;
std::vector<ast::Statement*> getStatements();
};
};
| 23.826087 | 63 | 0.70073 | [
"vector"
] |
9e658f7cb145a538f3f7151e3e70c5901577c841 | 12,841 | cpp | C++ | Modules/rossub/rgbdprocess.cpp | SJ-YI/HSRDEV | 8fa42bc41e337f0777e6980b37907dbd3c1067da | [
"Info-ZIP"
] | null | null | null | Modules/rossub/rgbdprocess.cpp | SJ-YI/HSRDEV | 8fa42bc41e337f0777e6980b37907dbd3c1067da | [
"Info-ZIP"
] | 1 | 2020-05-04T09:42:17.000Z | 2020-05-04T09:42:17.000Z | Modules/rossub2/rgbdprocess.cpp | SJ-YI/HSRDEV | 8fa42bc41e337f0777e6980b37907dbd3c1067da | [
"Info-ZIP"
] | null | null | null | #include "lua.hpp"
#include <thread>
#include <iostream>
#include <mutex>
#include <vector>
#include "ros/ros.h"
#include "ros/callback_queue.h"
#include "ros/subscribe_options.h"
#include "sensor_msgs/PointCloud2.h"
#include "geometry_msgs/PoseStamped.h"
#include "geometry_msgs/Twist.h"
#include "geometry_msgs/Pose.h"
#include "object_recognition_msgs/RecognizedObjectArray.h"
#include "object_recognition_msgs/TableArray.h"
#include <tf2_ros/transform_listener.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
#include <tf2/exceptions.h>
#include <tf2/LinearMath/Transform.h>
#include <tf2/LinearMath/Vector3.h>
#include <darknet_ros_msgs/BoundingBox.h>
#include <darknet_ros_msgs/BoundingBoxes.h>
#include <sensor_msgs/Image.h>
extern float rgbd_buf[640*480];
extern bool rgbd_received;
#define Z_OFFSET 0.03
extern int frontclear;
extern int shelfdetect;
extern float shelfx0,shelfx1, shelfy0, shelfy1;
float fxy = 554.382713;
float cx=320.5;float cy=240.5;
void checkfront(std::vector<double> pose,geometry_msgs::TransformStamped map_to_rgbd){
float angle_th=10.0*3.1415/180.0;
float z_min=-0.2;
float z_max=1.0;
float mag_min=1.0;
int i,j;
float x,y,z;
frontclear=0;
geometry_msgs::PoseStamped poseStampedLocal;
geometry_msgs::PoseStamped poseStampedGlobal;
for(i=0;i<640;i++){
for(j=0;j<480;j++){
z=rgbd_buf[j*640+i];
x=( i - cx ) / fxy * z;
y=( j - cx ) / fxy * z;
poseStampedLocal.pose.position.x=x;
poseStampedLocal.pose.position.y=y;
poseStampedLocal.pose.position.z=z;
try{
tf2::doTransform(poseStampedLocal, poseStampedGlobal,map_to_rgbd);
float mx0=poseStampedGlobal.pose.position.x;
float my0=poseStampedGlobal.pose.position.y;
float mz0=poseStampedGlobal.pose.position.z;
float dx=mx0-pose[0];
float dy=my0-pose[1];
float mag = sqrt(dx*dx+dy*dy);
float angle=atan2(dy,dx)-pose[2];
if(angle<-3.1415) angle+=3.1415;
if(angle>3.1415) angle-=3.1415;
if ((fabs(angle)<angle_th)&&(mz0<z_max)&&(mag>mag_min)){
// printf("Angle:%.1f Mag:%.2f Z:%.2f\n",angle*180.0/3.1415, mag, mz0);
// printf("Front clear!!!");
frontclear=1;
return;}
}catch(tf2::TransformException &ex){ROS_WARN("TR:%s",ex.what());}
}
}
return;
}
void getSurfaces(std::vector<double> pose,geometry_msgs::TransformStamped map_to_rgbd,int show_debug){
//Assume zero head pitch angle
//and project farthest point cloud to 2D to remove objects on the shelf
//Then find line segments that matches shelf discription
show_debug=2;
shelfdetect=0;
float min_shelfcheck_z=1.1;
float max_shelfcheck_z=2.0;
// float max_shelfcheck_dist=3.0;
float max_shelfcheck_dist=2.5;
float mx[640],my[640];
geometry_msgs::PoseStamped poseStampedLocal;
geometry_msgs::PoseStamped poseStampedGlobal;
int i,j;
int points_count=0;
float dist_connect_th=0.05;
float dist_connect_th2=0.03;
dist_connect_th2=0.05;
for(i=0;i<640;i++){
float max_z=-1.0;
float max_mx, max_my;
float x,y,z;
for(j=0;j<480;j++){
z=rgbd_buf[j*640+i];
x=( i - cx ) / fxy * z;
y=( j - cx ) / fxy * z;
poseStampedLocal.pose.position.x=x;
poseStampedLocal.pose.position.y=y;
poseStampedLocal.pose.position.z=z;
try{
tf2::doTransform(poseStampedLocal, poseStampedGlobal,map_to_rgbd);
float mx0=poseStampedGlobal.pose.position.x;
float my0=poseStampedGlobal.pose.position.y;
float mz0=poseStampedGlobal.pose.position.z;
float dx=mx0-pose[0];
float dy=my0-pose[1];
float mag = sqrt(dx*dx+dy*dy);
if ((mz0>min_shelfcheck_z)&&(mz0<max_shelfcheck_z)&&
(mag>0.5)&&(mag<max_shelfcheck_dist) ){
if (max_z<mag){max_z=mag;max_mx=mx0;max_my=my0;}
}
}catch(tf2::TransformException &ex){ROS_WARN("TR:%s",ex.what());}
}
if (max_z>0.0){
mx[points_count]=max_mx;
my[points_count]=max_my;
points_count++;
}
}
float sx=mx[0];float sy=my[0];
int si=0;int ei=1;
float c_ang= atan2(my[1]-my[0], mx[1]-mx[0]);
int line_count=0;
float lx0[655],lx1[655],ly0[655],ly1[655];
int lc[655];
lx0[0]=sx;ly0[0]=sy;
memset(lc,0,655*sizeof(int));
for(i=2;i<points_count;i++){
float dist=sqrt((my[i]-my[i-1])*(my[i]-my[i-1])+(mx[i]-mx[i-1])*(mx[i]-mx[i-1]));
float dy=my[i-1]-sy;float dx=mx[i-1]-sx;
float dy2=my[i]-sy;float dx2=mx[i]-sx;
float derr = fabs(-dy*dx2 + dx*dy2)/sqrt(dx*dx+dy*dy);
bool ang_check=false;
if (i-si>20){
float ang1 = atan2(my[si+10]-my[si], mx[si+10]-mx[si]);
float ang2 = atan2(my[i]-my[i-10], mx[i]-mx[i-10]);
float dang=ang1-ang2;
if (dang<-3.141592) dang+=2*3.141592;
if (dang>3.141592) dang-=2*3.141592;
if (fabs(dang)>3.1415/6.0) ang_check=true; //30 degree
}
if ( (dist>dist_connect_th) || (derr>dist_connect_th2 )||ang_check ){
if (lc[line_count]>20){ //Trim left and right a bit
lx0[line_count]=mx[si+10];ly0[line_count]=my[si+10];
lx1[line_count]=mx[i-10];ly1[line_count]=my[i-10];
}else{lx1[line_count]=mx[i-1];ly1[line_count]=my[i-1];}
sx=mx[i];sy=my[i];si=i;
line_count++;
lx0[line_count]=sx;
ly0[line_count]=sy;
}else lc[line_count]++;
}
lx1[line_count]=mx[points_count-1];
ly1[line_count]=my[points_count-1];
line_count++;
//Now we have a number of line segments
if(show_debug) printf("Total %d line segments\n",line_count);
float ref_dist = 0.9;
// float min_line_length=0.2;
float min_line_length=0.1;
float side_wall_th = 0.2;
float normalangle_th = 30*3.1415/180.0;
int best_index=-1;
float max_cost=0.0;
float x0=0.0,y0=0.0,x1=0.0,y1=0.0;
for(i=0;i<line_count;i++){
float dx = lx1[i]-lx0[i];float dy = ly1[i]-ly0[i];
float dist=sqrt(dx*dx+dy*dy);
// float xc=(lx0[i]+lx1[i])*0.5;float yc=(ly0[i]+ly1[i])*0.5; //TODOTODO,, use robot pose!!!!!
float xc=(lx0[i]+lx1[i])*0.5 - pose[0];float yc=(ly0[i]+ly1[i])*0.5 - pose[1];
float distc=sqrt(xc*xc+yc*yc);
if ((dist>min_line_length)&&(distc>0.5)){
//We have a line candidate. Search the left and right side of the lines to check shelf sides
float pcy = (-xc*dy + yc*dx)/dist; //projected normal distance to origin
float pcx = (dx*xc + dy*yc)/dist; //projected side distance to origin
float normalcos = pcy/distc;
if (normalcos>cos(normalangle_th)){
// if(0){
printf("TH!!\n");
float px_min=-999.0;
float px_max=999.0;
for(j=1;j<points_count-1;j++){
// float dmx = mx[j]; float dmy=my[j]; //j'th 2D point
float dmx = mx[j]-pose[0]; float dmy=my[j]-pose[1]; //j'th 2D point from pose
float py=(-dmx*dy + dmy*dx)/dist; //projected normal distance to origin
float px=(dx*dmx + dy*dmy)/dist; //projected side distance to the origin
float rpx = px-pcx; //projected side distance from the line center
if (py<pcy-side_wall_th){
if ( (rpx<0)&&(rpx>px_min) ) px_min=rpx;
if ( (rpx>0) && (rpx<px_max) ) px_max=rpx;
}
}
if ( (px_min<-10.0)||(px_max>10.0) ){ //No boundary found
}else{
float ang = atan2(dx,-dy)*180.0/3.1415;
// float ddx=x1-x0;
// float ddy=y1-y0;
// float ddist=sqrt(ddx*ddx+ddy*ddy);
//
// if (ddist>0.1){
float cost = pcy*normalcos;
if(cost>max_cost){
best_index=i;
max_cost=cost;
x0=xc + dx/dist*px_min + pose[0];
x1=xc + dx/dist*px_max + pose[0];
y0=yc + dy/dist*px_min + pose[1];
y1=yc + dy/dist*px_max + pose[1];
if(show_debug>2) printf("Line segment %d:(%.2f, %.2f)-(%.2f,%.2f)\n",i,x0,y0,x1,y1);
}
// }
}
}
}
}
if(best_index>=0){
shelfdetect=1;
shelfx0=x0;
shelfx1=x1;
shelfy0=y0;
shelfy1=y1;
if(show_debug>2) printf("Selected segment:%d\n",best_index);
}
}
int get_pose1(int x0,int x1, int y0,int y1, float *map_x, float*map_y, float*map_z,
std::vector<double> pose,
geometry_msgs::TransformStamped map_to_rgbd,
float tableheight
){
//todo: scan the area and find the closest z
float min_dist=2.0;
float min_dist_th=0.3;
float minx=1.0;
float miny=1.0;
for (int x=x0;x<=x1;x++){
//only scan top half of the bounding box (to reject table)
for (int y=y0;y<=(y0+y1)*0.5;y++){
float depth=rgbd_buf[y*640+x];
if ((depth<min_dist)&&(depth>min_dist_th)){
min_dist=depth;
minx=(float) x;
miny=(float) y;
}
}
}
if(min_dist>1.9) return 0;
min_dist+= Z_OFFSET;
float fxy = 554.382713;
float cx=320.5;
float cy=240.5;
float cam_x,cam_y,cam_z;
cam_x= ( minx - cx ) / fxy * min_dist;
cam_y= ( miny - cy ) / fxy * min_dist;
cam_z= min_dist;
geometry_msgs::PoseStamped poseStampedLocal;
geometry_msgs::PoseStamped poseStampedGlobal;
poseStampedLocal.pose.position.x=cam_x;
poseStampedLocal.pose.position.y=cam_y;
poseStampedLocal.pose.position.z=cam_z;
try{
tf2::doTransform(poseStampedLocal, poseStampedGlobal,map_to_rgbd);
*map_x=poseStampedGlobal.pose.position.x;
*map_y=poseStampedGlobal.pose.position.y;
float cal_z = poseStampedGlobal.pose.position.z;
printf("Calz:%.2f TableZ:%.2f\n",cal_z, tableheight);
if ( (tableheight>0.5)&&(cal_z>tableheight+0.07))
cal_z=tableheight+0.1;
*map_z=cal_z;
}catch(tf2::TransformException &ex){
ROS_WARN("TR:%s",ex.what());
}
return 1;
}
int get_pose2(int x0,int x1, int y0,int y1, float *map_x, float*map_y, float*map_z,
std::vector<double> pose,
geometry_msgs::TransformStamped map_to_rgbd,
float tableheight){
//todo: scan the area and find the closest z
float xbuf[640*480],ybuf[640*480],zbuf[640*480];
float table_z_margin=0.02;
float fxy = 554.382713;
float cx=320.5;
float cy=240.5;
int x,y,i;
//first transform depth pixels into 3d points
//do first pass scan to get rough object position
//sometimes the x,y exceeds[0-639],[0-479]
// printf("[%d-%d %d-%d]",x0,x1,y0,y1);
if(x1>=640) x1=640-1; if(y1>=480) y1=480-1;
if (tableheight<0.5) tableheight=0.5;
float min_dist2D=999;
float mdx, mdy;
float min_z=0.5;
float max_z=2.5;
int point_no=0;
for (x=x0;x<=x1;x++){
for (y=y0;y<=y1;y++){
geometry_msgs::PoseStamped poseStampedLocal;
geometry_msgs::PoseStamped poseStampedGlobal;
float depth=rgbd_buf[y*640+x];
float cam_x= ( (float) x - cx)/fxy *depth;
float cam_y= ( (float) y - cy)/fxy *depth;
float cam_z= depth;
poseStampedLocal.pose.position.x=cam_x;
poseStampedLocal.pose.position.y=cam_y;
poseStampedLocal.pose.position.z=cam_z;
if( (cam_z>min_z)&&(cam_z<max_z) ){
try{
tf2::doTransform(poseStampedLocal, poseStampedGlobal,map_to_rgbd);
float mx=poseStampedGlobal.pose.position.x;
float my=poseStampedGlobal.pose.position.y;
float mz=poseStampedGlobal.pose.position.z;
// if (mz>tableheight+table_z_margin){
if(1){
xbuf[point_no]=mx;
ybuf[point_no]=my;
zbuf[point_no]=mz;
float dist2D = ( (mx-pose[0])*(mx-pose[0])+(my-pose[1])*(my-pose[1]) );
if (dist2D<min_dist2D){
min_dist2D=dist2D;
mdx=mx;
mdy=my;
}
point_no++;
}
}catch(tf2::TransformException &ex){
ROS_WARN("TR:%s",ex.what());
}
}
}
}
// printf("Points:%d Mindist:%.2f\n",point_no,min_dist2D);
if(min_dist2D>1.9) return 0;
if (point_no<10) return 0;
float min_dist_th=0.1;
float x_0=999.0;
float x_1=-999.0;
float y_0=999.0;
float y_1=-999.0;
float maxz=0.0;
float minz=999.0;
for (i=0;i<point_no;i++) if(minz>zbuf[i]) minz=zbuf[i];
for (i=0;i<point_no;i++){
float dist=sqrt( (xbuf[i]-mdx)*(xbuf[i]-mdx)
+(ybuf[i]-mdy)*(ybuf[i]-mdy) );
if ((dist<min_dist_th) && (zbuf[i]>minz+table_z_margin) ){
if (maxz<zbuf[i]) maxz=zbuf[i];
if (xbuf[i]<x_0) x_0=xbuf[i];
if (ybuf[i]<y_0) y_0=ybuf[i];
if (xbuf[i]>x_1) x_1=xbuf[i];
if (ybuf[i]>y_1) y_1=ybuf[i];
}
}
// printf("Bounding box: [%.2f-%.2f , %.2f-%.2f, %.2f - %.2f ]\n",
// x_0,x_1, y_0,y_1, tableheight, maxz
// );
*map_x=(x_0+x_1)*0.5;
*map_y=(y_0+y_1)*0.5;
float grabheight=maxz-0.05;
*map_z=grabheight;
// printf("OBJ:%.2f %.2f %.2f\n",
// *map_x, *map_y, *map_z
// );
// printf("MINXYZ:%.1f %.1f %.1f\n",minx,miny,minz);
return 1;
}
| 28.409292 | 102 | 0.611868 | [
"object",
"vector",
"transform",
"3d"
] |
9e65d96ac93e3f21d9d886cae3d3dbb060ccb04e | 1,776 | cpp | C++ | aoc-2019/day10/src/CMonitoringStation.cpp | KlonicOne/adventofcode-2019 | 63884458720c8b0b83613272750453f51708439f | [
"MIT"
] | null | null | null | aoc-2019/day10/src/CMonitoringStation.cpp | KlonicOne/adventofcode-2019 | 63884458720c8b0b83613272750453f51708439f | [
"MIT"
] | null | null | null | aoc-2019/day10/src/CMonitoringStation.cpp | KlonicOne/adventofcode-2019 | 63884458720c8b0b83613272750453f51708439f | [
"MIT"
] | null | null | null | /*
* monitoringstation.cpp
*
* Created on: 6 Jan 2020
* Author: nico
*/
#include <numeric>
#include <iostream>
#include <string>
#include <math.h>
#include <fstream>
#include "CMonitoringStation.h"
CMonitoringStation::CMonitoringStation()
{
this->mSizeX = 0;
this->mSizeY = 0;
}
CMonitoringStation::~CMonitoringStation()
{
// TODO Auto-generated destructor stub
}
void CMonitoringStation::parseMap(istream &input)
{
unsigned X { 0 };
unsigned Y { 0 };
std::string asteroidMapLine;
string isAsteroid = "#";
string isEmpty = ".";
while (std::getline(input, asteroidMapLine))
{
std::vector<int> tempMapLine;
X = 0; // reset x size
// loop over string
for (char &asteroidElement : asteroidMapLine)
{
if (asteroidElement == '#')
{
tempMapLine.push_back(1);
}
else
{
tempMapLine.push_back(0);
}
X++;
}
// Add created line to the asteroid map
this->mAsteroidMap.push_back(tempMapLine);
tempMapLine.clear(); // clear content for new line
Y++;
}
// Take over the map size
this->mSizeX = X;
this->mSizeY = Y;
// debug out size
std::cout << "x(" << X << "), y(" << Y << ")" << std::endl;
// fit other maps to same size
this->mAsteroidSightMap.resize(X, vector<int>(Y));
}
void CMonitoringStation::calcAsteroidsInLine(void)
{
std::vector<int> currentPos; // x and y pos of current field evaluated
std::vector<int> gradient; // gradient used at the moment for calculation
}
void CMonitoringStation::plotAsteroidMap(void)
{
for (unsigned y = 0; y < mSizeY; y++)
{
for (unsigned x = 0; x < mSizeX; x++)
{
std::cout << this->mAsteroidMap[y].at(x);
}
std::cout << std::endl;
}
std::cout << std::endl;
}
| 20.413793 | 75 | 0.615991 | [
"vector"
] |
9e686ae1cf04e00307af1332a1218a45afb124b5 | 1,347 | cpp | C++ | GDIPlusRenderer.cpp | gcardi/AreaPrj | 831b23f0f7f444dca5f1395c2a4a0aff1e6d2f75 | [
"MIT"
] | null | null | null | GDIPlusRenderer.cpp | gcardi/AreaPrj | 831b23f0f7f444dca5f1395c2a4a0aff1e6d2f75 | [
"MIT"
] | null | null | null | GDIPlusRenderer.cpp | gcardi/AreaPrj | 831b23f0f7f444dca5f1395c2a4a0aff1e6d2f75 | [
"MIT"
] | null | null | null | //---------------------------------------------------------------------------
#pragma hdrstop
#include <algorithm>
#include <Vcl.Graphics.hpp>
#include "IModel.h"
#include "GDIPlusRenderer.h"
#include "Utils.h"
using std::transform;
//---------------------------------------------------------------------------
#pragma package(smart_init)
namespace AreaPrj {
void GDIPlusRenderer::DoPrepareRendering( IModel const & Model )
{
auto& Polygons = Model.GetPolygons();
PolygonCont GdiPolygons;
for ( auto const & Pol : Polygons ) {
GdiPolygons.push_back( ToGDIPolygon<Polygon>( Pol.outer() ) );
for ( auto const & RingInner : Pol.inners() ) {
GdiPolygons.push_back( ToGDIPolygon<Polygon>( RingInner ) );
}
}
polygons_ = std::move( GdiPolygons );
}
//---------------------------------------------------------------------------
void GDIPlusRenderer::DoRender( Vcl::Graphics::TCanvas& Canvas ) const
{
Gdiplus::Graphics g( Canvas.Handle );
Gdiplus::Pen MPen( Gdiplus::Color( 0xFF, 0, 0, 0 ) );
g.SetSmoothingMode( Gdiplus::SmoothingModeAntiAlias );
for ( auto const & Polygon : polygons_ ) {
g.DrawPolygon( &MPen, Polygon.data(), Polygon.size() );
}
}
//---------------------------------------------------------------------------
} // End of namespace AreaPrj
| 28.659574 | 77 | 0.507795 | [
"model",
"transform"
] |
9e68ed0f429e589b96fefed15903e75711b61d91 | 70,242 | cpp | C++ | src/third_party/mozjs/extract/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/third_party/mozjs/extract/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | src/third_party/mozjs/extract/js/src/jit/x86-shared/MacroAssembler-x86-shared.cpp | benety/mongo | 203430ac9559f82ca01e3cbb3b0e09149fec0835 | [
"Apache-2.0"
] | null | null | null | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jit/x86-shared/MacroAssembler-x86-shared.h"
#include "mozilla/Casting.h"
#include "jsmath.h"
#include "jit/JitFrames.h"
#include "jit/MacroAssembler.h"
#include "jit/MoveEmitter.h"
#include "js/ScalarType.h" // js::Scalar::Type
#include "jit/MacroAssembler-inl.h"
using namespace js;
using namespace js::jit;
// Note: this function clobbers the input register.
void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) {
ScratchDoubleScope scratch(*this);
MOZ_ASSERT(input != scratch);
Label positive, done;
// <= 0 or NaN --> 0
zeroDouble(scratch);
branchDouble(DoubleGreaterThan, input, scratch, &positive);
{
move32(Imm32(0), output);
jump(&done);
}
bind(&positive);
// Add 0.5 and truncate.
loadConstantDouble(0.5, scratch);
addDouble(scratch, input);
Label outOfRange;
// Truncate to int32 and ensure the result <= 255. This relies on the
// processor setting output to a value > 255 for doubles outside the int32
// range (for instance 0x80000000).
vcvttsd2si(input, output);
branch32(Assembler::Above, output, Imm32(255), &outOfRange);
{
// Check if we had a tie.
convertInt32ToDouble(output, scratch);
branchDouble(DoubleNotEqual, input, scratch, &done);
// It was a tie. Mask out the ones bit to get an even value.
// See also js_TypedArray_uint8_clamp_double.
and32(Imm32(~1), output);
jump(&done);
}
// > 255 --> 255
bind(&outOfRange);
{ move32(Imm32(255), output); }
bind(&done);
}
bool MacroAssemblerX86Shared::buildOOLFakeExitFrame(void* fakeReturnAddr) {
uint32_t descriptor = MakeFrameDescriptor(
asMasm().framePushed(), FrameType::IonJS, ExitFrameLayout::Size());
asMasm().Push(Imm32(descriptor));
asMasm().Push(ImmPtr(fakeReturnAddr));
return true;
}
void MacroAssemblerX86Shared::branchNegativeZero(FloatRegister reg,
Register scratch, Label* label,
bool maybeNonZero) {
// Determines whether the low double contained in the XMM register reg
// is equal to -0.0.
#if defined(JS_CODEGEN_X86)
Label nonZero;
// if not already compared to zero
if (maybeNonZero) {
ScratchDoubleScope scratchDouble(asMasm());
// Compare to zero. Lets through {0, -0}.
zeroDouble(scratchDouble);
// If reg is non-zero, jump to nonZero.
asMasm().branchDouble(DoubleNotEqual, reg, scratchDouble, &nonZero);
}
// Input register is either zero or negative zero. Retrieve sign of input.
vmovmskpd(reg, scratch);
// If reg is 1 or 3, input is negative zero.
// If reg is 0 or 2, input is a normal zero.
asMasm().branchTest32(NonZero, scratch, Imm32(1), label);
bind(&nonZero);
#elif defined(JS_CODEGEN_X64)
vmovq(reg, scratch);
cmpq(Imm32(1), scratch);
j(Overflow, label);
#endif
}
void MacroAssemblerX86Shared::branchNegativeZeroFloat32(FloatRegister reg,
Register scratch,
Label* label) {
vmovd(reg, scratch);
cmp32(scratch, Imm32(1));
j(Overflow, label);
}
MacroAssembler& MacroAssemblerX86Shared::asMasm() {
return *static_cast<MacroAssembler*>(this);
}
const MacroAssembler& MacroAssemblerX86Shared::asMasm() const {
return *static_cast<const MacroAssembler*>(this);
}
template <class T, class Map>
T* MacroAssemblerX86Shared::getConstant(const typename T::Pod& value, Map& map,
Vector<T, 0, SystemAllocPolicy>& vec) {
using AddPtr = typename Map::AddPtr;
size_t index;
if (AddPtr p = map.lookupForAdd(value)) {
index = p->value();
} else {
index = vec.length();
enoughMemory_ &= vec.append(T(value));
if (!enoughMemory_) {
return nullptr;
}
enoughMemory_ &= map.add(p, value, index);
if (!enoughMemory_) {
return nullptr;
}
}
return &vec[index];
}
MacroAssemblerX86Shared::Float* MacroAssemblerX86Shared::getFloat(float f) {
return getConstant<Float, FloatMap>(f, floatMap_, floats_);
}
MacroAssemblerX86Shared::Double* MacroAssemblerX86Shared::getDouble(double d) {
return getConstant<Double, DoubleMap>(d, doubleMap_, doubles_);
}
MacroAssemblerX86Shared::SimdData* MacroAssemblerX86Shared::getSimdData(
const SimdConstant& v) {
return getConstant<SimdData, SimdMap>(v, simdMap_, simds_);
}
void MacroAssemblerX86Shared::binarySimd128(
const SimdConstant& rhs, FloatRegister lhsDest,
void (MacroAssembler::*regOp)(const Operand&, FloatRegister, FloatRegister),
void (MacroAssembler::*constOp)(const SimdConstant&, FloatRegister)) {
ScratchSimd128Scope scratch(asMasm());
if (maybeInlineSimd128Int(rhs, scratch)) {
(asMasm().*regOp)(Operand(scratch), lhsDest, lhsDest);
} else {
(asMasm().*constOp)(rhs, lhsDest);
}
}
void MacroAssemblerX86Shared::binarySimd128(
const SimdConstant& rhs, FloatRegister lhs,
void (MacroAssembler::*regOp)(const Operand&, FloatRegister),
void (MacroAssembler::*constOp)(const SimdConstant&, FloatRegister)) {
ScratchSimd128Scope scratch(asMasm());
if (maybeInlineSimd128Int(rhs, scratch)) {
(asMasm().*regOp)(Operand(scratch), lhs);
} else {
(asMasm().*constOp)(rhs, lhs);
}
}
void MacroAssemblerX86Shared::bitwiseTestSimd128(const SimdConstant& rhs,
FloatRegister lhs) {
ScratchSimd128Scope scratch(asMasm());
if (maybeInlineSimd128Int(rhs, scratch)) {
vptest(scratch, lhs);
} else {
asMasm().vptestSimd128(rhs, lhs);
}
}
void MacroAssemblerX86Shared::minMaxDouble(FloatRegister first,
FloatRegister second, bool canBeNaN,
bool isMax) {
Label done, nan, minMaxInst;
// Do a vucomisd to catch equality and NaNs, which both require special
// handling. If the operands are ordered and inequal, we branch straight to
// the min/max instruction. If we wanted, we could also branch for less-than
// or greater-than here instead of using min/max, however these conditions
// will sometimes be hard on the branch predictor.
vucomisd(second, first);
j(Assembler::NotEqual, &minMaxInst);
if (canBeNaN) {
j(Assembler::Parity, &nan);
}
// Ordered and equal. The operands are bit-identical unless they are zero
// and negative zero. These instructions merge the sign bits in that
// case, and are no-ops otherwise.
if (isMax) {
vandpd(second, first, first);
} else {
vorpd(second, first, first);
}
jump(&done);
// x86's min/max are not symmetric; if either operand is a NaN, they return
// the read-only operand. We need to return a NaN if either operand is a
// NaN, so we explicitly check for a NaN in the read-write operand.
if (canBeNaN) {
bind(&nan);
vucomisd(first, first);
j(Assembler::Parity, &done);
}
// When the values are inequal, or second is NaN, x86's min and max will
// return the value we need.
bind(&minMaxInst);
if (isMax) {
vmaxsd(second, first, first);
} else {
vminsd(second, first, first);
}
bind(&done);
}
void MacroAssemblerX86Shared::minMaxFloat32(FloatRegister first,
FloatRegister second, bool canBeNaN,
bool isMax) {
Label done, nan, minMaxInst;
// Do a vucomiss to catch equality and NaNs, which both require special
// handling. If the operands are ordered and inequal, we branch straight to
// the min/max instruction. If we wanted, we could also branch for less-than
// or greater-than here instead of using min/max, however these conditions
// will sometimes be hard on the branch predictor.
vucomiss(second, first);
j(Assembler::NotEqual, &minMaxInst);
if (canBeNaN) {
j(Assembler::Parity, &nan);
}
// Ordered and equal. The operands are bit-identical unless they are zero
// and negative zero. These instructions merge the sign bits in that
// case, and are no-ops otherwise.
if (isMax) {
vandps(second, first, first);
} else {
vorps(second, first, first);
}
jump(&done);
// x86's min/max are not symmetric; if either operand is a NaN, they return
// the read-only operand. We need to return a NaN if either operand is a
// NaN, so we explicitly check for a NaN in the read-write operand.
if (canBeNaN) {
bind(&nan);
vucomiss(first, first);
j(Assembler::Parity, &done);
}
// When the values are inequal, or second is NaN, x86's min and max will
// return the value we need.
bind(&minMaxInst);
if (isMax) {
vmaxss(second, first, first);
} else {
vminss(second, first, first);
}
bind(&done);
}
//{{{ check_macroassembler_style
// ===============================================================
// MacroAssembler high-level usage.
void MacroAssembler::flush() {}
void MacroAssembler::comment(const char* msg) { masm.comment(msg); }
// This operation really consists of five phases, in order to enforce the
// restriction that on x86_shared, srcDest must be eax and edx will be
// clobbered.
//
// Input: { rhs, lhsOutput }
//
// [PUSH] Preserve registers
// [MOVE] Generate moves to specific registers
//
// [DIV] Input: { regForRhs, EAX }
// [DIV] extend EAX into EDX
// [DIV] x86 Division operator
// [DIV] Ouptut: { EAX, EDX }
//
// [MOVE] Move specific registers to outputs
// [POP] Restore registers
//
// Output: { lhsOutput, remainderOutput }
void MacroAssembler::flexibleDivMod32(Register rhs, Register lhsOutput,
Register remOutput, bool isUnsigned,
const LiveRegisterSet&) {
// Currently this helper can't handle this situation.
MOZ_ASSERT(lhsOutput != rhs);
MOZ_ASSERT(lhsOutput != remOutput);
// Choose a register that is not edx, or eax to hold the rhs;
// ebx is chosen arbitrarily, and will be preserved if necessary.
Register regForRhs = (rhs == eax || rhs == edx) ? ebx : rhs;
// Add registers we will be clobbering as live, but
// also remove the set we do not restore.
LiveRegisterSet preserve;
preserve.add(edx);
preserve.add(eax);
preserve.add(regForRhs);
preserve.takeUnchecked(lhsOutput);
preserve.takeUnchecked(remOutput);
PushRegsInMask(preserve);
// Shuffle input into place.
moveRegPair(lhsOutput, rhs, eax, regForRhs);
if (oom()) {
return;
}
// Sign extend eax into edx to make (edx:eax): idiv/udiv are 64-bit.
if (isUnsigned) {
mov(ImmWord(0), edx);
udiv(regForRhs);
} else {
cdq();
idiv(regForRhs);
}
moveRegPair(eax, edx, lhsOutput, remOutput);
if (oom()) {
return;
}
PopRegsInMask(preserve);
}
void MacroAssembler::flexibleQuotient32(
Register rhs, Register srcDest, bool isUnsigned,
const LiveRegisterSet& volatileLiveRegs) {
// Choose an arbitrary register that isn't eax, edx, rhs or srcDest;
AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
regs.takeUnchecked(eax);
regs.takeUnchecked(edx);
regs.takeUnchecked(rhs);
regs.takeUnchecked(srcDest);
Register remOut = regs.takeAny();
push(remOut);
flexibleDivMod32(rhs, srcDest, remOut, isUnsigned, volatileLiveRegs);
pop(remOut);
}
void MacroAssembler::flexibleRemainder32(
Register rhs, Register srcDest, bool isUnsigned,
const LiveRegisterSet& volatileLiveRegs) {
// Choose an arbitrary register that isn't eax, edx, rhs or srcDest
AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
regs.takeUnchecked(eax);
regs.takeUnchecked(edx);
regs.takeUnchecked(rhs);
regs.takeUnchecked(srcDest);
Register remOut = regs.takeAny();
push(remOut);
flexibleDivMod32(rhs, srcDest, remOut, isUnsigned, volatileLiveRegs);
mov(remOut, srcDest);
pop(remOut);
}
// ===============================================================
// Stack manipulation functions.
size_t MacroAssembler::PushRegsInMaskSizeInBytes(LiveRegisterSet set) {
return set.gprs().size() * sizeof(intptr_t) + set.fpus().getPushSizeInBytes();
}
void MacroAssembler::PushRegsInMask(LiveRegisterSet set) {
mozilla::DebugOnly<size_t> framePushedInitial = framePushed();
FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
unsigned numFpu = fpuSet.size();
int32_t diffF = fpuSet.getPushSizeInBytes();
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
// On x86, always use push to push the integer registers, as it's fast
// on modern hardware and it's a small instruction.
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); ++iter) {
diffG -= sizeof(intptr_t);
Push(*iter);
}
MOZ_ASSERT(diffG == 0);
reserveStack(diffF);
for (FloatRegisterBackwardIterator iter(fpuSet); iter.more(); ++iter) {
FloatRegister reg = *iter;
diffF -= reg.size();
numFpu -= 1;
Address spillAddress(StackPointer, diffF);
if (reg.isDouble()) {
storeDouble(reg, spillAddress);
} else if (reg.isSingle()) {
storeFloat32(reg, spillAddress);
} else if (reg.isSimd128()) {
storeUnalignedSimd128(reg, spillAddress);
} else {
MOZ_CRASH("Unknown register type.");
}
}
MOZ_ASSERT(numFpu == 0);
// x64 padding to keep the stack aligned on uintptr_t. Keep in sync with
// GetPushSizeInBytes.
size_t alignExtra = ((size_t)diffF) % sizeof(uintptr_t);
MOZ_ASSERT_IF(sizeof(uintptr_t) == 8, alignExtra == 0 || alignExtra == 4);
MOZ_ASSERT_IF(sizeof(uintptr_t) == 4, alignExtra == 0);
diffF -= alignExtra;
MOZ_ASSERT(diffF == 0);
// The macroassembler will keep the stack sizeof(uintptr_t)-aligned, so
// we don't need to take into account `alignExtra` here.
MOZ_ASSERT(framePushed() - framePushedInitial ==
PushRegsInMaskSizeInBytes(set));
}
void MacroAssembler::storeRegsInMask(LiveRegisterSet set, Address dest,
Register) {
mozilla::DebugOnly<size_t> offsetInitial = dest.offset;
FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
unsigned numFpu = fpuSet.size();
int32_t diffF = fpuSet.getPushSizeInBytes();
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
MOZ_ASSERT(dest.offset >= diffG + diffF);
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more(); ++iter) {
diffG -= sizeof(intptr_t);
dest.offset -= sizeof(intptr_t);
storePtr(*iter, dest);
}
MOZ_ASSERT(diffG == 0);
for (FloatRegisterBackwardIterator iter(fpuSet); iter.more(); ++iter) {
FloatRegister reg = *iter;
diffF -= reg.size();
numFpu -= 1;
dest.offset -= reg.size();
if (reg.isDouble()) {
storeDouble(reg, dest);
} else if (reg.isSingle()) {
storeFloat32(reg, dest);
} else if (reg.isSimd128()) {
storeUnalignedSimd128(reg, dest);
} else {
MOZ_CRASH("Unknown register type.");
}
}
MOZ_ASSERT(numFpu == 0);
// x64 padding to keep the stack aligned on uintptr_t. Keep in sync with
// GetPushSizeInBytes.
size_t alignExtra = ((size_t)diffF) % sizeof(uintptr_t);
MOZ_ASSERT_IF(sizeof(uintptr_t) == 8, alignExtra == 0 || alignExtra == 4);
MOZ_ASSERT_IF(sizeof(uintptr_t) == 4, alignExtra == 0);
diffF -= alignExtra;
MOZ_ASSERT(diffF == 0);
// What this means is: if `alignExtra` is nonzero, then the save area size
// actually used is `alignExtra` bytes smaller than what
// PushRegsInMaskSizeInBytes claims. Hence we need to compensate for that.
MOZ_ASSERT(alignExtra + offsetInitial - dest.offset ==
PushRegsInMaskSizeInBytes(set));
}
void MacroAssembler::PopRegsInMaskIgnore(LiveRegisterSet set,
LiveRegisterSet ignore) {
mozilla::DebugOnly<size_t> framePushedInitial = framePushed();
FloatRegisterSet fpuSet(set.fpus().reduceSetForPush());
unsigned numFpu = fpuSet.size();
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
int32_t diffF = fpuSet.getPushSizeInBytes();
const int32_t reservedG = diffG;
const int32_t reservedF = diffF;
for (FloatRegisterBackwardIterator iter(fpuSet); iter.more(); ++iter) {
FloatRegister reg = *iter;
diffF -= reg.size();
numFpu -= 1;
if (ignore.has(reg)) {
continue;
}
Address spillAddress(StackPointer, diffF);
if (reg.isDouble()) {
loadDouble(spillAddress, reg);
} else if (reg.isSingle()) {
loadFloat32(spillAddress, reg);
} else if (reg.isSimd128()) {
loadUnalignedSimd128(spillAddress, reg);
} else {
MOZ_CRASH("Unknown register type.");
}
}
freeStack(reservedF);
MOZ_ASSERT(numFpu == 0);
// x64 padding to keep the stack aligned on uintptr_t. Keep in sync with
// GetPushBytesInSize.
diffF -= diffF % sizeof(uintptr_t);
MOZ_ASSERT(diffF == 0);
// On x86, use pop to pop the integer registers, if we're not going to
// ignore any slots, as it's fast on modern hardware and it's a small
// instruction.
if (ignore.emptyGeneral()) {
for (GeneralRegisterForwardIterator iter(set.gprs()); iter.more(); ++iter) {
diffG -= sizeof(intptr_t);
Pop(*iter);
}
} else {
for (GeneralRegisterBackwardIterator iter(set.gprs()); iter.more();
++iter) {
diffG -= sizeof(intptr_t);
if (!ignore.has(*iter)) {
loadPtr(Address(StackPointer, diffG), *iter);
}
}
freeStack(reservedG);
}
MOZ_ASSERT(diffG == 0);
MOZ_ASSERT(framePushedInitial - framePushed() ==
PushRegsInMaskSizeInBytes(set));
}
void MacroAssembler::Push(const Operand op) {
push(op);
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Push(Register reg) {
push(reg);
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Push(const Imm32 imm) {
push(imm);
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Push(const ImmWord imm) {
push(imm);
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Push(const ImmPtr imm) {
Push(ImmWord(uintptr_t(imm.value)));
}
void MacroAssembler::Push(const ImmGCPtr ptr) {
push(ptr);
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Push(FloatRegister t) {
push(t);
adjustFrame(sizeof(double));
}
void MacroAssembler::PushFlags() {
pushFlags();
adjustFrame(sizeof(intptr_t));
}
void MacroAssembler::Pop(const Operand op) {
pop(op);
implicitPop(sizeof(intptr_t));
}
void MacroAssembler::Pop(Register reg) {
pop(reg);
implicitPop(sizeof(intptr_t));
}
void MacroAssembler::Pop(FloatRegister reg) {
pop(reg);
implicitPop(sizeof(double));
}
void MacroAssembler::Pop(const ValueOperand& val) {
popValue(val);
implicitPop(sizeof(Value));
}
void MacroAssembler::PopFlags() {
popFlags();
implicitPop(sizeof(intptr_t));
}
void MacroAssembler::PopStackPtr() { Pop(StackPointer); }
// ===============================================================
// Simple call functions.
CodeOffset MacroAssembler::call(Register reg) { return Assembler::call(reg); }
CodeOffset MacroAssembler::call(Label* label) { return Assembler::call(label); }
void MacroAssembler::call(const Address& addr) {
Assembler::call(Operand(addr.base, addr.offset));
}
CodeOffset MacroAssembler::call(wasm::SymbolicAddress target) {
mov(target, eax);
return Assembler::call(eax);
}
void MacroAssembler::call(ImmWord target) { Assembler::call(target); }
void MacroAssembler::call(ImmPtr target) { Assembler::call(target); }
void MacroAssembler::call(JitCode* target) { Assembler::call(target); }
CodeOffset MacroAssembler::callWithPatch() {
return Assembler::callWithPatch();
}
void MacroAssembler::patchCall(uint32_t callerOffset, uint32_t calleeOffset) {
Assembler::patchCall(callerOffset, calleeOffset);
}
void MacroAssembler::callAndPushReturnAddress(Register reg) { call(reg); }
void MacroAssembler::callAndPushReturnAddress(Label* label) { call(label); }
// ===============================================================
// Patchable near/far jumps.
CodeOffset MacroAssembler::farJumpWithPatch() {
return Assembler::farJumpWithPatch();
}
void MacroAssembler::patchFarJump(CodeOffset farJump, uint32_t targetOffset) {
Assembler::patchFarJump(farJump, targetOffset);
}
CodeOffset MacroAssembler::nopPatchableToCall() {
masm.nop_five();
return CodeOffset(currentOffset());
}
void MacroAssembler::patchNopToCall(uint8_t* callsite, uint8_t* target) {
Assembler::patchFiveByteNopToCall(callsite, target);
}
void MacroAssembler::patchCallToNop(uint8_t* callsite) {
Assembler::patchCallToFiveByteNop(callsite);
}
// ===============================================================
// Jit Frames.
uint32_t MacroAssembler::pushFakeReturnAddress(Register scratch) {
CodeLabel cl;
mov(&cl, scratch);
Push(scratch);
bind(&cl);
uint32_t retAddr = currentOffset();
addCodeLabel(cl);
return retAddr;
}
// ===============================================================
// WebAssembly
CodeOffset MacroAssembler::wasmTrapInstruction() { return ud2(); }
void MacroAssembler::wasmBoundsCheck32(Condition cond, Register index,
Register boundsCheckLimit,
Label* label) {
cmp32(index, boundsCheckLimit);
j(cond, label);
if (JitOptions.spectreIndexMasking) {
cmovCCl(cond, Operand(boundsCheckLimit), index);
}
}
void MacroAssembler::wasmBoundsCheck32(Condition cond, Register index,
Address boundsCheckLimit, Label* label) {
cmp32(index, Operand(boundsCheckLimit));
j(cond, label);
if (JitOptions.spectreIndexMasking) {
cmovCCl(cond, Operand(boundsCheckLimit), index);
}
}
// RAII class that generates the jumps to traps when it's destructed, to
// prevent some code duplication in the outOfLineWasmTruncateXtoY methods.
struct MOZ_RAII AutoHandleWasmTruncateToIntErrors {
MacroAssembler& masm;
Label inputIsNaN;
Label intOverflow;
wasm::BytecodeOffset off;
explicit AutoHandleWasmTruncateToIntErrors(MacroAssembler& masm,
wasm::BytecodeOffset off)
: masm(masm), off(off) {}
~AutoHandleWasmTruncateToIntErrors() {
// Handle errors. These cases are not in arbitrary order: code will
// fall through to intOverflow.
masm.bind(&intOverflow);
masm.wasmTrap(wasm::Trap::IntegerOverflow, off);
masm.bind(&inputIsNaN);
masm.wasmTrap(wasm::Trap::InvalidConversionToInteger, off);
}
};
void MacroAssembler::wasmTruncateDoubleToInt32(FloatRegister input,
Register output,
bool isSaturating,
Label* oolEntry) {
vcvttsd2si(input, output);
cmp32(output, Imm32(1));
j(Assembler::Overflow, oolEntry);
}
void MacroAssembler::wasmTruncateFloat32ToInt32(FloatRegister input,
Register output,
bool isSaturating,
Label* oolEntry) {
vcvttss2si(input, output);
cmp32(output, Imm32(1));
j(Assembler::Overflow, oolEntry);
}
void MacroAssembler::oolWasmTruncateCheckF64ToI32(FloatRegister input,
Register output,
TruncFlags flags,
wasm::BytecodeOffset off,
Label* rejoin) {
bool isUnsigned = flags & TRUNC_UNSIGNED;
bool isSaturating = flags & TRUNC_SATURATING;
if (isSaturating) {
if (isUnsigned) {
// Negative overflow and NaN both are converted to 0, and the only
// other case is positive overflow which is converted to
// UINT32_MAX.
Label nonNegative;
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleGreaterThanOrEqual, input, fpscratch,
&nonNegative);
move32(Imm32(0), output);
jump(rejoin);
bind(&nonNegative);
move32(Imm32(UINT32_MAX), output);
} else {
// Negative overflow is already saturated to INT32_MIN, so we only
// have to handle NaN and positive overflow here.
Label notNaN;
branchDouble(Assembler::DoubleOrdered, input, input, ¬NaN);
move32(Imm32(0), output);
jump(rejoin);
bind(¬NaN);
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleLessThan, input, fpscratch, rejoin);
sub32(Imm32(1), output);
}
jump(rejoin);
return;
}
AutoHandleWasmTruncateToIntErrors traps(*this, off);
// Eagerly take care of NaNs.
branchDouble(Assembler::DoubleUnordered, input, input, &traps.inputIsNaN);
// For unsigned, fall through to intOverflow failure case.
if (isUnsigned) {
return;
}
// Handle special values.
// We've used vcvttsd2si. The only valid double values that can
// truncate to INT32_MIN are in ]INT32_MIN - 1; INT32_MIN].
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(double(INT32_MIN) - 1.0, fpscratch);
branchDouble(Assembler::DoubleLessThanOrEqual, input, fpscratch,
&traps.intOverflow);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleGreaterThan, input, fpscratch,
&traps.intOverflow);
jump(rejoin);
}
void MacroAssembler::oolWasmTruncateCheckF32ToI32(FloatRegister input,
Register output,
TruncFlags flags,
wasm::BytecodeOffset off,
Label* rejoin) {
bool isUnsigned = flags & TRUNC_UNSIGNED;
bool isSaturating = flags & TRUNC_SATURATING;
if (isSaturating) {
if (isUnsigned) {
// Negative overflow and NaN both are converted to 0, and the only
// other case is positive overflow which is converted to
// UINT32_MAX.
Label nonNegative;
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(0.0f, fpscratch);
branchFloat(Assembler::DoubleGreaterThanOrEqual, input, fpscratch,
&nonNegative);
move32(Imm32(0), output);
jump(rejoin);
bind(&nonNegative);
move32(Imm32(UINT32_MAX), output);
} else {
// Negative overflow is already saturated to INT32_MIN, so we only
// have to handle NaN and positive overflow here.
Label notNaN;
branchFloat(Assembler::DoubleOrdered, input, input, ¬NaN);
move32(Imm32(0), output);
jump(rejoin);
bind(¬NaN);
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(0.0f, fpscratch);
branchFloat(Assembler::DoubleLessThan, input, fpscratch, rejoin);
sub32(Imm32(1), output);
}
jump(rejoin);
return;
}
AutoHandleWasmTruncateToIntErrors traps(*this, off);
// Eagerly take care of NaNs.
branchFloat(Assembler::DoubleUnordered, input, input, &traps.inputIsNaN);
// For unsigned, fall through to intOverflow failure case.
if (isUnsigned) {
return;
}
// Handle special values.
// We've used vcvttss2si. Check that the input wasn't
// float(INT32_MIN), which is the only legimitate input that
// would truncate to INT32_MIN.
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(float(INT32_MIN), fpscratch);
branchFloat(Assembler::DoubleNotEqual, input, fpscratch, &traps.intOverflow);
jump(rejoin);
}
void MacroAssembler::oolWasmTruncateCheckF64ToI64(FloatRegister input,
Register64 output,
TruncFlags flags,
wasm::BytecodeOffset off,
Label* rejoin) {
bool isUnsigned = flags & TRUNC_UNSIGNED;
bool isSaturating = flags & TRUNC_SATURATING;
if (isSaturating) {
if (isUnsigned) {
// Negative overflow and NaN both are converted to 0, and the only
// other case is positive overflow which is converted to
// UINT64_MAX.
Label positive;
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleGreaterThan, input, fpscratch, &positive);
move64(Imm64(0), output);
jump(rejoin);
bind(&positive);
move64(Imm64(UINT64_MAX), output);
} else {
// Negative overflow is already saturated to INT64_MIN, so we only
// have to handle NaN and positive overflow here.
Label notNaN;
branchDouble(Assembler::DoubleOrdered, input, input, ¬NaN);
move64(Imm64(0), output);
jump(rejoin);
bind(¬NaN);
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleLessThan, input, fpscratch, rejoin);
sub64(Imm64(1), output);
}
jump(rejoin);
return;
}
AutoHandleWasmTruncateToIntErrors traps(*this, off);
// Eagerly take care of NaNs.
branchDouble(Assembler::DoubleUnordered, input, input, &traps.inputIsNaN);
// Handle special values.
if (isUnsigned) {
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(0.0, fpscratch);
branchDouble(Assembler::DoubleGreaterThan, input, fpscratch,
&traps.intOverflow);
loadConstantDouble(-1.0, fpscratch);
branchDouble(Assembler::DoubleLessThanOrEqual, input, fpscratch,
&traps.intOverflow);
jump(rejoin);
return;
}
// We've used vcvtsd2sq. The only legit value whose i64
// truncation is INT64_MIN is double(INT64_MIN): exponent is so
// high that the highest resolution around is much more than 1.
ScratchDoubleScope fpscratch(*this);
loadConstantDouble(double(int64_t(INT64_MIN)), fpscratch);
branchDouble(Assembler::DoubleNotEqual, input, fpscratch, &traps.intOverflow);
jump(rejoin);
}
void MacroAssembler::oolWasmTruncateCheckF32ToI64(FloatRegister input,
Register64 output,
TruncFlags flags,
wasm::BytecodeOffset off,
Label* rejoin) {
bool isUnsigned = flags & TRUNC_UNSIGNED;
bool isSaturating = flags & TRUNC_SATURATING;
if (isSaturating) {
if (isUnsigned) {
// Negative overflow and NaN both are converted to 0, and the only
// other case is positive overflow which is converted to
// UINT64_MAX.
Label positive;
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(0.0f, fpscratch);
branchFloat(Assembler::DoubleGreaterThan, input, fpscratch, &positive);
move64(Imm64(0), output);
jump(rejoin);
bind(&positive);
move64(Imm64(UINT64_MAX), output);
} else {
// Negative overflow is already saturated to INT64_MIN, so we only
// have to handle NaN and positive overflow here.
Label notNaN;
branchFloat(Assembler::DoubleOrdered, input, input, ¬NaN);
move64(Imm64(0), output);
jump(rejoin);
bind(¬NaN);
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(0.0f, fpscratch);
branchFloat(Assembler::DoubleLessThan, input, fpscratch, rejoin);
sub64(Imm64(1), output);
}
jump(rejoin);
return;
}
AutoHandleWasmTruncateToIntErrors traps(*this, off);
// Eagerly take care of NaNs.
branchFloat(Assembler::DoubleUnordered, input, input, &traps.inputIsNaN);
// Handle special values.
if (isUnsigned) {
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(0.0f, fpscratch);
branchFloat(Assembler::DoubleGreaterThan, input, fpscratch,
&traps.intOverflow);
loadConstantFloat32(-1.0f, fpscratch);
branchFloat(Assembler::DoubleLessThanOrEqual, input, fpscratch,
&traps.intOverflow);
jump(rejoin);
return;
}
// We've used vcvtss2sq. See comment in outOfLineWasmTruncateDoubleToInt64.
ScratchFloat32Scope fpscratch(*this);
loadConstantFloat32(float(int64_t(INT64_MIN)), fpscratch);
branchFloat(Assembler::DoubleNotEqual, input, fpscratch, &traps.intOverflow);
jump(rejoin);
}
void MacroAssembler::enterFakeExitFrameForWasm(Register cxreg, Register scratch,
ExitFrameType type) {
enterFakeExitFrame(cxreg, scratch, type);
}
// ========================================================================
// Primitive atomic operations.
static void ExtendTo32(MacroAssembler& masm, Scalar::Type type, Register r) {
switch (Scalar::byteSize(type)) {
case 1:
if (Scalar::isSignedIntType(type)) {
masm.movsbl(r, r);
} else {
masm.movzbl(r, r);
}
break;
case 2:
if (Scalar::isSignedIntType(type)) {
masm.movswl(r, r);
} else {
masm.movzwl(r, r);
}
break;
default:
break;
}
}
static inline void CheckBytereg(Register r) {
#ifdef DEBUG
AllocatableGeneralRegisterSet byteRegs(Registers::SingleByteRegs);
MOZ_ASSERT(byteRegs.has(r));
#endif
}
static inline void CheckBytereg(Imm32 r) {
// Nothing
}
template <typename T>
static void CompareExchange(MacroAssembler& masm,
const wasm::MemoryAccessDesc* access,
Scalar::Type type, const T& mem, Register oldval,
Register newval, Register output) {
MOZ_ASSERT(output == eax);
if (oldval != output) {
masm.movl(oldval, output);
}
if (access) {
masm.append(*access, masm.size());
}
switch (Scalar::byteSize(type)) {
case 1:
CheckBytereg(newval);
masm.lock_cmpxchgb(newval, Operand(mem));
break;
case 2:
masm.lock_cmpxchgw(newval, Operand(mem));
break;
case 4:
masm.lock_cmpxchgl(newval, Operand(mem));
break;
}
ExtendTo32(masm, type, output);
}
void MacroAssembler::compareExchange(Scalar::Type type, const Synchronization&,
const Address& mem, Register oldval,
Register newval, Register output) {
CompareExchange(*this, nullptr, type, mem, oldval, newval, output);
}
void MacroAssembler::compareExchange(Scalar::Type type, const Synchronization&,
const BaseIndex& mem, Register oldval,
Register newval, Register output) {
CompareExchange(*this, nullptr, type, mem, oldval, newval, output);
}
void MacroAssembler::wasmCompareExchange(const wasm::MemoryAccessDesc& access,
const Address& mem, Register oldval,
Register newval, Register output) {
CompareExchange(*this, &access, access.type(), mem, oldval, newval, output);
}
void MacroAssembler::wasmCompareExchange(const wasm::MemoryAccessDesc& access,
const BaseIndex& mem, Register oldval,
Register newval, Register output) {
CompareExchange(*this, &access, access.type(), mem, oldval, newval, output);
}
template <typename T>
static void AtomicExchange(MacroAssembler& masm,
const wasm::MemoryAccessDesc* access,
Scalar::Type type, const T& mem, Register value,
Register output)
{
if (value != output) {
masm.movl(value, output);
}
if (access) {
masm.append(*access, masm.size());
}
switch (Scalar::byteSize(type)) {
case 1:
CheckBytereg(output);
masm.xchgb(output, Operand(mem));
break;
case 2:
masm.xchgw(output, Operand(mem));
break;
case 4:
masm.xchgl(output, Operand(mem));
break;
default:
MOZ_CRASH("Invalid");
}
ExtendTo32(masm, type, output);
}
void MacroAssembler::atomicExchange(Scalar::Type type, const Synchronization&,
const Address& mem, Register value,
Register output) {
AtomicExchange(*this, nullptr, type, mem, value, output);
}
void MacroAssembler::atomicExchange(Scalar::Type type, const Synchronization&,
const BaseIndex& mem, Register value,
Register output) {
AtomicExchange(*this, nullptr, type, mem, value, output);
}
void MacroAssembler::wasmAtomicExchange(const wasm::MemoryAccessDesc& access,
const Address& mem, Register value,
Register output) {
AtomicExchange(*this, &access, access.type(), mem, value, output);
}
void MacroAssembler::wasmAtomicExchange(const wasm::MemoryAccessDesc& access,
const BaseIndex& mem, Register value,
Register output) {
AtomicExchange(*this, &access, access.type(), mem, value, output);
}
static void SetupValue(MacroAssembler& masm, AtomicOp op, Imm32 src,
Register output) {
if (op == AtomicFetchSubOp) {
masm.movl(Imm32(-src.value), output);
} else {
masm.movl(src, output);
}
}
static void SetupValue(MacroAssembler& masm, AtomicOp op, Register src,
Register output) {
if (src != output) {
masm.movl(src, output);
}
if (op == AtomicFetchSubOp) {
masm.negl(output);
}
}
template <typename T, typename V>
static void AtomicFetchOp(MacroAssembler& masm,
const wasm::MemoryAccessDesc* access,
Scalar::Type arrayType, AtomicOp op, V value,
const T& mem, Register temp, Register output) {
// Note value can be an Imm or a Register.
#define ATOMIC_BITOP_BODY(LOAD, OP, LOCK_CMPXCHG) \
do { \
MOZ_ASSERT(output != temp); \
MOZ_ASSERT(output == eax); \
if (access) masm.append(*access, masm.size()); \
masm.LOAD(Operand(mem), eax); \
Label again; \
masm.bind(&again); \
masm.movl(eax, temp); \
masm.OP(value, temp); \
masm.LOCK_CMPXCHG(temp, Operand(mem)); \
masm.j(MacroAssembler::NonZero, &again); \
} while (0)
MOZ_ASSERT_IF(op == AtomicFetchAddOp || op == AtomicFetchSubOp,
temp == InvalidReg);
switch (Scalar::byteSize(arrayType)) {
case 1:
CheckBytereg(output);
switch (op) {
case AtomicFetchAddOp:
case AtomicFetchSubOp:
CheckBytereg(value); // But not for the bitwise ops
SetupValue(masm, op, value, output);
if (access) masm.append(*access, masm.size());
masm.lock_xaddb(output, Operand(mem));
break;
case AtomicFetchAndOp:
CheckBytereg(temp);
ATOMIC_BITOP_BODY(movb, andl, lock_cmpxchgb);
break;
case AtomicFetchOrOp:
CheckBytereg(temp);
ATOMIC_BITOP_BODY(movb, orl, lock_cmpxchgb);
break;
case AtomicFetchXorOp:
CheckBytereg(temp);
ATOMIC_BITOP_BODY(movb, xorl, lock_cmpxchgb);
break;
default:
MOZ_CRASH();
}
break;
case 2:
switch (op) {
case AtomicFetchAddOp:
case AtomicFetchSubOp:
SetupValue(masm, op, value, output);
if (access) masm.append(*access, masm.size());
masm.lock_xaddw(output, Operand(mem));
break;
case AtomicFetchAndOp:
ATOMIC_BITOP_BODY(movw, andl, lock_cmpxchgw);
break;
case AtomicFetchOrOp:
ATOMIC_BITOP_BODY(movw, orl, lock_cmpxchgw);
break;
case AtomicFetchXorOp:
ATOMIC_BITOP_BODY(movw, xorl, lock_cmpxchgw);
break;
default:
MOZ_CRASH();
}
break;
case 4:
switch (op) {
case AtomicFetchAddOp:
case AtomicFetchSubOp:
SetupValue(masm, op, value, output);
if (access) masm.append(*access, masm.size());
masm.lock_xaddl(output, Operand(mem));
break;
case AtomicFetchAndOp:
ATOMIC_BITOP_BODY(movl, andl, lock_cmpxchgl);
break;
case AtomicFetchOrOp:
ATOMIC_BITOP_BODY(movl, orl, lock_cmpxchgl);
break;
case AtomicFetchXorOp:
ATOMIC_BITOP_BODY(movl, xorl, lock_cmpxchgl);
break;
default:
MOZ_CRASH();
}
break;
}
ExtendTo32(masm, arrayType, output);
#undef ATOMIC_BITOP_BODY
}
void MacroAssembler::atomicFetchOp(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Register value, const BaseIndex& mem,
Register temp, Register output) {
AtomicFetchOp(*this, nullptr, arrayType, op, value, mem, temp, output);
}
void MacroAssembler::atomicFetchOp(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Register value, const Address& mem,
Register temp, Register output) {
AtomicFetchOp(*this, nullptr, arrayType, op, value, mem, temp, output);
}
void MacroAssembler::atomicFetchOp(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Imm32 value, const BaseIndex& mem,
Register temp, Register output) {
AtomicFetchOp(*this, nullptr, arrayType, op, value, mem, temp, output);
}
void MacroAssembler::atomicFetchOp(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Imm32 value, const Address& mem,
Register temp, Register output) {
AtomicFetchOp(*this, nullptr, arrayType, op, value, mem, temp, output);
}
void MacroAssembler::wasmAtomicFetchOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Register value,
const Address& mem, Register temp,
Register output) {
AtomicFetchOp(*this, &access, access.type(), op, value, mem, temp, output);
}
void MacroAssembler::wasmAtomicFetchOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Imm32 value,
const Address& mem, Register temp,
Register output) {
AtomicFetchOp(*this, &access, access.type(), op, value, mem, temp, output);
}
void MacroAssembler::wasmAtomicFetchOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Register value,
const BaseIndex& mem, Register temp,
Register output) {
AtomicFetchOp(*this, &access, access.type(), op, value, mem, temp, output);
}
void MacroAssembler::wasmAtomicFetchOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Imm32 value,
const BaseIndex& mem, Register temp,
Register output) {
AtomicFetchOp(*this, &access, access.type(), op, value, mem, temp, output);
}
template <typename T, typename V>
static void AtomicEffectOp(MacroAssembler& masm,
const wasm::MemoryAccessDesc* access,
Scalar::Type arrayType, AtomicOp op, V value,
const T& mem) {
if (access) {
masm.append(*access, masm.size());
}
switch (Scalar::byteSize(arrayType)) {
case 1:
switch (op) {
case AtomicFetchAddOp:
masm.lock_addb(value, Operand(mem));
break;
case AtomicFetchSubOp:
masm.lock_subb(value, Operand(mem));
break;
case AtomicFetchAndOp:
masm.lock_andb(value, Operand(mem));
break;
case AtomicFetchOrOp:
masm.lock_orb(value, Operand(mem));
break;
case AtomicFetchXorOp:
masm.lock_xorb(value, Operand(mem));
break;
default:
MOZ_CRASH();
}
break;
case 2:
switch (op) {
case AtomicFetchAddOp:
masm.lock_addw(value, Operand(mem));
break;
case AtomicFetchSubOp:
masm.lock_subw(value, Operand(mem));
break;
case AtomicFetchAndOp:
masm.lock_andw(value, Operand(mem));
break;
case AtomicFetchOrOp:
masm.lock_orw(value, Operand(mem));
break;
case AtomicFetchXorOp:
masm.lock_xorw(value, Operand(mem));
break;
default:
MOZ_CRASH();
}
break;
case 4:
switch (op) {
case AtomicFetchAddOp:
masm.lock_addl(value, Operand(mem));
break;
case AtomicFetchSubOp:
masm.lock_subl(value, Operand(mem));
break;
case AtomicFetchAndOp:
masm.lock_andl(value, Operand(mem));
break;
case AtomicFetchOrOp:
masm.lock_orl(value, Operand(mem));
break;
case AtomicFetchXorOp:
masm.lock_xorl(value, Operand(mem));
break;
default:
MOZ_CRASH();
}
break;
default:
MOZ_CRASH();
}
}
void MacroAssembler::wasmAtomicEffectOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Register value,
const Address& mem, Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, &access, access.type(), op, value, mem);
}
void MacroAssembler::wasmAtomicEffectOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Imm32 value,
const Address& mem, Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, &access, access.type(), op, value, mem);
}
void MacroAssembler::wasmAtomicEffectOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Register value,
const BaseIndex& mem, Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, &access, access.type(), op, value, mem);
}
void MacroAssembler::wasmAtomicEffectOp(const wasm::MemoryAccessDesc& access,
AtomicOp op, Imm32 value,
const BaseIndex& mem, Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, &access, access.type(), op, value, mem);
}
// ========================================================================
// JS atomic operations.
template <typename T>
static void CompareExchangeJS(MacroAssembler& masm, Scalar::Type arrayType,
const Synchronization& sync, const T& mem,
Register oldval, Register newval, Register temp,
AnyRegister output) {
if (arrayType == Scalar::Uint32) {
masm.compareExchange(arrayType, sync, mem, oldval, newval, temp);
masm.convertUInt32ToDouble(temp, output.fpu());
} else {
masm.compareExchange(arrayType, sync, mem, oldval, newval, output.gpr());
}
}
void MacroAssembler::compareExchangeJS(Scalar::Type arrayType,
const Synchronization& sync,
const Address& mem, Register oldval,
Register newval, Register temp,
AnyRegister output) {
CompareExchangeJS(*this, arrayType, sync, mem, oldval, newval, temp, output);
}
void MacroAssembler::compareExchangeJS(Scalar::Type arrayType,
const Synchronization& sync,
const BaseIndex& mem, Register oldval,
Register newval, Register temp,
AnyRegister output) {
CompareExchangeJS(*this, arrayType, sync, mem, oldval, newval, temp, output);
}
template <typename T>
static void AtomicExchangeJS(MacroAssembler& masm, Scalar::Type arrayType,
const Synchronization& sync, const T& mem,
Register value, Register temp,
AnyRegister output) {
if (arrayType == Scalar::Uint32) {
masm.atomicExchange(arrayType, sync, mem, value, temp);
masm.convertUInt32ToDouble(temp, output.fpu());
} else {
masm.atomicExchange(arrayType, sync, mem, value, output.gpr());
}
}
void MacroAssembler::atomicExchangeJS(Scalar::Type arrayType,
const Synchronization& sync,
const Address& mem, Register value,
Register temp, AnyRegister output) {
AtomicExchangeJS(*this, arrayType, sync, mem, value, temp, output);
}
void MacroAssembler::atomicExchangeJS(Scalar::Type arrayType,
const Synchronization& sync,
const BaseIndex& mem, Register value,
Register temp, AnyRegister output) {
AtomicExchangeJS(*this, arrayType, sync, mem, value, temp, output);
}
template <typename T>
static void AtomicFetchOpJS(MacroAssembler& masm, Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Register value, const T& mem, Register temp1,
Register temp2, AnyRegister output) {
if (arrayType == Scalar::Uint32) {
masm.atomicFetchOp(arrayType, sync, op, value, mem, temp2, temp1);
masm.convertUInt32ToDouble(temp1, output.fpu());
} else {
masm.atomicFetchOp(arrayType, sync, op, value, mem, temp1, output.gpr());
}
}
void MacroAssembler::atomicFetchOpJS(Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Register value, const Address& mem,
Register temp1, Register temp2,
AnyRegister output) {
AtomicFetchOpJS(*this, arrayType, sync, op, value, mem, temp1, temp2, output);
}
void MacroAssembler::atomicFetchOpJS(Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Register value, const BaseIndex& mem,
Register temp1, Register temp2,
AnyRegister output) {
AtomicFetchOpJS(*this, arrayType, sync, op, value, mem, temp1, temp2, output);
}
void MacroAssembler::atomicEffectOpJS(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Register value, const BaseIndex& mem,
Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, nullptr, arrayType, op, value, mem);
}
void MacroAssembler::atomicEffectOpJS(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Register value, const Address& mem,
Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, nullptr, arrayType, op, value, mem);
}
void MacroAssembler::atomicEffectOpJS(Scalar::Type arrayType,
const Synchronization&, AtomicOp op,
Imm32 value, const Address& mem,
Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, nullptr, arrayType, op, value, mem);
}
void MacroAssembler::atomicEffectOpJS(Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Imm32 value, const BaseIndex& mem,
Register temp) {
MOZ_ASSERT(temp == InvalidReg);
AtomicEffectOp(*this, nullptr, arrayType, op, value, mem);
}
template <typename T>
static void AtomicFetchOpJS(MacroAssembler& masm, Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Imm32 value, const T& mem, Register temp1,
Register temp2, AnyRegister output) {
if (arrayType == Scalar::Uint32) {
masm.atomicFetchOp(arrayType, sync, op, value, mem, temp2, temp1);
masm.convertUInt32ToDouble(temp1, output.fpu());
} else {
masm.atomicFetchOp(arrayType, sync, op, value, mem, temp1, output.gpr());
}
}
void MacroAssembler::atomicFetchOpJS(Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Imm32 value, const Address& mem,
Register temp1, Register temp2,
AnyRegister output) {
AtomicFetchOpJS(*this, arrayType, sync, op, value, mem, temp1, temp2, output);
}
void MacroAssembler::atomicFetchOpJS(Scalar::Type arrayType,
const Synchronization& sync, AtomicOp op,
Imm32 value, const BaseIndex& mem,
Register temp1, Register temp2,
AnyRegister output) {
AtomicFetchOpJS(*this, arrayType, sync, op, value, mem, temp1, temp2, output);
}
// ========================================================================
// Spectre Mitigations.
void MacroAssembler::speculationBarrier() {
// Spectre mitigation recommended by Intel and AMD suggest to use lfence as
// a way to force all speculative execution of instructions to end.
MOZ_ASSERT(HasSSE2());
masm.lfence();
}
void MacroAssembler::floorFloat32ToInt32(FloatRegister src, Register dest,
Label* fail) {
if (HasSSE41()) {
// Fail on negative-zero.
branchNegativeZeroFloat32(src, dest, fail);
// Round toward -Infinity.
{
ScratchFloat32Scope scratch(*this);
vroundss(X86Encoding::RoundDown, src, scratch);
truncateFloat32ToInt32(scratch, dest, fail);
}
} else {
Label negative, end;
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
{
ScratchFloat32Scope scratch(*this);
zeroFloat32(scratch);
branchFloat(Assembler::DoubleLessThan, src, scratch, &negative);
}
// Fail on negative-zero.
branchNegativeZeroFloat32(src, dest, fail);
// Input is non-negative, so truncation correctly rounds.
truncateFloat32ToInt32(src, dest, fail);
jump(&end);
// Input is negative, but isn't -0.
// Negative values go on a comparatively expensive path, since no
// native rounding mode matches JS semantics. Still better than callVM.
bind(&negative);
{
// Truncate and round toward zero.
// This is off-by-one for everything but integer-valued inputs.
truncateFloat32ToInt32(src, dest, fail);
// Test whether the input double was integer-valued.
{
ScratchFloat32Scope scratch(*this);
convertInt32ToFloat32(dest, scratch);
branchFloat(Assembler::DoubleEqualOrUnordered, src, scratch, &end);
}
// Input is not integer-valued, so we rounded off-by-one in the
// wrong direction. Correct by subtraction.
subl(Imm32(1), dest);
// Cannot overflow: output was already checked against INT_MIN.
}
bind(&end);
}
}
void MacroAssembler::floorDoubleToInt32(FloatRegister src, Register dest,
Label* fail) {
if (HasSSE41()) {
// Fail on negative-zero.
branchNegativeZero(src, dest, fail);
// Round toward -Infinity.
{
ScratchDoubleScope scratch(*this);
vroundsd(X86Encoding::RoundDown, src, scratch);
truncateDoubleToInt32(scratch, dest, fail);
}
} else {
Label negative, end;
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
{
ScratchDoubleScope scratch(*this);
zeroDouble(scratch);
branchDouble(Assembler::DoubleLessThan, src, scratch, &negative);
}
// Fail on negative-zero.
branchNegativeZero(src, dest, fail);
// Input is non-negative, so truncation correctly rounds.
truncateDoubleToInt32(src, dest, fail);
jump(&end);
// Input is negative, but isn't -0.
// Negative values go on a comparatively expensive path, since no
// native rounding mode matches JS semantics. Still better than callVM.
bind(&negative);
{
// Truncate and round toward zero.
// This is off-by-one for everything but integer-valued inputs.
truncateDoubleToInt32(src, dest, fail);
// Test whether the input double was integer-valued.
{
ScratchDoubleScope scratch(*this);
convertInt32ToDouble(dest, scratch);
branchDouble(Assembler::DoubleEqualOrUnordered, src, scratch, &end);
}
// Input is not integer-valued, so we rounded off-by-one in the
// wrong direction. Correct by subtraction.
subl(Imm32(1), dest);
// Cannot overflow: output was already checked against INT_MIN.
}
bind(&end);
}
}
void MacroAssembler::ceilFloat32ToInt32(FloatRegister src, Register dest,
Label* fail) {
ScratchFloat32Scope scratch(*this);
Label lessThanOrEqualMinusOne;
// If x is in ]-1,0], ceil(x) is -0, which cannot be represented as an int32.
// Fail if x > -1 and the sign bit is set.
loadConstantFloat32(-1.f, scratch);
branchFloat(Assembler::DoubleLessThanOrEqualOrUnordered, src, scratch,
&lessThanOrEqualMinusOne);
vmovmskps(src, dest);
branchTest32(Assembler::NonZero, dest, Imm32(1), fail);
if (HasSSE41()) {
// x <= -1 or x > -0
bind(&lessThanOrEqualMinusOne);
// Round toward +Infinity.
vroundss(X86Encoding::RoundUp, src, scratch);
truncateFloat32ToInt32(scratch, dest, fail);
return;
}
// No SSE4.1
Label end;
// x >= 0 and x is not -0.0. We can truncate integer values, and truncate and
// add 1 to non-integer values. This will also work for values >= INT_MAX + 1,
// as the truncate operation will return INT_MIN and we'll fail.
truncateFloat32ToInt32(src, dest, fail);
convertInt32ToFloat32(dest, scratch);
branchFloat(Assembler::DoubleEqualOrUnordered, src, scratch, &end);
// Input is not integer-valued, add 1 to obtain the ceiling value.
// If input > INT_MAX, output == INT_MAX so adding 1 will overflow.
branchAdd32(Assembler::Overflow, Imm32(1), dest, fail);
jump(&end);
// x <= -1, truncation is the way to go.
bind(&lessThanOrEqualMinusOne);
truncateFloat32ToInt32(src, dest, fail);
bind(&end);
}
void MacroAssembler::ceilDoubleToInt32(FloatRegister src, Register dest,
Label* fail) {
ScratchDoubleScope scratch(*this);
Label lessThanOrEqualMinusOne;
// If x is in ]-1,0], ceil(x) is -0, which cannot be represented as an int32.
// Fail if x > -1 and the sign bit is set.
loadConstantDouble(-1.0, scratch);
branchDouble(Assembler::DoubleLessThanOrEqualOrUnordered, src, scratch,
&lessThanOrEqualMinusOne);
vmovmskpd(src, dest);
branchTest32(Assembler::NonZero, dest, Imm32(1), fail);
if (HasSSE41()) {
// x <= -1 or x > -0
bind(&lessThanOrEqualMinusOne);
// Round toward +Infinity.
vroundsd(X86Encoding::RoundUp, src, scratch);
truncateDoubleToInt32(scratch, dest, fail);
return;
}
// No SSE4.1
Label end;
// x >= 0 and x is not -0.0. We can truncate integer values, and truncate and
// add 1 to non-integer values. This will also work for values >= INT_MAX + 1,
// as the truncate operation will return INT_MIN and we'll fail.
truncateDoubleToInt32(src, dest, fail);
convertInt32ToDouble(dest, scratch);
branchDouble(Assembler::DoubleEqualOrUnordered, src, scratch, &end);
// Input is not integer-valued, add 1 to obtain the ceiling value.
// If input > INT_MAX, output == INT_MAX so adding 1 will overflow.
branchAdd32(Assembler::Overflow, Imm32(1), dest, fail);
jump(&end);
// x <= -1, truncation is the way to go.
bind(&lessThanOrEqualMinusOne);
truncateDoubleToInt32(src, dest, fail);
bind(&end);
}
void MacroAssembler::truncDoubleToInt32(FloatRegister src, Register dest,
Label* fail) {
Label lessThanOrEqualMinusOne;
// Bail on ]-1; -0] range
{
ScratchDoubleScope scratch(*this);
loadConstantDouble(-1, scratch);
branchDouble(Assembler::DoubleLessThanOrEqualOrUnordered, src, scratch,
&lessThanOrEqualMinusOne);
}
// Test for remaining values with the sign bit set, i.e. ]-1; -0]
vmovmskpd(src, dest);
branchTest32(Assembler::NonZero, dest, Imm32(1), fail);
// x <= -1 or x >= +0, truncation is the way to go.
bind(&lessThanOrEqualMinusOne);
truncateDoubleToInt32(src, dest, fail);
}
void MacroAssembler::truncFloat32ToInt32(FloatRegister src, Register dest,
Label* fail) {
Label lessThanOrEqualMinusOne;
// Bail on ]-1; -0] range
{
ScratchFloat32Scope scratch(*this);
loadConstantFloat32(-1.f, scratch);
branchFloat(Assembler::DoubleLessThanOrEqualOrUnordered, src, scratch,
&lessThanOrEqualMinusOne);
}
// Test for remaining values with the sign bit set, i.e. ]-1; -0]
vmovmskps(src, dest);
branchTest32(Assembler::NonZero, dest, Imm32(1), fail);
// x <= -1 or x >= +0, truncation is the way to go.
bind(&lessThanOrEqualMinusOne);
truncateFloat32ToInt32(src, dest, fail);
}
void MacroAssembler::roundFloat32ToInt32(FloatRegister src, Register dest,
FloatRegister temp, Label* fail) {
ScratchFloat32Scope scratch(*this);
Label negativeOrZero, negative, end;
// Branch to a slow path for non-positive inputs. Doesn't catch NaN.
zeroFloat32(scratch);
loadConstantFloat32(GetBiggestNumberLessThan(0.5f), temp);
branchFloat(Assembler::DoubleLessThanOrEqual, src, scratch, &negativeOrZero);
{
// Input is non-negative. Add the biggest float less than 0.5 and truncate,
// rounding down (because if the input is the biggest float less than 0.5,
// adding 0.5 would undesirably round up to 1). Note that we have to add the
// input to the temp register because we're not allowed to modify the input
// register.
addFloat32(src, temp);
truncateFloat32ToInt32(temp, dest, fail);
jump(&end);
}
// Input is negative, +0 or -0.
bind(&negativeOrZero);
{
// Branch on negative input.
j(Assembler::NotEqual, &negative);
// Fail on negative-zero.
branchNegativeZeroFloat32(src, dest, fail);
// Input is +0.
xor32(dest, dest);
jump(&end);
}
// Input is negative.
bind(&negative);
{
// Inputs in ]-0.5; 0] need to be added 0.5, other negative inputs need to
// be added the biggest double less than 0.5.
Label loadJoin;
loadConstantFloat32(-0.5f, scratch);
branchFloat(Assembler::DoubleLessThan, src, scratch, &loadJoin);
loadConstantFloat32(0.5f, temp);
bind(&loadJoin);
if (HasSSE41()) {
// Add 0.5 and round toward -Infinity. The result is stored in the temp
// register (currently contains 0.5).
addFloat32(src, temp);
vroundss(X86Encoding::RoundDown, temp, scratch);
// Truncate.
truncateFloat32ToInt32(scratch, dest, fail);
// If the result is positive zero, then the actual result is -0. Fail.
// Otherwise, the truncation will have produced the correct negative
// integer.
branchTest32(Assembler::Zero, dest, dest, fail);
} else {
addFloat32(src, temp);
// Round toward -Infinity without the benefit of ROUNDSS.
{
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
// result is -0.
branchFloat(Assembler::DoubleGreaterThanOrEqual, temp, scratch, fail);
// Truncate and round toward zero.
// This is off-by-one for everything but integer-valued inputs.
truncateFloat32ToInt32(temp, dest, fail);
// Test whether the truncated double was integer-valued.
convertInt32ToFloat32(dest, scratch);
branchFloat(Assembler::DoubleEqualOrUnordered, temp, scratch, &end);
// Input is not integer-valued, so we rounded off-by-one in the
// wrong direction. Correct by subtraction.
subl(Imm32(1), dest);
// Cannot overflow: output was already checked against INT_MIN.
}
}
}
bind(&end);
}
void MacroAssembler::roundDoubleToInt32(FloatRegister src, Register dest,
FloatRegister temp, Label* fail) {
ScratchDoubleScope scratch(*this);
Label negativeOrZero, negative, end;
// Branch to a slow path for non-positive inputs. Doesn't catch NaN.
zeroDouble(scratch);
loadConstantDouble(GetBiggestNumberLessThan(0.5), temp);
branchDouble(Assembler::DoubleLessThanOrEqual, src, scratch, &negativeOrZero);
{
// Input is positive. Add the biggest double less than 0.5 and truncate,
// rounding down (because if the input is the biggest double less than 0.5,
// adding 0.5 would undesirably round up to 1). Note that we have to add the
// input to the temp register because we're not allowed to modify the input
// register.
addDouble(src, temp);
truncateDoubleToInt32(temp, dest, fail);
jump(&end);
}
// Input is negative, +0 or -0.
bind(&negativeOrZero);
{
// Branch on negative input.
j(Assembler::NotEqual, &negative);
// Fail on negative-zero.
branchNegativeZero(src, dest, fail, /* maybeNonZero = */ false);
// Input is +0
xor32(dest, dest);
jump(&end);
}
// Input is negative.
bind(&negative);
{
// Inputs in ]-0.5; 0] need to be added 0.5, other negative inputs need to
// be added the biggest double less than 0.5.
Label loadJoin;
loadConstantDouble(-0.5, scratch);
branchDouble(Assembler::DoubleLessThan, src, scratch, &loadJoin);
loadConstantDouble(0.5, temp);
bind(&loadJoin);
if (HasSSE41()) {
// Add 0.5 and round toward -Infinity. The result is stored in the temp
// register (currently contains 0.5).
addDouble(src, temp);
vroundsd(X86Encoding::RoundDown, temp, scratch);
// Truncate.
truncateDoubleToInt32(scratch, dest, fail);
// If the result is positive zero, then the actual result is -0. Fail.
// Otherwise, the truncation will have produced the correct negative
// integer.
branchTest32(Assembler::Zero, dest, dest, fail);
} else {
addDouble(src, temp);
// Round toward -Infinity without the benefit of ROUNDSD.
{
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
// result is -0.
branchDouble(Assembler::DoubleGreaterThanOrEqual, temp, scratch, fail);
// Truncate and round toward zero.
// This is off-by-one for everything but integer-valued inputs.
truncateDoubleToInt32(temp, dest, fail);
// Test whether the truncated double was integer-valued.
convertInt32ToDouble(dest, scratch);
branchDouble(Assembler::DoubleEqualOrUnordered, temp, scratch, &end);
// Input is not integer-valued, so we rounded off-by-one in the
// wrong direction. Correct by subtraction.
subl(Imm32(1), dest);
// Cannot overflow: output was already checked against INT_MIN.
}
}
}
bind(&end);
}
void MacroAssembler::nearbyIntDouble(RoundingMode mode, FloatRegister src,
FloatRegister dest) {
MOZ_ASSERT(HasRoundInstruction(mode));
vroundsd(Assembler::ToX86RoundingMode(mode), src, dest);
}
void MacroAssembler::nearbyIntFloat32(RoundingMode mode, FloatRegister src,
FloatRegister dest) {
MOZ_ASSERT(HasRoundInstruction(mode));
vroundss(Assembler::ToX86RoundingMode(mode), src, dest);
}
void MacroAssembler::copySignDouble(FloatRegister lhs, FloatRegister rhs,
FloatRegister output) {
ScratchDoubleScope scratch(*this);
double clearSignMask = mozilla::BitwiseCast<double>(INT64_MAX);
loadConstantDouble(clearSignMask, scratch);
vandpd(scratch, lhs, output);
double keepSignMask = mozilla::BitwiseCast<double>(INT64_MIN);
loadConstantDouble(keepSignMask, scratch);
vandpd(rhs, scratch, scratch);
vorpd(scratch, output, output);
}
void MacroAssembler::copySignFloat32(FloatRegister lhs, FloatRegister rhs,
FloatRegister output) {
ScratchFloat32Scope scratch(*this);
float clearSignMask = mozilla::BitwiseCast<float>(INT32_MAX);
loadConstantFloat32(clearSignMask, scratch);
vandps(scratch, lhs, output);
float keepSignMask = mozilla::BitwiseCast<float>(INT32_MIN);
loadConstantFloat32(keepSignMask, scratch);
vandps(rhs, scratch, scratch);
vorps(scratch, output, output);
}
//}}} check_macroassembler_style
| 33.949734 | 80 | 0.621252 | [
"vector"
] |
9e6900382a8ab005f245a856ae9c96afbce5acdb | 4,570 | cc | C++ | src/M4Cut.cc | ZAKI1905/HEP-Phen | bc06fecb2aa6bf108b59f76794e63c29eb37a35a | [
"MIT"
] | 1 | 2019-10-21T08:25:46.000Z | 2019-10-21T08:25:46.000Z | src/M4Cut.cc | ZAKI1905/HEP-Phen | bc06fecb2aa6bf108b59f76794e63c29eb37a35a | [
"MIT"
] | null | null | null | src/M4Cut.cc | ZAKI1905/HEP-Phen | bc06fecb2aa6bf108b59f76794e63c29eb37a35a | [
"MIT"
] | null | null | null | /*
M4Cut class
Last Updated by Zaki on July 6, 2019
*/
#include "../include/M4Cut.h"
//==============================================================
//--------------------------------------------------------------
// Default Constructor
PHENO::CUTS::M4Cut::M4Cut()
{
// logger.SetUnit("M4Cut");
SetName("M4Cut") ;
}
// Constructor
PHENO::CUTS::M4Cut::M4Cut(PHENO::ExEvent* ev) : Cut(ev)
{
// logger.SetUnit("M4Cut");
SetName("M4Cut") ;
}
//--------------------------------------------------------------
// Copy Constructor
PHENO::CUTS::M4Cut::M4Cut(const M4Cut& old_obj)
: M4_cut_min(old_obj.M4_cut_min), M4_cut_max(old_obj.M4_cut_max)
{
name = old_obj.name ;
}
//--------------------------------------------------------------
// Overriding the input method from base class "cut".
void PHENO::CUTS::M4Cut::Input(std::string property)
{
// Parsing the command
std::vector<std::string> inp = Zaki::String::Pars(property, "=") ;
if(inp[0] == "M4_Cut_Min")
{
M4_cut_min = std::stof (inp[1]) ;
}
else if(inp[0] == "M4_Cut_Max")
{
M4_cut_max= std::stof (inp[1]) ;
}
else
{ std::cerr<<"\n"<<inp[0]<<" is invalid option for M4 cut!"<<std::flush ;
}
}
//--------------------------------------------------------------
// Virtual method from cut class:
void PHENO::CUTS::M4Cut::CutCond(ParticleLST& in_parlst)
{
PROFILE_SCOPE("PHENO::CUTS::M4Cut::CutCond") ;
//************************************************************
// Special Colinear Approximation
//************************************************************
// if (in_parlst.size() != 4) return;
// vector<ExParticle> sel_emu ;
// vector<ExParticle> sel_taumu ;
// int tau_sign;
// for (size_t i=0 ; i<in_parlst.size() ; ++i)
// {
// if ( in_parlst[i].idAbs() == ID_TAU)
// {
// tau_sign = (in_parlst[i].id() / in_parlst[i].idAbs()) ;
// sel_taumu.push_back(in_parlst[i]) ;
// }
// if ( in_parlst[i].idAbs() == ID_ELECTRON)
// sel_emu.push_back(in_parlst[i]) ;
// }
// for (size_t i=0 ; i<in_parlst.size() ; ++i)
// {
// if ( in_parlst[i].idAbs() == ID_MUON )
// {
// if( (in_parlst[i].id() / in_parlst[i].idAbs()) == tau_sign )
// sel_emu.push_back(in_parlst[i]) ;
// else
// sel_taumu.push_back(in_parlst[i]) ;
// }
// }
// if (sel_emu.size() != 2 || sel_taumu.size() != 2) return ;
// double tauMuInv = invM(sel_taumu) ;
// double eMuInv = invM(sel_emu) ;
// double momProd = (sel_emu[0].mom()*sel_emu[1].mom());
// double eps = ( pow(tauMuInv, 2) - pow(eMuInv, 2) ) / (2*momProd) ;
// Vec4 tmp_vec4 = (1+eps)*sel_emu[0].mom() + sel_emu[1].mom() ;
// Vec4 tmp_total_vec4 = tmp_vec4 + sel_taumu[0].mom() + sel_taumu[1].mom() ;
// double tmp_m = tmp_total_vec4.mCalc() ;
//************************************************************
//************************************************************
// Calculate the invariant mass of the
// 4 leptons
double tmp_m = invM(in_parlst) ;
// For now we get rid of the events with size != 4.
if ( in_parlst.size() != 4 || tmp_m < M4_cut_min || tmp_m > M4_cut_max )
{
for(size_t i=0 ; i < in_parlst.size() ; ++i )
{
Zaki::Vector::Add(rm_list, (int) i) ;
}
} else return ;
char special_message_char[100] ;
if(report_cut)
{
sprintf(special_message_char,
"\n | - This event with invariant mass %2.2f GeV fails this cut. |",
tmp_m) ;
std::string somestring(special_message_char) ;
special_message += somestring ;
// Adding the top frame
sprintf(special_message_char," +%s+", Zaki::String::Multiply('-', 62).c_str() ) ;
somestring = special_message_char ;
special_message = somestring + special_message ;
// Adding the bottom frame
sprintf(special_message_char,"\n +%s+\n", Zaki::String::Multiply('-', 62).c_str() ) ;
somestring = special_message_char ;
special_message += somestring ;
}
}
//--------------------------------------------------------------
// Sorts particles according to pT
void PHENO::CUTS::M4Cut::pT_Sort(ParticleLST& in_list)
{
std::sort(in_list.begin(), in_list.end(),
[](ExParticle& a, ExParticle& b)
{return a.GetMom().pT() > b.GetMom().pT() ; } ) ;
}
//--------------------------------------------------------------
// Overriding the clone method
PHENO::CUTS::M4Cut* PHENO::CUTS::M4Cut::IClone() const
{
return new M4Cut(*this) ;
}
//==============================================================
| 27.865854 | 89 | 0.496499 | [
"vector"
] |
9e69ef0dd35fb10bffb145c796c9102bb0c983a4 | 396 | cpp | C++ | C++/081. Search in Rotated Sorted Array II.cpp | WangYang-wy/LeetCode | c92fcb83f86c277de6785d5a950f16bc007ccd31 | [
"MIT"
] | 3 | 2018-07-28T15:36:18.000Z | 2020-03-17T01:26:22.000Z | C++/081. Search in Rotated Sorted Array II.cpp | WangYang-wy/LeetCode | c92fcb83f86c277de6785d5a950f16bc007ccd31 | [
"MIT"
] | null | null | null | C++/081. Search in Rotated Sorted Array II.cpp | WangYang-wy/LeetCode | c92fcb83f86c277de6785d5a950f16bc007ccd31 | [
"MIT"
] | null | null | null | //
// Created by 王阳 on 2018/7/31.
//
#include "header.h"
class Solution {
public:
bool search(vector<int> &nums, int target) {
sort(nums.begin(), nums.end());
int n = int(nums.size());
for (int i = 0; i < n; ++i) {
if (target == nums[i]) {
return true;
}
}
return false;
}
};
int main() {
return 0;
}
| 16.5 | 48 | 0.45202 | [
"vector"
] |
9e81197abbd923148ce38071d4d662f18dda901d | 1,619 | cpp | C++ | 1009.cpp | ispobock/PAT_code | 1426a80ff4a8b0ddba97d9014e10b50a9cff16d6 | [
"MIT"
] | 1 | 2020-08-29T03:49:57.000Z | 2020-08-29T03:49:57.000Z | 1009.cpp | ispobock/PAT_code | 1426a80ff4a8b0ddba97d9014e10b50a9cff16d6 | [
"MIT"
] | null | null | null | 1009.cpp | ispobock/PAT_code | 1426a80ff4a8b0ddba97d9014e10b50a9cff16d6 | [
"MIT"
] | null | null | null | #include <cstdio>
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
struct node{
string name;
int height;
}stu[10010];
bool cmp(node a, node b){
if(a.height != b.height){
return a.height > b.height;
}
else{
return a.name < b.name;
}
}
stack<string> s;
queue<string> q;
int main(){
int n, k;
scanf("%d %d", &n, &k);
for(int i = 0; i < n; i++){
cin>>stu[i].name>>stu[i].height;
}
sort(stu, stu + n, cmp);
int index = 0;
for(int i = 0; i < k; i++){
if(i == 0 && n % k == 1){
int cnt = 0;
for(int j = 0; j < n / k + 1; j++){
if(j % 2 == 0){
q.push(stu[index++].name);
}
else{
s.push(stu[index++].name);
}
}
while(!s.empty()){
printf("%s", s.top().c_str());
s.pop();
cnt++;
if(cnt != n / k + 1){
printf(" ");
}
else{
printf("\n");
}
}
while(!q.empty()){
printf("%s", q.front().c_str());
q.pop();
cnt++;
if(cnt != n / k + 1){
printf(" ");
}
else{
printf("\n");
}
}
}
else{
int cnt = 0;
for(int j = 0; j < n / k; j++){
if(j % 2 == 0){
q.push(stu[index++].name);
}
else{
s.push(stu[index++].name);
}
}
while(!s.empty()){
printf("%s", s.top().c_str());
s.pop();
cnt++;
if(cnt != n / k){
printf(" ");
}
else{
printf("\n");
}
}
while(!q.empty()){
printf("%s", q.front().c_str());
q.pop();
cnt++;
if(cnt != n / k){
printf(" ");
}
else{
printf("\n");
}
}
}
}
return 0;
} | 15.419048 | 38 | 0.440395 | [
"vector"
] |
9e81c0bd0988ff5fee7a6df52150eae703b040eb | 2,321 | cpp | C++ | tests/chunked_output_stream.test.cpp | deeplex/deeppack | 0a94f61ee441eba7f0b280d2493505860c5b89cd | [
"BSL-1.0"
] | null | null | null | tests/chunked_output_stream.test.cpp | deeplex/deeppack | 0a94f61ee441eba7f0b280d2493505860c5b89cd | [
"BSL-1.0"
] | null | null | null | tests/chunked_output_stream.test.cpp | deeplex/deeppack | 0a94f61ee441eba7f0b280d2493505860c5b89cd | [
"BSL-1.0"
] | null | null | null |
// Copyright Henrik Steffen Gaßmann 2020
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// https://www.boost.org/LICENSE_1_0.txt)
#include <dplx/dp/streams/chunked_output_stream.hpp>
#include <cstddef>
#include <array>
#include <vector>
#include "boost-test.hpp"
#include "test_utils.hpp"
namespace dp_tests
{
BOOST_AUTO_TEST_SUITE(streams)
class test_chunked_output_stream final
: public dp::chunked_output_stream_base<test_chunked_output_stream>
{
public:
friend class dp::chunked_output_stream_base<test_chunked_output_stream>;
using base_type
= dp::chunked_output_stream_base<test_chunked_output_stream>;
std::array<std::vector<std::byte>, 2> mChunks;
unsigned int mNext;
explicit test_chunked_output_stream(unsigned int streamSize)
: base_type({}, streamSize)
, mChunks()
{
constexpr auto invalidItem = std::byte{0xfeu};
constexpr auto partition = dp::minimum_guaranteed_write_size * 2 - 1;
assert(streamSize > partition);
mChunks[0].resize(partition);
std::fill(mChunks[0].begin(), mChunks[0].end(), invalidItem);
mChunks[1].resize(streamSize - partition);
std::fill(mChunks[1].begin(), mChunks[1].end(), invalidItem);
}
private:
auto acquire_next_chunk_impl(std::uint64_t) -> dp::result<byte_span>
{
if (mNext >= mChunks.size())
{
return dp::errc::end_of_stream;
}
return std::span(mChunks[mNext++]);
}
};
static_assert(dp::output_stream<test_chunked_output_stream>);
static_assert(dp::lazy_output_stream<test_chunked_output_stream>);
static_assert(dp::stream_traits<test_chunked_output_stream>::output);
static_assert(dp::stream_traits<test_chunked_output_stream>::nothrow_output);
struct chunked_output_stream_dependencies
{
static constexpr unsigned int testSize
= dp::minimum_guaranteed_write_size * 4 - 1;
test_chunked_output_stream subject;
chunked_output_stream_dependencies()
: subject(testSize)
{
}
};
BOOST_FIXTURE_TEST_SUITE(chunked_output_stream,
chunked_output_stream_dependencies)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
} // namespace dp_tests
| 26.988372 | 77 | 0.70573 | [
"vector"
] |
9e84043dd38e652914c7d47f1c8829825115c63f | 9,579 | cpp | C++ | src/saiga/vision/camera/EuRoCDataset.cpp | SimonMederer/saiga | ff167e60c50b1cead4d19eb5ab2e93acce8c42a3 | [
"MIT"
] | null | null | null | src/saiga/vision/camera/EuRoCDataset.cpp | SimonMederer/saiga | ff167e60c50b1cead4d19eb5ab2e93acce8c42a3 | [
"MIT"
] | null | null | null | src/saiga/vision/camera/EuRoCDataset.cpp | SimonMederer/saiga | ff167e60c50b1cead4d19eb5ab2e93acce8c42a3 | [
"MIT"
] | null | null | null | /**
* Copyright (c) 2017 Darius Rückert
* Licensed under the MIT License.
* See LICENSE file for more information.
*/
#include "EuRoCDataset.h"
#include "saiga/core/util/ProgressBar.h"
#include "saiga/core/util/file.h"
#include "saiga/core/util/fileChecker.h"
#include "saiga/core/util/tostring.h"
#include "saiga/vision/camera/TimestampMatcher.h"
#include <filesystem>
#ifdef SAIGA_USE_YAML_CPP
# include "saiga/core/util/easylogging++.h"
# include "yaml-cpp/yaml.h"
namespace Saiga
{
template <typename MatrixType>
MatrixType readYamlMatrix(const YAML::Node& node)
{
MatrixType matrix;
std::vector<double> data;
for (auto n : node)
{
data.push_back(n.as<double>());
}
SAIGA_ASSERT(data.size() == (MatrixType::RowsAtCompileTime * MatrixType::ColsAtCompileTime));
for (int i = 0; i < MatrixType::RowsAtCompileTime; ++i)
{
for (int j = 0; j < MatrixType::ColsAtCompileTime; ++j)
{
matrix(i, j) = data[i * MatrixType::ColsAtCompileTime + j];
}
}
return matrix;
}
// Reads csv files of the following format:
//
// #timestamp [ns],filename
// 1403636579763555584,1403636579763555584.png
// 1403636579813555456,1403636579813555456.png
// 1403636579863555584,1403636579863555584.png
// ...
std::vector<std::pair<double, std::string>> loadTimestapDataCSV(const std::string& file)
{
auto lines = File::loadFileStringArray(file);
File::removeWindowsLineEnding(lines);
StringViewParser csvParser(", ");
// timestamp - filename
std::vector<std::pair<double, std::string>> data;
for (auto&& l : lines)
{
if (l.empty()) continue;
if (l[0] == '#') continue;
csvParser.set(l);
auto svTime = csvParser.next();
if (svTime.empty()) continue;
auto svImg = csvParser.next();
if (svImg.empty()) continue;
data.emplace_back(to_double(svTime), svImg);
}
std::sort(data.begin(), data.end());
return data;
}
struct Associations
{
// left and right image id
int left, right;
// id into gt array
// gtlow is the closest timestamp smaller and gthigh is the closest timestamp larger.
int gtlow, gthigh;
// the interpolation value between low and high
double gtAlpha;
};
EuRoCDataset::EuRoCDataset(const DatasetParameters& _params) : DatasetCameraBase<StereoFrameData>(_params)
{
intrinsics.fps = params.fps;
VLOG(1) << "Loading EuRoCDataset Stereo Dataset: " << params.dir;
auto leftImageSensor = params.dir + "/cam0/sensor.yaml";
auto rightImageSensor = params.dir + "/cam1/sensor.yaml";
SAIGA_ASSERT(std::filesystem::exists(leftImageSensor));
SAIGA_ASSERT(std::filesystem::exists(rightImageSensor));
{
// == Cam 0 ==
// Load camera meta data
YAML::Node config = YAML::LoadFile(leftImageSensor);
SAIGA_ASSERT(config);
SAIGA_ASSERT(!config.IsNull());
VLOG(1) << config["comment"].as<std::string>();
SAIGA_ASSERT(config["camera_model"].as<std::string>() == "pinhole");
intrinsics.model.K.coeffs(readYamlMatrix<Vec4>(config["intrinsics"]));
auto res = readYamlMatrix<ivec2>(config["resolution"]);
intrinsics.imageSize.w = res(0);
intrinsics.imageSize.h = res(1);
// 4 parameter rad-tan model
intrinsics.model.dis.segment<4>(0) = readYamlMatrix<Vec4>(config["distortion_coefficients"]);
intrinsics.model.dis(4) = 0;
Mat4 m = readYamlMatrix<Mat4>(config["T_BS"]["data"]);
extrinsics_cam0 = SE3::fitToSE3(m);
cam0_images = loadTimestapDataCSV(params.dir + "/cam0/data.csv");
}
{
// == Cam 1 ==
// Load camera meta data
YAML::Node config = YAML::LoadFile(rightImageSensor);
VLOG(1) << config["comment"].as<std::string>();
SAIGA_ASSERT(config["camera_model"].as<std::string>() == "pinhole");
intrinsics.rightModel.K.coeffs(readYamlMatrix<Vec4>(config["intrinsics"]));
auto res = readYamlMatrix<ivec2>(config["resolution"]);
intrinsics.rightImageSize.w = res(0);
intrinsics.rightImageSize.h = res(1);
// 4 parameter rad-tan model
intrinsics.rightModel.dis.segment<4>(0) = readYamlMatrix<Vec4>(config["distortion_coefficients"]);
intrinsics.rightModel.dis(4) = 0;
Mat4 m = readYamlMatrix<Mat4>(config["T_BS"]["data"]);
extrinsics_cam1 = SE3::fitToSE3(m);
cam1_images = loadTimestapDataCSV(params.dir + "/cam1/data.csv");
}
{
// == Ground truth position ==
auto sensorFile = params.dir + "/" + "state_groundtruth_estimate0/data.csv";
auto lines = File::loadFileStringArray(sensorFile);
StringViewParser csvParser(", ");
std::vector<double> gtTimes;
for (auto&& l : lines)
{
if (l.empty()) continue;
if (l[0] == '#') continue;
csvParser.set(l);
auto svTime = csvParser.next();
if (svTime.empty()) continue;
Vec3 data;
for (int i = 0; i < 3; ++i)
{
auto sv = csvParser.next();
SAIGA_ASSERT(!sv.empty());
data(i) = to_double(sv);
}
Vec4 dataq;
for (int i = 0; i < 4; ++i)
{
auto sv = csvParser.next();
SAIGA_ASSERT(!sv.empty());
dataq(i) = to_double(sv);
}
Quat q;
q.x() = dataq(0);
q.y() = dataq(1);
q.z() = dataq(2);
q.w() = dataq(3);
auto time = to_double(svTime);
gtTimes.push_back(time);
ground_truth.emplace_back(time, SE3(q, data));
}
YAML::Node config = YAML::LoadFile(params.dir + "/state_groundtruth_estimate0/sensor.yaml");
Mat4 m = readYamlMatrix<Mat4>(config["T_BS"]["data"]);
extrinsics_gt = SE3::fitToSE3(m);
std::sort(ground_truth.begin(), ground_truth.end(), [](auto a, auto b) { return a.first < b.first; });
}
groundTruthToCamera = extrinsics_gt.inverse() * extrinsics_cam0;
// groundTruthToCamera = extrinsics_gt * extrinsics_cam0.inverse();
std::cout << extrinsics_gt << std::endl;
std::cout << extrinsics_cam0 << std::endl;
std::cout << extrinsics_cam1 << std::endl;
std::cout << groundTruthToCamera << std::endl;
std::cout << "Found " << cam1_images.size() << " images and " << ground_truth.size()
<< " ground truth meassurements." << std::endl;
SAIGA_ASSERT(intrinsics.imageSize == intrinsics.rightImageSize);
std::cout << intrinsics << std::endl;
std::vector<Associations> assos;
// =========== Associate ============
{
// extract timestamps so the association matcher works
std::vector<double> left_timestamps, right_timestamps;
std::vector<double> gt_timestamps;
for (auto i : cam0_images) left_timestamps.push_back(i.first);
for (auto i : cam1_images) right_timestamps.push_back(i.first);
for (auto i : ground_truth) gt_timestamps.push_back(i.first);
for (int i = 0; i < cam0_images.size(); ++i)
{
Associations a;
a.left = i;
a.right = TimestampMatcher::findNearestNeighbour(left_timestamps[i], right_timestamps);
auto [id1, id2, alpha] = TimestampMatcher::findLowHighAlphaNeighbour(left_timestamps[i], gt_timestamps);
a.gtlow = id1;
a.gthigh = id2;
a.gtAlpha = alpha;
if (a.right == -1 || a.gtlow == -1 || a.gthigh == -1) continue;
assos.push_back(a);
}
}
// assos.resize(100);
// assos.erase(assos.begin(), assos.begin() + 1000);
// assos.resize(200);
// ==== Actual Image Loading ====
{
int N = assos.size();
if (params.maxFrames == -1)
{
params.maxFrames = N;
}
params.maxFrames = std::min(N - params.startFrame, params.maxFrames);
frames.resize(params.maxFrames);
N = params.maxFrames;
SyncedConsoleProgressBar loadingBar(std::cout, "Loading " + to_string(N) + " images ", N);
# pragma omp parallel for if (params.multiThreadedLoad)
for (int i = 0; i < N; ++i)
{
auto a = assos[i];
auto& frame = frames[i];
std::string leftFile = params.dir + "/cam0/data/" + cam0_images[a.left].second;
std::string rightFile = params.dir + "/cam1/data/" + cam1_images[a.right].second;
if (a.gtlow >= 0 && a.gthigh >= 0 && a.gtlow != a.gthigh)
{
// Vec3 gtpos =
// (1.0 - a.gtAlpha) * ground_truth[a.gtlow].second + a.gtAlpha *
// ground_truth[a.gthigh].second;
frame.groundTruth = slerp(ground_truth[a.gtlow].second, ground_truth[a.gthigh].second, a.gtAlpha);
frame.grayImg.load(leftFile);
frame.grayImg2.load(rightFile);
}
frame.timeStamp = cam0_images[a.left].first / 1e9;
loadingBar.addProgress(1);
}
}
}
} // namespace Saiga
#endif
| 32.917526 | 116 | 0.567074 | [
"vector",
"model"
] |
9e8ccedd4ddaabb6333189fecae9468ee951565a | 35,876 | cpp | C++ | native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | native/cocos/bindings/jswrapper/sm/ScriptEngine.cpp | SteveLau-GameDeveloper/engine | 159e5acd0f5115a878d59ed59f924ce7627a5466 | [
"Apache-2.0",
"MIT"
] | null | null | null | /****************************************************************************
Copyright (c) 2016 Chukong Technologies Inc.
Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ScriptEngine.h"
#if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
#include "../MappingUtils.h"
#include "../State.h"
#include "Class.h"
#include "Object.h"
#include "Utils.h"
// for debug socket
#ifdef _WIN32
#include <WS2tcpip.h>
#include <io.h>
#else
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
#include <mutex>
#include <sstream>
#include <thread>
#if SE_DEBUG
#define TRACE_DEBUGGER_SERVER(...) SE_LOGD(__VA_ARGS__)
#else
#define TRACE_DEBUGGER_SERVER(...)
#endif // #if CC_DEBUG
uint32_t __jsbInvocationCount = 0;
namespace se {
namespace {
const char *BYTE_CODE_FILE_EXT = ".jsc";
ScriptEngine *__instance = nullptr;
const JSClassOps global_classOps = {
nullptr, // addProperty
nullptr, // delProperty
nullptr, // enumerate
nullptr, // newEnumerate
nullptr, // resolve
nullptr, // mayResolve
nullptr, // finalize
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
JS_GlobalObjectTraceHook, // trace
};
JSClass __globalClass = {
"global",
JSCLASS_GLOBAL_FLAGS,
&global_classOps};
void reportWarning(JSContext *cx, JSErrorReport *report) {
MOZ_RELEASE_ASSERT(report);
// MOZ_RELEASE_ASSERT(report->isWarning());
SE_LOGE("%s:%u:%s\n", report->filename ? report->filename : "<no filename>",
(unsigned int)report->lineno,
report->message().c_str());
}
void SetStandardCompartmentOptions(JS::RealmOptions &options) {
bool enableSharedMemory = true;
options.creationOptions().setSharedMemoryAndAtomicsEnabled(enableSharedMemory);
}
bool __forceGC(JSContext *cx, uint32_t argc, JS::Value *vp) {
JS_GC(cx);
return true;
}
bool __log(JSContext *cx, uint32_t argc, JS::Value *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc > 0) {
JSString *string = JS::ToString(cx, args[0]);
if (string) {
JS::RootedString jsstr(cx, string);
JS::UniqueChars buffer = JS_EncodeStringToUTF8(cx, jsstr);
SE_LOGD("JS: %s\n", buffer.get());
}
}
args.rval().setUndefined();
return true;
}
// Private data class
bool privateDataContructor(JSContext *cx, uint32_t argc, JS::Value *vp) {
return true;
}
void privateDataFinalize(JSFreeOp *fop, JSObject *obj) {
internal::PrivateData *p = (internal::PrivateData *)internal::SE_JS_GetPrivate(obj, 0);
if (p == nullptr)
return;
internal::SE_JS_SetPrivate(obj, 0, p->data);
if (p->finalizeCb != nullptr)
p->finalizeCb(fop, obj);
free(p);
}
// ------------------------------------------------------- ScriptEngine
void on_garbage_collect(JSContext *cx, JSGCStatus status, JS::GCReason reason, void *data) {
/* We finalize any pending toggle refs before doing any garbage collection,
* so that we can collect the JS wrapper objects, and in order to minimize
* the chances of objects having a pending toggle up queued when they are
* garbage collected. */
if (status == JSGC_BEGIN) {
ScriptEngine::getInstance()->_setGarbageCollecting(true);
SE_LOGD("on_garbage_collect: begin, Native -> JS map count: %d, all objects: %d\n", (int)NativePtrToObjectMap::size(), (int)__objectMap.size());
} else if (status == JSGC_END) {
SE_LOGD("on_garbage_collect: end, Native -> JS map count: %d, all objects: %d\n", (int)NativePtrToObjectMap::size(), (int)__objectMap.size());
ScriptEngine::getInstance()->_setGarbageCollecting(false);
}
}
std::string removeFileExt(const std::string &filePath) {
size_t pos = filePath.rfind('.');
if (0 < pos) {
return filePath.substr(0, pos);
}
return filePath;
}
bool getBytecodeBuildId(JS::BuildIdCharVector *buildId) {
// The browser embeds the date into the buildid and the buildid is embedded
// in the binary, so every 'make' necessarily builds a new firefox binary.
// Fortunately, the actual firefox executable is tiny -- all the code is in
// libxul.so and other shared modules -- so this isn't a big deal. Not so
// for the statically-linked JS shell. To avoid recompiling js.cpp and
// re-linking 'js' on every 'make', we use a constant buildid and rely on
// the shell user to manually clear any caches between cache-breaking updates.
const char buildid[] = "cocos_xdr";
return buildId->append(buildid, sizeof(buildid));
}
// For console stuff
bool JSB_console_format_log(State &s, const char *prefix, int msgIndex = 0) {
if (msgIndex < 0)
return false;
const auto &args = s.args();
int argc = (int)args.size();
if ((argc - msgIndex) == 1) {
std::string msg = args[msgIndex].toStringForce();
SE_LOGD("JS: %s%s\n", prefix, msg.c_str());
} else if (argc > 1) {
std::string msg = args[msgIndex].toStringForce();
size_t pos;
for (int i = (msgIndex + 1); i < argc; ++i) {
pos = msg.find("%");
if (pos != std::string::npos && pos != (msg.length() - 1) && (msg[pos + 1] == 'd' || msg[pos + 1] == 's' || msg[pos + 1] == 'f')) {
msg.replace(pos, 2, args[i].toStringForce());
} else {
msg += " " + args[i].toStringForce();
}
}
SE_LOGD("JS: %s%s\n", prefix, msg.c_str());
}
return true;
}
bool JSB_console_log(State &s) {
JSB_console_format_log(s, "");
return true;
}
SE_BIND_FUNC(JSB_console_log)
bool JSB_console_debug(State &s) {
JSB_console_format_log(s, "[DEBUG]: ");
return true;
}
SE_BIND_FUNC(JSB_console_debug)
bool JSB_console_info(State &s) {
JSB_console_format_log(s, "[INFO]: ");
return true;
}
SE_BIND_FUNC(JSB_console_info)
bool JSB_console_warn(State &s) {
JSB_console_format_log(s, "[WARN]: ");
return true;
}
SE_BIND_FUNC(JSB_console_warn)
bool JSB_console_error(State &s) {
JSB_console_format_log(s, "[ERROR]: ");
return true;
}
SE_BIND_FUNC(JSB_console_error)
bool JSB_console_assert(State &s) {
const auto &args = s.args();
if (!args.empty()) {
if (args[0].isBoolean() && !args[0].toBoolean()) {
JSB_console_format_log(s, "[ASSERT]: ", 1);
}
}
return true;
}
SE_BIND_FUNC(JSB_console_assert)
bool JSB_console_time(State &s) {
return true; //TODO(cjh)
}
SE_BIND_FUNC(JSB_console_time)
bool JSB_console_timeEnd(State &s) {
return true; //TODO(cjh)
}
SE_BIND_FUNC(JSB_console_timeEnd)
} // namespace
AutoHandleScope::AutoHandleScope() {
}
AutoHandleScope::~AutoHandleScope() {
js::RunJobs(se::ScriptEngine::getInstance()->_getContext());
}
ScriptEngine *ScriptEngine::getInstance() {
if (__instance == nullptr) {
__instance = new ScriptEngine();
}
return __instance;
}
void ScriptEngine::destroyInstance() {
delete __instance;
__instance = nullptr;
}
ScriptEngine::ScriptEngine()
: _cx(nullptr),
_globalObj(nullptr),
_debugGlobalObj(nullptr),
_oldCompartment(nullptr),
_exceptionCallback(nullptr),
_debuggerServerPort(0),
_vmId(0),
_isGarbageCollecting(false),
_isValid(false),
_isInCleanup(false),
_isErrorHandleWorking(false) {
bool ok = JS_Init();
assert(ok);
}
/* static */
void ScriptEngine::onWeakPointerCompartmentCallback(JSTracer *trc, JS::Compartment *comp, void *data) {
onWeakPointerZoneGroupCallback(trc, data);
}
/* static */
void ScriptEngine::onWeakPointerZoneGroupCallback(JSTracer *trc, void *data) {
bool isInCleanup = getInstance()->isInCleanup();
bool isIterUpdated = false;
Object *obj = nullptr;
auto iter = NativePtrToObjectMap::begin();
while (iter != NativePtrToObjectMap::end()) {
obj = iter->second;
isIterUpdated = false;
if (!obj->isRooted()) {
if (obj->updateAfterGC(trc, data)) {
obj->decRef();
iter = NativePtrToObjectMap::erase(iter);
isIterUpdated = true;
}
} else if (isInCleanup) // Rooted and in cleanup step
{
obj->unprotect();
obj->decRef();
iter = NativePtrToObjectMap::erase(iter);
isIterUpdated = true;
}
if (!isIterUpdated)
++iter;
}
}
bool ScriptEngine::init() {
cleanup();
SE_LOGD("Initializing SpiderMonkey, version: %s\n", JS_GetImplementationVersion());
++_vmId;
for (const auto &hook : _beforeInitHookArray) {
hook();
}
_beforeInitHookArray.clear();
_cx = JS_NewContext(JS::DefaultHeapMaxBytes);
if (nullptr == _cx)
return false;
NativePtrToObjectMap::init();
Class::setContext(_cx);
Object::setContext(_cx);
js::UseInternalJobQueues(_cx);
JS_SetGCParameter(_cx, JSGC_MAX_BYTES, 0xffffffff);
JS_SetGCParameter(_cx, JSGC_INCREMENTAL_GC_ENABLED, 1);
JS_SetGCParameter(_cx, JSGC_PER_ZONE_GC_ENABLED, 1);
JS_SetGCParameter(_cx, JSGC_COMPACTING_ENABLED, 1);
JS_SetNativeStackQuota(_cx, 5000000);
JS_SetOffthreadIonCompilationEnabled(_cx, true);
JS_SetGlobalJitCompilerOption(_cx, JSJITCOMPILER_ION_ENABLE, 1);
JS_SetGlobalJitCompilerOption(_cx, JSJITCOMPILER_BASELINE_ENABLE, 1);
JS_SetGCCallback(_cx, on_garbage_collect, nullptr);
if (!JS::InitSelfHostedCode(_cx))
return false;
// Waiting is allowed on the shell's main thread, for now.
JS_SetFutexCanWait(_cx);
JS::SetWarningReporter(_cx, reportWarning);
#if defined(JS_GC_ZEAL) && defined(DEBUG)
// JS_SetGCZeal(_cx, 2, JS_DEFAULT_ZEAL_FREQ);
#endif
JS::RealmOptions options;
SetStandardCompartmentOptions(options);
#ifdef DEBUG
JS::ContextOptionsRef(_cx)
.setDisableIon()
.setWasmBaseline(false)
.setAsmJS(false)
.setWasm(false)
.setWasmIon(false);
#else
JS::ContextOptionsRef(_cx)
.setAsmJS(true)
.setWasm(true)
.setWasmBaseline(true)
.setWasmIon(true);
#endif
JS::RootedObject globalObj(_cx, JS_NewGlobalObject(_cx, &__globalClass, nullptr, JS::DontFireOnNewGlobalHook, options));
if (nullptr == globalObj)
return false;
_globalObj = Object::_createJSObject(nullptr, globalObj);
_globalObj->root();
JS::RootedObject rootedGlobalObj(_cx, _globalObj->_getJSObject());
_oldCompartment = JS::EnterRealm(_cx, rootedGlobalObj);
JS::InitRealmStandardClasses(_cx);
_globalObj->setProperty("window", Value(_globalObj));
// SpiderMonkey isn't shipped with a console variable. Make a fake one.
Value consoleVal;
bool hasConsole = _globalObj->getProperty("console", &consoleVal) && consoleVal.isObject();
assert(!hasConsole);
HandleObject consoleObj(Object::createPlainObject());
consoleObj->defineFunction("log", _SE(JSB_console_log));
consoleObj->defineFunction("debug", _SE(JSB_console_debug));
consoleObj->defineFunction("info", _SE(JSB_console_info));
consoleObj->defineFunction("warn", _SE(JSB_console_warn));
consoleObj->defineFunction("error", _SE(JSB_console_error));
consoleObj->defineFunction("assert", _SE(JSB_console_assert));
consoleObj->defineFunction("time", _SE(JSB_console_info)); //TODO(cjh)
consoleObj->defineFunction("timeEnd", _SE(JSB_console_info)); //TODO(cjh)
_globalObj->setProperty("console", Value(consoleObj));
_globalObj->setProperty("scriptEngineType", Value("SpiderMonkey"));
JS_DefineFunction(_cx, rootedGlobalObj, "log", __log, 0, JSPROP_PERMANENT);
JS_DefineFunction(_cx, rootedGlobalObj, "forceGC", __forceGC, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_FireOnNewGlobalObject(_cx, rootedGlobalObj);
JS::SetProcessBuildIdOp(getBytecodeBuildId);
_isValid = true;
for (const auto &hook : _afterInitHookArray) {
hook();
}
_afterInitHookArray.clear();
return true;
}
ScriptEngine::~ScriptEngine() {
cleanup();
JS_ShutDown();
}
void ScriptEngine::cleanup() {
if (!_isValid)
return;
_isInCleanup = true;
for (const auto &hook : _beforeCleanupHookArray) {
hook();
}
_beforeCleanupHookArray.clear();
SAFE_DEC_REF(_globalObj);
Class::cleanup();
Object::cleanup();
JS::LeaveRealm(_cx, _oldCompartment);
JS_DestroyContext(_cx);
_cx = nullptr;
_globalObj = nullptr;
_oldCompartment = nullptr;
_isValid = false;
_registerCallbackArray.clear();
_filenameScriptMap.clear();
for (const auto &hook : _afterCleanupHookArray) {
hook();
}
_afterCleanupHookArray.clear();
_isInCleanup = false;
NativePtrToObjectMap::destroy();
}
void ScriptEngine::addBeforeCleanupHook(const std::function<void()> &hook) {
_beforeCleanupHookArray.push_back(hook);
}
void ScriptEngine::addAfterCleanupHook(const std::function<void()> &hook) {
_afterCleanupHookArray.push_back(hook);
}
void ScriptEngine::addBeforeInitHook(const std::function<void()> &hook) {
_beforeInitHookArray.push_back(hook);
}
void ScriptEngine::addAfterInitHook(const std::function<void()> &hook) {
_afterInitHookArray.push_back(hook);
}
bool ScriptEngine::isGarbageCollecting() {
return _isGarbageCollecting;
}
void ScriptEngine::_setGarbageCollecting(bool isGarbageCollecting) {
_isGarbageCollecting = isGarbageCollecting;
}
Object *ScriptEngine::getGlobalObject() {
return _globalObj;
}
void ScriptEngine::addRegisterCallback(RegisterCallback cb) {
assert(std::find(_registerCallbackArray.begin(), _registerCallbackArray.end(), cb) == _registerCallbackArray.end());
_registerCallbackArray.push_back(cb);
}
void ScriptEngine::addPermanentRegisterCallback(RegisterCallback cb) {
if (std::find(_permRegisterCallbackArray.begin(), _permRegisterCallbackArray.end(), cb) == _permRegisterCallbackArray.end()) {
_permRegisterCallbackArray.push_back(cb);
}
}
#pragma mark - Debug
static std::string inData;
static std::string outData;
static ccstd::vector<std::string> g_queue;
static std::mutex g_qMutex;
static std::mutex g_rwMutex;
static int clientSocket = -1;
static uint32_t s_nestedLoopLevel = 0;
static void cc_closesocket(int fd) {
#ifdef _WIN32
closesocket(fd);
#else
close(fd);
#endif
}
void ScriptEngine::_debugProcessInput(const std::string &str) {
JS::RootedObject debugGlobal(_cx, _debugGlobalObj->_getJSObject());
JS::Realm * globalCpt = JS::EnterRealm(_cx, debugGlobal);
Value func;
if (_debugGlobalObj->getProperty("processInput", &func) && func.isObject() && func.toObject()->isFunction()) {
ValueArray args;
args.push_back(Value(str));
func.toObject()->call(args, _debugGlobalObj);
}
JS::LeaveRealm(_cx, globalCpt);
}
static bool NS_ProcessNextEvent() {
std::string message;
size_t messageCount = 0;
while (true) {
g_qMutex.lock();
messageCount = g_queue.size();
if (messageCount > 0) {
auto first = g_queue.begin();
message = *first;
g_queue.erase(first);
--messageCount;
}
g_qMutex.unlock();
if (!message.empty()) {
ScriptEngine::getInstance()->_debugProcessInput(message);
}
if (messageCount == 0)
break;
}
// std::this_thread::yield();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
return true;
}
static bool JSBDebug_enterNestedEventLoop(State &s) {
enum {
NS_OK = 0,
NS_ERROR_UNEXPECTED
};
#define NS_SUCCEEDED(v) ((v) == NS_OK)
int rv = NS_OK;
uint32_t nestLevel = ++s_nestedLoopLevel;
while (NS_SUCCEEDED(rv) && s_nestedLoopLevel >= nestLevel) {
js::RunJobs(se::ScriptEngine::getInstance()->_getContext());
if (!NS_ProcessNextEvent())
rv = NS_ERROR_UNEXPECTED;
}
assert(s_nestedLoopLevel <= nestLevel);
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_enterNestedEventLoop)
static bool JSBDebug_exitNestedEventLoop(State &s) {
if (s_nestedLoopLevel > 0) {
--s_nestedLoopLevel;
} else {
s.rval().setInt32(0);
return true;
}
return true;
}
SE_BIND_FUNC(JSBDebug_exitNestedEventLoop)
static bool JSBDebug_getEventLoopNestLevel(State &s) {
s.rval().setInt32(s_nestedLoopLevel);
return true;
}
SE_BIND_FUNC(JSBDebug_getEventLoopNestLevel)
static void _clientSocketWriteAndClearString(std::string &s) {
::send(clientSocket, s.c_str(), s.length(), 0);
s.clear();
}
static void processInput(const std::string &data) {
std::lock_guard<std::mutex> lk(g_qMutex);
g_queue.push_back(data);
}
static void clearBuffers() {
std::lock_guard<std::mutex> lk(g_rwMutex);
// only process input if there's something and we're not locked
if (!inData.empty()) {
processInput(inData);
inData.clear();
}
if (!outData.empty()) {
_clientSocketWriteAndClearString(outData);
}
}
static void serverEntryPoint(uint32_t port) {
// start a server, accept the connection and keep reading data from it
struct addrinfo hints, *result = nullptr, *rp = nullptr;
int s = 0;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; // TCP stream sockets
hints.ai_flags = AI_PASSIVE; // fill in my IP for me
std::stringstream portstr;
portstr << port;
int err = 0;
#ifdef _WIN32
WSADATA wsaData;
err = WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
if ((err = getaddrinfo(NULL, portstr.str().c_str(), &hints, &result)) != 0) {
SE_LOGD("getaddrinfo error : %s\n", gai_strerror(err));
}
for (rp = result; rp != NULL; rp = rp->ai_next) {
if ((s = socket(rp->ai_family, rp->ai_socktype, 0)) < 0) {
continue;
}
int optval = 1;
if ((setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&optval, sizeof(optval))) < 0) {
cc_closesocket(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_REUSEADDR\n");
return;
}
#ifdef __APPLE__
if ((setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval))) < 0) {
close(s);
TRACE_DEBUGGER_SERVER("debug server : error setting socket option SO_NOSIGPIPE\n");
return;
}
#endif
if ((::bind(s, rp->ai_addr, rp->ai_addrlen)) == 0) {
break;
}
cc_closesocket(s);
s = -1;
}
if (s < 0 || rp == NULL) {
TRACE_DEBUGGER_SERVER("debug server : error creating/binding socket\n");
return;
}
freeaddrinfo(result);
listen(s, 1);
#define MAX_RECEIVED_SIZE 1024
#define BUF_SIZE MAX_RECEIVED_SIZE + 1
char buf[BUF_SIZE] = {0};
int readBytes = 0;
while (true) {
clientSocket = accept(s, NULL, NULL);
if (clientSocket < 0) {
TRACE_DEBUGGER_SERVER("debug server : error on accept\n");
return;
} else {
// read/write data
TRACE_DEBUGGER_SERVER("debug server : client connected\n");
inData = "connected";
// process any input, send any output
clearBuffers();
while ((readBytes = (int)::recv(clientSocket, buf, MAX_RECEIVED_SIZE, 0)) > 0) {
buf[readBytes] = '\0';
// TRACE_DEBUGGER_SERVER("debug server : received command >%s", buf);
// no other thread is using this
inData.append(buf);
// process any input, send any output
clearBuffers();
} // while(read)
cc_closesocket(clientSocket);
}
} // while(true)
#undef BUF_SIZE
#undef MAX_RECEIVED_SIZE
}
static bool JSBDebug_require(State &s) {
const auto &args = s.args();
int argc = (int)args.size();
if (argc >= 1) {
ScriptEngine::getInstance()->runScript(args[0].toString());
return true;
}
SE_REPORT_ERROR("Wrong number of arguments: %d, expected: %d", argc, 1);
return false;
}
SE_BIND_FUNC(JSBDebug_require)
static bool JSBDebug_BufferWrite(State &s) {
const auto &args = s.args();
int argc = (int)args.size();
if (argc == 1) {
// this is safe because we're already inside a lock (from clearBuffers)
outData.append(args[0].toString());
_clientSocketWriteAndClearString(outData);
}
return true;
}
SE_BIND_FUNC(JSBDebug_BufferWrite)
bool ScriptEngine::start() {
if (!init())
return false;
if (isDebuggerEnabled() && _debugGlobalObj == nullptr) {
JS::RealmOptions options;
options.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
JS::RootedObject debugGlobal(_cx, JS_NewGlobalObject(_cx, &__globalClass, nullptr, JS::DontFireOnNewGlobalHook, options));
_debugGlobalObj = Object::_createJSObject(nullptr, debugGlobal);
_debugGlobalObj->root();
JS::Realm *globalCpt = JS::EnterRealm(_cx, debugGlobal);
JS::InitRealmStandardClasses(_cx);
JS_FireOnNewGlobalObject(_cx, debugGlobal);
JS_DefineDebuggerObject(_cx, debugGlobal);
// these are used in the debug program
JS_DefineFunction(_cx, debugGlobal, "log", __log, 0, JSPROP_PERMANENT);
_debugGlobalObj->defineFunction("require", _SE(JSBDebug_require));
_debugGlobalObj->defineFunction("_bufferWrite", _SE(JSBDebug_BufferWrite));
_debugGlobalObj->defineFunction("_enterNestedEventLoop", _SE(JSBDebug_enterNestedEventLoop));
_debugGlobalObj->defineFunction("_exitNestedEventLoop", _SE(JSBDebug_exitNestedEventLoop));
_debugGlobalObj->defineFunction("_getEventLoopNestLevel", _SE(JSBDebug_getEventLoopNestLevel));
JS::RootedObject globalObj(_cx, _globalObj->_getJSObject());
JS_WrapObject(_cx, &globalObj);
runScript("script/jsb_debugger.js");
// prepare the debugger
Value prepareDebuggerFunc;
assert(_debugGlobalObj->getProperty("_prepareDebugger", &prepareDebuggerFunc) && prepareDebuggerFunc.isObject() && prepareDebuggerFunc.toObject()->isFunction());
ValueArray args;
args.push_back(Value(_globalObj));
prepareDebuggerFunc.toObject()->call(args, _debugGlobalObj);
// start bg thread
auto t = std::thread(&serverEntryPoint, _debuggerServerPort);
t.detach();
JS::LeaveRealm(_cx, globalCpt);
}
bool ok = false;
_startTime = std::chrono::steady_clock::now();
for (auto cb : _permRegisterCallbackArray) {
ok = cb(_globalObj);
assert(ok);
if (!ok) {
break;
}
}
for (auto cb : _registerCallbackArray) {
ok = cb(_globalObj);
assert(ok);
if (!ok)
break;
}
// After ScriptEngine is started, _registerCallbackArray isn't needed. Therefore, clear it here.
_registerCallbackArray.clear();
return ok;
}
bool ScriptEngine::getScript(const std::string &path, JS::MutableHandleScript script) {
std::string fullPath = _fileOperationDelegate.onGetFullPath(path);
auto iter = _filenameScriptMap.find(fullPath);
if (iter != _filenameScriptMap.end()) {
JS::PersistentRootedScript *rootedScript = iter->second;
script.set(rootedScript->get());
return true;
}
// // a) check jsc file first
// std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT;
// if (_filenameScriptMap.find(byteCodePath) != _filenameScriptMap.end())
// {
// script.set(_filenameScriptMap[byteCodePath]->get());
// return true;
// }
//
// // b) no jsc file, check js file
// if (_filenameScriptMap.find(path) != _filenameScriptMap.end())
// {
// script.set(_filenameScriptMap[path]->get());
// return true;
// }
return false;
}
bool ScriptEngine::compileScript(const std::string &path, JS::MutableHandleScript script) {
if (path.empty())
return false;
bool ok = getScript(path, script);
if (ok)
return true;
assert(_fileOperationDelegate.isValid());
bool compileSucceed = false;
// Creator v1.7 supports v8, spidermonkey, javascriptcore and chakracore as its script engine,
// jsc file isn't bytecode format anymore, it's a xxtea encrpted binary format instead.
// Therefore, for unifying the flow, ScriptEngine class will not support spidermonkey bytecode.
// // a) check jsc file first
// std::string byteCodePath = removeFileExt(path) + BYTE_CODE_FILE_EXT;
//
// // Check whether '.jsc' files exist to avoid outputting log which says 'couldn't find .jsc file'.
// if (_fileOperationDelegate.onCheckFileExist(byteCodePath))
// {
// _fileOperationDelegate.onGetDataFromFile(byteCodePath, [&](const uint8_t* data, size_t dataLen) {
// if (data != nullptr && dataLen > 0)
// {
// JS::TranscodeBuffer buffer;
// bool appended = buffer.append(data, dataLen);
// JS::TranscodeResult result = JS::DecodeScript(_cx, buffer, script);
// if (appended && result == JS::TranscodeResult::TranscodeResult_Ok)
// {
// compileSucceed = true;
// _filenameScriptMap[byteCodePath] = new (std::nothrow) JS::PersistentRootedScript(_cx, script.get());
// }
// assert(compileSucceed);
// }
// });
//
// }
// b) no jsc file, check js file
if (!compileSucceed) {
/* Clear any pending exception from previous failed decoding. */
clearException();
std::string jsFileContent = _fileOperationDelegate.onGetStringFromFile(path);
if (!jsFileContent.empty()) {
JS::CompileOptions op(_cx);
op.setFileAndLine(path.c_str(), 1);
JS::SourceText<mozilla::Utf8Unit> srcBuf;
bool succeed = srcBuf.init(_cx, jsFileContent.c_str(), jsFileContent.length(),
JS::SourceOwnership::Borrowed);
assert(succeed);
JSScript *compiledScript = JS::Compile(_cx, op, srcBuf);
if (compiledScript != nullptr) {
compileSucceed = true;
script.set(compiledScript);
std::string fullPath = _fileOperationDelegate.onGetFullPath(path);
_filenameScriptMap[fullPath] = new (std::nothrow) JS::PersistentRootedScript(_cx, script.get());
}
assert(compileSucceed);
}
}
clearException();
if (!compileSucceed) {
SE_LOGD("ScriptEngine::compileScript fail:%s\n", path.c_str());
}
return compileSucceed;
}
bool ScriptEngine::evalString(const char *script, ssize_t length /* = -1 */, Value *ret /* = nullptr */, const char *fileName /* = nullptr */) {
assert(script != nullptr);
if (length < 0)
length = strlen(script);
if (fileName == nullptr)
fileName = "(no filename)";
JS::CompileOptions options(_cx);
options.setFile(fileName);
JS::RootedValue rval(_cx);
JS::SourceText<mozilla::Utf8Unit> srcBuf;
bool succeed = srcBuf.init(_cx, script, length, JS::SourceOwnership::Borrowed);
assert(succeed);
bool ok = JS::Evaluate(_cx, options, srcBuf, &rval);
if (!ok) {
clearException();
}
assert(ok);
if (ok && ret != nullptr && !rval.isNullOrUndefined()) {
internal::jsToSeValue(_cx, rval, ret);
}
if (!ok) {
SE_LOGE("ScriptEngine::evalString script %s, failed!\n", fileName);
}
return ok;
}
void ScriptEngine::setFileOperationDelegate(const FileOperationDelegate &delegate) {
_fileOperationDelegate = delegate;
}
const ScriptEngine::FileOperationDelegate &ScriptEngine::getFileOperationDelegate() const {
return _fileOperationDelegate;
}
bool ScriptEngine::runScript(const std::string &path, Value *ret /* = nullptr */) {
assert(_fileOperationDelegate.isValid());
JS::RootedScript script(_cx);
bool ok = compileScript(path, &script);
if (ok) {
JS::RootedValue rval(_cx);
ok = JS_ExecuteScript(_cx, script, &rval);
if (!ok) {
SE_LOGE("Evaluating %s failed (evaluatedOK == JS_FALSE)\n", path.c_str());
clearException();
}
if (ok && ret != nullptr && !rval.isNullOrUndefined()) {
internal::jsToSeValue(_cx, rval, ret);
}
}
return ok;
}
void ScriptEngine::clearException() {
if (_cx == nullptr)
return;
if (JS_IsExceptionPending(_cx)) {
JS::RootedValue exceptionValue(_cx);
JS_GetPendingException(_cx, &exceptionValue);
JS_ClearPendingException(_cx);
assert(exceptionValue.isObject());
JS::RootedObject exceptionObj(_cx, exceptionValue.toObjectOrNull());
JSErrorReport * report = JS_ErrorFromException(_cx, exceptionObj);
const char * message = report->message().c_str();
const std::string filePath = report->filename != nullptr ? report->filename : "(no filename)";
char line[50] = {0};
snprintf(line, sizeof(line), "%u", report->lineno);
char column[50] = {0};
snprintf(column, sizeof(column), "%u", report->column);
const std::string location = filePath + ":" + line + ":" + column;
JS::UniqueChars stack;
JS::RootedValue stackVal(_cx);
if (JS_GetProperty(_cx, exceptionObj, "stack", &stackVal) && stackVal.isString()) {
JS::RootedString jsstackStr(_cx, stackVal.toString());
stack = JS_EncodeStringToUTF8(_cx, jsstackStr);
}
std::string exceptionStr = message;
exceptionStr += ", location: " + location;
if (stack != nullptr) {
exceptionStr += "\nSTACK:\n";
exceptionStr += stack.get();
}
SE_LOGE("ERROR: %s\n", exceptionStr.c_str());
if (_exceptionCallback != nullptr) {
_exceptionCallback(location.c_str(), message, stack.get());
}
if (!_isErrorHandleWorking) {
_isErrorHandleWorking = true;
Value errorHandler;
if (_globalObj->getProperty("__errorHandler", &errorHandler) && errorHandler.isObject() && errorHandler.toObject()->isFunction()) {
ValueArray args;
args.push_back(Value(filePath));
args.push_back(Value(report->lineno));
args.push_back(Value(message));
if (stack) {
args.push_back(Value(stack.get()));
} else {
args.push_back(Value(""));
}
errorHandler.toObject()->call(args, _globalObj);
}
_isErrorHandleWorking = false;
} else {
SE_LOGE("ERROR: __errorHandler has exception\n");
}
}
}
void ScriptEngine::setExceptionCallback(const ExceptionCallback &cb) {
_exceptionCallback = cb;
}
void ScriptEngine::setJSExceptionCallback(const ExceptionCallback &cb) { //TODO(cjh)
}
void ScriptEngine::enableDebugger(const std::string &serverAddr, uint32_t port, bool isWait) {
_debuggerServerAddr = serverAddr;
_debuggerServerPort = port;
}
bool ScriptEngine::isDebuggerEnabled() const {
return !_debuggerServerAddr.empty() && _debuggerServerPort > 0;
}
void ScriptEngine::mainLoopUpdate() {
js::RunJobs(_cx);
if (!isDebuggerEnabled()) {
return;
}
std::string message;
size_t messageCount = 0;
while (true) {
g_qMutex.lock();
messageCount = g_queue.size();
if (messageCount > 0) {
auto first = g_queue.begin();
message = *first;
g_queue.erase(first);
--messageCount;
}
g_qMutex.unlock();
if (!message.empty()) {
_debugProcessInput(message);
}
if (messageCount == 0)
break;
}
}
bool ScriptEngine::callFunction(Object *targetObj, const char *funcName, uint32_t argc, Value *args, Value *rval /* = nullptr*/) {
JS::RootedValueVector jsarr(_cx);
if (!jsarr.reserve(argc)) {
SE_LOGE("ScriptEngine::callFunction out of memory!");
return false;
}
for (size_t i = 0; i < argc; ++i) {
JS::RootedValue jsval(_cx);
internal::seToJsValue(_cx, args[i], &jsval);
jsarr.append(jsval);
}
JS::RootedObject contextObject(_cx);
if (targetObj != nullptr) {
contextObject.set(targetObj->_getJSObject());
}
bool found = false;
bool ok = JS_HasProperty(_cx, contextObject, funcName, &found);
if (!ok || !found) {
return false;
}
JS::RootedValue funcValue(_cx);
ok = JS_GetProperty(_cx, contextObject, funcName, &funcValue);
if (!ok) {
return false;
}
JS::RootedValue rcValue(_cx);
JSAutoRealm autoRealm(_cx, funcValue.toObjectOrNull());
ok = JS_CallFunctionValue(_cx, contextObject, funcValue, jsarr, &rcValue);
if (ok) {
if (rval != nullptr)
internal::jsToSeValue(_cx, rcValue, rval);
} else {
se::ScriptEngine::getInstance()->clearException();
}
return ok;
}
void ScriptEngine::handlePromiseExceptions() {
clearException();
} //TODO(cjh)
} // namespace se
#endif // #if SCRIPT_ENGINE_TYPE == SCRIPT_ENGINE_SM
| 31.142361 | 169 | 0.620638 | [
"object",
"vector"
] |
9e8da2c5a6d49d13329859bf9a0bbe88296c9730 | 104,710 | cpp | C++ | src/main.cpp | lucsmelo/TF-FCG | 2075103a7050b86bc16572e9c395bf9d4d48c9cc | [
"MIT"
] | null | null | null | src/main.cpp | lucsmelo/TF-FCG | 2075103a7050b86bc16572e9c395bf9d4d48c9cc | [
"MIT"
] | null | null | null | src/main.cpp | lucsmelo/TF-FCG | 2075103a7050b86bc16572e9c395bf9d4d48c9cc | [
"MIT"
] | null | null | null | // Universidade Federal do Rio Grande do Sul
// Instituto de Informática
// Departamento de Informática Aplicada
//
// INF01047 Fundamentos de Computação Gráfica
// Prof. Eduardo Gastal
//
// LABORATÓRIO 5
//
// Arquivos "headers" padrões de C podem ser incluídos em um
// programa C++, sendo necessário somente adicionar o caractere
// "c" antes de seu nome, e remover o sufixo ".h". Exemplo:
// #include <stdio.h> // Em C
// vira
// #include <cstdio> // Em C++
//
#include <cmath>
#include <cstdio>
#include <cstdlib>
// Headers abaixo são específicos de C++
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <limits>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <algorithm>
#include <random>
#include <ctime>
#include <iostream>
#include <chrono>
// Headers das bibliotecas OpenGL
#include <glad/glad.h> // Criação de contexto OpenGL 3.3
#include <GLFW/glfw3.h> // Criação de janelas do sistema operacional
// Headers da biblioteca GLM: criação de matrizes e vetores.
#include <glm/mat4x4.hpp>
#include <glm/vec4.hpp>
#include <glm/gtc/type_ptr.hpp>
// Headers da biblioteca para carregar modelos obj
#include <tiny_obj_loader.h>
#include <stb_image.h>
// Headers locais, definidos na pasta "include/"
#include "utils.h"
#include "matrices.h"
#include "collisions.h"
// Estrutura que representa um modelo geométrico carregado a partir de um
// arquivo ".obj". Veja https://en.wikipedia.org/wiki/Wavefront_.obj_file .
struct ObjModel
{
tinyobj::attrib_t attrib;
std::vector<tinyobj::shape_t> shapes;
std::vector<tinyobj::material_t> materials;
// Este construtor lê o modelo de um arquivo utilizando a biblioteca tinyobjloader.
// Veja: https://github.com/syoyo/tinyobjloader
ObjModel(const char* filename, const char* basepath = NULL, bool triangulate = true)
{
printf("Carregando modelo \"%s\"... ", filename);
std::string err;
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, filename, basepath, triangulate);
if (!err.empty())
fprintf(stderr, "\n%s\n", err.c_str());
if (!ret)
throw std::runtime_error("Erro ao carregar modelo.");
printf("OK.\n");
}
};
// Declaração de funções utilizadas para pilha de matrizes de modelagem.
void PushMatrix(glm::mat4 M);
void PopMatrix(glm::mat4& M);
// Declaração de várias funções utilizadas em main(). Essas estão definidas
// logo após a definição de main() neste arquivo.
void BuildTrianglesAndAddToVirtualScene(ObjModel*); // Constrói representação de um ObjModel como malha de triângulos para renderização
void ComputeNormals(ObjModel* model); // Computa normais de um ObjModel, caso não existam.
void LoadShadersFromFiles(); // Carrega os shaders de vértice e fragmento, criando um programa de GPU
void LoadTextureImage(const char* filename); // Função que carrega imagens de textura
void DrawVirtualObject(const char* object_name); // Desenha um objeto armazenado em g_VirtualScene
GLuint LoadShader_Vertex(const char* filename); // Carrega um vertex shader
GLuint LoadShader_Fragment(const char* filename); // Carrega um fragment shader
void LoadShader(const char* filename, GLuint shader_id); // Função utilizada pelas duas acima
GLuint CreateGpuProgram(GLuint vertex_shader_id, GLuint fragment_shader_id); // Cria um programa de GPU
void PrintObjModelInfo(ObjModel*); // Função para debugging
// Declaração de funções auxiliares para renderizar texto dentro da janela
// OpenGL. Estas funções estão definidas no arquivo "textrendering.cpp".
void TextRendering_Init();
float TextRendering_LineHeight(GLFWwindow* window);
float TextRendering_CharWidth(GLFWwindow* window);
void TextRendering_PrintString(GLFWwindow* window, const std::string &str, float x, float y, float scale = 1.0f);
void TextRendering_PrintMatrix(GLFWwindow* window, glm::mat4 M, float x, float y, float scale = 1.0f);
void TextRendering_PrintVector(GLFWwindow* window, glm::vec4 v, float x, float y, float scale = 1.0f);
void TextRendering_PrintMatrixVectorProduct(GLFWwindow* window, glm::mat4 M, glm::vec4 v, float x, float y, float scale = 1.0f);
void TextRendering_PrintMatrixVectorProductMoreDigits(GLFWwindow* window, glm::mat4 M, glm::vec4 v, float x, float y, float scale = 1.0f);
void TextRendering_PrintMatrixVectorProductDivW(GLFWwindow* window, glm::mat4 M, glm::vec4 v, float x, float y, float scale = 1.0f);
// Funções abaixo renderizam como texto na janela OpenGL algumas matrizes e
// outras informações do programa. Definidas após main().
void TextRendering_ShowModelViewProjection(GLFWwindow* window, glm::mat4 projection, glm::mat4 view, glm::mat4 model, glm::vec4 p_model);
void TextRendering_ShowEulerAngles(GLFWwindow* window);
void TextRendering_ShowProjection(GLFWwindow* window);
void TextRendering_ShowFramesPerSecond(GLFWwindow* window);
void TextRendering_ShowPoints(GLFWwindow* window);
// Funções callback para comunicação com o sistema operacional e interação do
// usuário. Veja mais comentários nas definições das mesmas, abaixo.
void FramebufferSizeCallback(GLFWwindow* window, int width, int height);
void ErrorCallback(int error, const char* description);
void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mode);
void MouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
void CursorPosCallback(GLFWwindow* window, double xpos, double ypos);
void ScrollCallback(GLFWwindow* window, double xoffset, double yoffset);
//função que calcula a posição dada pela curva de bezier
glm::vec4 bezier_position(glm::vec4 p1,glm::vec4 p2,glm::vec4 p3,glm::vec4 p4,float t );
// Definimos uma estrutura que armazenará dados necessários para renderizar
// cada objeto da cena virtual.
//************************************
//ESTA SEÇÃO FOI MOVIDA PARA COLLISIONS.H
/*
struct SceneObject
{
std::string name; // Nome do objeto
size_t first_index; // Índice do primeiro vértice dentro do vetor indices[] definido em BuildTrianglesAndAddToVirtualScene()
size_t num_indices; // Número de índices do objeto dentro do vetor indices[] definido em BuildTrianglesAndAddToVirtualScene()
GLenum rendering_mode; // Modo de rasterização (GL_TRIANGLES, GL_TRIANGLE_STRIP, etc.)
GLuint vertex_array_object_id; // ID do VAO onde estão armazenados os atributos do modelo
glm::vec3 bbox_min; // Axis-Aligned Bounding Box do objeto
glm::vec3 bbox_max;
};
struct Box{
int id; //id da caixa(identificador de posição)
float posx; // posição x no plano
float posy;// posição y no plano
float posz;// posição z no plano
bool is_selected; // bool para verificar se ela foi selecionada
};
//************************************
*/
//vetor que armazena as caixas
std::vector<Box>Boxes;
// Estrutura que contém as informações das recompensas
struct RewardObject{
std::string type; //tipo da recompensa
int id; //id da recompensa(posição)
float posx;// posição x no plano
float posy;// posição y no plano
float posz;// posição z no plano
int points;// pontos que valem a recompensa
bool is_ok; //variavel de controle para não recompensar mais de uma vez
};
//vetor que armazena as recompensas
std::vector<RewardObject>Rewards;
// Estrutura que contém as informações do player
struct Player{
int points; //pontos totais
};
//player
Player player;
// Abaixo definimos variáveis globais utilizadas em várias funções do código.
// A cena virtual é uma lista de objetos nomeados, guardados em um dicionário
// (map). Veja dentro da função BuildTrianglesAndAddToVirtualScene() como que são incluídos
// objetos dentro da variável g_VirtualScene, e veja na função main() como
// estes são acessados.
std::map<std::string, SceneObject> g_VirtualScene;
// Pilha que guardará as matrizes de modelagem.
std::stack<glm::mat4> g_MatrixStack;
// Razão de proporção da janela (largura/altura). Veja função FramebufferSizeCallback().
float g_ScreenRatio = 1.0f;
// Ângulos de Euler que controlam a rotação de um dos cubos da cena virtual
float g_AngleX = 0.0f;
float g_AngleY = 0.0f;
float g_AngleZ = 0.0f;
// "g_LeftMouseButtonPressed = true" se o usuário está com o botão esquerdo do mouse
// pressionado no momento atual. Veja função MouseButtonCallback().
bool g_LeftMouseButtonPressed = false;
bool g_RightMouseButtonPressed = false; // Análogo para botão direito do mouse
bool g_MiddleMouseButtonPressed = false; // Análogo para botão do meio do mouse
// Variáveis que definem a câmera em coordenadas esféricas, controladas pelo
// usuário através do mouse (veja função CursorPosCallback()). A posição
// efetiva da câmera é calculada dentro da função main(), dentro do loop de
// renderização.
float g_CameraTheta = 3.14f; // Ângulo no plano ZX em relação ao eixo Z
float g_CameraPhi = 0.0f; // Ângulo em relação ao eixo Y
float g_CameraDistance = 3.5f; // Distância da câmera para a origem
// Variáveis que controlam rotação do antebraço
float g_ForearmAngleZ = 0.0f;
float g_ForearmAngleX = 0.0f;
// Variáveis que controlam translação do torso
float g_TorsoPositionX = 0.0f;
float g_TorsoPositionY = 0.0f;
// Variável que controla o tipo de projeção utilizada: perspectiva ou ortográfica.
bool g_UsePerspectiveProjection = true;
// Variável que controla se o texto informativo será mostrado na tela.
bool g_ShowInfoText = true;
// Variáveis que definem um programa de GPU (shaders). Veja função LoadShadersFromFiles().
GLuint vertex_shader_id;
GLuint fragment_shader_id;
GLuint program_id = 0;
GLint model_uniform;
GLint view_uniform;
GLint projection_uniform;
GLint object_id_uniform;
GLint bbox_min_uniform;
GLint bbox_max_uniform;
GLboolean spotlight_uniform;
// Número de texturas carregadas pela função LoadTextureImage()
GLuint g_NumLoadedTextures = 0;
//vetor que controla quais recompensas foram selecionadas
std::vector<int>selects;
// booleanos que controlam o movimento wasd do player
bool w_was_press = false;
bool s_was_press = false;
bool d_was_press = false;
bool a_was_press = false;
// floats que controlam a posição inicial da camera
float start_x=0.0f;
float start_y=0.0f;
float start_z=3.0f;
//bool que controla se o jogador já escolheu as 3 caixas possiveis ou não
bool game_is_running=true;
// vetores que controlam as posições inicias das caixa
float pos_x[9]={-2,0.5,2.5,-2,0.5,2.5,-2,0.5,2.5};
float pos_y[9]={0,0,0,-2,-2,-2,-4,-4,-4};
// camera_position da camera livre
glm::vec4 camera_position_c=glm::vec4(start_x,start_y,start_z,1.0f);
// vetor que controla se a caixa está na posição em que foi escolhida ou na original
std::vector<bool> posz_atuals;
// vetor que controla o movimento da caixa
// se oks=true movimenta
// se oks=false para
std::vector<bool> oks;
//valor que controla quando o jogo deve ir para tela de recompensas
int correct_points=0;
// variaveis que controlam o movimento de bezier
float t=0; // variavel "t" no calculo de bezier
bool should_go=true; // se está indo
bool should_return=false; //se esta voltando
std::vector<SceneObject> scenes_objs;
//máximo de caixas possiveis a serem escolhidas
#define MAX 3
int main(int argc, char* argv[])
{
// Inicializamos a biblioteca GLFW, utilizada para criar uma janela do
// sistema operacional, onde poderemos renderizar com OpenGL.
int success = glfwInit();
if (!success)
{
fprintf(stderr, "ERROR: glfwInit() failed.\n");
std::exit(EXIT_FAILURE);
}
// Definimos o callback para impressão de erros da GLFW no terminal
glfwSetErrorCallback(ErrorCallback);
// Pedimos para utilizar OpenGL versão 3.3 (ou superior)
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
// Pedimos para utilizar o perfil "core", isto é, utilizaremos somente as
// funções modernas de OpenGL.
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Criamos uma janela do sistema operacional, com 800 colunas e 600 linhas
// de pixels, e com título "INF01047 ...".
GLFWwindow* window;
window = glfwCreateWindow(800, 600, "CASSINO VIRTUAL", NULL, NULL);
if (!window)
{
glfwTerminate();
fprintf(stderr, "ERROR: glfwCreateWindow() failed.\n");
std::exit(EXIT_FAILURE);
}
// Definimos a função de callback que será chamada sempre que o usuário
// pressionar alguma tecla do teclado ...
glfwSetKeyCallback(window, KeyCallback);
// ... ou clicar os botões do mouse ...
glfwSetMouseButtonCallback(window, MouseButtonCallback);
// ... ou movimentar o cursor do mouse em cima da janela ...
glfwSetCursorPosCallback(window, CursorPosCallback);
// ... ou rolar a "rodinha" do mouse.
glfwSetScrollCallback(window, ScrollCallback);
// Indicamos que as chamadas OpenGL deverão renderizar nesta janela
glfwMakeContextCurrent(window);
// Carregamento de todas funções definidas por OpenGL 3.3, utilizando a
// biblioteca GLAD.
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
// Definimos a função de callback que será chamada sempre que a janela for
// redimensionada, por consequência alterando o tamanho do "framebuffer"
// (região de memória onde são armazenados os pixels da imagem).
glfwSetFramebufferSizeCallback(window, FramebufferSizeCallback);
FramebufferSizeCallback(window, 800, 600); // Forçamos a chamada do callback acima, para definir g_ScreenRatio.
// Imprimimos no terminal informações sobre a GPU do sistema
const GLubyte *vendor = glGetString(GL_VENDOR);
const GLubyte *renderer = glGetString(GL_RENDERER);
const GLubyte *glversion = glGetString(GL_VERSION);
const GLubyte *glslversion = glGetString(GL_SHADING_LANGUAGE_VERSION);
printf("GPU: %s, %s, OpenGL %s, GLSL %s\n", vendor, renderer, glversion, glslversion);
// Carregamos os shaders de vértices e de fragmentos que serão utilizados
// para renderização. Veja slides 176-196 do documento Aula_03_Rendering_Pipeline_Grafico.pdf.
//
LoadShadersFromFiles();
// Carregamos duas imagens para serem utilizadas como textura
LoadTextureImage("../../data/tc-earth_daymap_surface.jpg"); // TextureImage0
LoadTextureImage("../../data/orange_surface.jpg"); // TextureImage1
LoadTextureImage("../../data/banana_surface.jpg"); // TextureImage2
LoadTextureImage("../../data/skull.jpg"); // TextureImage3
// Construímos a representação de objetos geométricos através de malhas de triângulos
ObjModel boxmodel("../../data/wood_box.obj");
ComputeNormals(&boxmodel);
BuildTrianglesAndAddToVirtualScene(&boxmodel);
ObjModel handmodel("../../data/hand.obj");
ComputeNormals(&handmodel);
BuildTrianglesAndAddToVirtualScene(&handmodel);
ObjModel bunnymodel("../../data/bunny.obj");
ComputeNormals(&bunnymodel);
BuildTrianglesAndAddToVirtualScene(&bunnymodel);
ObjModel planemodel("../../data/plane.obj");
ComputeNormals(&planemodel);
BuildTrianglesAndAddToVirtualScene(&planemodel);
ObjModel orangemodel("../../data/Orange.obj");
ComputeNormals(&orangemodel);
BuildTrianglesAndAddToVirtualScene(&orangemodel);
ObjModel bitcoinmodel("../../data/bit.obj");
ComputeNormals(&bitcoinmodel);
BuildTrianglesAndAddToVirtualScene(&bitcoinmodel);
ObjModel skullmodel("../../data/Skull.obj");
ComputeNormals(&skullmodel);
BuildTrianglesAndAddToVirtualScene(&skullmodel);
ObjModel bananamodel("../../data/export_banana.obj");
ComputeNormals(&bananamodel);
BuildTrianglesAndAddToVirtualScene(&bananamodel);
// Cria as caixas com suas informações iniciais
for (int aux=0; aux < 9; aux++){
Boxes.push_back(Box());
Boxes[aux].id=aux;
Boxes[aux].posx=pos_x[aux];
Boxes[aux].posy=pos_y[aux];
Boxes[aux].posz=-2;
Boxes[aux].is_selected=false;
}
//cria as posições atuais como falsa porque nao foram escolhida ainda
for(int aux=0;aux<9;aux++)
{
posz_atuals.push_back(false);
}
// lógica que seta números aleatórios de 0 a 8 para as recompensas (para recompensas não ficarem sempre na mesma posição)
//esta lógica foi usada a partir de uma resposta do stackoverflow FONTE https://stackoverflow.com/questions/36922371/generate-different-random-numbers
std::vector<int> numbers;
for(int i=0; i<9; i++)
numbers.push_back(i);
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::shuffle(numbers.begin(), numbers.end(), std::default_random_engine(seed));
//número auxiliar apenas
int number=0;
// cria as recompensas do tipo laranja com suas devidas informações
for (int aux=0; aux < 3; aux++){
number=numbers[aux];
Rewards.push_back(RewardObject());
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].type="Orange";
Rewards[aux].points=100;
Rewards[aux].is_ok=true;
}
// cria as recompensas do tipo coelho com suas devidas informações
for (int aux=3; aux < 5; aux++){
number=numbers[aux];
Rewards.push_back(RewardObject());
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].type="bunny";
Rewards[aux].points=200;
Rewards[aux].is_ok=true;
}
// cria as recompensas do tipo bitcoin com suas devidas informações
for (int aux=5; aux < 6; aux++){
number=numbers[aux];
Rewards.push_back(RewardObject());
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].type="16783_Zeus_v1_NEW.001";
Rewards[aux].points=500;
Rewards[aux].is_ok=true;
}
// cria as recompensas do tipo caveira com suas devidas informações
for (int aux=6; aux < 7; aux++){
number=numbers[aux];
Rewards.push_back(RewardObject());
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].type="Skull";
Rewards[aux].points=0;
Rewards[aux].is_ok=true;
}
// cria as recompensas do tipo banana com suas devidas informações
for (int aux=7; aux < 9; aux++){
number=numbers[aux];
Rewards.push_back(RewardObject());
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].type="banana_mesh_quad.001";
Rewards[aux].points=150;
Rewards[aux].is_ok=true;
}
//seta os pontos do player para 0 no início
player.points=0;
// seta oks para true porque todos ainda não foram escolhidos
for(int i=0; i<9; i++)
oks.push_back(true);
// variável que serve para calcular o delta_time do jogo
float prev_time=(float)glfwGetTime(); //tempo anterior
if ( argc > 1 )
{
ObjModel model(argv[1]);
BuildTrianglesAndAddToVirtualScene(&model);
}
// Inicializamos o código para renderização de texto.
TextRendering_Init();
// Habilitamos o Z-buffer. Veja slides 104-116 do documento Aula_09_Projecoes.pdf.
glEnable(GL_DEPTH_TEST);
// Habilitamos o Backface Culling. Veja slides 23-34 do documento Aula_13_Clipping_and_Culling.pdf.
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
// Variáveis auxiliares utilizadas para chamada à função
// TextRendering_ShowModelViewProjection(), armazenando matrizes 4x4.
glm::mat4 the_projection;
glm::mat4 the_model;
glm::mat4 the_view;
SceneObject a;
SceneObject b;
glUniform1i(spotlight_uniform,false);
// variaveis auxiliares para controlar colisão plano-caixa
for(int aux=0;aux<scenes_objs.size();aux++){
if(scenes_objs[aux].name=="plane")
a=scenes_objs[aux];
else if(scenes_objs[aux].name=="Crate_Plane.005")
b=scenes_objs[aux];
}
// Ficamos em loop, renderizando, até que o usuário feche a janela
while (!glfwWindowShouldClose(window))
{
glUniform1i(spotlight_uniform,false);
// controla o número de caixas escolhidas
correct_points=std::count(posz_atuals.begin(), posz_atuals.end(), true);
if (correct_points==MAX){
game_is_running=false; //se o número de caixas for igual ao máximo, vai pra tela final
}
else{
game_is_running=true; // se não continua o jogo
}
if(game_is_running){ // se o número de caixas escolhidas for menor que o máximo
// Aqui executamos as operações de renderização
// Definimos a cor do "fundo" do framebuffer como branco. Tal cor é
// definida como coeficientes RGBA: Red, Green, Blue, Alpha; isto é:
// Vermelho, Verde, Azul, Alpha (valor de transparência).
// Conversaremos sobre sistemas de cores nas aulas de Modelos de Iluminação.
//
// R G B A
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
// "Pintamos" todos os pixels do framebuffer com a cor definida acima,
// e também resetamos todos os pixels do Z-buffer (depth buffer).
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Pedimos para a GPU utilizar o programa de GPU criado acima (contendo
// os shaders de vértice e fragmentos).
glUseProgram(program_id);
// Computamos a posição da câmera utilizando coordenadas esféricas. As
// variáveis g_CameraDistance, g_CameraPhi, e g_CameraTheta são
// controladas pelo mouse do usuário. Veja as funções CursorPosCallback()
// e ScrollCallback().
float r = g_CameraDistance;
float y = r*sin(g_CameraPhi);
float z = r*cos(g_CameraPhi)*cos(g_CameraTheta);
float x = r*cos(g_CameraPhi)*sin(g_CameraTheta);
// controlador de tempo clássico, onde usa o temmpo atual e antigo
float cur_time = (float)glfwGetTime();
float delta_time = cur_time - prev_time;
prev_time = cur_time;
/*
// Abaixo definimos as varáveis que efetivamente definem a câmera virtual.
// Veja slides 195-227 e 229-234 do documento Aula_08_Sistemas_de_Coordenadas.pdf.
glm::vec4 camera_position_c = glm::vec4(x,y,z,1.0f); // Ponto "c", centro da câmera
glm::vec4 camera_lookat_l = glm::vec4(0.0f,0.0f,0.0f,1.0f); // Ponto "l", para onde a câmera (look-at) estará sempre olhando
glm::vec4 camera_view_vector = camera_lookat_l - camera_position_c; // Vetor "view", sentido para onde a câmera está virada
glm::vec4 camera_up_vector = glm::vec4(0.0f,1.0f,0.0f,0.0f); // Vetor "up" fixado para apontar para o "céu" (eito Y global)
// Computamos a matriz "View" utilizando os parâmetros da câmera para
// definir o sistema de coordenadas da câmera. Veja slides 2-14, 184-190 e 236-242 do documento Aula_08_Sistemas_de_Coordenadas.pdf.
glm::mat4 view = Matrix_Camera_View(camera_position_c, camera_view_vector, camera_up_vector);
*/
glm::vec4 free_camera_view_vector = glm::vec4(x,y,z,0.0f); // inicia free camera
glm::vec4 camera_up_vector= glm::vec4(0.0f,1.0f,0.0f,0.0f); // Vetor "up" fixado para apontar para o "céu" (eito Y global) //still using that
glm::vec4 w=(-free_camera_view_vector)/norm(free_camera_view_vector);
glm::vec4 u=crossproduct(camera_up_vector,w)/norm(crossproduct(camera_up_vector,w));
//controla o movimento wasd da free camera
if(w_was_press)
camera_position_c += -w * 0.03f;
if(s_was_press)
camera_position_c += w * 0.03f;
if(d_was_press)
camera_position_c +=u * 0.03f;
if(a_was_press)
camera_position_c +=-u * 0.03f;
// Computamos a matriz "View" utilizando os parâmetros da câmera para
// definir o sistema de coordenadas da câmera. Veja slides 2-14, 184-190 e 236-242 do documento Aula_08_Sistemas_de_Coordenadas.pdf.
glm::mat4 view = Matrix_Camera_View(camera_position_c, free_camera_view_vector, camera_up_vector);
// Agora computamos a matriz de Projeção.
glm::mat4 projection;
// Note que, no sistema de coordenadas da câmera, os planos near e far
// estão no sentido negativo! Veja slides 176-204 do documento Aula_09_Projecoes.pdf.
float nearplane = -0.1f; // Posição do "near plane"
float farplane = -20.0f; // Posição do "far plane"
if (g_UsePerspectiveProjection)
{
// Projeção Perspectiva.
// Para definição do field of view (FOV), veja slides 205-215 do documento Aula_09_Projecoes.pdf.
float field_of_view = 3.141592 / 2.0f;
projection = Matrix_Perspective(field_of_view, g_ScreenRatio, nearplane, farplane);
}
else
{
// Projeção Ortográfica.
// Para definição dos valores l, r, b, t ("left", "right", "bottom", "top"),
// PARA PROJEÇÃO ORTOGRÁFICA veja slides 219-224 do documento Aula_09_Projecoes.pdf.
// Para simular um "zoom" ortográfico, computamos o valor de "t"
// utilizando a variável g_CameraDistance.
float t = 1.5f*g_CameraDistance/2.5f;
float b = -t;
float r = t*g_ScreenRatio;
float l = -r;
projection = Matrix_Orthographic(l, r, b, t, nearplane, farplane);
}
glm::mat4 model = Matrix_Identity(); // Transformação identidade de modelagem
// Enviamos as matrizes "view" e "projection" para a placa de vídeo
// (GPU). Veja o arquivo "shader_vertex.glsl", onde estas são
// efetivamente aplicadas em todos os pontos.
glUniformMatrix4fv(view_uniform , 1 , GL_FALSE , glm::value_ptr(view));
glUniformMatrix4fv(projection_uniform , 1 , GL_FALSE , glm::value_ptr(projection));
//defines dos ids dos objetos
#define BOX 0
#define BUNNY 1
#define PLANE 2
#define ORANGE 3
#define BITCOIN 4
#define SKULL 5
#define BANANA 6
#define HAND 7
//tamanho do plano
#define LENGTH 5
// Desenhamos o modelo do plano
model = Matrix_Translate(0.0f,-1.0f,-LENGTH)*Matrix_Rotate_X(3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(0.0f,-6,0.0f)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(LENGTH,-1.0f,0.0f)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Z(3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(-LENGTH,-1.0f,0.0f)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Z(-3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
//desenhamos a mão
model = Matrix_Translate(camera_position_c.x+0.5,camera_position_c.y-0.4,camera_position_c.z-0.4)*Matrix_Rotate_Z(3.14/2)*Matrix_Rotate_X(3.14/2)*Matrix_Scale(0.03,0.03,0.03);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, HAND);
DrawVirtualObject("15797_Pointer_v1");
// desenhamos as caixas
for (int aux=0; aux < 9; aux++){
if(Boxes[aux].is_selected==false) // se a caixa não for selecionada começa na posição inicial
model = Matrix_Translate(Boxes[aux].posx, Boxes[aux].posy,Boxes[aux].posz)*Matrix_Scale(0.2,0.2,0.2);
else{
if(oks[aux]){ // se a caixa foi selecionada começa a animação
model = Matrix_Translate(Boxes[aux].posx, Boxes[aux].posy,Boxes[aux].posz)*Matrix_Scale(0.2,0.2,0.2);
Boxes[aux].posz=Boxes[aux].posz-delta_time;
}
else{ // animação acabou, deixa a caixa na posição final
model = Matrix_Translate(Boxes[aux].posx, Boxes[aux].posy,Boxes[aux].posz)*Matrix_Scale(0.2,0.2,0.2);
}
if(checkPlaneBoxColl(b,a,Boxes[aux])) //se colidiu com plano para de se mover
{
posz_atuals[aux]=true;
oks[aux]=false;
}
}
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BOX);
DrawVirtualObject("Crate_Plane.005");
}
// desenha as laranjas
for (int aux=0; aux < 3; aux++){
model = Matrix_Translate(Rewards[aux].posx, Rewards[aux].posy+0.5, Rewards[aux].posz)*Matrix_Scale(0.2,0.2,0.2);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, ORANGE);
DrawVirtualObject("Orange");
}
// desenha os coelhos
for (int aux=3; aux < 5; aux++){
model = Matrix_Translate(Rewards[aux].posx, Rewards[aux].posy+0.5, Rewards[aux].posz)*Matrix_Scale(0.2,0.2,0.2);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BUNNY);
DrawVirtualObject("bunny");
}
// desenha o bitcoin
for (int aux=5; aux < 6; aux++){
model = Matrix_Translate(Rewards[aux].posx, Rewards[aux].posy+0.5,Rewards[aux].posz)*Matrix_Scale(0.1,0.1,0.1);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BITCOIN);
DrawVirtualObject("16783_Zeus_v1_NEW.001");
}
//desenha a caveira
for (int aux=6; aux < 7; aux++){
model = Matrix_Translate(Rewards[aux].posx, Rewards[aux].posy+0.3,Rewards[aux].posz)*Matrix_Scale(1.8,1.8,1.8);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, SKULL);
DrawVirtualObject("Skull");
}
//desenha a banana
for (int aux=7; aux < 9; aux++){
model = Matrix_Translate(Rewards[aux].posx, Rewards[aux].posy+0.5,Rewards[aux].posz)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Y(3.14/2)*Matrix_Scale(0.35,0.35,0.35);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BANANA);
DrawVirtualObject("banana_mesh_quad.001");
}
// Pegamos um vértice com coordenadas de modelo (0.5, 0.5, 0.5, 1) e o
// passamos por todos os sistemas de coordenadas armazenados nas
// matrizes the_model, the_view, e the_projection; e escrevemos na tela
// as matrizes e pontos resultantes dessas transformações.
//glm::vec4 p_model(0.5f, 0.5f, 0.5f, 1.0f);
//TextRendering_ShowModelViewProjection(window, projection, view, model, p_model);
// Imprimimos na tela os ângulos de Euler que controlam a rotação do
// terceiro cubo.
// TextRendering_ShowEulerAngles(window);
// Imprimimos na informação sobre a matriz de projeção sendo utilizada.
//TextRendering_ShowProjection(window);
// Imprimimos na tela informação sobre o número de quadros renderizados
// por segundo (frames per second).
TextRendering_ShowFramesPerSecond(window);
// Imprime os pontos na tela
TextRendering_ShowPoints(window);
// O framebuffer onde OpenGL executa as operações de renderização não
// é o mesmo que está sendo mostrado para o usuário, caso contrário
// seria possível ver artefatos conhecidos como "screen tearing". A
// chamada abaixo faz a troca dos buffers, mostrando para o usuário
// tudo que foi renderizado pelas funções acima.
// Veja o link: Veja o link: https://en.wikipedia.org/w/index.php?title=Multiple_buffering&oldid=793452829#Double_buffering_in_computer_graphics
glfwSwapBuffers(window);
// Verificamos com o sistema operacional se houve alguma interação do
// usuário (teclado, mouse, ...). Caso positivo, as funções de callback
// definidas anteriormente usando glfwSet*Callback() serão chamadas
// pela biblioteca GLFW.
glfwPollEvents();
}
else{// else referente a tela final( tela onde mostra-se as recompensas apenas)
glUniform1i(spotlight_uniform,true);
// Aqui executamos as operações de renderização
// Definimos a cor do "fundo" do framebuffer como branco. Tal cor é
// definida como coeficientes RGBA: Red, Green, Blue, Alpha; isto é:
// Vermelho, Verde, Azul, Alpha (valor de transparência).
// Conversaremos sobre sistemas de cores nas aulas de Modelos de Iluminação.
//
// R G B A
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
// "Pintamos" todos os pixels do framebuffer com a cor definida acima,
// e também resetamos todos os pixels do Z-buffer (depth buffer).
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Pedimos para a GPU utilizar o programa de GPU criado acima (contendo
// os shaders de vértice e fragmentos).
glUseProgram(program_id);
// Computamos a posição da câmera utilizando coordenadas esféricas. As
// variáveis g_CameraDistance, g_CameraPhi, e g_CameraTheta são
// controladas pelo mouse do usuário. Veja as funções CursorPosCallback()
// e ScrollCallback().
float r = g_CameraDistance;
float y = r*sin(g_CameraPhi);
float z = r*cos(g_CameraPhi)*cos(g_CameraTheta);
float x = r*cos(g_CameraPhi)*sin(g_CameraTheta);
// controlador de tempo clássico, onde usa o temmpo atual e antigo
float cur_time = (float)glfwGetTime();
float delta_time = cur_time - prev_time;
prev_time = cur_time;
// Abaixo definimos as varáveis que efetivamente definem a câmera virtual.
// Veja slides 195-227 e 229-234 do documento Aula_08_Sistemas_de_Coordenadas.pdf.
glm::vec4 camera_position_c = glm::vec4(-x,-y,-z,1.0f); // Ponto "c", centro da câmera
glm::vec4 camera_lookat_l = glm::vec4(0.0f,0.0f,0.0f,1.0f); // Ponto "l", para onde a câmera (look-at) estará sempre olhando
glm::vec4 camera_view_vector = camera_lookat_l - camera_position_c; // Vetor "view", sentido para onde a câmera está virada
glm::vec4 camera_up_vector = glm::vec4(0.0f,1.0f,0.0f,0.0f); // Vetor "up" fixado para apontar para o "céu" (eito Y global)
// Computamos a matriz "View" utilizando os parâmetros da câmera para
// definir o sistema de coordenadas da câmera. Veja slides 2-14, 184-190 e 236-242 do documento Aula_08_Sistemas_de_Coordenadas.pdf.
glm::mat4 view = Matrix_Camera_View(camera_position_c, camera_view_vector, camera_up_vector);
// Agora computamos a matriz de Projeção.
glm::mat4 projection;
// Note que, no sistema de coordenadas da câmera, os planos near e far
// estão no sentido negativo! Veja slides 176-204 do documento Aula_09_Projecoes.pdf.
float nearplane = -0.1f; // Posição do "near plane"
float farplane = -10.0f; // Posição do "far plane"
if (g_UsePerspectiveProjection)
{
// Projeção Perspectiva.
// Para definição do field of view (FOV), veja slides 205-215 do documento Aula_09_Projecoes.pdf.
float field_of_view = 3.141592 / 2.0f;
projection = Matrix_Perspective(field_of_view, g_ScreenRatio, nearplane, farplane);
}
else
{
// Projeção Ortográfica.
// Para definição dos valores l, r, b, t ("left", "right", "bottom", "top"),
// PARA PROJEÇÃO ORTOGRÁFICA veja slides 219-224 do documento Aula_09_Projecoes.pdf.
// Para simular um "zoom" ortográfico, computamos o valor de "t"
// utilizando a variável g_CameraDistance.
float t = 1.5f*g_CameraDistance/2.5f;
float b = -t;
float r = t*g_ScreenRatio;
float l = -r;
projection = Matrix_Orthographic(l, r, b, t, nearplane, farplane);
}
glm::mat4 model = Matrix_Identity(); // Transformação identidade de modelagem
// Enviamos as matrizes "view" e "projection" para a placa de vídeo
// (GPU). Veja o arquivo "shader_vertex.glsl", onde estas são
// efetivamente aplicadas em todos os pontos.
glUniformMatrix4fv(view_uniform , 1 , GL_FALSE , glm::value_ptr(view));
glUniformMatrix4fv(projection_uniform , 1 , GL_FALSE , glm::value_ptr(projection));
// definimos os ids dos objetos
#define BOX 0
#define BUNNY 1
#define PLANE 2
#define ORANGE 3
#define BITCOIN 4
#define SKULL 5
#define BANANA 6
//define tamanho do plano
#define LENGTH 5
// Desenhamos o modelo do plano
model = Matrix_Translate(0.0f,-1.0f,-LENGTH)*Matrix_Rotate_X(3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(0.0f,-6,0.0f)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(LENGTH,-1.0f,0.0f)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Z(3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
// Desenhamos o modelo do plano
model = Matrix_Translate(-LENGTH,-1.0f,0.0f)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Z(-3.14/2)*Matrix_Scale(LENGTH,1.0f,LENGTH);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, PLANE);
DrawVirtualObject("plane");
//lógica de controle para movimentação conforme curva de bezier não ser infinita
if (should_go) // se está indo
{
t+=delta_time*0.2; //aumenta t
}
if(should_return) // se esta voltando
{
t-=delta_time*0.2; //diminui t
}
if(t>=1){ //se t for maior que 1, completou a trajetoria
should_return=true; // então volta
should_go=false;
}
else
if(t<=0){ // se t menor que 0 completou a trajetória também
should_return=false;
should_go=true; // então vai novamente
}
//desenha apenas as recompensas que foram selecionadas e com de uma curva de bezier cúbica
for (int aux=0; aux < 3; aux++){
if(Rewards[selects[aux]].type=="Orange")
{
// posição calcula com a curva de bezier
glm::vec4 p1 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz,1.0f);
glm::vec4 p2 = glm::vec4(Rewards[selects[aux]].posx+1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+0.5,1.0f);
glm::vec4 p3 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+1,1.0f);
glm::vec4 p4 = glm::vec4(Rewards[selects[aux]].posx-1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz-0.5,1.0f);
glm::vec4 bezier_pos=bezier_position(p1,p2,p3,p4,t);
model = Matrix_Translate(bezier_pos.x, bezier_pos.y,bezier_pos.z)*Matrix_Scale(0.8,0.8,0.8);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, ORANGE);
DrawVirtualObject("Orange");
}
else if(Rewards[selects[aux]].type=="banana_mesh_quad.001"){
// posição calcula com a curva de bezier
glm::vec4 p1 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz,1.0f);
glm::vec4 p2 = glm::vec4(Rewards[selects[aux]].posx+1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+0.5,1.0f);
glm::vec4 p3 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+1,1.0f);
glm::vec4 p4 = glm::vec4(Rewards[selects[aux]].posx-1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz-0.5,1.0f);
glm::vec4 bezier_pos=bezier_position(p1,p2,p3,p4,t);
model = Matrix_Translate(bezier_pos.x, bezier_pos.y,bezier_pos.z)*Matrix_Rotate_X(3.14/2)*Matrix_Rotate_Y(3.14/2)*Matrix_Scale(1.1,1.1,1.1);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BANANA);
DrawVirtualObject("banana_mesh_quad.001");
}
else if(Rewards[selects[aux]].type=="Skull"){
// posição calcula com a curva de bezier
glm::vec4 p1 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy,Rewards[selects[aux]].posz,1.0f);
glm::vec4 p2 = glm::vec4(Rewards[selects[aux]].posx+1,Rewards[selects[aux]].posy,Rewards[selects[aux]].posz+0.5,1.0f);
glm::vec4 p3 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy,Rewards[selects[aux]].posz+1,1.0f);
glm::vec4 p4 = glm::vec4(Rewards[selects[aux]].posx-1,Rewards[selects[aux]].posy,Rewards[selects[aux]].posz-0.5,1.0f);
glm::vec4 bezier_pos=bezier_position(p1,p2,p3,p4,t);
model = Matrix_Translate(bezier_pos.x, bezier_pos.y,bezier_pos.z)*Matrix_Scale(6.8,6.8,6.8);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, SKULL);
DrawVirtualObject("Skull");
}
else if(Rewards[selects[aux]].type=="bunny"){
// posição calcula com a curva de bezier
glm::vec4 p1 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz,1.0f);
glm::vec4 p2 = glm::vec4(Rewards[selects[aux]].posx+1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+0.5,1.0f);
glm::vec4 p3 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+1,1.0f);
glm::vec4 p4 = glm::vec4(Rewards[selects[aux]].posx-1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz-0.5,1.0f);
glm::vec4 bezier_pos=bezier_position(p1,p2,p3,p4,t);
model = Matrix_Translate(bezier_pos.x, bezier_pos.y,bezier_pos.z)*Matrix_Scale(0.8,0.8,0.8);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BUNNY);
DrawVirtualObject("bunny");
}
else if(Rewards[selects[aux]].type=="16783_Zeus_v1_NEW.001"){
// posição calcula com a curva de bezier
glm::vec4 p1 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz,1.0f);
glm::vec4 p2 = glm::vec4(Rewards[selects[aux]].posx+1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+0.5,1.0f);
glm::vec4 p3 = glm::vec4(Rewards[selects[aux]].posx,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz+1,1.0f);
glm::vec4 p4 = glm::vec4(Rewards[selects[aux]].posx-1,Rewards[selects[aux]].posy+0.5,Rewards[selects[aux]].posz-0.5,1.0f);
glm::vec4 bezier_pos=bezier_position(p1,p2,p3,p4,t);
model = Matrix_Translate(bezier_pos.x, bezier_pos.y,bezier_pos.z)*Matrix_Scale(0.2,0.2,0.2);
glUniformMatrix4fv(model_uniform, 1 , GL_FALSE , glm::value_ptr(model));
glUniform1i(object_id_uniform, BITCOIN);
DrawVirtualObject("16783_Zeus_v1_NEW.001");
}
}
// Pegamos um vértice com coordenadas de modelo (0.5, 0.5, 0.5, 1) e o
// passamos por todos os sistemas de coordenadas armazenados nas
// matrizes the_model, the_view, e the_projection; e escrevemos na tela
// as matrizes e pontos resultantes dessas transformações.
//glm::vec4 p_model(0.5f, 0.5f, 0.5f, 1.0f);
//TextRendering_ShowModelViewProjection(window, projection, view, model, p_model);
// Imprimimos na tela os ângulos de Euler que controlam a rotação do
// terceiro cubo.
//TextRendering_ShowEulerAngles(window);
// Imprimimos na informação sobre a matriz de projeção sendo utilizada.
//TextRendering_ShowProjection(window);
// Imprimimos na tela informação sobre o número de quadros renderizados
// por segundo (frames per second).
TextRendering_ShowFramesPerSecond(window);
TextRendering_ShowPoints(window);
// O framebuffer onde OpenGL executa as operações de renderização não
// é o mesmo que está sendo mostrado para o usuário, caso contrário
// seria possível ver artefatos conhecidos como "screen tearing". A
// chamada abaixo faz a troca dos buffers, mostrando para o usuário
// tudo que foi renderizado pelas funções acima.
// Veja o link: Veja o link: https://en.wikipedia.org/w/index.php?title=Multiple_buffering&oldid=793452829#Double_buffering_in_computer_graphics
glfwSwapBuffers(window);
// Verificamos com o sistema operacional se houve alguma interação do
// usuário (teclado, mouse, ...). Caso positivo, as funções de callback
// definidas anteriormente usando glfwSet*Callback() serão chamadas
// pela biblioteca GLFW.
glfwPollEvents();
}
}
// Finalizamos o uso dos recursos do sistema operacional
glfwTerminate();
// Fim do programa
return 0;
}
// Função que carrega uma imagem para ser utilizada como textura
void LoadTextureImage(const char* filename)
{
printf("Carregando imagem \"%s\"... ", filename);
// Primeiro fazemos a leitura da imagem do disco
stbi_set_flip_vertically_on_load(true);
int width;
int height;
int channels;
unsigned char *data = stbi_load(filename, &width, &height, &channels, 3);
if ( data == NULL )
{
fprintf(stderr, "ERROR: Cannot open image file \"%s\".\n", filename);
std::exit(EXIT_FAILURE);
}
printf("OK (%dx%d).\n", width, height);
// Agora criamos objetos na GPU com OpenGL para armazenar a textura
GLuint texture_id;
GLuint sampler_id;
glGenTextures(1, &texture_id);
glGenSamplers(1, &sampler_id);
// Veja slides 95-96 do documento Aula_20_Mapeamento_de_Texturas.pdf
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(sampler_id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
// Parâmetros de amostragem da textura.
glSamplerParameteri(sampler_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glSamplerParameteri(sampler_id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// Agora enviamos a imagem lida do disco para a GPU
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
GLuint textureunit = g_NumLoadedTextures;
glActiveTexture(GL_TEXTURE0 + textureunit);
glBindTexture(GL_TEXTURE_2D, texture_id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glBindSampler(textureunit, sampler_id);
stbi_image_free(data);
g_NumLoadedTextures += 1;
}
// Função que desenha um objeto armazenado em g_VirtualScene. Veja definição
// dos objetos na função BuildTrianglesAndAddToVirtualScene().
void DrawVirtualObject(const char* object_name)
{
// "Ligamos" o VAO. Informamos que queremos utilizar os atributos de
// vértices apontados pelo VAO criado pela função BuildTrianglesAndAddToVirtualScene(). Veja
// comentários detalhados dentro da definição de BuildTrianglesAndAddToVirtualScene().
glBindVertexArray(g_VirtualScene[object_name].vertex_array_object_id);
// Setamos as variáveis "bbox_min" e "bbox_max" do fragment shader
// com os parâmetros da axis-aligned bounding box (AABB) do modelo.
glm::vec3 bbox_min = g_VirtualScene[object_name].bbox_min;
glm::vec3 bbox_max = g_VirtualScene[object_name].bbox_max;
glUniform4f(bbox_min_uniform, bbox_min.x, bbox_min.y, bbox_min.z, 1.0f);
glUniform4f(bbox_max_uniform, bbox_max.x, bbox_max.y, bbox_max.z, 1.0f);
// Pedimos para a GPU rasterizar os vértices dos eixos XYZ
// apontados pelo VAO como linhas. Veja a definição de
// g_VirtualScene[""] dentro da função BuildTrianglesAndAddToVirtualScene(), e veja
// a documentação da função glDrawElements() em
// http://docs.gl/gl3/glDrawElements.
glDrawElements(
g_VirtualScene[object_name].rendering_mode,
g_VirtualScene[object_name].num_indices,
GL_UNSIGNED_INT,
(void*)(g_VirtualScene[object_name].first_index * sizeof(GLuint))
);
// "Desligamos" o VAO, evitando assim que operações posteriores venham a
// alterar o mesmo. Isso evita bugs.
glBindVertexArray(0);
}
// Função que carrega os shaders de vértices e de fragmentos que serão
// utilizados para renderização. Veja slides 176-196 do documento Aula_03_Rendering_Pipeline_Grafico.pdf.
//
void LoadShadersFromFiles()
{
// Note que o caminho para os arquivos "shader_vertex.glsl" e
// "shader_fragment.glsl" estão fixados, sendo que assumimos a existência
// da seguinte estrutura no sistema de arquivos:
//
// + FCG_Lab_01/
// |
// +--+ bin/
// | |
// | +--+ Release/ (ou Debug/ ou Linux/)
// | |
// | o-- main.exe
// |
// +--+ src/
// |
// o-- shader_vertex.glsl
// |
// o-- shader_fragment.glsl
//
vertex_shader_id = LoadShader_Vertex("../../src/shader_vertex.glsl");
fragment_shader_id = LoadShader_Fragment("../../src/shader_fragment.glsl");
// Deletamos o programa de GPU anterior, caso ele exista.
if ( program_id != 0 )
glDeleteProgram(program_id);
// Criamos um programa de GPU utilizando os shaders carregados acima.
program_id = CreateGpuProgram(vertex_shader_id, fragment_shader_id);
// Buscamos o endereço das variáveis definidas dentro do Vertex Shader.
// Utilizaremos estas variáveis para enviar dados para a placa de vídeo
// (GPU)! Veja arquivo "shader_vertex.glsl" e "shader_fragment.glsl".
model_uniform = glGetUniformLocation(program_id, "model"); // Variável da matriz "model"
view_uniform = glGetUniformLocation(program_id, "view"); // Variável da matriz "view" em shader_vertex.glsl
projection_uniform = glGetUniformLocation(program_id, "projection"); // Variável da matriz "projection" em shader_vertex.glsl
object_id_uniform = glGetUniformLocation(program_id, "object_id"); // Variável "object_id" em shader_fragment.glsl
bbox_min_uniform = glGetUniformLocation(program_id, "bbox_min");
bbox_max_uniform = glGetUniformLocation(program_id, "bbox_max");
spotlight_uniform = glGetUniformLocation(program_id, "spotlight");
// Variáveis em "shader_fragment.glsl" para acesso das imagens de textura
glUseProgram(program_id);
glUniform1i(glGetUniformLocation(program_id, "TextureImage0"), 0);
glUniform1i(glGetUniformLocation(program_id, "TextureImage1"), 1);
glUniform1i(glGetUniformLocation(program_id, "TextureImage2"), 2);
glUniform1i(glGetUniformLocation(program_id, "TextureImage3"), 3);
glUseProgram(0);
}
// Função que pega a matriz M e guarda a mesma no topo da pilha
void PushMatrix(glm::mat4 M)
{
g_MatrixStack.push(M);
}
// Função que remove a matriz atualmente no topo da pilha e armazena a mesma na variável M
void PopMatrix(glm::mat4& M)
{
if ( g_MatrixStack.empty() )
{
M = Matrix_Identity();
}
else
{
M = g_MatrixStack.top();
g_MatrixStack.pop();
}
}
// Função que computa as normais de um ObjModel, caso elas não tenham sido
// especificadas dentro do arquivo ".obj"
void ComputeNormals(ObjModel* model)
{
if ( !model->attrib.normals.empty() )
return;
// Primeiro computamos as normais para todos os TRIÂNGULOS.
// Segundo, computamos as normais dos VÉRTICES através do método proposto
// por Gouraud, onde a normal de cada vértice vai ser a média das normais de
// todas as faces que compartilham este vértice.
size_t num_vertices = model->attrib.vertices.size() / 3;
std::vector<int> num_triangles_per_vertex(num_vertices, 0);
std::vector<glm::vec4> vertex_normals(num_vertices, glm::vec4(0.0f,0.0f,0.0f,0.0f));
for (size_t shape = 0; shape < model->shapes.size(); ++shape)
{
size_t num_triangles = model->shapes[shape].mesh.num_face_vertices.size();
for (size_t triangle = 0; triangle < num_triangles; ++triangle)
{
assert(model->shapes[shape].mesh.num_face_vertices[triangle] == 3);
glm::vec4 vertices[3];
for (size_t vertex = 0; vertex < 3; ++vertex)
{
tinyobj::index_t idx = model->shapes[shape].mesh.indices[3*triangle + vertex];
const float vx = model->attrib.vertices[3*idx.vertex_index + 0];
const float vy = model->attrib.vertices[3*idx.vertex_index + 1];
const float vz = model->attrib.vertices[3*idx.vertex_index + 2];
vertices[vertex] = glm::vec4(vx,vy,vz,1.0);
}
const glm::vec4 a = vertices[0];
const glm::vec4 b = vertices[1];
const glm::vec4 c = vertices[2];
const glm::vec4 n = crossproduct(b-a,c-a);
for (size_t vertex = 0; vertex < 3; ++vertex)
{
tinyobj::index_t idx = model->shapes[shape].mesh.indices[3*triangle + vertex];
num_triangles_per_vertex[idx.vertex_index] += 1;
vertex_normals[idx.vertex_index] += n;
model->shapes[shape].mesh.indices[3*triangle + vertex].normal_index = idx.vertex_index;
}
}
}
model->attrib.normals.resize( 3*num_vertices );
for (size_t i = 0; i < vertex_normals.size(); ++i)
{
glm::vec4 n = vertex_normals[i] / (float)num_triangles_per_vertex[i];
n /= norm(n);
model->attrib.normals[3*i + 0] = n.x;
model->attrib.normals[3*i + 1] = n.y;
model->attrib.normals[3*i + 2] = n.z;
}
}
// Constrói triângulos para futura renderização a partir de um ObjModel.
void BuildTrianglesAndAddToVirtualScene(ObjModel* model)
{
GLuint vertex_array_object_id;
glGenVertexArrays(1, &vertex_array_object_id);
glBindVertexArray(vertex_array_object_id);
std::vector<GLuint> indices;
std::vector<float> model_coefficients;
std::vector<float> normal_coefficients;
std::vector<float> texture_coefficients;
for (size_t shape = 0; shape < model->shapes.size(); ++shape)
{
size_t first_index = indices.size();
size_t num_triangles = model->shapes[shape].mesh.num_face_vertices.size();
const float minval = std::numeric_limits<float>::min();
const float maxval = std::numeric_limits<float>::max();
glm::vec3 bbox_min = glm::vec3(maxval,maxval,maxval);
glm::vec3 bbox_max = glm::vec3(minval,minval,minval);
for (size_t triangle = 0; triangle < num_triangles; ++triangle)
{
assert(model->shapes[shape].mesh.num_face_vertices[triangle] == 3);
for (size_t vertex = 0; vertex < 3; ++vertex)
{
tinyobj::index_t idx = model->shapes[shape].mesh.indices[3*triangle + vertex];
indices.push_back(first_index + 3*triangle + vertex);
const float vx = model->attrib.vertices[3*idx.vertex_index + 0];
const float vy = model->attrib.vertices[3*idx.vertex_index + 1];
const float vz = model->attrib.vertices[3*idx.vertex_index + 2];
//printf("tri %d vert %d = (%.2f, %.2f, %.2f)\n", (int)triangle, (int)vertex, vx, vy, vz);
model_coefficients.push_back( vx ); // X
model_coefficients.push_back( vy ); // Y
model_coefficients.push_back( vz ); // Z
model_coefficients.push_back( 1.0f ); // W
bbox_min.x = std::min(bbox_min.x, vx);
bbox_min.y = std::min(bbox_min.y, vy);
bbox_min.z = std::min(bbox_min.z, vz);
bbox_max.x = std::max(bbox_max.x, vx);
bbox_max.y = std::max(bbox_max.y, vy);
bbox_max.z = std::max(bbox_max.z, vz);
// Inspecionando o código da tinyobjloader, o aluno Bernardo
// Sulzbach (2017/1) apontou que a maneira correta de testar se
// existem normais e coordenadas de textura no ObjModel é
// comparando se o índice retornado é -1. Fazemos isso abaixo.
if ( idx.normal_index != -1 )
{
const float nx = model->attrib.normals[3*idx.normal_index + 0];
const float ny = model->attrib.normals[3*idx.normal_index + 1];
const float nz = model->attrib.normals[3*idx.normal_index + 2];
normal_coefficients.push_back( nx ); // X
normal_coefficients.push_back( ny ); // Y
normal_coefficients.push_back( nz ); // Z
normal_coefficients.push_back( 0.0f ); // W
}
if ( idx.texcoord_index != -1 )
{
const float u = model->attrib.texcoords[2*idx.texcoord_index + 0];
const float v = model->attrib.texcoords[2*idx.texcoord_index + 1];
texture_coefficients.push_back( u );
texture_coefficients.push_back( v );
}
}
}
size_t last_index = indices.size() - 1;
SceneObject theobject;
theobject.name = model->shapes[shape].name;
theobject.first_index = first_index; // Primeiro índice
theobject.num_indices = last_index - first_index + 1; // Número de indices
theobject.rendering_mode = GL_TRIANGLES; // Índices correspondem ao tipo de rasterização GL_TRIANGLES.
theobject.vertex_array_object_id = vertex_array_object_id;
theobject.bbox_min = bbox_min;
theobject.bbox_max = bbox_max;
scenes_objs.push_back(theobject);// adiciona o objeto para testar colisão
g_VirtualScene[model->shapes[shape].name] = theobject;
}
GLuint VBO_model_coefficients_id;
glGenBuffers(1, &VBO_model_coefficients_id);
glBindBuffer(GL_ARRAY_BUFFER, VBO_model_coefficients_id);
glBufferData(GL_ARRAY_BUFFER, model_coefficients.size() * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, model_coefficients.size() * sizeof(float), model_coefficients.data());
GLuint location = 0; // "(location = 0)" em "shader_vertex.glsl"
GLint number_of_dimensions = 4; // vec4 em "shader_vertex.glsl"
glVertexAttribPointer(location, number_of_dimensions, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(location);
glBindBuffer(GL_ARRAY_BUFFER, 0);
if ( !normal_coefficients.empty() )
{
GLuint VBO_normal_coefficients_id;
glGenBuffers(1, &VBO_normal_coefficients_id);
glBindBuffer(GL_ARRAY_BUFFER, VBO_normal_coefficients_id);
glBufferData(GL_ARRAY_BUFFER, normal_coefficients.size() * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, normal_coefficients.size() * sizeof(float), normal_coefficients.data());
location = 1; // "(location = 1)" em "shader_vertex.glsl"
number_of_dimensions = 4; // vec4 em "shader_vertex.glsl"
glVertexAttribPointer(location, number_of_dimensions, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(location);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
if ( !texture_coefficients.empty() )
{
GLuint VBO_texture_coefficients_id;
glGenBuffers(1, &VBO_texture_coefficients_id);
glBindBuffer(GL_ARRAY_BUFFER, VBO_texture_coefficients_id);
glBufferData(GL_ARRAY_BUFFER, texture_coefficients.size() * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, texture_coefficients.size() * sizeof(float), texture_coefficients.data());
location = 2; // "(location = 1)" em "shader_vertex.glsl"
number_of_dimensions = 2; // vec2 em "shader_vertex.glsl"
glVertexAttribPointer(location, number_of_dimensions, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(location);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
GLuint indices_id;
glGenBuffers(1, &indices_id);
// "Ligamos" o buffer. Note que o tipo agora é GL_ELEMENT_ARRAY_BUFFER.
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_id);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLuint), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, indices.size() * sizeof(GLuint), indices.data());
// glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // XXX Errado!
//
// "Desligamos" o VAO, evitando assim que operações posteriores venham a
// alterar o mesmo. Isso evita bugs.
glBindVertexArray(0);
}
// Carrega um Vertex Shader de um arquivo GLSL. Veja definição de LoadShader() abaixo.
GLuint LoadShader_Vertex(const char* filename)
{
// Criamos um identificador (ID) para este shader, informando que o mesmo
// será aplicado nos vértices.
GLuint vertex_shader_id = glCreateShader(GL_VERTEX_SHADER);
// Carregamos e compilamos o shader
LoadShader(filename, vertex_shader_id);
// Retorna o ID gerado acima
return vertex_shader_id;
}
// Carrega um Fragment Shader de um arquivo GLSL . Veja definição de LoadShader() abaixo.
GLuint LoadShader_Fragment(const char* filename)
{
// Criamos um identificador (ID) para este shader, informando que o mesmo
// será aplicado nos fragmentos.
GLuint fragment_shader_id = glCreateShader(GL_FRAGMENT_SHADER);
// Carregamos e compilamos o shader
LoadShader(filename, fragment_shader_id);
// Retorna o ID gerado acima
return fragment_shader_id;
}
// Função auxilar, utilizada pelas duas funções acima. Carrega código de GPU de
// um arquivo GLSL e faz sua compilação.
void LoadShader(const char* filename, GLuint shader_id)
{
// Lemos o arquivo de texto indicado pela variável "filename"
// e colocamos seu conteúdo em memória, apontado pela variável
// "shader_string".
std::ifstream file;
try {
file.exceptions(std::ifstream::failbit);
file.open(filename);
} catch ( std::exception& e ) {
fprintf(stderr, "ERROR: Cannot open file \"%s\".\n", filename);
std::exit(EXIT_FAILURE);
}
std::stringstream shader;
shader << file.rdbuf();
std::string str = shader.str();
const GLchar* shader_string = str.c_str();
const GLint shader_string_length = static_cast<GLint>( str.length() );
// Define o código do shader GLSL, contido na string "shader_string"
glShaderSource(shader_id, 1, &shader_string, &shader_string_length);
// Compila o código do shader GLSL (em tempo de execução)
glCompileShader(shader_id);
// Verificamos se ocorreu algum erro ou "warning" durante a compilação
GLint compiled_ok;
glGetShaderiv(shader_id, GL_COMPILE_STATUS, &compiled_ok);
GLint log_length = 0;
glGetShaderiv(shader_id, GL_INFO_LOG_LENGTH, &log_length);
// Alocamos memória para guardar o log de compilação.
// A chamada "new" em C++ é equivalente ao "malloc()" do C.
GLchar* log = new GLchar[log_length];
glGetShaderInfoLog(shader_id, log_length, &log_length, log);
// Imprime no terminal qualquer erro ou "warning" de compilação
if ( log_length != 0 )
{
std::string output;
if ( !compiled_ok )
{
output += "ERROR: OpenGL compilation of \"";
output += filename;
output += "\" failed.\n";
output += "== Start of compilation log\n";
output += log;
output += "== End of compilation log\n";
}
else
{
output += "WARNING: OpenGL compilation of \"";
output += filename;
output += "\".\n";
output += "== Start of compilation log\n";
output += log;
output += "== End of compilation log\n";
}
fprintf(stderr, "%s", output.c_str());
}
// A chamada "delete" em C++ é equivalente ao "free()" do C
delete [] log;
}
// Esta função cria um programa de GPU, o qual contém obrigatoriamente um
// Vertex Shader e um Fragment Shader.
GLuint CreateGpuProgram(GLuint vertex_shader_id, GLuint fragment_shader_id)
{
// Criamos um identificador (ID) para este programa de GPU
GLuint program_id = glCreateProgram();
// Definição dos dois shaders GLSL que devem ser executados pelo programa
glAttachShader(program_id, vertex_shader_id);
glAttachShader(program_id, fragment_shader_id);
// Linkagem dos shaders acima ao programa
glLinkProgram(program_id);
// Verificamos se ocorreu algum erro durante a linkagem
GLint linked_ok = GL_FALSE;
glGetProgramiv(program_id, GL_LINK_STATUS, &linked_ok);
// Imprime no terminal qualquer erro de linkagem
if ( linked_ok == GL_FALSE )
{
GLint log_length = 0;
glGetProgramiv(program_id, GL_INFO_LOG_LENGTH, &log_length);
// Alocamos memória para guardar o log de compilação.
// A chamada "new" em C++ é equivalente ao "malloc()" do C.
GLchar* log = new GLchar[log_length];
glGetProgramInfoLog(program_id, log_length, &log_length, log);
std::string output;
output += "ERROR: OpenGL linking of program failed.\n";
output += "== Start of link log\n";
output += log;
output += "\n== End of link log\n";
// A chamada "delete" em C++ é equivalente ao "free()" do C
delete [] log;
fprintf(stderr, "%s", output.c_str());
}
// Os "Shader Objects" podem ser marcados para deleção após serem linkados
glDeleteShader(vertex_shader_id);
glDeleteShader(fragment_shader_id);
// Retornamos o ID gerado acima
return program_id;
}
// Função que calcula a curva de bezier
//baseado na aula 16 slide 82
glm::vec4 bezier_position(glm::vec4 p1,glm::vec4 p2,glm::vec4 p3,glm::vec4 p4,float t )
{
float b03= (1 - t) * (1 - t) * (1 - t);
float b13= 3 * t * (1 - t) * (1 - t);
float b23= 3* t * t * (1-t);
float b33 = t * t * t;
return b03 * p1 + b13 * p2 + b23 * p3 + b33 * p4;
}
// Definição da função que será chamada sempre que a janela do sistema
// operacional for redimensionada, por consequência alterando o tamanho do
// "framebuffer" (região de memória onde são armazenados os pixels da imagem).
void FramebufferSizeCallback(GLFWwindow* window, int width, int height)
{
// Indicamos que queremos renderizar em toda região do framebuffer. A
// função "glViewport" define o mapeamento das "normalized device
// coordinates" (NDC) para "pixel coordinates". Essa é a operação de
// "Screen Mapping" ou "Viewport Mapping" vista em aula ({+ViewportMapping2+}).
glViewport(0, 0, width, height);
// Atualizamos também a razão que define a proporção da janela (largura /
// altura), a qual será utilizada na definição das matrizes de projeção,
// tal que não ocorra distorções durante o processo de "Screen Mapping"
// acima, quando NDC é mapeado para coordenadas de pixels. Veja slides 205-215 do documento Aula_09_Projecoes.pdf.
//
// O cast para float é necessário pois números inteiros são arredondados ao
// serem divididos!
g_ScreenRatio = (float)width / height;
}
// Variáveis globais que armazenam a última posição do cursor do mouse, para
// que possamos calcular quanto que o mouse se movimentou entre dois instantes
// de tempo. Utilizadas no callback CursorPosCallback() abaixo.
double g_LastCursorPosX, g_LastCursorPosY;
// Função callback chamada sempre que o usuário aperta algum dos botões do mouse
void MouseButtonCallback(GLFWwindow* window, int button, int action, int mods)
{
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
{
// Se o usuário pressionou o botão esquerdo do mouse, guardamos a
// posição atual do cursor nas variáveis g_LastCursorPosX e
// g_LastCursorPosY. Também, setamos a variável
// g_LeftMouseButtonPressed como true, para saber que o usuário está
// com o botão esquerdo pressionado.
glfwGetCursorPos(window, &g_LastCursorPosX, &g_LastCursorPosY);
g_LeftMouseButtonPressed = true;
}
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_RELEASE)
{
// Quando o usuário soltar o botão esquerdo do mouse, atualizamos a
// variável abaixo para false.
g_LeftMouseButtonPressed = false;
}
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_PRESS)
{
// Se o usuário pressionou o botão esquerdo do mouse, guardamos a
// posição atual do cursor nas variáveis g_LastCursorPosX e
// g_LastCursorPosY. Também, setamos a variável
// g_RightMouseButtonPressed como true, para saber que o usuário está
// com o botão esquerdo pressionado.
glfwGetCursorPos(window, &g_LastCursorPosX, &g_LastCursorPosY);
g_RightMouseButtonPressed = true;
}
if (button == GLFW_MOUSE_BUTTON_RIGHT && action == GLFW_RELEASE)
{
// Quando o usuário soltar o botão esquerdo do mouse, atualizamos a
// variável abaixo para false.
g_RightMouseButtonPressed = false;
}
if (button == GLFW_MOUSE_BUTTON_MIDDLE && action == GLFW_PRESS)
{
// Se o usuário pressionou o botão esquerdo do mouse, guardamos a
// posição atual do cursor nas variáveis g_LastCursorPosX e
// g_LastCursorPosY. Também, setamos a variável
// g_MiddleMouseButtonPressed como true, para saber que o usuário está
// com o botão esquerdo pressionado.
glfwGetCursorPos(window, &g_LastCursorPosX, &g_LastCursorPosY);
g_MiddleMouseButtonPressed = true;
}
if (button == GLFW_MOUSE_BUTTON_MIDDLE && action == GLFW_RELEASE)
{
// Quando o usuário soltar o botão esquerdo do mouse, atualizamos a
// variável abaixo para false.
g_MiddleMouseButtonPressed = false;
}
}
// Função callback chamada sempre que o usuário movimentar o cursor do mouse em
// cima da janela OpenGL.
void CursorPosCallback(GLFWwindow* window, double xpos, double ypos)
{
// Abaixo executamos o seguinte: caso o botão esquerdo do mouse esteja
// pressionado, computamos quanto que o mouse se movimento desde o último
// instante de tempo, e usamos esta movimentação para atualizar os
// parâmetros que definem a posição da câmera dentro da cena virtual.
// Assim, temos que o usuário consegue controlar a câmera.
if (g_LeftMouseButtonPressed)
{
// Deslocamento do cursor do mouse em x e y de coordenadas de tela!
float dx = xpos - g_LastCursorPosX;
float dy = ypos - g_LastCursorPosY;
// Atualizamos parâmetros da câmera com os deslocamentos
g_CameraTheta -= 0.01f*dx;
g_CameraPhi += 0.01f*dy;
// Em coordenadas esféricas, o ângulo phi deve ficar entre -pi/2 e +pi/2.
float phimax = 3.141592f/2;
float phimin = -phimax;
if (g_CameraPhi > phimax)
g_CameraPhi = phimax;
if (g_CameraPhi < phimin)
g_CameraPhi = phimin;
// Atualizamos as variáveis globais para armazenar a posição atual do
// cursor como sendo a última posição conhecida do cursor.
g_LastCursorPosX = xpos;
g_LastCursorPosY = ypos;
}
if (g_RightMouseButtonPressed)
{
// Deslocamento do cursor do mouse em x e y de coordenadas de tela!
float dx = xpos - g_LastCursorPosX;
float dy = ypos - g_LastCursorPosY;
// Atualizamos parâmetros da antebraço com os deslocamentos
g_ForearmAngleZ -= 0.01f*dx;
g_ForearmAngleX += 0.01f*dy;
// Atualizamos as variáveis globais para armazenar a posição atual do
// cursor como sendo a última posição conhecida do cursor.
g_LastCursorPosX = xpos;
g_LastCursorPosY = ypos;
}
if (g_MiddleMouseButtonPressed)
{
// Deslocamento do cursor do mouse em x e y de coordenadas de tela!
float dx = xpos - g_LastCursorPosX;
float dy = ypos - g_LastCursorPosY;
// Atualizamos parâmetros da antebraço com os deslocamentos
g_TorsoPositionX += 0.01f*dx;
g_TorsoPositionY -= 0.01f*dy;
// Atualizamos as variáveis globais para armazenar a posição atual do
// cursor como sendo a última posição conhecida do cursor.
g_LastCursorPosX = xpos;
g_LastCursorPosY = ypos;
}
}
// Função callback chamada sempre que o usuário movimenta a "rodinha" do mouse.
void ScrollCallback(GLFWwindow* window, double xoffset, double yoffset)
{
// Atualizamos a distância da câmera para a origem utilizando a
// movimentação da "rodinha", simulando um ZOOM.
g_CameraDistance -= 0.1f*yoffset;
// Uma câmera look-at nunca pode estar exatamente "em cima" do ponto para
// onde ela está olhando, pois isto gera problemas de divisão por zero na
// definição do sistema de coordenadas da câmera. Isto é, a variável abaixo
// nunca pode ser zero. Versões anteriores deste código possuíam este bug,
// o qual foi detectado pelo aluno Vinicius Fraga (2017/2).
const float verysmallnumber = std::numeric_limits<float>::epsilon();
if (g_CameraDistance < verysmallnumber)
g_CameraDistance = verysmallnumber;
}
// Definição da função que será chamada sempre que o usuário pressionar alguma
// tecla do teclado. Veja http://www.glfw.org/docs/latest/input_guide.html#input_key
void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mod)
{
// ===============
// Não modifique este loop! Ele é utilizando para correção automatizada dos
// laboratórios. Deve ser sempre o primeiro comando desta função KeyCallback().
for (int i = 0; i < 10; ++i)
if (key == GLFW_KEY_0 + i && action == GLFW_PRESS && mod == GLFW_MOD_SHIFT)
std::exit(100 + i);
// ===============
// Se o usuário pressionar a tecla ESC, fechamos a janela.
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
// O código abaixo implementa a seguinte lógica:
// Se apertar tecla X então g_AngleX += delta;
// Se apertar tecla shift+X então g_AngleX -= delta;
// Se apertar tecla Y então g_AngleY += delta;
// Se apertar tecla shift+Y então g_AngleY -= delta;
// Se apertar tecla Z então g_AngleZ += delta;
// Se apertar tecla shift+Z então g_AngleZ -= delta;
float delta = 3.141592 / 16; // 22.5 graus, em radianos.
if (key == GLFW_KEY_X && action == GLFW_PRESS)
{
LoadShadersFromFiles();
fprintf(stdout,"Shaders recarregados!\n");
fflush(stdout);
}
/*
// Se o usuário apertar a tecla P, utilizamos projeção perspectiva.
if (key == GLFW_KEY_P && action == GLFW_PRESS)
{
g_UsePerspectiveProjection = true;
}
// Se o usuário apertar a tecla O, utilizamos projeção ortográfica.
if (key == GLFW_KEY_O && action == GLFW_PRESS)
{
g_UsePerspectiveProjection = false;
}
*/
// Se o usuário apertar a tecla H, fazemos um "toggle" do texto informativo mostrado na tela.
if (key == GLFW_KEY_H && action == GLFW_PRESS)
{
g_ShowInfoText = !g_ShowInfoText;
}
// Se o usuário apertar a tecla R, o jogo recomeça, podendo escolher mais 3 caixas .
if (key == GLFW_KEY_R && action == GLFW_PRESS)
{
// lógica que seta as recompensas em caixas aleatórias novamente
//esta lógica foi usada a partir de uma resposta do stackoverflow FONTE https://stackoverflow.com/questions/36922371/generate-different-random-numbers
std::vector<int> numbers;
for(int i=0; i<9; i++)
numbers.push_back(i);
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::shuffle(numbers.begin(), numbers.end(), std::default_random_engine(seed));
int number;
// reseta todas variaveis que determinam o funcionamento do jogo
if(correct_points==MAX)
{
for (int aux=0; aux < 9; aux++){
number=numbers[aux];
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Boxes[number].posz=-2;
Boxes[number].is_selected=false;
Rewards[aux].posz=Boxes[number].posz;
Rewards[aux].is_ok=true;
posz_atuals[aux]=false;
oks[aux]=true;
selects.clear();
}
correct_points=0;// reseta o número de caixas na posição certa
//std::cout<<correct_points<<std::endl;
//player é subtraido 400 pontos (nova aposta)
player.points-=400;
}
}
// Se o usuário apertar a tecla E, as recompensas são aleatóriamente embaralhadas nas caixas .
if (key == GLFW_KEY_E&& action == GLFW_PRESS)
{
//vetor que controla se as caixas foram selecionadas
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
// variavel que controla quantas caixas foram selecionadas
int count_s=std::count(selections.begin(), selections.end(), true);
// se nenhuma caixa foi selecionada ainda embaralha as recompensas
if(count_s==0){
//esta lógica foi usada a partir de uma resposta do stackoverflow FONTE https://stackoverflow.com/questions/36922371/generate-different-random-numbers
std::vector<int> numbers;
for(int i=0; i<9; i++)
numbers.push_back(i);
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::shuffle(numbers.begin(), numbers.end(), std::default_random_engine(seed));
int number;
for(int i=0; i<9; i++)
std::cout << numbers[i] << std::endl;
for (int aux=0; aux < 9; aux++){
number=numbers[aux];
Rewards[aux].id=number;
Rewards[aux].posx=Boxes[number].posx;
Rewards[aux].posy=Boxes[number].posy;
Rewards[aux].posz=Boxes[number].posz;
}
}
}
//************************************************************************
// seção utilizada para teclas que o usuário aperta para escolher as caixas
// se o usuário apertar a tecla 1, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_1 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[0].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==0)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 2, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_2 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[1].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==1)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 3, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_3 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[2].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==2)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 4, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_4 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[3].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==3)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 5, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_5 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[4].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==4)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 6, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_6 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[5].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==5)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 7, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_7 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[6].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==6)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 8, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_8 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[7].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==7)
{
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
// se o usuário apertar a tecla 9, seleciona a tecla 1 e conta os pontos da recompensa que está na caixa
if (key == GLFW_KEY_9 && action == GLFW_PRESS)
{
std::vector<bool> selections;
for(int aux=0;aux<9;aux++)
{
selections.push_back(Boxes[aux].is_selected);
}
int selected;
int count_s=std::count(selections.begin(), selections.end(), true);
if(count_s<MAX){
Boxes[8].is_selected=true;
for(int aux=0;aux<9;aux++)
{
if(Rewards[aux].id==8){
selected=aux;
selects.push_back(selected);
}
}
if(Rewards[selected].is_ok==true){
player.points+=Rewards[selected].points;
Rewards[selected].is_ok=false;
}
}
}
//fim da seção
//************************************************************************
// Parte que controla o movimento wasd pelo usuário
// se apertar w seta w_was_press pra true e movimenta pra frente
if (key == GLFW_KEY_W && action == GLFW_PRESS)
{
w_was_press = true;
} else if (key == GLFW_KEY_W && action == GLFW_RELEASE) { //se não para de movimentar
w_was_press = false;
}
// se apertar a seta a_was_press pra true e movimenta pra esquerda
if (key == GLFW_KEY_A && action == GLFW_PRESS)
{
a_was_press = true;
} else if (key == GLFW_KEY_A && action == GLFW_RELEASE) {//se não para de movimentar
a_was_press = false;
}
// se apertar s seta s_was_press pra true e movimenta pra tras
if (key == GLFW_KEY_S && action == GLFW_PRESS)
{
s_was_press = true;
} else if (key == GLFW_KEY_S && action == GLFW_RELEASE) {//se não para de movimentar
s_was_press = false;
}
// se apertar d seta d_was_press pra true e movimenta pra direita
if (key == GLFW_KEY_D && action == GLFW_PRESS)
{
d_was_press = true;
} else if (key == GLFW_KEY_D && action == GLFW_RELEASE) {//se não para de movimentar
d_was_press = false;
}
}
// Definimos o callback para impressão de erros da GLFW no terminal
void ErrorCallback(int error, const char* description)
{
fprintf(stderr, "ERROR: GLFW: %s\n", description);
}
// Esta função recebe um vértice com coordenadas de modelo p_model e passa o
// mesmo por todos os sistemas de coordenadas armazenados nas matrizes model,
// view, e projection; e escreve na tela as matrizes e pontos resultantes
// dessas transformações.
void TextRendering_ShowModelViewProjection(
GLFWwindow* window,
glm::mat4 projection,
glm::mat4 view,
glm::mat4 model,
glm::vec4 p_model
)
{
if ( !g_ShowInfoText )
return;
glm::vec4 p_world = model*p_model;
glm::vec4 p_camera = view*p_world;
glm::vec4 p_clip = projection*p_camera;
glm::vec4 p_ndc = p_clip / p_clip.w;
float pad = TextRendering_LineHeight(window);
TextRendering_PrintString(window, " Model matrix Model In World Coords.", -1.0f, 1.0f-pad, 1.0f);
TextRendering_PrintMatrixVectorProduct(window, model, p_model, -1.0f, 1.0f-2*pad, 1.0f);
TextRendering_PrintString(window, " | ", -1.0f, 1.0f-6*pad, 1.0f);
TextRendering_PrintString(window, " .-----------' ", -1.0f, 1.0f-7*pad, 1.0f);
TextRendering_PrintString(window, " V ", -1.0f, 1.0f-8*pad, 1.0f);
TextRendering_PrintString(window, " View matrix World In Camera Coords.", -1.0f, 1.0f-9*pad, 1.0f);
TextRendering_PrintMatrixVectorProduct(window, view, p_world, -1.0f, 1.0f-10*pad, 1.0f);
TextRendering_PrintString(window, " | ", -1.0f, 1.0f-14*pad, 1.0f);
TextRendering_PrintString(window, " .-----------' ", -1.0f, 1.0f-15*pad, 1.0f);
TextRendering_PrintString(window, " V ", -1.0f, 1.0f-16*pad, 1.0f);
TextRendering_PrintString(window, " Projection matrix Camera In NDC", -1.0f, 1.0f-17*pad, 1.0f);
TextRendering_PrintMatrixVectorProductDivW(window, projection, p_camera, -1.0f, 1.0f-18*pad, 1.0f);
int width, height;
glfwGetFramebufferSize(window, &width, &height);
glm::vec2 a = glm::vec2(-1, -1);
glm::vec2 b = glm::vec2(+1, +1);
glm::vec2 p = glm::vec2( 0, 0);
glm::vec2 q = glm::vec2(width, height);
glm::mat4 viewport_mapping = Matrix(
(q.x - p.x)/(b.x-a.x), 0.0f, 0.0f, (b.x*p.x - a.x*q.x)/(b.x-a.x),
0.0f, (q.y - p.y)/(b.y-a.y), 0.0f, (b.y*p.y - a.y*q.y)/(b.y-a.y),
0.0f , 0.0f , 1.0f , 0.0f ,
0.0f , 0.0f , 0.0f , 1.0f
);
TextRendering_PrintString(window, " | ", -1.0f, 1.0f-22*pad, 1.0f);
TextRendering_PrintString(window, " .--------------------------' ", -1.0f, 1.0f-23*pad, 1.0f);
TextRendering_PrintString(window, " V ", -1.0f, 1.0f-24*pad, 1.0f);
TextRendering_PrintString(window, " Viewport matrix NDC In Pixel Coords.", -1.0f, 1.0f-25*pad, 1.0f);
TextRendering_PrintMatrixVectorProductMoreDigits(window, viewport_mapping, p_ndc, -1.0f, 1.0f-26*pad, 1.0f);
}
// Escrevemos na tela os ângulos de Euler definidos nas variáveis globais
// g_AngleX, g_AngleY, e g_AngleZ.
void TextRendering_ShowEulerAngles(GLFWwindow* window)
{
if ( !g_ShowInfoText )
return;
float pad = TextRendering_LineHeight(window);
char buffer[80];
snprintf(buffer, 80, "Euler Angles rotation matrix = Z(%.2f)*Y(%.2f)*X(%.2f)\n", g_AngleZ, g_AngleY, g_AngleX);
TextRendering_PrintString(window, buffer, -1.0f+pad/10, -1.0f+2*pad/10, 1.0f);
}
// Escrevemos na tela qual matriz de projeção está sendo utilizada.
void TextRendering_ShowProjection(GLFWwindow* window)
{
if ( !g_ShowInfoText )
return;
float lineheight = TextRendering_LineHeight(window);
float charwidth = TextRendering_CharWidth(window);
if ( g_UsePerspectiveProjection )
TextRendering_PrintString(window, "Perspective", 1.0f-13*charwidth, -1.0f+2*lineheight/10, 1.0f);
else
TextRendering_PrintString(window, "Orthographic", 1.0f-13*charwidth, -1.0f+2*lineheight/10, 1.0f);
}
// Escrevemos na tela o número de quadros renderizados por segundo (frames per
// second).
void TextRendering_ShowFramesPerSecond(GLFWwindow* window)
{
if ( !g_ShowInfoText )
return;
// Variáveis estáticas (static) mantém seus valores entre chamadas
// subsequentes da função!
static float old_seconds = (float)glfwGetTime();
static int ellapsed_frames = 0;
static char buffer[20] = "?? fps";
static int numchars = 7;
ellapsed_frames += 1;
// Recuperamos o número de segundos que passou desde a execução do programa
float seconds = (float)glfwGetTime();
// Número de segundos desde o último cálculo do fps
float ellapsed_seconds = seconds - old_seconds;
if ( ellapsed_seconds > 1.0f )
{
numchars = snprintf(buffer, 20, "%.2f fps", ellapsed_frames / ellapsed_seconds);
old_seconds = seconds;
ellapsed_frames = 0;
}
float lineheight = TextRendering_LineHeight(window);
float charwidth = TextRendering_CharWidth(window);
TextRendering_PrintString(window, buffer, 1.0f-(numchars + 1)*charwidth, 1.0f-lineheight, 1.0f);
}
void TextRendering_ShowPoints(GLFWwindow* window)
{
if ( !g_ShowInfoText )
return;
// Variáveis estáticas (static) mantém seus valores entre chamadas
// subsequentes da função!
float pad = TextRendering_LineHeight(window);
char buffer[80];
snprintf(buffer, 80, "Points = %d\n", player.points);
TextRendering_PrintString(window, buffer, -1.0f+pad/10, 1.0f-pad, 1.0f);
}
// Função para debugging: imprime no terminal todas informações de um modelo
// geométrico carregado de um arquivo ".obj".
// Veja: https://github.com/syoyo/tinyobjloader/blob/22883def8db9ef1f3ffb9b404318e7dd25fdbb51/loader_example.cc#L98
void PrintObjModelInfo(ObjModel* model)
{
const tinyobj::attrib_t & attrib = model->attrib;
const std::vector<tinyobj::shape_t> & shapes = model->shapes;
const std::vector<tinyobj::material_t> & materials = model->materials;
printf("# of vertices : %d\n", (int)(attrib.vertices.size() / 3));
printf("# of normals : %d\n", (int)(attrib.normals.size() / 3));
printf("# of texcoords : %d\n", (int)(attrib.texcoords.size() / 2));
printf("# of shapes : %d\n", (int)shapes.size());
printf("# of materials : %d\n", (int)materials.size());
for (size_t v = 0; v < attrib.vertices.size() / 3; v++) {
printf(" v[%ld] = (%f, %f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.vertices[3 * v + 0]),
static_cast<const double>(attrib.vertices[3 * v + 1]),
static_cast<const double>(attrib.vertices[3 * v + 2]));
}
for (size_t v = 0; v < attrib.normals.size() / 3; v++) {
printf(" n[%ld] = (%f, %f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.normals[3 * v + 0]),
static_cast<const double>(attrib.normals[3 * v + 1]),
static_cast<const double>(attrib.normals[3 * v + 2]));
}
for (size_t v = 0; v < attrib.texcoords.size() / 2; v++) {
printf(" uv[%ld] = (%f, %f)\n", static_cast<long>(v),
static_cast<const double>(attrib.texcoords[2 * v + 0]),
static_cast<const double>(attrib.texcoords[2 * v + 1]));
}
// For each shape
for (size_t i = 0; i < shapes.size(); i++) {
printf("shape[%ld].name = %s\n", static_cast<long>(i),
shapes[i].name.c_str());
printf("Size of shape[%ld].indices: %lu\n", static_cast<long>(i),
static_cast<unsigned long>(shapes[i].mesh.indices.size()));
size_t index_offset = 0;
assert(shapes[i].mesh.num_face_vertices.size() ==
shapes[i].mesh.material_ids.size());
printf("shape[%ld].num_faces: %lu\n", static_cast<long>(i),
static_cast<unsigned long>(shapes[i].mesh.num_face_vertices.size()));
// For each face
for (size_t f = 0; f < shapes[i].mesh.num_face_vertices.size(); f++) {
size_t fnum = shapes[i].mesh.num_face_vertices[f];
printf(" face[%ld].fnum = %ld\n", static_cast<long>(f),
static_cast<unsigned long>(fnum));
// For each vertex in the face
for (size_t v = 0; v < fnum; v++) {
tinyobj::index_t idx = shapes[i].mesh.indices[index_offset + v];
printf(" face[%ld].v[%ld].idx = %d/%d/%d\n", static_cast<long>(f),
static_cast<long>(v), idx.vertex_index, idx.normal_index,
idx.texcoord_index);
}
printf(" face[%ld].material_id = %d\n", static_cast<long>(f),
shapes[i].mesh.material_ids[f]);
index_offset += fnum;
}
printf("shape[%ld].num_tags: %lu\n", static_cast<long>(i),
static_cast<unsigned long>(shapes[i].mesh.tags.size()));
for (size_t t = 0; t < shapes[i].mesh.tags.size(); t++) {
printf(" tag[%ld] = %s ", static_cast<long>(t),
shapes[i].mesh.tags[t].name.c_str());
printf(" ints: [");
for (size_t j = 0; j < shapes[i].mesh.tags[t].intValues.size(); ++j) {
printf("%ld", static_cast<long>(shapes[i].mesh.tags[t].intValues[j]));
if (j < (shapes[i].mesh.tags[t].intValues.size() - 1)) {
printf(", ");
}
}
printf("]");
printf(" floats: [");
for (size_t j = 0; j < shapes[i].mesh.tags[t].floatValues.size(); ++j) {
printf("%f", static_cast<const double>(
shapes[i].mesh.tags[t].floatValues[j]));
if (j < (shapes[i].mesh.tags[t].floatValues.size() - 1)) {
printf(", ");
}
}
printf("]");
printf(" strings: [");
for (size_t j = 0; j < shapes[i].mesh.tags[t].stringValues.size(); ++j) {
printf("%s", shapes[i].mesh.tags[t].stringValues[j].c_str());
if (j < (shapes[i].mesh.tags[t].stringValues.size() - 1)) {
printf(", ");
}
}
printf("]");
printf("\n");
}
}
for (size_t i = 0; i < materials.size(); i++) {
printf("material[%ld].name = %s\n", static_cast<long>(i),
materials[i].name.c_str());
printf(" material.Ka = (%f, %f ,%f)\n",
static_cast<const double>(materials[i].ambient[0]),
static_cast<const double>(materials[i].ambient[1]),
static_cast<const double>(materials[i].ambient[2]));
printf(" material.Kd = (%f, %f ,%f)\n",
static_cast<const double>(materials[i].diffuse[0]),
static_cast<const double>(materials[i].diffuse[1]),
static_cast<const double>(materials[i].diffuse[2]));
printf(" material.Ks = (%f, %f ,%f)\n",
static_cast<const double>(materials[i].specular[0]),
static_cast<const double>(materials[i].specular[1]),
static_cast<const double>(materials[i].specular[2]));
printf(" material.Tr = (%f, %f ,%f)\n",
static_cast<const double>(materials[i].transmittance[0]),
static_cast<const double>(materials[i].transmittance[1]),
static_cast<const double>(materials[i].transmittance[2]));
printf(" material.Ke = (%f, %f ,%f)\n",
static_cast<const double>(materials[i].emission[0]),
static_cast<const double>(materials[i].emission[1]),
static_cast<const double>(materials[i].emission[2]));
printf(" material.Ns = %f\n",
static_cast<const double>(materials[i].shininess));
printf(" material.Ni = %f\n", static_cast<const double>(materials[i].ior));
printf(" material.dissolve = %f\n",
static_cast<const double>(materials[i].dissolve));
printf(" material.illum = %d\n", materials[i].illum);
printf(" material.map_Ka = %s\n", materials[i].ambient_texname.c_str());
printf(" material.map_Kd = %s\n", materials[i].diffuse_texname.c_str());
printf(" material.map_Ks = %s\n", materials[i].specular_texname.c_str());
printf(" material.map_Ns = %s\n",
materials[i].specular_highlight_texname.c_str());
printf(" material.map_bump = %s\n", materials[i].bump_texname.c_str());
printf(" material.map_d = %s\n", materials[i].alpha_texname.c_str());
printf(" material.disp = %s\n", materials[i].displacement_texname.c_str());
printf(" <<PBR>>\n");
printf(" material.Pr = %f\n", materials[i].roughness);
printf(" material.Pm = %f\n", materials[i].metallic);
printf(" material.Ps = %f\n", materials[i].sheen);
printf(" material.Pc = %f\n", materials[i].clearcoat_thickness);
printf(" material.Pcr = %f\n", materials[i].clearcoat_thickness);
printf(" material.aniso = %f\n", materials[i].anisotropy);
printf(" material.anisor = %f\n", materials[i].anisotropy_rotation);
printf(" material.map_Ke = %s\n", materials[i].emissive_texname.c_str());
printf(" material.map_Pr = %s\n", materials[i].roughness_texname.c_str());
printf(" material.map_Pm = %s\n", materials[i].metallic_texname.c_str());
printf(" material.map_Ps = %s\n", materials[i].sheen_texname.c_str());
printf(" material.norm = %s\n", materials[i].normal_texname.c_str());
std::map<std::string, std::string>::const_iterator it(
materials[i].unknown_parameter.begin());
std::map<std::string, std::string>::const_iterator itEnd(
materials[i].unknown_parameter.end());
for (; it != itEnd; it++) {
printf(" material.%s = %s\n", it->first.c_str(), it->second.c_str());
}
printf("\n");
}
}
// set makeprg=cd\ ..\ &&\ make\ run\ >/dev/null
// vim: set spell spelllang=pt_br :
| 41.683917 | 187 | 0.638172 | [
"mesh",
"shape",
"vector",
"model"
] |
9e98bdbf3392cc4eb956afa1c7720cd6a013634e | 3,774 | cpp | C++ | sandbox/tqli.cpp | f-fathurrahman/ffr-pspw-dft-c | 5e673e33385eb467d99fcd992b350614c2709740 | [
"MIT"
] | 1 | 2018-05-17T09:01:12.000Z | 2018-05-17T09:01:12.000Z | sandbox/tqli.cpp | f-fathurrahman/ffr-pspw-dft-c | 5e673e33385eb467d99fcd992b350614c2709740 | [
"MIT"
] | null | null | null | sandbox/tqli.cpp | f-fathurrahman/ffr-pspw-dft-c | 5e673e33385eb467d99fcd992b350614c2709740 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SQR(x) ((x)*(x))
#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
#define IDX2F(i,j,DIM1) (((j)-1)*(DIM1) + ((i)-1))
double pythag(double a, double b)
// Computes (a**2 + b**2)**(1/2) without destructive underflow or overflow.
{
double absa,absb;
absa = fabs(a);
absb = fabs(b);
if(absa > absb) return absa*sqrt(1.0 + SQR(absb/absa));
else return(absb == 0.0 ? 0.0 : absb*sqrt(1.0 + SQR(absa/absb)));
}
void eigsrt(double *d, double *v, int n)
/* Given the eigenvalues d[1..n] and eigenvectors v[1..n][1..n] as output from jacobi
* tqli, this routine sorts the eigenvalues into descending order, and rearranges
* the columns of v correspondingly. The method is straight insertion.
*/
{
int k,j,i;
double p;
for(i=1; i<n; i++) {
k = i;
p = d[k-1];
for (j=i+1; j<=n; j++) {
if (d[j-1] >= p) {
k = j;
p = d[k-1];
}
}
if (k != i) {
d[k-1] = d[i-1];
d[i-1] = p;
for (j=1; j<=n; j++) {
p = v[IDX2F(j,i,n)];
v[IDX2F(j,i,n)] = v[IDX2F(j,k,n)];
v[IDX2F(j,k,n)] = p;
}
}
}
}
void tqli(double *d, double *e, int n, double *z)
/* QL algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a real,
* symmetric, tridiagonal matrix, or of a real, symmetric matrix previously reduced by tred2
* x11.2. On input, d[1..n] contains the diagonal elements of the tridiagonal matrix. On
* output, it returns the eigenvalues. The vector e[1..n] inputs the subdiagonal elements of
* the tridiagonal matrix, with e[1] arbitrary. On output e is destroyed. When finding only the
* eigenvalues, several lines may be omitted, as noted in the comments. If the eigenvectors of
* a tridiagonal matrix are desired, the matrix z[1..n][1..n] is input as the identity matrix.
* If the eigenvectors of a matrix that has been reduced by tred2 are required, then z is input
* as the matrix output by tred2.
* In either case, the kth column of z returns the normalized eigenvector corresponding to d[k].
*/
{
int m,l,iter,i,k;
double s,r,p,g,f,dd,c,b;
for(i=2; i<=n; i++) e[i-2] = e[i-1]; // Convenient to renumber the elements of e. e[n]=0.0;
for(l=1; l<=n; l++) {
iter=0;
do {
// Look for a single small subdiagonal element to splitthe matrix.
for (m=l; m<=n-1; m++) {
dd = fabs(d[m-1]) + fabs(d[m]);
if ((double) (fabs(e[m-1]) + dd) == dd) break;
}
if (m != l) {
if (iter++ == 30) {
printf("ERROR: Too many iterations in tqli\n");
abort();
}
g = (d[l] - d[l-1])/(2.0*e[l-1]); // Form shift.
r = pythag(g,1.0);
g = d[m-1] - d[l-1] + e[l-1]/(g + SIGN(r,g)); // This is dm - ks.
s = c = 1.0;
p = 0.0;
// A plane rotation as in the original QL, followed by Givens rotations
// to restore tridiagonal form.
for(i=m-1; i>=l; i--) {
f = s*e[i-1];
b = c*e[i-1];
e[i] = ( r = pythag(f,g) );
// Recover from underflow
if (r == 0.0) {
d[i] -= p;
e[m-1] = 0.0;
break;
}
s = f/r;
c = g/r;
g = d[i] - p;
r = (d[i-1]-g)*s + 2.0*c*b;
d[i] = g + (p=s*r);
g = c*r-b;
/* Next loop can be omitted if eigenvectors not wanted*/
for (k=1;k<=n;k++) { // Form eigenvectors.
f = z[IDX2F(k,i+1,n)];
z[IDX2F(k,i+1,n)] = s*z[IDX2F(k,i,n)] + c*f;
z[IDX2F(k,i,n)] = c*z[IDX2F(k,i,n)] - s*f;
}
}
if (r == 0.0 && i >= l) continue;
d[l-1] -= p;
e[l-1] = g;
e[m-1] = 0.0;
}
} while (m != l);
}
}
| 31.983051 | 96 | 0.518018 | [
"vector"
] |
9e9c50b797123485b25a3b31dd7a7645b065f602 | 2,107 | hpp | C++ | include/OrbitConversions/CartState.hpp | bbercovici/OrbitConversions | c4cdc4604d91e90d89cfa6aa7739bef8cdb18739 | [
"MIT"
] | null | null | null | include/OrbitConversions/CartState.hpp | bbercovici/OrbitConversions | c4cdc4604d91e90d89cfa6aa7739bef8cdb18739 | [
"MIT"
] | null | null | null | include/OrbitConversions/CartState.hpp | bbercovici/OrbitConversions | c4cdc4604d91e90d89cfa6aa7739bef8cdb18739 | [
"MIT"
] | null | null | null | // MIT License
// Copyright (c) 2018 Benjamin Bercovici
// 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.
#ifndef CARTSTATE_HEADER
#define CARTSTATE_HEADER
#include "OrbitConversions/State.hpp"
#include "OrbitConversions/KepState.hpp"
namespace OC{
class KepState;
class CartState : public State{
public:
CartState( arma::vec state,double mu);
CartState();
virtual double get_momentum() const;
virtual double get_energy() const;
virtual double get_a() const;
virtual double get_eccentricity() const;
double get_speed() const;
double get_radius() const;
arma::vec::fixed<3> get_position_vector() const;
arma::vec::fixed<3> get_velocity_vector() const;
arma::vec::fixed<3> get_momentum_vector() const ;
arma::vec::fixed<3> get_eccentricity_vector() const ;
/*
Returns the keplerian orbital elements state corresponding to the
cartesian state
@param delta_T time since epoch
@return keplerian state vector of orbital_elements (a, e, i, Omega, omega, M0)
*/
KepState convert_to_kep(double delta_T) const;
protected:
};
}
#endif | 31.447761 | 81 | 0.753204 | [
"vector"
] |
9e9e9a898e7efba602df4f71aab0187918455b09 | 3,310 | cpp | C++ | net.cpp | redouane-dev/feedforward-neural-network | 12e398658ea58506640039196a4ee52c0999f445 | [
"MIT"
] | 1 | 2020-05-01T16:57:47.000Z | 2020-05-01T16:57:47.000Z | net.cpp | redouane-dev/feedforward-neural-network | 12e398658ea58506640039196a4ee52c0999f445 | [
"MIT"
] | null | null | null | net.cpp | redouane-dev/feedforward-neural-network | 12e398658ea58506640039196a4ee52c0999f445 | [
"MIT"
] | null | null | null |
#include <cstdlib>
#include <vector>
#include <cmath>
#include <cassert>
#include "net.hpp"
#include "neuron.hpp"
/* NET IMPLEMENTATION ****************************************************************************/
double Net::m_recentAverageSmoothingFactor = 1.0;
Net::Net(std::vector<unsigned>& topology){
unsigned numLayers = topology.size();
for(unsigned layerNum = 0 ; layerNum < numLayers ; ++layerNum){
m_layers.push_back(Layer());
unsigned numOutputs = (layerNum == numLayers - 1)? 0 : topology[layerNum + 1];
for(unsigned j = 0 ; j < topology[layerNum] ; ++j){
m_layers.back().push_back(Neuron(numOutputs));
}
// A Bias neuron is needed in each layer
m_layers.back().push_back(Neuron(numOutputs));
// Force the Bias neuron's output val to 1.0
m_layers.back().back().setOutputVal(1.0);
}
}
void Net::feedForward(std::vector<double> const& inputVals){
// We make sure that the num of inputs is the same as the num of neurons in input layer
assert(inputVals.size() == m_layers[0].size() - 1); // The Bias neuron is not included
for(unsigned n = 0 ; n < inputVals.size() ; ++n){
m_layers[0][n].setOutputVal(inputVals[n]);
}
for(unsigned layerNum = 1 ; layerNum < m_layers.size() ; ++layerNum){
for(unsigned n = 0 ; n < m_layers[layerNum].size() - 1 ; ++n){ // The -1 is to avoid the Bias n
Layer& prevLayer = m_layers[layerNum - 1];
m_layers[layerNum][n].feedForward(prevLayer, n);
}
}
}
void Net::backPropagation(std::vector<double> const& targetVals){
// This method calculates the errors, and tries to correct these errors
// Calculating the overall neural net error (The RMS val of neurons output error)
Layer& outputLayer = m_layers.back();
m_rmsError = 0.0;
for(unsigned n = 0 ; n < outputLayer.size() - 1 ; ++n){ // The -1 is to avoid the Bias neuron
double delta = targetVals[n] - outputLayer[n].getOutputVal();
m_rmsError += delta * delta;
}
m_rmsError /= (outputLayer.size() - 1);
m_rmsError = sqrt(m_rmsError);
// Implementing a recent average measurement (to give a running indication of how well the training is going)
m_recentAverageError =
(m_recentAverageError * m_recentAverageSmoothingFactor + m_rmsError)
/ (m_recentAverageSmoothingFactor + 1.0);
// Calculate the output layer gradient
for(unsigned n = 0 ; n < outputLayer.size() ; ++n){
outputLayer[n].calculateOutputGradients(targetVals[n]);
}
// Calculate the hidden layers gradients
for(unsigned layerNum = m_layers.size() - 2 ; layerNum > 0 ; --layerNum){
Layer& hiddenLayer = m_layers[layerNum];
Layer& nextLayer = m_layers[layerNum + 1];
for(unsigned n = 0 ; n < hiddenLayer.size() ; ++n){
hiddenLayer[n].calculateHiddenGradients(nextLayer);
}
}
// Update connections weight from output layer to 1st hidden layer
for(unsigned layerNum = m_layers.size() - 1 ; layerNum > 0 ; --layerNum){
Layer& layer = m_layers[layerNum];
Layer& prevLayer = m_layers[layerNum - 1];
for(unsigned n = 0 ; n < layer.size() - 1 ; ++n){ // Bias neuron is omitted
layer[n].updateInputWeights(prevLayer, n);
}
}
}
void Net::getResults(std::vector<double> & resultVals) const{
resultVals.clear();
for(unsigned n = 0 ; n < m_layers.back().size() - 1 ; ++n){
resultVals.push_back(m_layers.back()[n].getOutputVal());
}
} | 28.782609 | 110 | 0.668882 | [
"vector"
] |
9e9f841121c4ebb64bd23e8db1e7f032ef67e894 | 465 | hpp | C++ | source/sdl_core/sdl_core.hpp | Spirrwell/AMEngine | 9edc38af84bdb2f37ba0d988f5a9cb6d6250d0b7 | [
"MIT"
] | 2 | 2020-10-15T07:32:02.000Z | 2020-12-01T22:42:55.000Z | source/sdl_core/sdl_core.hpp | Spirrwell/AMEngine | 9edc38af84bdb2f37ba0d988f5a9cb6d6250d0b7 | [
"MIT"
] | null | null | null | source/sdl_core/sdl_core.hpp | Spirrwell/AMEngine | 9edc38af84bdb2f37ba0d988f5a9cb6d6250d0b7 | [
"MIT"
] | null | null | null | #ifndef SDL_CORE_HPP
#define SDL_CORE_HPP
#include "isdl_core.hpp"
#include "SDL.h"
#include "sdleventlistener.hpp"
#include <vector>
class SDL_Core : public ISDL_Core
{
public:
void ProcessEvents() override;
void AddSDLEventListener( SDLEventListener *pListener ) override;
void RemoveSDLEventListener( SDLEventListener *pListener ) override;
private:
std::vector< SDLEventListener * > m_pSDLEventListeners;
SDL_Event m_Event;
};
#endif // SDL_CORE_HPP | 19.375 | 69 | 0.782796 | [
"vector"
] |
9eac0e60ccae239a6e2d439c40f2f096bed25621 | 145,546 | cpp | C++ | src/csalt/src/executive/Phase.cpp | IncompleteWorlds/GMAT_2020 | 624de54d00f43831a4d46b46703e069d5c8c92ff | [
"Apache-2.0"
] | null | null | null | src/csalt/src/executive/Phase.cpp | IncompleteWorlds/GMAT_2020 | 624de54d00f43831a4d46b46703e069d5c8c92ff | [
"Apache-2.0"
] | null | null | null | src/csalt/src/executive/Phase.cpp | IncompleteWorlds/GMAT_2020 | 624de54d00f43831a4d46b46703e069d5c8c92ff | [
"Apache-2.0"
] | null | null | null | //------------------------------------------------------------------------------
// Phase
//------------------------------------------------------------------------------
// GMAT: General Mission Analysis Tool
//
// Copyright (c) 2002 - 2020 United States Government as represented by the
// Administrator of The National Aeronautics and Space Administration.
// All Other Rights Reserved.
//
// Author: Wendy Shoan / NASA
// Created: 2016.02.29
//
/**
* From original MATLAB prototype:
* Author: S. Hughes. steven.p.hughes@nasa.gov
*/
//------------------------------------------------------------------------------
#include <iostream>
#include <sstream>
#include "GmatConstants.hpp"
#include "Phase.hpp"
#include "DecVecTypeBetts.hpp"
#include "MessageInterface.hpp"
#include "StringUtil.hpp"
//#define DEBUG_PHASE_INIT
//#define DEBUG_PHASE_PATH_INIT
//#define DEBUG_GUESS
//#define DEBUG_PHASE_SPARSE
//#define DEBUG_PHASE
//#define DEBUG_BOUNDS_VALUES
//#define DEBUG_DESTRUCT
//#define DEBUG_REPORT_DATA
//------------------------------------------------------------------------------
// static data
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// public methods
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// default constructor
//------------------------------------------------------------------------------
Phase::Phase() :
decVector (NULL),
config (NULL),
initialGuessMode (""),
pathFunction (NULL),
userGuessClass (NULL),
phaseNum (-999),
numAlgPathConNLP (0),
costFunctionIntegral (-999.99),
defectConStartIdx (0),
algPathConStartIdx (0),
defectConEndIdx (0),
algPathConEndIdx (0),
recomputeUserFunctions (true),
isInitialized (false),
recomputeNLPFunctions (true),
isRefining (false),
constraintTimeOffset (0),
dynFunctionProps (NULL),
costFunctionProps (NULL),
algFunctionProps (NULL),
guessGen (NULL),
algPathNLPFuncUtil (NULL),
transUtil (NULL),
guessArrayData (NULL),
scaleUtil (NULL),
relativeErrorTol (1.0e-5)
{
// this is specific and should really be set in a child class!!
decVector = new DecVecTypeBetts();
config = new ProblemCharacteristics();
pathFunctionManager = new UserPathFunctionManager();
pathFunctionInputData = new FunctionInputData();
guessGen = new GuessGenerator();
// This was moved from InitializeNLPHelpers to here - a run-time malloc error
// was generated when it was created in InitializeNLPHelpers
algPathNLPFuncUtil = new NLPFuncUtil_AlgPath();
scaleUtil = new ScalingUtility();
// Set size initially for RSMatrix items (trying to avoid a weird malloc/free
// error message)
SparseMatrixUtil::SetSize(nlpConstraintJacobian, 1, 1);
SparseMatrixUtil::SetSize(nlpCostJacobian, 1, 1);
SparseMatrixUtil::SetSize(conSparsityPattern, 1, 1);
SparseMatrixUtil::SetSize(costSparsityPattern, 1, 1);
}
//------------------------------------------------------------------------------
// copy constructor
//------------------------------------------------------------------------------
Phase::Phase(const Phase ©) :
// decVector (NULL),
// config (NULL),
initialGuessMode (copy.initialGuessMode),
// pathFunction (NULL),
userGuessClass (copy.userGuessClass),
phaseNum (copy.phaseNum),
numAlgPathConNLP (copy.numAlgPathConNLP),
costFunctionIntegral (copy.costFunctionIntegral),
defectConStartIdx (copy.defectConStartIdx),
algPathConStartIdx (copy.algPathConStartIdx),
defectConEndIdx (copy.defectConEndIdx),
algPathConEndIdx (copy.algPathConEndIdx),
recomputeUserFunctions (copy.recomputeUserFunctions),
isInitialized (copy.isInitialized),
recomputeNLPFunctions (copy.recomputeNLPFunctions),
isRefining (copy.isRefining),
constraintTimeOffset (copy.constraintTimeOffset),
relativeErrorTol (copy.relativeErrorTol)
// dynFunctionProps (NULL),
// costFunctionProps (NULL),
// algFunctionProps (NULL),
// pathFunctionManager (NULL), // clone/copy here?
// pathFunctionInputData (NULL), // clone/copy here?
// guessGen (NULL),
// algPathNLPFuncUtil (NULL),
// transUtil (NULL)
{
DecVecTypeBetts *dv = (DecVecTypeBetts*) copy.decVector;
if (dv)
decVector = new DecVecTypeBetts(*dv);
if (copy.config)
config = new ProblemCharacteristics(*(copy.config));
// pathFunctionManager =
// new UserPathFunctionManager(*(copy.pathFunctionManager)); // ??
// pathFunctionInputData =
// new FunctionInputData(*(copy.pathFunctionInputData)); // ??
guessGen = new GuessGenerator(*(copy.guessGen));
if (pathFunction) delete pathFunction;
pathFunction = copy.pathFunction; // or clone?
if (copy.pathFunctionManager)
{
if (pathFunctionManager) delete pathFunctionManager;
pathFunctionManager =
new UserPathFunctionManager(*(copy.pathFunctionManager));
}
if (copy.pathFunctionInputData)
{
if (pathFunctionInputData) delete pathFunctionInputData;
pathFunctionInputData =
new FunctionInputData(*(copy.pathFunctionInputData));
}
if (copy.algPathNLPFuncUtil)
{
if (algPathNLPFuncUtil) delete algPathNLPFuncUtil;
algPathNLPFuncUtil = new NLPFuncUtil_AlgPath(*(copy.algPathNLPFuncUtil));
}
/* moved to subclass
if (copy.transUtil)
{
if (transUtil) delete transUtil;
transUtil = new NLPFuncUtil_Coll(*(copy.transUtil));
}
*/
if (copy.guessArrayData)
{
if (guessArrayData) delete guessArrayData;
guessArrayData = new ArrayTrajectoryData(*(copy.guessArrayData));
}
if (copy.scaleUtil)
{
if (scaleUtil) delete scaleUtil;
scaleUtil = new ScalingUtility(*(copy.scaleUtil));
}
if (dynFunctionProps) delete dynFunctionProps;
dynFunctionProps = new UserFunctionProperties(*(copy.dynFunctionProps));
if (costFunctionProps) delete costFunctionProps;
costFunctionProps = new UserFunctionProperties(*(copy.costFunctionProps));
if (algFunctionProps) delete algFunctionProps;
algFunctionProps = new UserFunctionProperties(*(copy.algFunctionProps));
MessageInterface::ShowMessage(
"COPY: decVector <%p>, config <%p>, pathFM <%p>, pFID <%p>, gg <%p>\n",
decVector, config, pathFunctionManager,
pathFunctionInputData, guessGen);
CopyArrays(copy);
}
//------------------------------------------------------------------------------
// operator=
//------------------------------------------------------------------------------
Phase& Phase::operator=(const Phase ©)
{
if (© == this)
return *this;
initialGuessMode = copy.initialGuessMode;
pathFunction = copy.pathFunction;
userGuessClass = copy.userGuessClass;
phaseNum = copy.phaseNum;
numAlgPathConNLP = copy.numAlgPathConNLP;
costFunctionIntegral = copy.costFunctionIntegral;
defectConStartIdx = copy.defectConStartIdx;
algPathConStartIdx = copy.algPathConStartIdx;
defectConEndIdx = copy.defectConEndIdx;
algPathConEndIdx = copy.algPathConEndIdx;
recomputeUserFunctions = copy.recomputeUserFunctions;
isInitialized = copy.isInitialized;
recomputeNLPFunctions = copy.recomputeNLPFunctions;
isRefining = copy.isRefining;
constraintTimeOffset = copy.constraintTimeOffset;
relativeErrorTol = copy.relativeErrorTol;
if (pathFunction) delete pathFunction;
pathFunction = copy.pathFunction;
// if (decVector) delete decVector;
DecVecTypeBetts *dv = (DecVecTypeBetts*) copy.decVector;
decVector = new DecVecTypeBetts(*dv);
if (config) delete config;
ProblemCharacteristics *pc = copy.config;
config = new ProblemCharacteristics(*pc);
if (pathFunctionManager) delete pathFunctionManager;
pathFunctionManager = new UserPathFunctionManager(
*(copy.pathFunctionManager));
if (pathFunctionInputData) delete pathFunctionInputData;
pathFunctionInputData = new FunctionInputData(*(copy.pathFunctionInputData));
if (guessGen) delete guessGen;
guessGen = new GuessGenerator(*(copy.guessGen));
if (algPathNLPFuncUtil) delete algPathNLPFuncUtil;
algPathNLPFuncUtil = new NLPFuncUtil_AlgPath(*(copy.algPathNLPFuncUtil));
/* moved to subclass
if (transUtil) delete transUtil;
transUtil = new NLPFuncUtilRadau(*(copy.transUtil));
*/
if (guessArrayData) delete guessArrayData;
guessArrayData = new ArrayTrajectoryData(*(copy.guessArrayData));
if (scaleUtil) delete scaleUtil;
scaleUtil = new ScalingUtility(*(copy.scaleUtil));
if (dynFunctionProps) delete dynFunctionProps;
dynFunctionProps = new UserFunctionProperties(*(copy.dynFunctionProps));
if (costFunctionProps) delete costFunctionProps;
costFunctionProps = new UserFunctionProperties(*(copy.costFunctionProps));
if (algFunctionProps) delete algFunctionProps;
algFunctionProps = new UserFunctionProperties(*(copy.algFunctionProps));
MessageInterface::ShowMessage(
"OP=: decVector <%p>, config <%p>, pathFM <%p>, pFID <%p>, gg <%p>\n",
decVector, config, pathFunctionManager,
pathFunctionInputData, guessGen);
CopyArrays(copy);
// @todo - handle other pointers here - need to clone?
return *this;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
Phase::~Phase()
{
#ifdef DEBUG_DESTRUCT
MessageInterface::ShowMessage("DESTRUCTING CSALT Phase\n");
#endif
if (decVector) delete decVector; // if using one created here!!!
if (config) delete config;
if (pathFunctionManager) delete pathFunctionManager;
if (pathFunctionInputData) delete pathFunctionInputData;
if (guessGen) delete guessGen;
if (algPathNLPFuncUtil) delete algPathNLPFuncUtil;
if (transUtil) delete transUtil; // or in leaf class????
if (scaleUtil) delete scaleUtil;
if (guessArrayData) delete guessArrayData;
if (dynFunctionProps) delete dynFunctionProps;
if (costFunctionProps) delete costFunctionProps;
if (algFunctionProps) delete algFunctionProps;
for (Integer i = 0; i < funcData.size(); ++i)
{
if (funcData.at(i))
delete funcData.at(i);
}
/*
for (Integer i = 0; i < userDynFunctionData.size(); ++i)
{
if (userDynFunctionData.at(i))
delete userDynFunctionData.at(i);
}
for (Integer i = 0; i < userAlgFunctionData.size(); ++i)
{
if (userAlgFunctionData.at(i))
delete userAlgFunctionData.at(i);
}
for (Integer i = 0; i < costIntFunctionData.size(); ++i)
{
if (costIntFunctionData.at(i))
delete costIntFunctionData.at(i);
}
*/
funcData.clear();
userDynFunctionData.clear();
userAlgFunctionData.clear();
costIntFunctionData.clear();
// delete anything else that is created in this class here
// BUT NOT anything managed somewhere else (e.g. dynFunctionProps, etc.)
#ifdef DEBUG_DESTRUCT
MessageInterface::ShowMessage("Done DESTRUCTING CSALT Phase\n");
#endif
}
//------------------------------------------------------------------------------
// void RefineMesh(bool ifUpdateMesh,
// bool &isMeshRefined,
// IntegerArray &newMeshIntervalNumPoints,
// Rvector &newMeshIntervalFractions,
// Rvector &maxRelErrorVec,
// Rmatrix &newStateArray,
// Rmatrix &newControlArray)
//------------------------------------------------------------------------------
/**
* This method performs the mesh refnement
*
* @param <ifUpdateMesh> flag to update the mesh or not
* @param <isMeshRefined> output - has the mesh refinement been done
* @param <newMeshIntervalNumPoints> output - number of mesh interval mesh pts
* @param <newMeshIntervalFractions> output - mesh interval fractions
* @param <newStateArray> output - state
* @param <newControlArray> output - control array
* @param <maxRelErrorVec> output - maximum relative error per the mesh
*
*/
//------------------------------------------------------------------------------
void Phase::RefineMesh(bool ifUpdateMesh,
bool &isCurrentMeshRefined)
{
IntegerArray newMeshIntervalNumPoints;
Rvector newMeshIntervalFractions;
isRefining = true;
// Computes new mesh intervals and orders, state and control guesses
transUtil->RefineMesh((DecVecTypeBetts*)decVector, pathFunctionManager,
&maxRelErrorVec,
isCurrentMeshRefined, newMeshIntervalNumPoints,
newMeshIntervalFractions,
maxRelErrorVec, newStateGuess, newControlGuess);
if (isCurrentMeshRefined && ifUpdateMesh)
{
SetMeshIntervalFractions(newMeshIntervalFractions);
SetMeshIntervalNumPoints(newMeshIntervalNumPoints);
recomputeUserFunctions = true;
recomputeNLPFunctions = true;
}
}
//------------------------------------------------------------------------------
// void SetInitialGuessMode(const std::string &toMode)
//------------------------------------------------------------------------------
/**
* Set the initial guess mode
*
* @param <toMode> input initial guess mode
*/
//------------------------------------------------------------------------------
void Phase::SetInitialGuessMode(const std::string &toMode)
{
initialGuessMode = toMode;
// @TODO add validation here
}
//------------------------------------------------------------------------------
// void SetUserGuessClass(TrajectoryData *inputClass)
//------------------------------------------------------------------------------
/**
* Set the guess function class
*
* @param <inputClass> A pointer to the user's class which derives
* from TrajectoryData
*/
//------------------------------------------------------------------------------
void Phase::SetUserGuessClass(TrajectoryData *inputClass)
{
userGuessClass = inputClass;
}
//------------------------------------------------------------------------------
// void SetGuessFileName(const std::string &toName)
//------------------------------------------------------------------------------
/**
* Set the guess file name
*
* @param <toMode> input initial guess file name
*/
//------------------------------------------------------------------------------
void Phase::SetGuessFileName(const std::string &toName)
{
guessFileName = toName;
}
//------------------------------------------------------------------------------
// void SetInitialGuessArrays(Rvector timeArray,Rmatrix stateArray,
// Rmatrix controlArray)
//------------------------------------------------------------------------------
/**
* Set the guess file name
*
* @param <toMode> input initial guess file name
*/
//------------------------------------------------------------------------------
void Phase::SetInitialGuessArrays(Rvector timeArray,Rmatrix stateArray,
Rmatrix controlArray)
{
guessArrayData = new ArrayTrajectoryData();
TrajectoryDataStructure localData;
Integer numStateTimes,numStateParams,numControlTimes,numControlParams;
Integer numTimes;
numTimes = timeArray.GetSize();
guessArrayData->SetNumSegments(1);
// Get the number of control parameters and size the
// array data object and the local structure
controlArray.GetSize(numControlTimes,numControlParams);
guessArrayData->SetNumControlParams(0,numControlParams);
localData.controls.SetSize(numControlParams);
// Get the number of state parameters and size the
// och data object and the local structure
stateArray.GetSize(numStateTimes,numStateParams);
guessArrayData->SetNumStateParams(0,numStateParams);
localData.states.SetSize(numStateParams);
localData.integrals.SetSize(0);
// Loop through each time value
for (Integer idx = 0; idx < numTimes; idx++)
{
// Set the time value
localData.time = timeArray(idx);
// Make sure that we have a control value at this time
if (idx < numControlTimes)
// Set all of the control values
for (Integer jdx = 0; jdx < numControlParams; jdx++)
localData.controls(jdx) = controlArray(idx,jdx);
else
// There are no control values here, so set them to be zero
for (Integer jdx = 0; jdx < numControlParams; jdx++)
localData.controls(jdx) = 0.0;
// Make sure that we have a state value at this time
if (idx < numStateTimes)
// Set all of the state values
for (Integer jdx = 0; jdx < numStateParams; jdx++)
localData.states(jdx) = stateArray(idx,jdx);
else
// There are no state values here, so set them to be zero
for (Integer jdx = 0; jdx < numStateParams; jdx++)
localData.states(jdx) = 0.0;
// Add this data point to the OCH Data object
try
{
guessArrayData->AddDataPoint(0,localData);
}
catch (LowThrustException <)
{
// Assume exception thrown is for non-monotonic times
throw LowThrustException("ERROR setting initial guess array: "
"data points are not in the correct "
"temporal order\n");
}
}
}
//------------------------------------------------------------------------------
// void SetInitialGuessArrays(Rvector timeArray,Rmatrix stateArray,
// Rmatrix controlArray, Rvector staticParams)
//------------------------------------------------------------------------------
/**
* Set the initial guess; YK mod static params
* TBD: explain paramaters
*/
//------------------------------------------------------------------------------
void Phase::SetInitialGuessArrays(Rvector timeArray, Rmatrix stateArray,
Rmatrix controlArray, Rvector staticParams)
{
SetInitialGuessArrays(timeArray, stateArray, controlArray);
// TBD: modify guessArrayData to handle static params.
}
//------------------------------------------------------------------------------
// void SetPathFunction(UserPathFunction* f)
//------------------------------------------------------------------------------
/**
* Set the path function
*
* @param <toMode> input path function
*/
//------------------------------------------------------------------------------
void Phase::SetPathFunction(UserPathFunction* f)
{
#ifdef DEBUG_PHASE_INIT
std::cout << "Entering SetPathFunction ...\n";
#endif
pathFunction = f;
#ifdef DEBUG_PHASE_INIT
std::cout << "Exiting SetPathFunction ...\n";
#endif
}
//------------------------------------------------------------------------------
// void PrepareToOptimize()
//------------------------------------------------------------------------------
/**
* Prepares to optimize
*
*/
//------------------------------------------------------------------------------
void Phase::PrepareToOptimize()
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"Entering Phase::PrepareToOptimize ...\n");
#endif
// Init to be done after all phases are initialized but BEFORE optimization
ComputeSparsityPattern();
}
//------------------------------------------------------------------------------
// void Initialize()
//------------------------------------------------------------------------------
/**
* Initializes the Phase
*
*/
//------------------------------------------------------------------------------
void Phase::Initialize()
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("Entering Phase::Initialize ...\n");
MessageInterface::ShowMessage(" isRefining = %s\n",
(isRefining? "true" : "false"));
#endif
// This is required for re-initialization during mesh refinement
isInitialized = false;
recomputeUserFunctions = true;
// Check the user's configuration before proceeding
config->ValidateMeshConfig();
config->ValidateStateProperties();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
" config validated mesh and properties ...\n");
std::cout << " config validated mesh and properties ...\n";
#endif
// save the current unscaled mesh points vector, state, control; YK
if (isRefining)
PrepareForMeshRefinement();
// Initialize transcription and other helper classes;
InitializeTranscription();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" InitializeTranscription done ...\n");
std::cout << " InitializeTranscription done ...\n";
#endif
InitializeDecisionVector();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" InitializeDecisionVector done ...\n");
std::cout << " InitializeDecisionVector done ...\n";
#endif
InitializeTimeVector();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" InitializeTimeVector done ...\n");
std::cout << " InitializeTimeVector done ...\n";
#endif
InitializeUserFunctions();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" InitializeUserFunctions done ...\n");
std::cout << " InitializeUserFunctions done ...\n";
#endif
SetProblemCharacteristics();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" SetProblemCharacteristics done ...\n");
std::cout << " SetProblemCharacteristics done ...\n";
#endif
SetConstraintProperties();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" SetConstraintProperties done ...\n");
std::cout << " SetConstraintProperties done ...\n";
#endif
SetInitialGuess();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
" stuff has been initialized ... now will set bounds ...\n");
std::cout << " stuff has been initialized ... now will set bounds ...\n";
#endif
// Dimension and initialize bounds and other quantities
SetConstraintBounds();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" SetConstraintBounds done ...\n");
std::cout << " SetConstraintBounds done ...\n";
#endif
SetDecisionVectorBounds();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" SetDecisionVectorBounds done ...\n");
std::cout << " SetDecisionVectorBounds done ...\n";
#endif
IntializeJacobians();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" IntializeJacobians done ...\n");
std::cout << " IntializeJacobians done ...\n";
#endif
InitializePathFunctionInputData();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
" InitializePathFunctionInputData done ...\n");
std::cout << " InitializePathFunctionInputData done ...\n";
#endif
InitializeNLPHelpers();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" Initialization complete ...\n");
std::cout << " Initialization complete ...\n";
#endif
if (!transUtil)
{
throw LowThrustException("ERROR setting relative error tolerance on Phase!\n");
}
else
{
transUtil->SetRelativeErrorTol(relativeErrorTol);
}
// We're done intializing!
isInitialized = true;
}
//------------------------------------------------------------------------------
// bool SetDecisionVector(const Rvector &decVec)
//------------------------------------------------------------------------------
/**
* This method sets the decision vector
*
* @param <decVec> input decision vector
*
* @return true if successful
*
*/
//------------------------------------------------------------------------------
bool Phase::SetDecisionVector(const Rvector &newDecVec)
{
Integer numVarsNLP = config->GetNumDecisionVarsNLP();
if (newDecVec.GetSize() == numVarsNLP)
{
if (!decVector)
throw LowThrustException("ERROR setting decision vector on Phase!\n");
Rvector oldDecVec = decVector->GetDecisionVector();
bool isNew = false;
for (Integer idx = 0; idx < oldDecVec.GetSize(); idx++)
{
if (oldDecVec(idx) != newDecVec(idx))
{
isNew = true;
break;
}
}
if (!decVector->SetDecisionVector(newDecVec))
{
std::stringstream errmsg("");
errmsg << "Phase::SetDecisionVector: Error setting ";
errmsg << "decision vector on DecisionVector object.\n";
throw LowThrustException(errmsg.str());
}
// Update the time data on the Coll util helper
Rvector timeVector = decVector->GetTimeVector();
transUtil->SetTimeVector(timeVector(0), timeVector(1));
SetTimeInitialGuess(timeVector(0));
SetTimeFinalGuess(timeVector(1));
if (isNew == true)
{
recomputeUserFunctions = true;
recomputeNLPFunctions = true;
// Reset cost Jacobian to zeros so that summing elements
// does not sum across iterations
SparseMatrixUtil::SetSize(nlpCostJacobian, 1, numVarsNLP);
}
else
{
// do nothing. No reason to change flags
/*
recomputeUserFunctions = false;
recomputeNLPFunctions = false;
recomputeAlgPathConstraints = false;
recomputeAlgCostFunction = false;
*/
}
return true;
}
else
{
std::stringstream errmsg("");
errmsg << "Phase::SetDecisionVector: Length of decision vector must be ";
errmsg << "equal to totalnumDecisionVarsNLP\n";
throw LowThrustException(errmsg.str());
}
};
//------------------------------------------------------------------------------
// DecisionVector* GetDecisionVector()
//------------------------------------------------------------------------------
/**
* Returns the decision vector object of the Phase
*
* @return the decision vector object
*
*/
//------------------------------------------------------------------------------
DecisionVector* Phase::GetDecisionVector()
{
return decVector;
}
//------------------------------------------------------------------------------
// Rvector GetDecVector()
//------------------------------------------------------------------------------
/**
* Returns the decision vector
*
* @return the decision vector
*
*/
//------------------------------------------------------------------------------
Rvector Phase::GetDecVector()
{
if (!decVector)
throw LowThrustException("ERROR getting decision vector from Phase!\n");
return decVector->GetDecisionVector();
}
//------------------------------------------------------------------------------
// void SetNumStateVars(Integer toNum)
//------------------------------------------------------------------------------
/**
* Sets the number of state variables
*
*/
//------------------------------------------------------------------------------
void Phase::SetNumStateVars(Integer toNum)
{
if (!config)
throw LowThrustException("ERROR setting num state vars on Phase!\n");
config->SetNumStateVars(toNum);
}
//------------------------------------------------------------------------------
// void SetNumControlVars(Integer toNum)
//------------------------------------------------------------------------------
/**
* Sets the number of control variables
*
*/
//------------------------------------------------------------------------------
void Phase::SetNumControlVars(Integer toNum)
{
if (!config)
throw LowThrustException("ERROR setting num control vars on Phase!\n");
config->SetNumControlVars(toNum);
}
//------------------------------------------------------------------------------
// void SetRelativeErrorTol(Real toNum)
//------------------------------------------------------------------------------
/**
* Sets the maximum realtive error tolerance
*
*/
//------------------------------------------------------------------------------
void Phase::SetRelativeErrorTol(Real toNum)
{
relativeErrorTol = toNum;
}
//------------------------------------------------------------------------------
// Integer GetNumStateVars()
//------------------------------------------------------------------------------
/**
* Returns the number of state variables
*
* @return the number of state variables
*/
//------------------------------------------------------------------------------
Integer Phase::GetNumStateVars()
{
if (!config)
throw LowThrustException("ERROR getting num state vars from Phase!\n");
return config->GetNumStateVars();
}
//------------------------------------------------------------------------------
// Integer GetNumControlVars()
//------------------------------------------------------------------------------
/**
* Returns the number of control variables
*
* @return the number of control variables
*/
//------------------------------------------------------------------------------
Integer Phase::GetNumControlVars()
{
if (!config)
throw LowThrustException("ERROR getting num control vars from Phase!\n");
return config->GetNumControlVars();
}
//------------------------------------------------------------------------------
// Integer GetDefectConStartIdx()
//------------------------------------------------------------------------------
/**
* Returns the start index of the defect constraint
*
* @return the start index of the defect constraint
*/
//------------------------------------------------------------------------------
Integer Phase::GetDefectConStartIdx()
{
return defectConStartIdx;
}
//------------------------------------------------------------------------------
// Integer GetDefectConEndIdx()
//------------------------------------------------------------------------------
/**
* Returns the end index of the defect constraint
*
* @return the end index of the defect constraint
*/
//------------------------------------------------------------------------------
Integer Phase::GetDefectConEndIdx()
{
return defectConEndIdx;
}
//------------------------------------------------------------------------------
// void SetPhaseNumber(Integer toNum)
//------------------------------------------------------------------------------
/**
* Sets the phase number for this phase
*/
//------------------------------------------------------------------------------
void Phase::SetPhaseNumber(Integer toNum)
{
phaseNum = toNum;
}
//------------------------------------------------------------------------------
// Integer GetPhaseNumber()
//------------------------------------------------------------------------------
/**
* Returns the phase number for this phase
*
* @return the phase number
*/
//------------------------------------------------------------------------------
Integer Phase::GetPhaseNumber()
{
return phaseNum;
}
//------------------------------------------------------------------------------
// Rvector GetAllConLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the lower bound vector for all constraints
*
* @return the lower bounds for all constraints
*/
//------------------------------------------------------------------------------
Rvector Phase::GetAllConLowerBound()
{
return allConLowerBound;
}
//------------------------------------------------------------------------------
// Rvector GetAllConUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the upper bound vector for all constraints
*
* @return the upper bounds for all constraints
*/
//------------------------------------------------------------------------------
Rvector Phase::GetAllConUpperBound()
{
return allConUpperBound;
}
//------------------------------------------------------------------------------
// Rvector GetDecVecLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the lower bound vector for the decision vector
*
* @return the lower bounds for the decision vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetDecVecLowerBound()
{
return decisionVecLowerBound;
}
//------------------------------------------------------------------------------
// Rvector GetDecVecUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the upper bound vector for the decision vector
*
* @return the upper bounds for the decision vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetDecVecUpperBound()
{
return decisionVecUpperBound;
}
//------------------------------------------------------------------------------
// void SetMeshIntervalFractions(const Rvector &fractions)
//------------------------------------------------------------------------------
/**
* Sets the mesh interval fractions
*
* @param <fractions> the mesh interval fractions
*/
//------------------------------------------------------------------------------
void Phase::SetMeshIntervalFractions(const Rvector &fractions)
{
config->SetMeshIntervalFractions(fractions);
}
//------------------------------------------------------------------------------
// Rvector GetMeshIntervalFractions()
//------------------------------------------------------------------------------
/**
* Returns the mesh interval fractions
*
* @return the mesh interval fractions
*/
//------------------------------------------------------------------------------
Rvector Phase::GetMeshIntervalFractions()
{
return config->GetMeshIntervalFractions();
}
//------------------------------------------------------------------------------
// void SetMeshIntervalNumPoints(const IntegerArray &toNum)
//------------------------------------------------------------------------------
/**
* Sets the mesh interval number of points
*
* @param <toNum> the mesh interval number of points
*/
//------------------------------------------------------------------------------
void Phase::SetMeshIntervalNumPoints(const IntegerArray &toNum)
{
config->SetMeshIntervalNumPoints(toNum);
}
//------------------------------------------------------------------------------
// IntegerArray GetMeshIntervalNumPoints()
//------------------------------------------------------------------------------
/**
* Returns the mesh interval number of points
*
* @return the mesh interval number of points
*/
//------------------------------------------------------------------------------
IntegerArray Phase::GetMeshIntervalNumPoints()
{
return config->GetMeshIntervalNumPoints();
}
//------------------------------------------------------------------------------
// void SetStateLowerBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the state lower bound vector
*
* @param <bound> the state lower bound vector
*/
//------------------------------------------------------------------------------
void Phase::SetStateLowerBound(const Rvector &bound)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStateLowerBound, bound = ";
for (Integer ii = 0; ii < bound.GetSize(); ii++)
{
debugMsg << bound[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
config->SetStateLowerBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetStateLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the state lower bound vector
*
* @return the state lower bound vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStateLowerBound()
{
return config->GetStateLowerBound();
}
//------------------------------------------------------------------------------
// void SetStateUpperBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the state upper bound vector
*
* @param <bound> the state upper bound vector
*/
//------------------------------------------------------------------------------
void Phase::SetStateUpperBound(const Rvector &bound)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStateUpperBound, bound = ";
for (Integer ii = 0; ii < bound.GetSize(); ii++)
{
debugMsg << bound[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
config->SetStateUpperBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetStateUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the state upper bound vector
*
* @return the state upper bound vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStateUpperBound()
{
return config->GetStateUpperBound();
}
//------------------------------------------------------------------------------
// void SetStateInitialGuess(const Rvector &guess)
//------------------------------------------------------------------------------
/**
* Sets the state initial guess
*
* @param <guess> the state initial guess
*/
//------------------------------------------------------------------------------
void Phase::SetStateInitialGuess(const Rvector &guess)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStateInitialGuess, guess = ";
for (Integer ii = 0; ii < guess.GetSize(); ii++)
{
debugMsg << guess[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
config->SetStateInitialGuess(guess);
}
//------------------------------------------------------------------------------
// Rvector GetStateInitialGuess()
//------------------------------------------------------------------------------
/**
* Returns the state initial guess
*
* @return the state initial guess
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStateInitialGuess()
{
return config->GetStateInitialGuess();
}
//------------------------------------------------------------------------------
// void SetStateFinalGuess(const Rvector &guess)
//------------------------------------------------------------------------------
/**
* Sets the state final guess
*
* @param <guess> the state final guess
*/
//------------------------------------------------------------------------------
void Phase::SetStateFinalGuess(const Rvector &guess)
{
config->SetStateFinalGuess(guess);
}
//------------------------------------------------------------------------------
// Rvector GetStateFinalGuess()
//------------------------------------------------------------------------------
/**
* Returns the state final guess
*
* @return the state final guess
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStateFinalGuess()
{
return config->GetStateFinalGuess();
}
//------------------------------------------------------------------------------
// void SetTimeLowerBound(Real bound)
//------------------------------------------------------------------------------
/**
* Sets the lower bound for the time
*
* @param <bound> the time lower bound
*/
//------------------------------------------------------------------------------
void Phase::SetTimeLowerBound(Real bound)
{
config->SetTimeLowerBound(bound);
}
//------------------------------------------------------------------------------
// Real GetTimeLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the lower bound for the time
*
* @return the time lower bound
*/
//------------------------------------------------------------------------------
Real Phase::GetTimeLowerBound()
{
return config->GetTimeLowerBound();
}
//------------------------------------------------------------------------------
// void SetTimeUpperBound(Real bound)
//------------------------------------------------------------------------------
/**
* Sets the upper bound for the time
*
* @param <bound> the time upper bound
*/
//------------------------------------------------------------------------------
void Phase::SetTimeUpperBound(Real bound)
{
config->SetTimeUpperBound(bound);
}
//------------------------------------------------------------------------------
// Real GetTimeUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the upper bound for the time
*
* @return the time upper bound
*/
//------------------------------------------------------------------------------
Real Phase::GetTimeUpperBound()
{
return config->GetTimeUpperBound();
}
//------------------------------------------------------------------------------
// void SetTimeInitialGuess(Real guess)
//------------------------------------------------------------------------------
/**
* Sets the initial guess for the time
*
* @param <guess> the time initial guess
*/
//------------------------------------------------------------------------------
void Phase::SetTimeInitialGuess(Real guess)
{
config->SetTimeInitialGuess(guess);
}
//------------------------------------------------------------------------------
// Real GetTimeInitialGuess()
//------------------------------------------------------------------------------
/**
* Returns the initial guess for the time
*
* @return the time initial guess
*/
//------------------------------------------------------------------------------
Real Phase::GetTimeInitialGuess()
{
return config->GetTimeInitialGuess();
}
//------------------------------------------------------------------------------
// void SetTimeFinalGuess(Real guess)
//------------------------------------------------------------------------------
/**
* Sets the final guess for the time
*
* @param <guess> the time final guess
*/
//------------------------------------------------------------------------------
void Phase::SetTimeFinalGuess(Real guess)
{
config->SetTimeFinalGuess(guess);
}
//------------------------------------------------------------------------------
// Real GetTimeFinalGuess()
//------------------------------------------------------------------------------
/**
* Returns the final guess for the time
*
* @return the time final guess
*/
//------------------------------------------------------------------------------
Real Phase::GetTimeFinalGuess()
{
return config->GetTimeFinalGuess();
}
//------------------------------------------------------------------------------
// void SetControlLowerBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the lower bound vector for control
*
* @param <bound> the control lower bound
*/
//------------------------------------------------------------------------------
void Phase::SetControlLowerBound(const Rvector &bound)
{
config->SetControlLowerBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetControlLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the lower bound vector for control
*
* @return the control lower bound
*/
//------------------------------------------------------------------------------
Rvector Phase::GetControlLowerBound()
{
return config->GetControlLowerBound();
}
//------------------------------------------------------------------------------
// void SetControlUpperBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the upper bound vector for control
*
* @param <bound> the control upper bound
*/
//------------------------------------------------------------------------------
void Phase::SetControlUpperBound(const Rvector &bound)
{
config->SetControlUpperBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetControlUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the upper bound vector for control
*
* @return the control upper bound
*/
//------------------------------------------------------------------------------
Rvector Phase::GetControlUpperBound()
{
return config->GetControlUpperBound();
}
//------------------------------------------------------------------------------
// Integer GetNumTotalConNLP()
//------------------------------------------------------------------------------
/**
* Returns the total number of constraints
*
* @return the total number of constraints
*/
//------------------------------------------------------------------------------
Integer Phase::GetNumTotalConNLP()
{
return config->GetNumTotalConNLP();
}
//------------------------------------------------------------------------------
// Integer GetNumDecisionVarsNLP()
//------------------------------------------------------------------------------
/**
* Returns the number of decision variables
*
* @return the number of decision variables
*/
//------------------------------------------------------------------------------
Integer Phase::GetNumDecisionVarsNLP()
{
return config->GetNumDecisionVarsNLP();
}
//------------------------------------------------------------------------------
// IntegerArray GetNumNLPNonZeros()
//------------------------------------------------------------------------------
/**
* Returns the array of number of non-zero elements
*
* @return array of number of non-zero elements
*/
//------------------------------------------------------------------------------
IntegerArray Phase::GetNumNLPNonZeros()
{
// Get number of defect contraints
IntegerArray numNonZeros;
Integer numAZerosTot = 0;
Integer numBZerosTot = 0;
Integer numQZerosTot = 0;
if (config->HasAlgPathCons())
{
IntegerArray nums = algPathNLPFuncUtil->GetMatrixNumNonZeros();
numAZerosTot += nums[0];
numBZerosTot += nums[1];
numQZerosTot += nums[2];
}
if (config->HasDefectCons())
{
IntegerArray nums = transUtil->GetDefectMatrixNumNonZeros();
numAZerosTot += nums[0];
numBZerosTot += nums[1];
numQZerosTot += nums[2];
}
numNonZeros.push_back(numAZerosTot);
numNonZeros.push_back(numBZerosTot);
numNonZeros.push_back(numQZerosTot);
return numNonZeros;
}
//------------------------------------------------------------------------------
// void SetNumStaticVars(Integer toNum)
//------------------------------------------------------------------------------
/**
* Sets the number of state variables; YK mod static params
*
*/
//------------------------------------------------------------------------------
void Phase::SetNumStaticVars(Integer toNum)
{
if (!config)
throw LowThrustException("ERROR setting num state vars on Phase!\n");
config->SetNumStaticVars(toNum);
}
//------------------------------------------------------------------------------
// Integer GetNumStaticVars()
//------------------------------------------------------------------------------
/**
* Returns the number of state variables; YK mod static params
*
* @return the number of state variables
*/
//------------------------------------------------------------------------------
Integer Phase::GetNumStaticVars()
{
if (!config)
throw LowThrustException("ERROR getting num state vars from Phase!\n");
return config->GetNumStaticVars();
}
//------------------------------------------------------------------------------
// void SetStaticLowerBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the state lower bound vector; YK mod static params
*
* @param <bound> the state lower bound vector
*/
//------------------------------------------------------------------------------
void Phase::SetStaticLowerBound(const Rvector &bound)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStaticLowerBound, bound = ";
for (Integer ii = 0; ii < bound.GetSize(); ii++)
{
debugMsg << bound[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
config->SetStaticLowerBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetStaticLowerBound()
//------------------------------------------------------------------------------
/**
* Returns the state lower bound vector; YK mod static params
*
* @return the state lower bound vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStaticLowerBound()
{
return config->GetStaticLowerBound();
}
//------------------------------------------------------------------------------
// void SetStaticUpperBound(const Rvector &bound)
//------------------------------------------------------------------------------
/**
* Sets the state upper bound vector; YK mod static params
*
* @param <bound> the state upper bound vector
*/
//------------------------------------------------------------------------------
void Phase::SetStaticUpperBound(const Rvector &bound)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStaticUpperBound, bound = ";
for (Integer ii = 0; ii < bound.GetSize(); ii++)
{
debugMsg << bound[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
config->SetStaticUpperBound(bound);
}
//------------------------------------------------------------------------------
// Rvector GetStaticUpperBound()
//------------------------------------------------------------------------------
/**
* Returns the state upper bound vector; YK mod static params
*
* @return the state upper bound vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStaticUpperBound()
{
return config->GetStaticUpperBound();
}
//------------------------------------------------------------------------------
// void SetStaticInitialGuess(const Rvector &guess)
//------------------------------------------------------------------------------
/**
* Sets the static vector initial guess; YK mod static params
*
* @param <guess> the state initial guess
*/
//------------------------------------------------------------------------------
void Phase::SetStaticGuess(const Rvector &guess)
{
#ifdef DEBUG_BOUNDS_VALUES
std::stringstream debugMsg;
debugMsg << "In Phase::SetStaticInitialGuess, guess = ";
for (Integer ii = 0; ii < guess.GetSize(); ii++)
{
debugMsg << guess[ii] << " ";
}
std::cout << debugMsg.str().c_str() << std::endl;
#endif
// YK mod static vars: there are two copies of static vector.
/// first, decision vector. second, problem configuration.
config->SetStaticVector(guess);
// now, dec vector is not defined yet.
// thus, handle it at InitializeDecisionVector() method
///decVector->SetStaticVector(guess);
}
//------------------------------------------------------------------------------
// Rvector GetTimeVector()
//------------------------------------------------------------------------------
/**
* Returns the time vector
*
* @return the time vector
*/
//------------------------------------------------------------------------------
Rvector Phase::GetTimeVector()
{
return transUtil->GetTimeVector();
}
//------------------------------------------------------------------------------
// void InitializeNLPHelpers()
//------------------------------------------------------------------------------
/**
* Initializes the NLP helper classes
*
*/
//------------------------------------------------------------------------------
void Phase::InitializeNLPHelpers()
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("Entering InitializeNLPHelpers ...\n");
#endif
// Initialization for quadrature type functions
if (dynFunctionProps)
{
delete dynFunctionProps;
dynFunctionProps = NULL;
}
if (pathFunctionManager->HasDynFunctions())
dynFunctionProps = new UserFunctionProperties(pathFunctionManager->
GetDynFunctionProperties());
if (costFunctionProps)
{
delete costFunctionProps;
costFunctionProps = NULL;
}
if (pathFunctionManager->HasCostFunction())
costFunctionProps = new UserFunctionProperties(pathFunctionManager->
GetCostFunctionProperties());
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"About to call ComputeUserFunctions ...\n");
#endif
ComputeUserFunctions();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("About to call PrepareToOptimize ...\n");
if (!transUtil)
MessageInterface::ShowMessage("transUtil is NULL!!!!\n");
MessageInterface::ShowMessage(" --- dynFunctionProps (%s) = <%p>\n",
(pathFunctionManager->HasDynFunctions()? "true" : "false"),
dynFunctionProps);
MessageInterface::ShowMessage(" --- costFunctionProps (%s) = <%p>\n",
(pathFunctionManager->HasCostFunction()? "true" : "false"),
costFunctionProps);
#endif
if (pathFunctionManager->HasCostFunction()) // TEMPORARY!!!
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("-- there IS a cost function ...\n");
#endif
transUtil->PrepareToOptimize(*dynFunctionProps, userDynFunctionData,
*costFunctionProps,costIntFunctionData);
}
else
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("-- there IS NO cost function ...\n");
#endif
transUtil->PrepareToOptimize(*dynFunctionProps, userDynFunctionData);
}
transUtil->SetPhaseNum(phaseNum);
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("AFTER call to PrepareToOptimize ...\n");
#endif
// Initialization for algebraic path functions
if (pathFunctionManager->HasAlgFunctions())
{
// Set up the properties for the algebraic functions
if (algFunctionProps)
delete algFunctionProps;
algFunctionProps = new UserFunctionProperties(pathFunctionManager->
GetAlgFunctionProperties());
algFunctionProps->SetHasStateVars(config->HasStateVars());
algFunctionProps->SetHasControlVars(config->HasControlVars());
// YK mod static params
algFunctionProps->SetHasStaticVars(config->HasStaticVars());
// Build array needed by NLP util but computed by Coll util
Integer numPathConPoints = transUtil->GetNumPathConstraintPoints();
Rvector dTimedTi(numPathConPoints);
Rvector dTimedTf(numPathConPoints);
for (Integer ptIdx = 0; ptIdx < numPathConPoints; ptIdx++)
{
// mod by YK for RK collocation implementation; as in MATLAB prototype
Integer meshIdx = userAlgFunctionData.at(ptIdx)->GetMeshIdx();
Integer stageIdx = userAlgFunctionData.at(ptIdx)->GetStageIdx();
dTimedTi(ptIdx) = transUtil->GetdCurrentTimedTI(meshIdx, stageIdx);
dTimedTf(ptIdx) = transUtil->GetdCurrentTimedTF(meshIdx, stageIdx);
}
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"In InitializeNLPHelpers, initializing algPathNLPFuncUtil ...\n");
MessageInterface::ShowMessage(" numPathConPoints = %d\n",
numPathConPoints);
Integer r;
r = dTimedTi.GetSize();
MessageInterface::ShowMessage(" size of dTimedTi is %d \n", r);
r = dTimedTf.GetSize();
MessageInterface::ShowMessage(" size of dTimedTf is %d \n", r);
#endif
// Intialize the NLP util
Integer numConstraintPts = transUtil->GetNumPathConstraintPoints();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" numConstraintPts = %d\n",
numConstraintPts);
MessageInterface::ShowMessage(" algFunctionProps = <%p>\n",
algFunctionProps);
MessageInterface::ShowMessage(" algPathNLPFuncUtil = <%p>\n",
algPathNLPFuncUtil);
#endif
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" NOW algPathNLPFuncUtil created\n");
MessageInterface::ShowMessage(" NOW algPathNLPFuncUtil = <%p>\n",
algPathNLPFuncUtil);
#endif
algPathNLPFuncUtil->Initialize(algFunctionProps,userAlgFunctionData,
decVector->GetNumDecisionParams(),
numConstraintPts,dTimedTi,dTimedTf);
}
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("LEAVING InitializeNLPHelpers ...\n");
#endif
}
//------------------------------------------------------------------------------
// Rvector GetConstraintVector()
//------------------------------------------------------------------------------
/**
* Assembles the total constraint vector for the phase (note: assumes these are
* in order ???)
*
* @return the constraint vector
*
*/
//------------------------------------------------------------------------------
Rvector Phase::GetConstraintVector()
{
Rvector result(algPathConEndIdx - defectConStartIdx + 1);
// Update functions if they need to be recomputed
CheckFunctions();
// Assemble the total constraint vector
if (pathFunctionManager->HasDynFunctions())
{
Integer jj = 0;
for (Integer ii = defectConStartIdx; ii <= defectConEndIdx; ii++)
result(ii) = defectConVec(jj++);
}
if (pathFunctionManager->HasAlgFunctions())
{
Integer jj = 0;
for (Integer ii = algPathConStartIdx; ii <= algPathConEndIdx; ii++)
result(ii) = algPathConVec(jj++);
}
return result;
}
//------------------------------------------------------------------------------
// StringArray GetConstraintVectorNames()
//------------------------------------------------------------------------------
/**
* Assembles the total constraint vector descriptions cell array for the phase
*
* @return an array of the constraint vector names
*
*/
//------------------------------------------------------------------------------
StringArray Phase::GetConstraintVectorNames()
{
StringArray constraintNames;
// Assemble the total constraint vector
Integer meshIdx = 0;
Integer nStateVars = 0;
Integer nAlgFuns = 0;
if (pathFunctionManager->HasDynFunctions())
{
for (Integer ii = defectConStartIdx; ii <= defectConEndIdx; ii++)
{
nStateVars++;
std::stringstream phaseStr("");
phaseStr << "Phase ";
phaseStr << phaseNum << ", Mesh Index ";
phaseStr << meshIdx << ": State Variable ";
phaseStr << nStateVars;
constraintNames.push_back(phaseStr.str());
if (config->GetNumStateVars() == nStateVars)
{
meshIdx++;
nStateVars = 0;
}
}
}
if (pathFunctionManager->HasAlgFunctions())
{
meshIdx = 0;
nAlgFuns = 0;
for (Integer ii = algPathConStartIdx; ii <= algPathConEndIdx; ii++)
{
std::stringstream phaseStr("");
phaseStr << "Phase ";
phaseStr << phaseNum << ", Mesh Index " << meshIdx;
if (algPathConVecNames.empty())
{
phaseStr << ": User Path Constraint ";
phaseStr << nAlgFuns;
}
else
{
phaseStr << ": ";
phaseStr << algPathConVecNames.at(nAlgFuns);
}
nAlgFuns++;
constraintNames.push_back(phaseStr.str());
if (pathFunctionManager->GetNumAlgFunctions() == nAlgFuns)
{
meshIdx++;
nAlgFuns = 0;
}
}
}
return constraintNames;
}
//------------------------------------------------------------------------------
// Real GetCostFunction()
//------------------------------------------------------------------------------
/**
* Computes and returns the cost function value
*
* @return the cost function value
*
*/
//------------------------------------------------------------------------------
Real Phase::GetCostFunction()
{
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("Entering Phase::GetCostFunction ...\n");
#endif
CheckFunctions();
Real costFunction = 0;
if (pathFunctionManager->HasCostFunction())
costFunction += costFunctionIntegral;
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("LEAVING Phase::GetCostFunction ...\n");
#endif
return costFunction;
}
//------------------------------------------------------------------------------
// void ComputeDefectConstraints()
//------------------------------------------------------------------------------
/**
* Inserts the defect constraints and Jacobian into the constraint vector
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeDefectConstraints()
{
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage(
"Entering Phase::ComputeDefectConstraints ...\n");
MessageInterface::ShowMessage(" isInitialized = %s\n",
(isInitialized? "true" : "false"));
#endif
// If not intialized, cannot compute functions.
if (!isInitialized)
return;
Rvector fData;
RSMatrix jac;
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("In Phase::ComputeDefectConstraints, calling ComputeDefectFunAnfJac ...\n");
#endif
transUtil->ComputeDefectFunAndJac(userDynFunctionData,
(DecVecTypeBetts*) decVector,
fData, jac);
// resize defectConVec for MR; YK mod
defectConVec.SetSize(fData.GetSize());
defectConVec = fData;
IntegerArray idxs;
idxs.push_back(defectConStartIdx);
idxs.push_back(defectConEndIdx);
InsertJacobianRowChunk(jac,idxs);
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage(
"LEAVING Phase::ComputeDefectConstraints ...\n");
#endif
}
//------------------------------------------------------------------------------
// void ComputeIntegralCost()
//------------------------------------------------------------------------------
/**
* Inserts the integral cost and Jacobian into the appropriatelocations
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeIntegralCost()
{
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage(
"Entering Phase::ComputeIntegralCost ...\n");
#endif
// Insert the integral cost and Jacobian into the appropriatelocations
// If not intialized, cannot compute functions.
if (!isInitialized)
return;
Rvector fData;
RSMatrix jac;
transUtil->ComputeCostFunAndJac(costIntFunctionData,
(DecVecTypeBetts*) decVector, fData,
nlpCostJacobian);
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage(
"--- done calling ComputeCostFunAndJac ...\n");
#endif
costFunctionIntegral = fData[0];
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("LEAVING Phase::ComputeIntegralCost ...\n");
#endif
}
//------------------------------------------------------------------------------
// void ComputeAlgebraicPathConstraints()
//------------------------------------------------------------------------------
/**
* Inserts algebraic path constraints and the Jacobian into the constraint
* vector
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeAlgebraicPathConstraints()
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"Phase: ComputeAlgebraicPathConstraints ...\n");
MessageInterface::ShowMessage(
" isInitialized? %s\n", (isInitialized? "YES" : "no"));
MessageInterface::ShowMessage(
" algPathConStartIdx = %d\n", algPathConStartIdx);
MessageInterface::ShowMessage(
" algPathConEndIdx = %d\n", algPathConEndIdx);
MessageInterface::ShowMessage(" size of userAlgFunctionData = %d\n",
(Integer) userAlgFunctionData.size());
#endif
// If not intialized, cannot compute functions.
if (!isInitialized)
return;
Rvector fVal;
RSMatrix jacValues;
IntegerArray idxs;
for (Integer ii = algPathConStartIdx; ii <= algPathConEndIdx; ii++)
idxs.push_back(ii);
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"Phase: calling ComputeFuncAndJac ...\n");
#endif
algPathNLPFuncUtil->ComputeFuncAndJac(userAlgFunctionData, fVal, jacValues);
// resizing for MR; YK mod
algPathConVec.SetSize(fVal.GetSize());
algPathConVec = fVal;
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"Phase: inserting jacobian row chunk ...\n");
#endif
InsertJacobianRowChunk(jacValues,idxs);
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"LEAVING Phase: ComputeAlgebraicPathConstraints ...\n");
#endif
}
//------------------------------------------------------------------------------
// void SetRecomputeUserFunctions(bool toFlag)
//------------------------------------------------------------------------------
/**
* Sets the flag indicating whether or not the user functions need to be
* recomputed. For debugging, this allows you to set user functions to
* recompute even when there is no change in decision vector.
*
* @param <toFlag> input flag value
*
*/
//------------------------------------------------------------------------------
void Phase::SetRecomputeUserFunctions(bool toFlag)
{
recomputeUserFunctions = toFlag;
}
//------------------------------------------------------------------------------
// RSMatrix GetCostJacobian()
//------------------------------------------------------------------------------
/**
* Returns the total Jacobian of the cost function by summing
* Jacobian of algebraic and quadrature terms
*
* @return total jacobian of the cost function
*
*/
//------------------------------------------------------------------------------
RSMatrix Phase::GetCostJacobian()
{
return nlpCostJacobian;
}
//------------------------------------------------------------------------------
// RSMatrix GetConJacobian()
//------------------------------------------------------------------------------
/**
* Returns the constraint Jacobian
*
* @return the constraint jacobian
*
*/
//------------------------------------------------------------------------------
RSMatrix Phase::GetConJacobian()
{
return nlpConstraintJacobian;
}
//------------------------------------------------------------------------------
// RSMatrix GetCostSparsityPattern()
//------------------------------------------------------------------------------
/**
* Returns the cost sparsity pattern
*
* @return the cost sparsity pattern
*
*/
//------------------------------------------------------------------------------
RSMatrix Phase::GetCostSparsityPattern()
{
return costSparsityPattern;
}
//------------------------------------------------------------------------------
// RSMatrix GetConSparsityPattern()
//------------------------------------------------------------------------------
/**
* Returns the constraint sparsity pattern
*
* @return the constraint sparsity pattern
*
*/
//------------------------------------------------------------------------------
RSMatrix Phase::GetConSparsityPattern()
{
return conSparsityPattern;
}
//------------------------------------------------------------------------------
// Rvector GetInitialFinalTime()
//------------------------------------------------------------------------------
/**
* Returns the initial final time
*
* @return the initial final time
*
*/
//------------------------------------------------------------------------------
Rvector Phase::GetInitialFinalTime()
{
Rvector times(2, decVector->GetFirstTime(), decVector->GetLastTime());
return times;
}
//------------------------------------------------------------------------------
// void DebugPathFunction()
//------------------------------------------------------------------------------
/**
* Debugs the path function
*
*/
//------------------------------------------------------------------------------
void Phase::DebugPathFunction()
{
ComputePathFunctions();
}
//------------------------------------------------------------------------------
// bool HasAlgPathCons()
//------------------------------------------------------------------------------
/**
* Returns a flag indicating whether or not there is an algebraic path
* constraint
*
* @return flag indicating whether or not there is an algebraic path
* constraint
*
*/
//------------------------------------------------------------------------------
bool Phase::HasAlgPathCons()
{
return config->HasAlgPathCons();
}
//------------------------------------------------------------------------------
// void ComputeAlgFuncAndJac(Rvector &funcValues,RSMatrix &jacArray)
//------------------------------------------------------------------------------
/**
* Calls the NLP utility to compute the function and Jacobian
*
* @param <funcValues> output - computed function values
* @param <jacArray> output - computed Jacobian matrix
*
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeAlgFuncAndJac(Rvector &funcValues,
RSMatrix &jacArray)
{
algPathNLPFuncUtil->ComputeFuncAndJac(userAlgFunctionData,
funcValues, jacArray);
}
//------------------------------------------------------------------------------
// Rmatrix GetStateArray()
//------------------------------------------------------------------------------
/**
* Returns the decision vector state matrix
*
* @return the decision vector state matrix
*/
//------------------------------------------------------------------------------
Rmatrix Phase::GetStateArray()
{
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
return decVector->GetStateArray();
}
//------------------------------------------------------------------------------
// Rmatrix GetControlArray()
//------------------------------------------------------------------------------
/**
* Returns the decision vector control matrix
*
* @return the decision vector control matrix
*/
//------------------------------------------------------------------------------
Rmatrix Phase::GetControlArray()
{
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
return decVector->GetControlArray();
}
//------------------------------------------------------------------------------
// Rmatrix GetStaticVector()
//------------------------------------------------------------------------------
/**
* Returns the decision vector static matrix
*
* @return the decision vector static matrix
*/
//------------------------------------------------------------------------------
Rvector Phase::GetStaticVector()
{
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
return decVector->GetStaticVector();
}
//------------------------------------------------------------------------------
// void SetStateArray(Rmatrix stateArray)
//------------------------------------------------------------------------------
/**
* Sets the decision vector state matrix
*
* @param <stateArray> the array of state guesses
*
*/
//------------------------------------------------------------------------------
void Phase::SetStateArray(Rmatrix stateArray)
{
if (transUtil->GetNumStatePoints() != stateArray.GetNumRows() ||
GetNumStateVars() != stateArray.GetNumColumns())
throw LowThrustException("ERROR - State Array dimensions are not valid!\n");
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
recomputeUserFunctions = true;
recomputeNLPFunctions = true;
return decVector->SetStateArray(stateArray);
}
//------------------------------------------------------------------------------
// void SetControlArray(Rmatrix controlArray)
//------------------------------------------------------------------------------
/**
* Sets the decision vector control matrix
*
* @param <controlArray> the array of control guesses
*/
//------------------------------------------------------------------------------
void Phase::SetControlArray(Rmatrix controlArray)
{
if (transUtil->GetNumControlPoints() != controlArray.GetNumRows() ||
GetNumControlVars() != controlArray.GetNumColumns())
throw LowThrustException("ERROR - State Array dimensions are not valid!\n");
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
recomputeUserFunctions = true;
recomputeNLPFunctions = true;
return decVector->SetControlArray(controlArray);
}
//------------------------------------------------------------------------------
// void UpdateStaticVector()
//------------------------------------------------------------------------------
/**
* Update the static vector stored in prblem characteristic using decision vector
*
*/
//------------------------------------------------------------------------------
void Phase::UpdateStaticVector()
{
// YK mod static vars: there are two copies of static vector.
/// first, decision vector. second, problem configuration.
config->SetStaticVector(decVector->GetStaticVector());
return;
}
//------------------------------------------------------------------------------
// Real GetFirstTime()
//------------------------------------------------------------------------------
/**
* Returns the decision vector initial time
*
* @return the decision vector initial time
*/
//------------------------------------------------------------------------------
Real Phase::GetFirstTime()
{
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
return decVector->GetFirstTime();
}
//------------------------------------------------------------------------------
// Real GetLastTime()
//------------------------------------------------------------------------------
/**
* Returns the decision vector final time
*
* @return the decision vector final time
*/
//------------------------------------------------------------------------------
Real Phase::GetLastTime()
{
if (!decVector)
throw LowThrustException("ERROR - decision vector is NULL!\n");
return decVector->GetLastTime();
}
//------------------------------------------------------------------------------
// ScalingUtility* GetScaleUtility()
//------------------------------------------------------------------------------
/**
* Returns the pointer to the scale utility object
*
* @return the scale utility object
*/
//------------------------------------------------------------------------------
ScalingUtility* Phase::GetScaleUtility()
{
if (!scaleUtil)
throw LowThrustException("ERROR - scale utility is NULL!\n");
return scaleUtil;
}
//------------------------------------------------------------------------------
// void ReportBoundsData(bool addHeader = true)
//------------------------------------------------------------------------------
/**
* Reports Bounds data to the log.
* TBD: review report output changes due to static variables
*
* NOTE: the following assumptions are made:
* size of lower and upper bounds are the same for state
* size of lower and upper bounds are the same for control
* size of lower and upper bounds are the same for static
* size of any of these vectors does not exceed 99
* size of the time vector does not exceed perLine
*
*/
//------------------------------------------------------------------------------
void Phase::ReportBoundsData(bool addHeader)
{
Integer perLine = 5;
Real timeLow = GetTimeLowerBound();
Real timeUp = GetTimeUpperBound();
Rvector stateLow = GetStateLowerBound();
Rvector controlLow = GetControlLowerBound();
Rvector staticLow = GetStaticLowerBound();
Rvector stateUp = GetStateUpperBound();
Rvector controlUp = GetControlUpperBound();
Rvector staticUp = GetStaticUpperBound();
// Assume size of lower and upper bounds are the same for state
// Assume size of lower and upper bounds are the same for control
// Assume size of lower and upper bounds are the same for static params
// Assume that the size of any of these vectors does not exceed 99
// Assume that the size of the time vector does not exceed perLine
Integer szStateLow = stateLow.GetSize();
Integer szControlLow = controlLow.GetSize();
Integer szStaticLow = staticLow.GetSize();
Integer szStateUp = stateUp.GetSize();
Integer szControlUp = controlUp.GetSize();
Integer szStaticUp = staticUp.GetSize();
Integer stateIdx = 0;
Integer controlIdx = 0;
Integer staticIdx = 0;
std::stringstream boundsMsg;
std::stringstream boundsHeader;
boundsMsg.width(12);
boundsMsg.fill(' ');
boundsMsg.setf(std::ios::left);
boundsMsg.precision(7);
boundsMsg.setf(std::ios::fixed,std::ios::floatfield);
// Write the header if requested
// Write the header if requested
if (addHeader)
boundsMsg << ReportHeaderData();
// Write the section header and divider
boundsMsg << " =============================================== Bounds " <<
"=================================================" << std::endl;
boundsMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Figure out the header based on the sizes of the vectors
boundsHeader << " ";
// Write the header
Integer count = 0;
for (Integer ii = 0; ii < szStateLow; ii++)
{
boundsHeader << "STATE";
if (ii < 10)
boundsHeader << "0";
boundsHeader << ii << " ";
count++;
if (count >= perLine && ii < (szStateLow-1))
{
boundsHeader << std::endl;
boundsHeader << " ";
count = 0;
}
}
for (Integer ii = 0; ii < szControlLow; ii++)
{
boundsHeader << "CNTRL";
if (ii < 10)
boundsHeader << "0";
boundsHeader << ii << " ";
count++;
if (count >= perLine && ii < (szControlLow-1))
{
boundsHeader << std::endl;
boundsHeader << " ";
count = 0;
}
}
// YK mod static params
for (Integer ii = 0; ii < szStaticLow; ii++)
{
boundsHeader << "STATIC";
if (ii < 10)
boundsHeader << "0";
boundsHeader << ii << " ";
count++;
if (count >= perLine && ii < (szStaticLow - 1))
{
boundsHeader << std::endl;
boundsHeader << " ";
count = 0;
}
}
boundsMsg << boundsHeader.str() << std::endl;
boundsMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Write the state and control data here
count = 0;
boundsMsg << " Lower Bounds ";
for (Integer ii = 0; ii < szStateLow; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(stateLow(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szStateLow-1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
for (Integer ii = 0; ii < szControlLow; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(controlLow(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szControlLow-1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
// YK mod static params
for (Integer ii = 0; ii < szStaticLow; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(staticLow(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szStaticLow - 1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
count = 0;
boundsMsg << std::endl << " Upper Bounds ";
for (Integer ii = 0; ii < szStateUp; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(stateUp(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szStateUp-1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
for (Integer ii = 0; ii < szControlUp; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(controlUp(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szControlUp-1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
for (Integer ii = 0; ii < szStaticUp; ii++)
{
boundsMsg << GmatStringUtil::BuildNumber(staticUp(ii), true, 12) << " ";
count++;
if (count >= perLine && ii < (szStaticUp - 1))
{
boundsMsg << std::endl;
boundsMsg << " ";
count = 0;
}
}
boundsMsg << std::endl;
boundsMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
boundsMsg << " Time" << std::endl;
boundsMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Write the time data here
boundsMsg << " Lower Bounds ";
boundsMsg << GmatStringUtil::BuildNumber(timeLow, true);
boundsMsg << std::endl;
boundsMsg << " Upper Bounds ";
boundsMsg << GmatStringUtil::BuildNumber(timeUp, true);
boundsMsg << std::endl;
MessageInterface::ShowMessage("%s\n", boundsMsg.str().c_str());
}
//------------------------------------------------------------------------------
// void ReportDecisionVectorData(bool addHeader = true)
//------------------------------------------------------------------------------
/**
* Reports Decision Vector data (parameters and dynamic variables) to the log.
* TBD: review report changes due to static params
*
*/
//------------------------------------------------------------------------------
void Phase::ReportDecisionVectorData(bool addHeader)
{
Integer perLine = 5;
// Get initial and final times
Real tInit = GetFirstTime();
Real tFinal = GetLastTime();
// Get State and Control Data
Rmatrix stateData = GetStateArray();
Rmatrix controlData = GetControlArray();
// Get the time vector
Rvector times = GetTimeVector();
Integer numTimes = times.GetSize();
IntegerArray timeTypes = transUtil->GetTimeVectorType();
Integer numTimeTypes = timeTypes.size();
// Get static parameters
Rvector staticVec = GetStaticVector();
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("--- size of times is %d\n", numTimes);
MessageInterface::ShowMessage("--- size of time types is %d\n", numTimeTypes);
#endif
// How big are these arrays?
Integer stateX, stateY, controlX, controlY;
stateData.GetSize(stateX, stateY);
controlData.GetSize(controlX, controlY);
std::stringstream decVecMsg;
std::stringstream decVecHeader;
decVecMsg.width(12);
decVecMsg.fill(' ');
// decVecMsg(std::ios::scientific);
decVecMsg.setf(std::ios::left);
decVecMsg.precision(7);
decVecMsg.setf(std::ios::fixed,std::ios::floatfield);
// Write the header if requested
if (addHeader)
decVecMsg << ReportHeaderData();
// Write the Parameters section header and divider and data
decVecMsg << " ============================================= Parameters " <<
"===============================================" << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
decVecMsg << " TINIT TFINAL" << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
decVecMsg << " ";
decVecMsg << tInit << " " << tFinal << std::endl;
// Write the Static Variables section header and data; YK mod static params
decVecMsg << " ========================================== Static Variables " <<
"===========================================" << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
Integer count = 0;
for (Integer ii = 0; ii < staticVec.GetSize(); ii++)
{
decVecHeader << "STATIC";
if (ii < 10)
decVecHeader << "0";
decVecHeader << ii << " ";
count++;
if (count >= perLine && ii < (staticVec.GetSize() - 1))
{
decVecHeader << std::endl;
decVecHeader << " ";
count = 0;
}
}
decVecMsg << decVecHeader.str() << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Write static parameter data; YK mod static params
count = 0;
Integer staticIdx = 0;
for (Integer jj = 0; jj < staticVec.GetSize(); jj++)
{
decVecMsg << GmatStringUtil::BuildNumber(staticVec(jj), true, 13) << " ";
count++;
if (count >= perLine && jj < (stateY - 1))
{
decVecMsg << std::endl;
decVecMsg << " ";
count = 0;
}
}
decVecMsg << std::endl;
// Write the Dynamic Variables section header and data
decVecMsg << " ========================================== Dynamic Variables " <<
"===========================================" << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
decVecMsg << " Point TIME ";
count = 0;
for (Integer ii = 0; ii < stateY; ii++)
{
decVecHeader << "STATE";
if (ii < 10)
decVecHeader << "0";
decVecHeader << ii << " ";
count++;
if (count >= perLine && ii < (stateY-1))
{
decVecHeader << std::endl;
decVecHeader << " ";
count = 0;
}
}
for (Integer ii = 0; ii < controlY; ii++)
{
decVecHeader << "CNTRL";
if (ii < 10)
decVecHeader << "0";
decVecHeader << ii << " ";
count++;
if (count >= perLine && ii < (controlY-1))
{
decVecHeader << std::endl;
decVecHeader << " ";
count = 0;
}
}
decVecMsg << decVecHeader.str() << std::endl;
decVecMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Write point number, time, state and control data
count = 0;
Integer stateIdx = 0;
Integer cntrlIdx = 0;
for (Integer ii = 0; ii < numTimes; ii++)
{
count = 0;
decVecMsg << " " << std::setw(5) << std::setfill(' ') << ii;
decVecMsg << " " <<
GmatStringUtil::BuildNumber(times(ii), true, 13) << " ";
Integer itsType = timeTypes.at(ii);
if ((itsType == 1) || (itsType == 2)) // if not, need blanks here??????
{
for (Integer jj = 0; jj < stateY; jj++)
{
decVecMsg << GmatStringUtil::BuildNumber(stateData(stateIdx,jj), true, 13) << " ";
count++;
if (count >= perLine && jj < (stateY-1))
{
decVecMsg << std::endl;
decVecMsg << " ";
count = 0;
}
}
stateIdx++;
}
if ((itsType == 1) || (itsType == 3))
{
for (Integer jj = 0; jj < controlY; jj++)
{
decVecMsg << GmatStringUtil::BuildNumber(controlData(cntrlIdx,jj), true, 13) << " ";
count++;
if (count >= perLine && jj < (controlY-1))
{
decVecMsg << std::endl;
decVecMsg << " ";
count = 0;
}
}
cntrlIdx++;
}
decVecMsg << std::endl;
}
decVecMsg << std::endl;
MessageInterface::ShowMessage(decVecMsg.str().c_str());
}
//------------------------------------------------------------------------------
// void ReportDefectConstraintData(bool addHeader)
//------------------------------------------------------------------------------
/**
* Reports Differential Constraint data to the log.
*
*
*/
//------------------------------------------------------------------------------
void Phase::ReportDefectConstraintData(bool addHeader)
{
std::stringstream defectMsg;
Integer perLine = 6;
// Write the header if requested
if (addHeader)
defectMsg << ReportHeaderData();
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to get the number of states and stuff ...\n");
#endif
Integer numStates = GetNumStateVars();
// Get the time vector
Rvector times = GetTimeVector();
Integer numTimes = times.GetSize();
IntegerArray timeTypes = transUtil->GetTimeVectorType();
Integer numTimeTypes = timeTypes.size();
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to set the width etc. ...\n");
MessageInterface::ShowMessage(" numStates = %d, numTimes = %d, numTimeTypes = %d\n",
numStates, numTimes, numTimeTypes);
MessageInterface::ShowMessage(" perLine = %d\n", perLine);
MessageInterface::ShowMessage(" size of defectConVec = %d\n",
defectConVec.GetSize());
#endif
defectMsg.width(12);
defectMsg.fill(' ');
defectMsg.setf(std::ios::scientific);
defectMsg.setf(std::ios::left);
defectMsg.precision(7);
// Write the header
defectMsg << " ====================================== Differential Constraints " <<
"========================================" << std::endl;
defectMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
defectMsg << " Intrvl ";
// Write the rest of the header
Integer count = 0;
for (Integer ii = 0; ii < numStates; ii++)
{
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("IN THE LOOP (numStates) ...\n");
MessageInterface::ShowMessage(" ii = %d, count = %d\n",
ii, count);
#endif
defectMsg << "DEFECT";
if (ii < 10)
defectMsg << "0";
defectMsg << ii << " ";
count++;
if ((count >= perLine) && ii < (numStates-1))
{
defectMsg << std::endl;
defectMsg << " ";
count = 0;
}
}
defectMsg << std::endl;
defectMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
// Write the data
// Only time vector type 1 has these constraints
Integer startIdx = 0;
Integer stopIdx = numStates - 1;
for (Integer ii = 0; ii < numTimeTypes - constraintTimeOffset; ii++)
{
count = 0;
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("IN THE LOOP (numTimeTypes) ...\n");
MessageInterface::ShowMessage(" ii = %d, count = %d\n",
ii, count);
MessageInterface::ShowMessage(" constraintTimeOffset = %d\n",
constraintTimeOffset);
#endif
if (timeTypes.at(ii) == 1)
{
defectMsg << " " << std::setw(5) << std::setfill(' ') << ii;
defectMsg << " ";
// << GmatStringUtil::BuildNumber(times(ii), true, 13) << " ";
for (Integer jj = 0; jj < numStates; jj++)
{
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("IN THE LOOP (numStates) ...\n");
MessageInterface::ShowMessage(" jj = %d, count = %d\n",
jj, count);
#endif
defectMsg << GmatStringUtil::BuildNumber(defectConVec(startIdx + jj), true, 12) << " ";
count++;
// if we've reached the end of the line and there are more things to write
if ((count >= perLine) && jj < (numStates-1))
{
defectMsg << std::endl;
defectMsg << " ";
count = 0;
}
}
defectMsg << std::endl;
}
startIdx += numStates;
stopIdx += numStates;
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("AT END OF THE LOOP (numTimeTypes) ...\n");
MessageInterface::ShowMessage(" startIdx = %d, stopIdx = %d\n",
startIdx, stopIdx);
#endif
}
defectMsg << std::endl;
MessageInterface::ShowMessage(defectMsg.str().c_str());
}
//------------------------------------------------------------------------------
// void ReportAlgebraicConstraintData(bool addHeader = true)
//------------------------------------------------------------------------------
/**
* Reports Algebraic Constraint data to the log.
*
*
*/
//------------------------------------------------------------------------------
void Phase::ReportAlgebraicConstraintData(bool addHeader)
{
std::stringstream algebraicMsg;
Integer perLine = 6;
// Get the time vector
Rvector times = GetTimeVector();
Integer numTimes = times.GetSize();
IntegerArray timeTypes = transUtil->GetTimeVectorType();
Integer numTimeTypes = timeTypes.size();
algebraicMsg.width(12);
algebraicMsg.fill(' ');
algebraicMsg.setf(std::ios::scientific);
algebraicMsg.setf(std::ios::left);
algebraicMsg.precision(7);
// Write the header if requested
if (addHeader)
algebraicMsg << ReportHeaderData();
// Write the header
algebraicMsg << " ======================================== Algebraic Constraints " <<
"=========================================" << std::endl;
algebraicMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
algebraicMsg << " Point TIME ";
// algebraicMsg << "QNORM_a" << std::endl; // switch to ALGPATH1, etc.
// algebraicMsg << " ---------------------------------------------------------" <<
// "-----------------------------------------------" << std::endl;
// Write the data
Integer count = 0;
// First check to see if there are alg. path functions
if (pathFunctionManager->HasAlgFunctions())
{
Integer numAlgFuncsPerPoint = pathFunctionManager->GetNumAlgFunctions();
// Finish the header, based on the number of alg functions
count = 0;
for (Integer ii = 0; ii < numAlgFuncsPerPoint; ii++)
{
algebraicMsg << "ALGPATH";
if (ii < 10)
algebraicMsg << "0";
algebraicMsg << ii << " ";
count++;
// if we've reached the end of the line and there are more things to write
if ((count >= perLine) && ii << (numAlgFuncsPerPoint-1))
{
algebraicMsg << std::endl;
algebraicMsg << " ";
count = 0;
}
}
algebraicMsg << std::endl;
algebraicMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
Integer startIdx = 0;
Integer stopIdx = numAlgFuncsPerPoint - 1;
for (Integer pointIdx = 0; pointIdx < numTimeTypes; pointIdx++)
{
count = 0;
// Only have defect constraints at points that are type 1
if (timeTypes.at(pointIdx) == 1)
{
algebraicMsg << " " << std::setw(5) << std::setfill(' ') << pointIdx;
algebraicMsg << " " <<
GmatStringUtil::BuildNumber(times(pointIdx), true, 13) << " ";
for (Integer jj = 0; jj < numAlgFuncsPerPoint; jj++)
{
algebraicMsg << GmatStringUtil::BuildNumber(algPathConVec(startIdx + jj), true, 12) << " ";
count++;
if (count > perLine && jj < (numAlgFuncsPerPoint - 1))
{
algebraicMsg << std::endl;
// algebraicMsg << " "; // ??
count = 0;
}
}
}
algebraicMsg << std::endl;
// Update the bookkeeping parameters
startIdx += numAlgFuncsPerPoint;
stopIdx += numAlgFuncsPerPoint;
}
}
else
{
algebraicMsg << std::endl;
algebraicMsg << " ---------------------------------------------------------" <<
"-----------------------------------------------" << std::endl;
algebraicMsg << " *** No algebraic functions ***" << std::endl;
}
algebraicMsg << std::endl;
MessageInterface::ShowMessage(algebraicMsg.str().c_str());
}
//------------------------------------------------------------------------------
// void ReportAllData()
//------------------------------------------------------------------------------
/**
* Reports all data to the log.
*
*
*/
//------------------------------------------------------------------------------
void Phase::ReportAllData()
{
// only write the header info at the top of the entire report
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to report Bounds Data ...\n");
#endif
ReportBoundsData(true);
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to report Decision Vector Data ...\n");
#endif
ReportDecisionVectorData(false);
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to report Defect Constraint Data ...\n");
#endif
ReportDefectConstraintData(false);
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("ABOUT to report Algebraic Constraint Data ...\n");
#endif
ReportAlgebraicConstraintData(false);
#ifdef DEBUG_REPORT_DATA
MessageInterface::ShowMessage("DONE reporting...\n");
#endif
}
//------------------------------------------------------------------------------
// std::string ReportHeaderData()
//------------------------------------------------------------------------------
/**
* Returns a string containing the header information for the data reports
*
*
*/
//------------------------------------------------------------------------------
std::string Phase::ReportHeaderData()
{
std::stringstream headerMsg;
headerMsg << " =======================================================" <<
"=================================================" << std::endl;
headerMsg << " ==== Phase " <<
phaseNum <<
" ====" << std::endl;
headerMsg << " =======================================================" <<
"=================================================" << std::endl;
headerMsg << std::endl;
return headerMsg.str();
}
//------------------------------------------------------------------------------
// protected methods
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// void InitializePathFunctionInputData()
//------------------------------------------------------------------------------
/**
* Initializes the path function input data
*
*
*/
//------------------------------------------------------------------------------
void Phase::InitializePathFunctionInputData()
{
pathFunctionInputData->Initialize(config->GetNumStateVars(),
GetNumControlVars());
}
//------------------------------------------------------------------------------
// void IntializeJacobians()
//------------------------------------------------------------------------------
/**
* Initializes the jacobians
*
*/
//------------------------------------------------------------------------------
void Phase::IntializeJacobians()
{
SparseMatrixUtil::SetSize(nlpConstraintJacobian, config->GetNumTotalConNLP(),
config->GetNumDecisionVarsNLP());
SparseMatrixUtil::SetSize(nlpCostJacobian, 1,
config->GetNumDecisionVarsNLP());
}
//------------------------------------------------------------------------------
// void PrepareForMeshRefinement()
//------------------------------------------------------------------------------
/**
* Prepares fot the mesh refinement
*
*/
//------------------------------------------------------------------------------
void Phase::PrepareForMeshRefinement()
{
// Previously, old state and control copied here
// Now, it is handled by generating new state and control at MR code.
// So, do nothing here.
// However, this place may be useful in the future.
// So, keep the method.
// YK 2017.08.22
}
//------------------------------------------------------------------------------
// void SetInitialGuess()
//------------------------------------------------------------------------------
/**
* Sets the initial guess
*
* NOTE: this currently only sets the initial guess from the GuessGenerator
*
*/
//------------------------------------------------------------------------------
void Phase::SetInitialGuess()
{
// no mesh-refinement related things are done here
/// but subclass can rewrite this method so that a proper initial guess
/// is provided based on the collocation
if (!isRefining)
{
SetInitialGuessFromGuessGen();
}
else
{
// updated by YK for MR; 2017.08.14
decVector->SetStateArray(newStateGuess);
decVector->SetControlArray(newControlGuess);
}
}
//------------------------------------------------------------------------------
// void InitializeDecisionVector()
//------------------------------------------------------------------------------
/**
* Initializes the decision vector helper class
*
*/
//------------------------------------------------------------------------------
void Phase::InitializeDecisionVector()
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"In InitDecVec, numStatePoints = %d, numCcontrolPoints = %d,"
"numStateStagePoints = %d, numControlStagePoints = %d\n",
transUtil->GetNumStatePoints(),
transUtil->GetNumControlPoints(),
transUtil->GetNumStateStagePointsPerMesh(),
transUtil->GetNumControlStagePointsPerMesh());
#endif
decVector->Initialize(config->GetNumStateVars(),
GetNumControlVars(),config->GetNumIntegralVars(),
config->GetNumStaticVars(),
transUtil->GetNumStatePoints(),
transUtil->GetNumControlPoints(),
transUtil->GetNumStateStagePointsPerMesh(),
transUtil->GetNumControlStagePointsPerMesh());
// YK mod static params: at initilization, use the static guess in config
if (config->GetNumStaticVars() > 0)
decVector->SetStaticVector(config->GetStaticVector());
}
//------------------------------------------------------------------------------
// void CheckFunctions()
//------------------------------------------------------------------------------
/**
* Recomputes the user functions and/or quadratures if they are stale
*
*/
//------------------------------------------------------------------------------
void Phase::CheckFunctions()
{
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("Entering Phase::CheckFunctions ...\n");
MessageInterface::ShowMessage(" recomputeUserFunctions = %s\n",
(recomputeUserFunctions? "true" : "false"));
MessageInterface::ShowMessage(" recomputeNLPFunctions = %s\n",
(recomputeNLPFunctions? "true" : "false"));
MessageInterface::ShowMessage(" recomputeAlgPathConstraints = %s\n", (recomputeAlgPathConstraints? "true" : "false"));
MessageInterface::ShowMessage(" recomputeAlgCostFunction = %s\n", (recomputeAlgCostFunction? "true" : "false"));
#endif
// Update functions if necessary.
if (recomputeUserFunctions)
ComputeUserFunctions();
// Update quadratures if necessary
if (recomputeNLPFunctions)
{
if (config->HasDefectCons())
ComputeDefectConstraints();
if (pathFunctionManager->HasCostFunction())
{
costFunctionIntegral = 0;
ComputeIntegralCost();
}
// Update Algebraic path constraints
if (config->HasAlgPathCons())
{
ComputeAlgebraicPathConstraints();
}
// Update cost function
if (config->HasAlgebraicCost())
{
// what should be done here? YK 2018.02.01
}
recomputeNLPFunctions = false;
}
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage("LEAVING Phase::CheckFunctions ...\n");
#endif
}
//------------------------------------------------------------------------------
// void ComputeUserFunctions()
//------------------------------------------------------------------------------
/**
* Computes user path and point functions
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeUserFunctions()
{
#ifdef DEBUG_PHASE
MessageInterface::ShowMessage(
"Entering Phase::ComputeUserFunctions ...\n");
#endif
// YK mod static vars: before computing user functions,
// update static vars in problem characteristics according to decision vector
UpdateStaticVector();
ComputePathFunctions();
recomputeUserFunctions = false;
recomputeNLPFunctions = true;
}
//------------------------------------------------------------------------------
// void ComputePathFunctions()
//------------------------------------------------------------------------------
/**
* Computes user path functions
*
*/
//------------------------------------------------------------------------------
void Phase::ComputePathFunctions()
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("Entering ComputePathFunctions ...\n");
#endif
// Computes user path functions
// Compute user functions at each point
IntegerArray tvTypes = transUtil->GetTimeVectorType();
Integer numTimePts = transUtil->GetNumTimePoints();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("numTimePts = %d ...\n", numTimePts);
for (Integer ii = 0; ii < tvTypes.size(); ii++)
MessageInterface::ShowMessage(" tvTypes(%d) = %d\n",
ii, tvTypes.at(ii));
#endif
// clear the arrays
for (Integer i = 0; i < funcData.size(); ++i)
{
if (funcData.at(i))
delete funcData.at(i);
}
/*
for (Integer i = 0; i < userDynFunctionData.size(); ++i)
{
if (userDynFunctionData.at(i))
delete userDynFunctionData.at(i);
}
for (Integer i = 0; i < userAlgFunctionData.size(); ++i)
{
if (userAlgFunctionData.at(i))
delete userAlgFunctionData.at(i);
}
for (Integer i = 0; i < costIntFunctionData.size(); ++i)
{
if (costIntFunctionData.at(i))
delete costIntFunctionData.at(i);
}
*/
funcData.clear();
userDynFunctionData.clear();
userAlgFunctionData.clear();
costIntFunctionData.clear();
//YK mod static vars: save static idxs vector, here, and use it for loop
IntegerArray stcIdxs = decVector->GetStaticIdxs();
for (Integer pt = 0; pt < numTimePts; pt++)
{
// Extract info on the current mesh/stage point
Integer pointType = tvTypes.at(pt);
Integer meshIdx = transUtil->GetMeshIndex(pt);
Integer stageIdx = transUtil->GetStageIndex(pt);
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"Before PreparePathFunction, meshIdx = %d ...\n",
meshIdx);
MessageInterface::ShowMessage(
" stageIdx = %d ...\n",
stageIdx);
#endif
IntegerArray tIdxs = decVector->GetTimeIdxs();
IntegerArray stIdxs = decVector->GetStateIdxsAtMeshPoint(meshIdx,
stageIdx);
IntegerArray clIdxs = decVector->GetControlIdxsAtMeshPoint(meshIdx,
stageIdx);
// Prepare the user function data structures then call the
// user function
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("tIdxs size = %d ...\n",
(Integer) tIdxs.size());
MessageInterface::ShowMessage("stIdxs size = %d ...\n",
(Integer) stIdxs.size());
MessageInterface::ShowMessage("clIdxs size = %d ...\n",
(Integer) clIdxs.size());
#endif
PreparePathFunction(meshIdx,stageIdx,pointType,pt);
// CREATING NEW ONE HERE???? Is that what we want to do?
funcData.push_back(new PathFunctionContainer());
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"INITIALIZING PathFunctionContainer ... \n");
#endif
funcData.back()->Initialize();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("Calling EvaluateUserFunction with phaseNum = %d, pathFunctionInputData = <%p> ... \n",
pathFunctionInputData->GetPhaseNum(), pathFunctionInputData);
#endif
// Evaluate user functions and Jacobians
funcData.back() = pathFunctionManager->EvaluateUserFunction(
pathFunctionInputData,funcData.back());
funcData.back() = pathFunctionManager->EvaluateUserJacobian(
pathFunctionInputData,funcData.back());
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"AFTER calling EvalUserF and EvaluUserJ ... \n");
MessageInterface::ShowMessage(" dyn? %s\n",
(pathFunctionManager->HasDynFunctions()?
"true" : "false"));
MessageInterface::ShowMessage(" cost? %s\n",
(pathFunctionManager->HasCostFunction()?
"true" : "false"));
MessageInterface::ShowMessage(" alg? %s\n",
(pathFunctionManager->HasAlgFunctions()?
"true" : "false"));
#endif
// Handle defect constraints
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("HasDynFunctions??? ... \n");
#endif
if (pathFunctionManager->HasDynFunctions())
{
FunctionOutputData *dyn = funcData.back()->GetDynData();
userDynFunctionData.push_back(dyn);
dyn->SetNLPData(meshIdx, stageIdx, stIdxs, clIdxs, stcIdxs);
}
// Handle cost function
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("HasCostFunction??? ... \n");
#endif
if (pathFunctionManager->HasCostFunction())
{
FunctionOutputData *cost = funcData.back()->GetCostData();
costIntFunctionData.push_back(cost);
cost->SetNLPData(meshIdx, stageIdx, stIdxs, clIdxs, stcIdxs);
}
// Handle algebraic constraints
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("HasAlgFunction??? ... \n");
#endif
if (pathFunctionManager->HasAlgFunctions())
{
FunctionOutputData *alg = funcData.back()->GetAlgData();
userAlgFunctionData.push_back(alg);
alg->SetNLPData(meshIdx, stageIdx, stIdxs, clIdxs, stcIdxs);
}
}
// @TODO delete local pointers??
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("LEAVING ComputePathFunctions \n");
#endif
}
//------------------------------------------------------------------------------
// void ComputeSparsityPattern()
//------------------------------------------------------------------------------
/**
* Computes the sparsity of the Phase NLP problem.
*
*/
//------------------------------------------------------------------------------
void Phase::ComputeSparsityPattern()
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"Entering Phase::ComputeSparsityPattern ...\n");
MessageInterface::ShowMessage(" size of conSparsityPattern = %d x %d\n",
(Integer) conSparsityPattern.size1(),
(Integer) conSparsityPattern.size2());
MessageInterface::ShowMessage(" size of costSparsityPattern = %d x %d\n",
(Integer) costSparsityPattern.size1(),
(Integer) costSparsityPattern.size2());
MessageInterface::ShowMessage("config = %sNULL\n", (config? "NOT " : ""));
MessageInterface::ShowMessage(
" attempting to set conSparsityPattern to size %d x %d\n",
config->GetNumTotalConNLP(),
config->GetNumDecisionVarsNLP());
MessageInterface::ShowMessage(
" attempting to set costSparsityPattern to size 1 x %d\n",
config->GetNumDecisionVarsNLP());
#endif
SparseMatrixUtil::SetSize(conSparsityPattern, config->GetNumTotalConNLP(),
config->GetNumDecisionVarsNLP());
SparseMatrixUtil::SetSize(costSparsityPattern, 1,
config->GetNumDecisionVarsNLP());
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage("Entering Phase:: after setsize ...\n");
#endif
if (config->HasAlgPathCons())
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"CSP: conSparsityPattern size (row) = %d\n",
config->GetNumTotalConNLP());
MessageInterface::ShowMessage(
"CSP: conSparsityPattern size (col) = %d\n",
config->GetNumDecisionVarsNLP());
MessageInterface::ShowMessage(
"CSP: About to call SetSparseBLockMatrix (alg)\n");
#endif
SparseMatrixUtil::SetSparseBLockMatrix(conSparsityPattern,
algPathConStartIdx, 0,
algPathNLPFuncUtil->ComputeSparsity());
}
if (config->HasDefectCons())
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"CSP: About to call SetSparseBLockMatrix (defect)\n");
#endif
SparseMatrixUtil::SetSparseBLockMatrix(conSparsityPattern,
defectConStartIdx, 0,
transUtil->ComputeDefectSparsityPattern());
}
if (config->HasIntegralCost())
{
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage(
"CSP: About to call SetSparseBLockMatrix (cost)\n");
#endif
SparseMatrixUtil::SetSparseBLockMatrix(costSparsityPattern, 0, 0,
transUtil->ComputeCostSparsityPattern(),
false);
// -----> how to add these together?
// @TODO - this will need fixing when we have Cost
costSparsityPattern = SparseMatrixUtil::CopySparseMatrix(
transUtil->ComputeCostSparsityPattern());
}
#ifdef DEBUG_PHASE_SPARSE
MessageInterface::ShowMessage("CSP: LEAVING\n");
#endif
}
//------------------------------------------------------------------------------
// void SetProblemCharacteristics()
//------------------------------------------------------------------------------
/**
* Sets variable dependencies and function type flags
*
*/
//------------------------------------------------------------------------------
void Phase::SetProblemCharacteristics()
{
if (pathFunctionManager->HasAlgFunctions())
{
config->SetHasAlgPathCons(true);
}
if (pathFunctionManager->HasDynFunctions())
{
config->SetHasDefectCons(true);
}
if (pathFunctionManager->HasCostFunction())
{
config->SetHasIntegralCost(true);
}
}
//------------------------------------------------------------------------------
// void InitializeUserFunctions()
//------------------------------------------------------------------------------
/**
* Initializes the user functions
*
*/
//------------------------------------------------------------------------------
void Phase::InitializeUserFunctions()
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("Entering InitializeUserFunctions ...\n");
MessageInterface::ShowMessage("numStateVars = %d\n",
GetNumStateVars());
MessageInterface::ShowMessage("numControlVars = %d\n",
GetNumControlVars());
std::cout << "Entering InitializeUserFunctions ...\n";
std::cout << " numStateVars, numControlVars = ";
std::cout << GetNumStateVars() << " " << GetNumControlVars() << std::endl;
#endif
// Initialize the path function
pathFunctionInputData->Initialize(GetNumStateVars(), GetNumControlVars(),
GetNumStaticVars());
pathFunctionInputData->SetStateVector(GetStateUpperBound());
pathFunctionInputData->SetTime(GetTimeUpperBound());
if (GetNumControlVars() > 0)
pathFunctionInputData->SetControlVector(GetControlUpperBound());
if (GetNumStaticVars() > 0)
pathFunctionInputData->SetStaticVector(GetStaticUpperBound());
pathFunctionInputData->SetPhaseNum(phaseNum);
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("--- path function initialized ...\n");
std::cout << "--- path function initialized ...\n";
#endif
// Create bounds data needed for initialization
BoundData *boundData = new BoundData();
boundData->SetStateLowerBound(GetStateLowerBound());
boundData->SetStateUpperBound(GetStateUpperBound());
if (GetNumControlVars() > 0)
{
boundData->SetControlLowerBound(GetControlLowerBound());
boundData->SetControlUpperBound(GetControlUpperBound());
}
if (GetNumStaticVars() > 0)
{
boundData->SetStaticLowerBound(GetStaticLowerBound());
boundData->SetStaticUpperBound(GetStaticUpperBound());
}
Rvector timeUpper(1, GetTimeUpperBound());
Rvector timeLower(1, GetTimeLowerBound());
boundData->SetTimeUpperBound(timeUpper);
boundData->SetTimeLowerBound(timeLower);
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("--- about to create and initialize the PathFunctionContainer ...\n");
std::cout << "--- about to create and initialize the PathFunctionContainer ...\n";
#endif
// @TODO - do we really want a new one here??
// Switched to adding the new pointer to the list rather than a
// separate pointer to avoid memory leak
funcData.push_back(new PathFunctionContainer());
funcData.back()->Initialize();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"--- PathFunctionContainer is initialized...\n");
std::cout << "--- PathFunctionContainer is initialized...\n";
#endif
pathFunctionManager->Initialize(pathFunction,pathFunctionInputData,
funcData.back(),boundData);
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(
"--- pathFunctionManager initialized ...\n");
std::cout << "--- pathFunctionManager initialized ...\n";
#endif
algPathConVecNames = (funcData.back()->GetAlgData())->GetFunctionNames();
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("numState = %d\n",
pathFunctionInputData->GetNumStateVars());
MessageInterface::ShowMessage("LEAVING InitializeUserFunctions ...\n");
#endif
// Delete the boundData pointer that is no longer needed
delete boundData;
}
//------------------------------------------------------------------------------
// void SetConstraintProperties()
//------------------------------------------------------------------------------
/**
* Computes the number of constraints and start/end indexes
*
*/
//------------------------------------------------------------------------------
void Phase::SetConstraintProperties()
{
// Computes number of constraints and start/end indeces
// Set chunk values and bounds.
numAlgPathConNLP = transUtil->GetNumPathConstraintPoints() *
pathFunctionManager->GetNumAlgFunctions();
config->SetNumTotalConNLP(config->GetNumDefectConNLP() + numAlgPathConNLP);
// Set start and end indeces of different constraint
// parameter types. These describe where different chunks
// of the constraint vector begin and end.
defectConStartIdx = 0; // was 1
defectConEndIdx = defectConStartIdx + config->GetNumDefectConNLP() - 1;
// TODO. If certain type of constraint does not exist, indeces
// are populated with useless data that makes it look like they
// exist. May want to change that to be zeros or something.
algPathConStartIdx = defectConEndIdx + 1;
algPathConEndIdx = algPathConStartIdx + numAlgPathConNLP -1;
}
//------------------------------------------------------------------------------
// void SetDecisionVectorBounds()
//------------------------------------------------------------------------------
/**
* Sets the upper and lower bounds on the decision vector
*
*/
//------------------------------------------------------------------------------
void Phase::SetDecisionVectorBounds()
{
// Dimension the vectors
decisionVecLowerBound.SetSize(config->GetNumDecisionVarsNLP());
decisionVecUpperBound.SetSize(config->GetNumDecisionVarsNLP());
// Use a temporary decision vector object for bookkeeping
DecVecTypeBetts *boundVector = new DecVecTypeBetts();
boundVector->Initialize(config->GetNumStateVars(),
GetNumControlVars(),config->GetNumIntegralVars(),
config->GetNumStaticVars(),
transUtil->GetNumStatePoints(),transUtil->GetNumControlPoints(),
transUtil->GetNumStateStagePointsPerMesh(),
transUtil->GetNumControlStagePointsPerMesh());
// Assemble the state bound array
Rmatrix upperBoundStateArray(decVector->GetNumStatePoints(),
config->GetNumStateVars());
Rmatrix lowerBoundStateArray(decVector->GetNumStatePoints(),
config->GetNumStateVars());
Rvector stateLower = GetStateLowerBound();
Rvector stateUpper = GetStateUpperBound();
for (Integer rowIdx = 0; rowIdx < decVector->GetNumStatePoints(); rowIdx++)
{
for (Integer jj = 0; jj < stateLower.GetSize(); jj++)
lowerBoundStateArray(rowIdx,jj) = stateLower(jj);
for (Integer jj = 0; jj < stateUpper.GetSize(); jj++)
upperBoundStateArray(rowIdx,jj) = stateUpper(jj);
}
Rmatrix upperBoundControlArray;
Rmatrix lowerBoundControlArray;
// Assemble the control bound array
if (config->HasControlVars())
{
upperBoundControlArray.SetSize(decVector->GetNumControlPoints(),
GetNumControlVars());
lowerBoundControlArray.SetSize(decVector->GetNumControlPoints(),
GetNumControlVars());
Rvector controlLower = GetControlLowerBound();
Rvector controlUpper = GetControlUpperBound();
for (Integer rowIdx = 0; rowIdx < decVector->GetNumControlPoints();
rowIdx++)
{
for (Integer jj = 0; jj < controlLower.GetSize(); jj++)
lowerBoundControlArray(rowIdx,jj) = controlLower(jj);
for (Integer jj = 0; jj < controlUpper.GetSize(); jj++)
upperBoundControlArray(rowIdx,jj) = controlUpper(jj);
}
}
// Set time vector bounds
Rvector upperBoundTimeArray(2, GetTimeUpperBound(), GetTimeUpperBound());
Rvector lowerBoundTimeArray(2, GetTimeLowerBound(), GetTimeLowerBound());
// Set static vector bounds
Rvector staticUpper, staticLower;
if ((config->HasStaticVars()) && (config->GetNumStaticVars()>0))
{
staticLower.SetSize(config->GetNumStaticVars());
staticUpper.SetSize(config->GetNumStaticVars());
staticUpper = GetStaticUpperBound();
staticLower = GetStaticLowerBound();
}
// Set lower bound vector
boundVector->SetStateArray(lowerBoundStateArray);
if (config->HasControlVars())
{
boundVector->SetControlArray(lowerBoundControlArray);
}
boundVector->SetTimeVector(lowerBoundTimeArray);
if ((config->HasStaticVars()) && (config->GetNumStaticVars()>0))
boundVector->SetStaticVector(staticLower);
decisionVecLowerBound = boundVector->GetDecisionVector();
// Set upper bound vector
boundVector->SetStateArray(upperBoundStateArray);
if (config->HasControlVars())
{
boundVector->SetControlArray(upperBoundControlArray);
}
boundVector->SetTimeVector(upperBoundTimeArray);
if ((config->HasStaticVars()) && (config->GetNumStaticVars()>0))
boundVector->SetStaticVector(staticUpper);
decisionVecUpperBound = boundVector->GetDecisionVector();
delete boundVector;
}
//------------------------------------------------------------------------------
// void InitializeTimeVector()
//------------------------------------------------------------------------------
/**
*Initializes the dimensional time vector
*
*/
//------------------------------------------------------------------------------
void Phase::InitializeTimeVector()
{
Rvector timeV(2, GetTimeInitialGuess(), GetTimeFinalGuess());
decVector->SetTimeVector(timeV);
transUtil->SetTimeVector(GetTimeInitialGuess(), GetTimeFinalGuess());
}
//------------------------------------------------------------------------------
// void SetConstraintBounds()
//------------------------------------------------------------------------------
/**
* Sets bounds for all constraint types
*
*/
//------------------------------------------------------------------------------
void Phase::SetConstraintBounds()
{
// Computes the bounds for each constraint type.
SetDefectConstraintBounds();
SetPathConstraintBounds();
// Now insert chunks into the complete bounds vector
Integer dStartIdx = defectConStartIdx;
Integer dEndIdx = defectConEndIdx;
Integer pStartIdx = algPathConStartIdx;
Integer pEndIdx = algPathConEndIdx;
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("--- dStartIdx = %d\n", dStartIdx);
MessageInterface::ShowMessage("--- dEndIdx = %d\n", dEndIdx);
MessageInterface::ShowMessage("--- pStartIdx = %d\n", pStartIdx);
MessageInterface::ShowMessage("--- pEndIdx = %d\n", pEndIdx);
if (!allConLowerBound.IsSized())
MessageInterface::ShowMessage("allConLowerBound is NOT SIZED!\n");
else
{
MessageInterface::ShowMessage(" --- size of allConLowerBound = %d\n",
(Integer) allConLowerBound.GetSize());
}
if (!defectConLowerBound.IsSized())
MessageInterface::ShowMessage("defectConLowerBound is NOT SIZED!\n");
else
{
MessageInterface::ShowMessage(
" --- size of defectConLowerBound = %d\n",
(Integer) defectConLowerBound.GetSize());
}
#endif
allConLowerBound.SetSize(algPathConEndIdx - defectConStartIdx + 1);
allConUpperBound.SetSize(algPathConEndIdx - defectConStartIdx + 1);
// Concatenate defect constraints bounds if any
if (pathFunctionManager->HasDynFunctions())
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" HAS dyn functions ...\n");
MessageInterface::ShowMessage(" defectConLowerBound = %s\n",
defectConLowerBound.ToString(12).c_str());
MessageInterface::ShowMessage(" defectConUpperBound = %s\n",
defectConUpperBound.ToString(12).c_str());
#endif
Integer conIdx = 0;
for (Integer ii = dStartIdx; ii <= dEndIdx; ii++)
{
allConLowerBound(ii) = defectConLowerBound(conIdx);
allConUpperBound(ii) = defectConUpperBound(conIdx);
conIdx++;
}
}
// Concatenate algebraic path constraint bounds if any
if (pathFunctionManager->HasAlgFunctions())
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage(" HAS alg functions ...\n");
#endif
Integer algIdx = 0;
for (Integer ii = pStartIdx; ii <= pEndIdx; ii++)
{
allConLowerBound(ii) = algPathConLowerBound(algIdx);
allConUpperBound(ii) = algPathConUpperBound(algIdx);
algIdx++;
}
}
}
//------------------------------------------------------------------------------
// void SetDefectConstraintBounds()
//------------------------------------------------------------------------------
/**
* Sets bounds on the defect constraint
*
*/
//------------------------------------------------------------------------------
void Phase::SetDefectConstraintBounds()
{
Integer sz = config->GetNumDefectConNLP();
// Sets bounds on defect constraints
defectConLowerBound.SetSize(sz);
defectConUpperBound.SetSize(sz);
for (Integer ii = 0; ii < sz; ii++)
{
defectConLowerBound[ii] = 0.0;
defectConUpperBound[ii] = 0.0;
}
}
//------------------------------------------------------------------------------
// void SetPathConstraintBounds()
//------------------------------------------------------------------------------
/**
* Sets bounds on the path constraint
*
*/
//------------------------------------------------------------------------------
void Phase::SetPathConstraintBounds()
{
if (pathFunctionManager->HasAlgFunctions())
{
algPathConLowerBound.SetSize(numAlgPathConNLP);
algPathConUpperBound.SetSize(numAlgPathConNLP);
Integer lowIdx = 0; // was 1;
for (Integer conIdx = 0; conIdx < transUtil->GetNumPathConstraintPoints();
conIdx++)
{
Integer highIdx = lowIdx + pathFunctionManager->GetNumAlgFunctions()-1;
Rvector lowB = pathFunctionManager->GetAlgFunctionsLowerBounds();
Rvector highB = pathFunctionManager->GetAlgFunctionsUpperBounds();
Integer theIdx = 0;
for (Integer ii = lowIdx; ii <= highIdx; ii++)
{
algPathConLowerBound(ii) = lowB(theIdx);
algPathConUpperBound(ii) = highB(theIdx);
theIdx++;
}
lowIdx += pathFunctionManager->GetNumAlgFunctions();
}
}
else
{
algPathConLowerBound.SetSize(0);
algPathConUpperBound.SetSize(0);
}
}
//------------------------------------------------------------------------------
// void SetInitialGuessFromGuessGen()
//------------------------------------------------------------------------------
/**
* Calls guess utility to compute guess for state and control
*
*/
//------------------------------------------------------------------------------
void Phase::SetInitialGuessFromGuessGen()
{
#ifdef DEBUG_GUESS
MessageInterface::ShowMessage("Entering SetInitialGuessFromGuessGen\n");
#endif
// Calls guess utility to compute guess for state and control
// Intialize the guess generator class
guessGen->Initialize(transUtil->GetTimeVector(),
decVector->GetNumStateVars(),
decVector->GetNumStatePoints(),
decVector->GetNumControlVars(),
decVector->GetNumControlPoints(),
initialGuessMode);
#ifdef DEBUG_GUESS
MessageInterface::ShowMessage(" guessGen initialized\n");
#endif
Rmatrix xGuessMat;
Rmatrix uGuessMat;
if ((initialGuessMode == "LinearNoControl") ||
(initialGuessMode == "LinearUnityControl") ||
(initialGuessMode == "LinearCoast"))
{
Rvector init = GetStateInitialGuess();
Rvector final = GetStateFinalGuess();
#ifdef DEBUG_GUESS
MessageInterface::ShowMessage(" init guess = %s\n",
init.ToString(12).c_str());
MessageInterface::ShowMessage(" final guess = %s\n",
final.ToString(12).c_str());
#endif
guessGen->ComputeLinearGuess(init, final,
xGuessMat, uGuessMat);
}
else if ((initialGuessMode == "UserGuessClass"))
{
guessGen->ComputeUserFunctionGuess(userGuessClass, scaleUtil,
"dummyTimeType", // TODO: fix this!
xGuessMat, uGuessMat);
}
else if ((initialGuessMode == "OCHFile"))
{
guessGen->ComputeGuessFromOCHFile(guessFileName,
"dummyTimeType", // TODO: fix this!
xGuessMat,uGuessMat);
}
else if ((initialGuessMode == "GuessArrays"))
{
guessGen->ComputeGuessFromArrayData(guessArrayData,
"dummyTimeType", // TODO: fix this!
xGuessMat,uGuessMat);
}
else
{
throw LowThrustException("Invalid InitialGuessMode!\n");
}
// Call the decision vector and populate with the guess
#ifdef DEBUG_GUESS
MessageInterface::ShowMessage(" xGuessMat = %s\n",
xGuessMat.ToString(12).c_str());
MessageInterface::ShowMessage(" uGuessMat = %s\n",
uGuessMat.ToString(12).c_str());
#endif
decVector->SetStateArray(xGuessMat);
decVector->SetControlArray(uGuessMat);
#ifdef DEBUG_GUESS
MessageInterface::ShowMessage(" decisionVectorGuess = %s\n",
decVector->GetDecisionVector().ToString(12).c_str());
MessageInterface::ShowMessage("LEAVING SetInitialGuessFromGuessGen\n");
#endif
}
//------------------------------------------------------------------------------
// void PreparePathFunction(Integer meshIdx, Integer stageIdx,
// Integer pointType, Integer pointIdx)
//------------------------------------------------------------------------------
/**
* Calls guess utility to compute guess for state and control
*
* @param <meshIdx> the mesh index
* @param <stageIdx> the stage index
* @param <pointType> the point type
* @param <pointIdx> the point index
*
*/
//------------------------------------------------------------------------------
void Phase::PreparePathFunction(Integer meshIdx, Integer stageIdx,
Integer pointType, Integer pointIdx)
{
#ifdef DEBUG_PHASE_PATH_INIT
MessageInterface::ShowMessage("ENTERING PreparePathFunction\n");
MessageInterface::ShowMessage(
" meshIdx = %d, stageIdx = %d, pointType = %d, pointIdx = %d, phaseNum = %d\n",
meshIdx, stageIdx, pointType, pointIdx, phaseNum);
#endif
// Prepares user path function evaluation at a specific point
// This function extracts the state, control, and time from decision vector
pathFunctionInputData->SetPhaseNum(phaseNum);
if (pointType == 1 || pointType == 2)
{
pathFunctionInputData->SetStateVector(
decVector->GetStateAtMeshPoint(meshIdx,stageIdx));
}
else
{
Rvector ones(GetNumStateVars());
ones = ones * GmatMathConstants::QUIET_NAN;
pathFunctionInputData->SetStateVector(ones);
}
if (pointType == 1 || pointType == 3)
{
pathFunctionInputData->SetControlVector(
decVector->GetControlAtMeshPoint(meshIdx,
stageIdx));
}
else
{
Rvector ones(GetNumControlVars());
ones = ones * GmatMathConstants::QUIET_NAN;
pathFunctionInputData->SetControlVector(ones);
}
pathFunctionInputData->SetTime(transUtil->GetTimeAtMeshPoint(pointIdx));
// YK mod static params; is it right to place this line here?
pathFunctionInputData->SetStaticVector(decVector->GetStaticVector());
#ifdef DEBUG_PHASE_PATH_INIT
MessageInterface::ShowMessage("LEAVING PreparePathFunction\n");
#endif
}
//------------------------------------------------------------------------------
// void InsertJacobianRowChunk(const RSMatrix &jacChunk,
// const IntegerArray &idxs)
//------------------------------------------------------------------------------
/**
* Inserts a chunk into the jacobian
*
* @param <jacChunk> the input jacobian chunk
* @param <idxs> the input array of indexes
*
*/
//------------------------------------------------------------------------------
void Phase::InsertJacobianRowChunk(const RSMatrix &jacChunk,
const IntegerArray &idxs)
{
SparseMatrixUtil::SetSparseBLockMatrix(nlpConstraintJacobian,
idxs[0], 0, &jacChunk);
}
//------------------------------------------------------------------------------
// void CopyArrays(const Phase ©)
//------------------------------------------------------------------------------
/**
* Copies all of the array/matrix data from the input object to this object
*
* @param <copy> the object whose data to copy
*
*/
//------------------------------------------------------------------------------
void Phase::CopyArrays(const Phase ©)
{
#ifdef DEBUG_PHASE_INIT
MessageInterface::ShowMessage("In Phase::CopyArrays!!!!!!!!!!!!\n");
#endif
Integer sz = (Integer) copy.initialGuessControl.GetSize();
initialGuessControl.SetSize(sz);
initialGuessControl = copy.initialGuessControl;
sz = (Integer) copy.algPathConVec.GetSize();
algPathConVec.SetSize(sz);
algPathConVec = copy.algPathConVec;
sz = (Integer) copy.defectConVec.GetSize();
defectConVec.SetSize(sz);
defectConVec = copy.defectConVec;
algPathConVecNames = copy.algPathConVecNames;
// mesh-refinement related things. YK 2017.08.22
Integer sz1, sz2;
sz1 = (Integer)copy.newStateGuess.GetNumRows();
sz2 = (Integer)copy.newStateGuess.GetNumColumns();
newStateGuess.SetSize(sz1,sz2);
newStateGuess = copy.newStateGuess;
sz1 = (Integer)copy.newControlGuess.GetNumRows();
sz2 = (Integer)copy.newControlGuess.GetNumColumns();
newControlGuess.SetSize(sz1, sz2);
newControlGuess = copy.newControlGuess;
sz = (Integer)copy.maxRelErrorVec.GetSize();
maxRelErrorVec.SetSize(sz);
maxRelErrorVec = copy.maxRelErrorVec;
// @todo figure out how to copy RSMatrix !!!!
SparseMatrixUtil::CopySparseMatrix(copy.nlpConstraintJacobian,
nlpConstraintJacobian);
SparseMatrixUtil::CopySparseMatrix(copy.nlpCostJacobian, nlpCostJacobian);
SparseMatrixUtil::CopySparseMatrix(copy.conSparsityPattern,
conSparsityPattern);
SparseMatrixUtil::CopySparseMatrix(copy.costSparsityPattern,
costSparsityPattern);
sz = (Integer) copy.defectConLowerBound.GetSize();
defectConLowerBound.SetSize(sz);
defectConLowerBound = copy.defectConLowerBound;
sz = (Integer) copy.defectConUpperBound.GetSize();
defectConUpperBound.SetSize(sz);
defectConUpperBound = copy.defectConUpperBound;
sz = (Integer) copy.algPathConLowerBound.GetSize();
algPathConLowerBound.SetSize(sz);
algPathConLowerBound = copy.algPathConLowerBound;
sz = (Integer) copy.algPathConUpperBound.GetSize();
algPathConUpperBound.SetSize(sz);
algPathConUpperBound = copy.algPathConUpperBound;
sz = (Integer) copy.algEventConLowerBound.GetSize();
algEventConLowerBound.SetSize(sz);
algEventConLowerBound = copy.algEventConLowerBound;
sz = (Integer) copy.algEventConUpperBound.GetSize();
algEventConUpperBound.SetSize(sz);
algEventConUpperBound = copy.algEventConUpperBound;
sz = (Integer) copy.allConLowerBound.GetSize();
allConLowerBound.SetSize(sz);
allConLowerBound = copy.allConLowerBound;
sz = (Integer) copy.allConUpperBound.GetSize();
allConUpperBound.SetSize(sz);
allConUpperBound = copy.allConUpperBound;
sz = (Integer) copy.decisionVecLowerBound.GetSize();
decisionVecLowerBound.SetSize(sz);
decisionVecLowerBound = copy.decisionVecLowerBound;
sz = (Integer) copy.decisionVecUpperBound.GetSize();
decisionVecUpperBound.SetSize(sz);
decisionVecUpperBound = copy.decisionVecUpperBound;
sz = (Integer) copy.decisionVecUpperBound.GetSize();
decisionVecUpperBound.SetSize(sz);
decisionVecUpperBound = copy.decisionVecUpperBound;
userDynFunctionData = copy.userDynFunctionData; // clone pointers?
userAlgFunctionData = copy.userAlgFunctionData; // clone pointers?
costIntFunctionData = copy.costIntFunctionData; // clone pointers?
}
| 36.061943 | 126 | 0.491563 | [
"mesh",
"object",
"vector"
] |
9eaf56dc20a36c7fb3dbf0a7ce722c47926a963a | 7,328 | cpp | C++ | sample/09.Globalillumination/model.cpp | Lauvak/ray | 906d3991ddd232a7f78f0e51f29aeead008a139a | [
"BSD-3-Clause"
] | 113 | 2015-06-25T06:24:59.000Z | 2021-09-26T02:46:02.000Z | sample/09.Globalillumination/model.cpp | Lauvak/ray | 906d3991ddd232a7f78f0e51f29aeead008a139a | [
"BSD-3-Clause"
] | 2 | 2015-05-03T07:22:49.000Z | 2017-12-11T09:17:20.000Z | sample/09.Globalillumination/model.cpp | Lauvak/ray | 906d3991ddd232a7f78f0e51f29aeead008a139a | [
"BSD-3-Clause"
] | 17 | 2015-11-10T15:07:15.000Z | 2021-01-19T15:28:16.000Z | // +----------------------------------------------------------------------
// | Project : ray.
// | All rights reserved.
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2015.
// +----------------------------------------------------------------------
// | * Redistribution and use of this software 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 ray team, nor the names of its
// | contributors may be used to endorse or promote products
// | derived from this software without specific prior
// | written permission of the ray team.
// |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// +----------------------------------------------------------------------
#include "model.h"
#include <ray/mesh_render_component.h>
#include <ray/mesh_component.h>
#include <ray/res_manager.h>
#include <ray/mesh_render_component.h>
#include <ray/mesh_component.h>
#include <ray/res_manager.h>
#include <ray/material.h>
__ImplementSubClass(ModelComponent, GameComponent, "Model")
ModelComponent::ModelComponent() noexcept
{
}
ModelComponent::~ModelComponent() noexcept
{
}
void
ModelComponent::onActivate() noexcept
{
auto materialTemp = ray::ResManager::instance()->createMaterial("sys:fx/opacity.fxml");
if (!materialTemp)
return;
auto white = materialTemp->clone();
white->getParameter("quality")->uniform4f(ray::float4(0.0, 0.0, 0.0, 0.0));
white->getParameter("diffuse")->uniform3f(ray::float3(0.76, 0.75, 0.5));
white->getParameter("metalness")->uniform1f(0.1);
white->getParameter("smoothness")->uniform1f(0.1);
auto red = materialTemp->clone();
red->getParameter("quality")->uniform4f(ray::float4(0.0, 0.0, 0.0, 0.0));
red->getParameter("diffuse")->uniform3f(ray::float3(0.63, 0.06, 0.04));
red->getParameter("metalness")->uniform1f(0.1);
red->getParameter("smoothness")->uniform1f(0.1);
auto green = materialTemp->clone();
green->getParameter("quality")->uniform4f(ray::float4(0.0, 0.0, 0.0, 0.0));
green->getParameter("diffuse")->uniform3f(ray::float3(0.15, 0.48, 0.09));
green->getParameter("metalness")->uniform1f(0.1);
green->getParameter("smoothness")->uniform1f(0.1);
auto planeMesh = std::make_shared<ray::MeshProperty>();
planeMesh->makePlane(1.0, 1.0);
auto& normals = planeMesh->getNormalArray();
for (auto& normal : normals)
normal = -normal;
auto cubeMesh = std::make_shared<ray::MeshProperty>();
cubeMesh->makeCube(1.0, 1.0, 1.0);
auto nearPlane = std::make_shared<ray::GameObject>();
nearPlane->setActive(true);
nearPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
nearPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
nearPlane->setQuaternion(ray::Quaternion(ray::float3::UnitX, 180.0f));
nearPlane->setScale(ray::float3(5, 5, 5));
nearPlane->setTranslate(ray::float3(0, 0, -2.5));
auto farPlane = std::make_shared<ray::GameObject>();
farPlane->setActive(true);
farPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
farPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
farPlane->setScale(ray::float3(5, 5, 5));
farPlane->setTranslate(ray::float3(0, 0, 2.5));
auto rightPlane = std::make_shared<ray::GameObject>();
rightPlane->setActive(true);
rightPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
rightPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(green));
rightPlane->setQuaternion(ray::Quaternion(ray::float3::UnitY, 90.0f));
rightPlane->setScale(ray::float3(5, 5, 5));
rightPlane->setTranslate(ray::float3(2.5, 0, 0.0));
auto leftPlane = std::make_shared<ray::GameObject>();
leftPlane->setActive(true);
leftPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
leftPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(red));
leftPlane->setQuaternion(ray::Quaternion(ray::float3::UnitY, -90.0f));
leftPlane->setScale(ray::float3(5, 5, 5));
leftPlane->setTranslate(ray::float3(-2.5, 0, 0.0));
auto topPlane = std::make_shared<ray::GameObject>();
topPlane->setActive(true);
topPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
topPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
topPlane->setQuaternion(ray::Quaternion(ray::float3::UnitX, -90.0f));
topPlane->setScale(ray::float3(5, 5, 5));
topPlane->setTranslate(ray::float3(0.0, 2.5, 0.0));
auto bottomPlane = std::make_shared<ray::GameObject>();
bottomPlane->setActive(true);
bottomPlane->addComponent(std::make_shared<ray::MeshComponent>(planeMesh));
bottomPlane->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
bottomPlane->setQuaternion(ray::Quaternion(ray::float3::UnitX, 90.0f));
bottomPlane->setScale(ray::float3(5, 5, 5));
bottomPlane->setTranslate(ray::float3(0.0, -2.5, 0.0));
auto largeCube = std::make_shared<ray::GameObject>();
largeCube->setActive(true);
largeCube->addComponent(std::make_shared<ray::MeshComponent>(cubeMesh));
largeCube->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
largeCube->setScale(ray::float3(1.5, 3.4, 1.5));
largeCube->setQuaternion(ray::Quaternion(ray::float3::UnitY, -20.0f));
largeCube->setTranslate(ray::float3(-1, -0.8, 1.0));
auto smallCube = std::make_shared<ray::GameObject>();
smallCube->setActive(true);
smallCube->addComponent(std::make_shared<ray::MeshComponent>(cubeMesh));
smallCube->addComponent(std::make_shared<ray::MeshRenderComponent>(white));
smallCube->setScale(ray::float3(1.5, 1.5, 1.5));
smallCube->setQuaternion(ray::Quaternion(ray::float3::UnitY, 20.0f));
smallCube->setTranslate(ray::float3(1, -1.75, -1));
_objects.push_back(nearPlane);
_objects.push_back(farPlane);
_objects.push_back(rightPlane);
_objects.push_back(leftPlane);
_objects.push_back(topPlane);
_objects.push_back(bottomPlane);
_objects.push_back(largeCube);
_objects.push_back(smallCube);
}
void
ModelComponent::onDeactivate() noexcept
{
_objects.clear();
}
ray::GameComponentPtr
ModelComponent::clone() const noexcept
{
return std::make_shared<ModelComponent>();
} | 42.358382 | 88 | 0.704694 | [
"model"
] |
9eb2e0117e333e4590ee0a3335ecf78cebe06558 | 2,086 | cpp | C++ | Engine/Application.cpp | Grimkin/SoftShadows | 579b711ceb976679e13bb3442ed9f0bf740d3244 | [
"BSD-2-Clause"
] | 1 | 2017-06-13T14:33:57.000Z | 2017-06-13T14:33:57.000Z | Engine/Application.cpp | Grimkin/SoftShadows | 579b711ceb976679e13bb3442ed9f0bf740d3244 | [
"BSD-2-Clause"
] | null | null | null | Engine/Application.cpp | Grimkin/SoftShadows | 579b711ceb976679e13bb3442ed9f0bf740d3244 | [
"BSD-2-Clause"
] | null | null | null | #include "Application.h"
#include "Window.h"
#include "Logger.h"
#include "Makros.h"
#include "D3DRenderBackend.h"
#include "InputManager.h"
#include "Time.h"
#include "GameObjectManager.h"
#include "Game.h"
#include "Renderer.h"
#include "Material.h"
#include "Texture.h"
#include "GUI.h"
#include "FontManager.h"
#include "Geometry.h"
#include "FileLoader.h"
#include "RenderPass.h"
#include "DebugElements.h"
#include "ConfigManager.h"
Application::Application( HINSTANCE hInstance ) {
Game::SetApplication( *this );
Initialize( hInstance );
}
void Application::Initialize( HINSTANCE hInstance ) {
m_Logger = &Logger::InitMainLogger();
m_ConfigManager = &ConfigManager::Init( L"Assets\\Config\\main.config" );
m_Time = &Time::Init();
int2 winSize = m_ConfigManager->GetInt2( L"WinSize", { 800,800 } );
m_Window = &Window::InitMainWindow( hInstance, winSize.x, winSize.y );
m_RenderPassManager = &RenderPassManager::Init();
m_TextureManager = &TextureManager::Init();
m_RenderBackend = &D3DRenderBackend::Init( *m_Window );
FileLoader::Init( &Game::GetDevice(), &Game::GetContext() );
m_GameObjectManager = &GameObjectManager::Init();
m_InputManager = &InputManager::Init( *m_Window );
m_Renderer = &Renderer::Init();
m_MaterialManager = &MaterialManager::Init();
m_GUI = &GUI::Init();
m_GeometryManager = &GeometryManager::Init();
DebugElementsManager::Init( *m_RenderBackend );
m_TextureManager->CreateDummyTexture();
m_RenderBackend->Start();
}
Application& Application::Init( HINSTANCE hinstance ) {
static Application application( hinstance );
return application;
}
void Application::Run() {
while( m_Run ) {
Window::HandleMessages();
m_Time->Update();
float dt = m_Time->GetDeltaTime();
m_GameObjectManager->EarlyUpdate( dt );
m_GameObjectManager->Update( dt );
m_RenderBackend->Render();
m_GameObjectManager->LateUpdate( dt );
m_GameObjectManager->OnFrameEnd();
m_InputManager->Update();
}
m_GameObjectManager->Exit();
m_RenderBackend->Exit();
}
void Application::Exit() {
m_Run = false;
}
Application::~Application() {
}
| 26.74359 | 74 | 0.727229 | [
"geometry",
"render"
] |
9eb6dac8987c5d6483805def4ae3908b9c910706 | 698 | cpp | C++ | src/boost_python_exception/auto_translation/import.cpp | abingham/boost_python_exception | 7882d5e8df051494498a58c06e046cb52421620b | [
"BSL-1.0"
] | 1 | 2015-03-28T08:28:56.000Z | 2015-03-28T08:28:56.000Z | src/boost_python_exception/auto_translation/import.cpp | abingham/boost_python_exception | 7882d5e8df051494498a58c06e046cb52421620b | [
"BSL-1.0"
] | 3 | 2015-01-08T08:10:55.000Z | 2015-01-08T10:20:42.000Z | src/boost_python_exception/auto_translation/import.cpp | abingham/boost_python_exception | 7882d5e8df051494498a58c06e046cb52421620b | [
"BSL-1.0"
] | 2 | 2018-11-13T07:42:31.000Z | 2020-03-10T22:43:31.000Z | #include <boost_python_exception/auto_translation/import.hpp>
#include <boost/python/import.hpp>
#include <boost_python_exception/get_exception_info.hpp>
#include <boost_python_exception/clear_exception.hpp>
#include <boost_python_exception/auto_translation/exception_translator.hpp>
namespace bp = boost::python;
namespace boost_python_exception { namespace auto_translation {
boost::python::object import(std::string const & module_name)
{
try {
return bp::import(module_name.c_str());
} catch (bp::error_already_set const &) {
exception_info const error = get_exception_info();
clear_exception();
exception_translator::translate(error);
}
}
} }
| 27.92 | 75 | 0.752149 | [
"object"
] |
9ec3280dd3be55197acd999d1fab65539616a905 | 31,674 | cpp | C++ | tests/netlist/net.cpp | e7p/hal | 2a88a8abefe5e2f79a74ec646e5fb3d8e6eb7cc8 | [
"MIT"
] | null | null | null | tests/netlist/net.cpp | e7p/hal | 2a88a8abefe5e2f79a74ec646e5fb3d8e6eb7cc8 | [
"MIT"
] | null | null | null | tests/netlist/net.cpp | e7p/hal | 2a88a8abefe5e2f79a74ec646e5fb3d8e6eb7cc8 | [
"MIT"
] | null | null | null | #include "netlist_test_utils.h"
#include "hal_core/netlist/event_system/net_event_handler.h"
namespace hal {
using test_utils::MIN_GATE_ID;
using test_utils::MIN_NET_ID;
using test_utils::MIN_MODULE_ID;
using test_utils::MIN_NETLIST_ID;
class NetTest : public ::testing::Test {
protected:
virtual void SetUp() {
test_utils::init_log_channels();
}
virtual void TearDown() {
}
};
/**
* Testing the constructor of the Net
*
* Functions: constructor, get_id, get_name, get_netlist
*/
TEST_F(NetTest, check_constructor) {
TEST_START
// Create a Net (id = 100) and append it to its netlist
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 100, "test_net");
EXPECT_EQ(test_net->get_id(), (u32) (MIN_NET_ID + 100));
EXPECT_EQ(test_net->get_name(), "test_net");
EXPECT_EQ(test_net->get_netlist()->get_id(), (u32) (MIN_NETLIST_ID + 0));
TEST_END
}
/**
* Testing the function set_name and get_name
*
* Functions: get_name, set_name
*/
TEST_F(NetTest, check_set_and_get_name) {
TEST_START
// Create a Net and append it to its netlist
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
EXPECT_EQ(test_net->get_name(), "test_net");
// Set a new name
NO_COUT(test_net->set_name("new_name"));
EXPECT_EQ(test_net->get_name(), "new_name");
// Set the name to the same new name again
NO_COUT(test_net->set_name("new_name"));
EXPECT_EQ(test_net->get_name(), "new_name");
// Set an empty name (should do nothing)
NO_COUT(test_net->set_name("name"));
NO_COUT(test_net->set_name(""));
EXPECT_EQ(test_net->get_name(), "name");
TEST_END
}
/**
* Testing the function add_src
*
* Functions: add_src
*/
TEST_F(NetTest, check_add_src) {
TEST_START
{
// Add a source of the Net (using a valid Gate and pin_type)
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
Gate* t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
bool suc = test_net->add_source(t_gate, "O");
EXPECT_TRUE(suc);
ASSERT_EQ(test_net->get_sources().size(), 1);
EXPECT_EQ(test_net->get_sources()[0], test_utils::get_endpoint(t_gate, "O"));
}
// Negative
{
// Set the source of the Net (Gate is nullptr)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->add_source(nullptr, "O");
EXPECT_FALSE(suc);
EXPECT_EQ(test_net->get_sources().size(), 0);
}
{
// Pin is an input pin (not an output/inout pin)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate_0 = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
bool suc = test_net->add_source(t_gate_0, "I0"); // <- input pin
EXPECT_FALSE(suc);
EXPECT_EQ(test_net->get_sources().size(), 0);
}
{
// Pin is already occupied (example netlist is used)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_example_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->add_source(nl->get_gate_by_id(MIN_NET_ID + 1), "O");
EXPECT_FALSE(suc);
EXPECT_EQ(test_net->get_sources().size(), 0);
}
{
// Set the source of the Net (invalid pin type)
auto nl = test_utils::create_empty_netlist(0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
testing::internal::CaptureStdout();
bool suc = test_net->add_source(t_gate, "NEx_PIN");
testing::internal::GetCapturedStdout();
EXPECT_FALSE(suc);
EXPECT_EQ(test_net->get_sources().size(), 0);
}
TEST_END
}
/**
* Testing the access on sources
*
* Functions: get_sources, get_source
*/
// disable get_source() deprecated warning for this test (because get_source() is also tested)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma warning(disable:1478)
TEST_F(NetTest, check_get_sources) {
TEST_START
{
// Get a single source
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_4_to_4"), "test_gate");
test_net->add_source(t_gate, "O0");
EXPECT_EQ(test_net->get_source(), test_utils::get_endpoint(t_gate, "O0")); // (compiler warning intended)
}
{
// Get all sources (no filter)
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_4_to_4"), "test_gate");
test_net->add_source(t_gate, "O0");
test_net->add_source(t_gate, "O1");
test_net->add_source(t_gate, "O3");
EXPECT_EQ(test_net->get_sources(), std::vector<Endpoint*>({test_utils::get_endpoint(t_gate, "O0"),
test_utils::get_endpoint(t_gate, "O1"),
test_utils::get_endpoint(t_gate, "O3")}));
}
{
// Get all sources by using a filter
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate_0 =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_4_to_4"), "test_gate_0");
auto t_gate_1 =
nl->create_gate(MIN_GATE_ID + 1, test_utils::get_gate_type_by_name("gate_4_to_4"), "test_gate_1");
test_net->add_source(t_gate_0, "O0");
test_net->add_source(t_gate_0, "O1");
test_net->add_source(t_gate_1, "O1");
test_net->add_source(t_gate_1, "O2");
EXPECT_EQ(test_net->get_sources(test_utils::endpoint_gate_name_filter("test_gate_0")),
std::vector<Endpoint*>({test_utils::get_endpoint(t_gate_0, "O0"),
test_utils::get_endpoint(t_gate_0, "O1")}));
}
{
// Get the source(s) if the Gate has no source
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
EXPECT_TRUE(test_utils::is_empty(test_net->get_source())); // (compiler warning intended)
EXPECT_TRUE(test_net->get_sources().empty());
}
// NEGATIVE
{
// Get source, if there are multiple sources (only the first one is returned)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_4_to_4"), "test_gate");
test_net->add_source(t_gate, "O0");
test_net->add_source(t_gate, "O1");
EXPECT_EQ(test_net->get_source(), test_utils::get_endpoint(t_gate, "O0")); // (compiler warning intended)
}
TEST_END
}
// enable get_source() deprecated warning
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#pragma warning(enable:1478) // enable get_source() deprecated warning
/**
* Testing the function remove_src
*
* Functions: remove_src
*/
TEST_F(NetTest, check_remove_src) {
TEST_START
{
// Remove an existing source (passing a Gate and a pin type)
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_source(t_gate, "O");
bool suc = test_net->remove_source(t_gate, "O");
EXPECT_EQ(test_net->get_sources().size(), 0);
EXPECT_TRUE(suc);
}
// NEGATIVE
{
// Remove the source if the passed parameters do not define any source
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->remove_source(nullptr, "");
EXPECT_EQ(test_net->get_sources().size(), 0);
EXPECT_FALSE(suc);
}
TEST_END
}
/**
* Testing the function which removes a destination
*
* Functions: remove_destination, get_num_of_destinations
*/
TEST_F(NetTest, check_add_remove_destination) {
TEST_START
{
// Remove a destination in the normal way
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I0");
bool suc = test_net->remove_destination(t_gate, "I0");
EXPECT_TRUE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 0);
}
{
// Remove the same destination twice
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I0");
test_net->remove_destination(t_gate, "I0");
NO_COUT_TEST_BLOCK;
bool suc = test_net->remove_destination(t_gate, "I0");
EXPECT_FALSE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), 0);
}
// NEGATIVE
{
// The Gate is a nullptr
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->remove_destination(nullptr, "I0");
EXPECT_FALSE(suc);
}
{
// The Gate wasn't added to the netlist
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
Gate*
t_gate =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_1_to_1"), "t_gate");
bool suc = test_net->remove_destination(t_gate, "I0");
EXPECT_FALSE(suc);
}
TEST_END
}
/**
* Testing the function which adds a destination
*
* Functions: add_destination, get_num_of_destinations
*/
TEST_F(NetTest, check_add_dst) {
TEST_START
{
// Add a destination in the normal way
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
bool suc = test_net->add_destination(t_gate, "I0");
std::vector<Endpoint*> dsts = {test_utils::get_endpoint(t_gate, "I0")};
EXPECT_EQ(test_net->get_destinations(), dsts);
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 1);
EXPECT_TRUE(suc);
}
{
// Add the same destination twice
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I0");
bool suc = test_net->add_destination(t_gate, "I0");
std::vector<Endpoint*> dsts = {test_utils::get_endpoint(t_gate, "I0")};
EXPECT_EQ(test_net->get_destinations(), dsts);
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 1);
EXPECT_FALSE(suc);
}
// NEGATIVE
{
// The Gate is a nullptr
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->add_destination(nullptr, "I0");
EXPECT_FALSE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 0);
}
{
// The Gate isn't part of the netlist
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
Gate*
t_gate =
nl->create_gate(MIN_GATE_ID + 0, test_utils::get_gate_type_by_name("gate_1_to_1"), "t_gate");
// Gate isn't added
bool suc = test_net->add_destination(t_gate, "I0");
EXPECT_FALSE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 0);
}
{
// The pin to connect is weather an input pin nor an inout pin (but an output pin)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
bool suc = test_net->add_destination(t_gate, "O");
EXPECT_FALSE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 0);
}
{
// The pin is already occupied (example netlist is used)
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_example_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
bool suc = test_net->add_destination(nl->get_gate_by_id(MIN_GATE_ID + 0), "I1");
EXPECT_FALSE(suc);
EXPECT_TRUE(test_net->get_destinations().empty());
EXPECT_EQ(test_net->get_num_of_destinations(), (size_t) 0);
}
TEST_END
}
/**
* Testing the functions is_a_destination and is_a_source
*
* Functions: is_a_destination, is_a_source
*/
TEST_F(NetTest, check_is_a_dest_or_src) {
TEST_START
{
// Gate is a destination
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I2");
// Pass the Gate and the pin type
EXPECT_TRUE(test_net->is_a_destination(t_gate, "I2"));
EXPECT_FALSE(test_net->is_a_source(t_gate, "I2"));
// Pass the Endpoint
EXPECT_TRUE(test_net->is_a_destination(test_utils::get_endpoint(t_gate, "I2")));
NO_COUT_TEST_BLOCK;
EXPECT_FALSE(test_net->is_a_source(test_utils::get_endpoint(t_gate, "I2")));
}
{
// Gate is a source
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_source(t_gate, "O");
// Pass the Gate and the pin type
EXPECT_TRUE(test_net->is_a_source(t_gate, "O"));
EXPECT_FALSE(test_net->is_a_destination(t_gate, "O"));
// Pass the Endpoint
EXPECT_TRUE(test_net->is_a_source(test_utils::get_endpoint(t_gate, "O")));
NO_COUT_TEST_BLOCK;
EXPECT_FALSE(test_net->is_a_destination(test_utils::get_endpoint(t_gate, "O")));
}
{
// Gate is a destination but the pin type doesn't match
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I2");
EXPECT_TRUE(test_net->is_a_destination(t_gate, "I2"));
EXPECT_FALSE(test_net->is_a_destination(t_gate, "I1"));
}
{
// Gate is a destination but the pin type doesn't exist
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate, "I2");
EXPECT_TRUE(test_net->is_a_destination(t_gate, "I2"));
EXPECT_FALSE(test_net->is_a_destination(t_gate, "NEx_PIN"));
}
// NEGATIVE
{
// Gate is a nullptr
NO_COUT_TEST_BLOCK;
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
EXPECT_FALSE(test_net->is_a_destination(nullptr, ""));
EXPECT_FALSE(test_net->is_a_source(nullptr, ""));
}
TEST_END
}
/**
* Testing the function get_destinations
*
* Functions: get_destinations, get_destinations_by_type
*/
TEST_F(NetTest, check_get_destinations) {
TEST_START
// Create a Net with two different destinations (AND3 and INV Gate)
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto mult_gate = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
Gate*
inv_gate = nl->create_gate(MIN_GATE_ID + 2, test_utils::get_gate_type_by_name("gate_1_to_1"), "gate_1");
test_net->add_destination(mult_gate, "I0");
test_net->add_destination(inv_gate, "I");
{
// Get the destinations
std::vector<Endpoint*>
dsts = {test_utils::get_endpoint(mult_gate, "I0"), test_utils::get_endpoint(inv_gate, "I")};
EXPECT_TRUE(test_utils::vectors_have_same_content(test_net->get_destinations(), dsts));
}
{
// Get the destinations by passing a Gate type
std::vector<Endpoint*> dsts = {test_utils::get_endpoint(inv_gate, "I")};
EXPECT_TRUE(test_utils::vectors_have_same_content(test_net
->get_destinations(test_utils::endpoint_gate_type_filter(
"gate_1_to_1")),
dsts));
}
TEST_END
}
/**
* Testing the function is_unrouted
*
* Functions: is_unrouted
*/
TEST_F(NetTest, check_is_unrouted) {
TEST_START
{
// Net has a source and a destination
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate_src = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
auto t_gate_dst = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 2);
test_net->add_source(t_gate_src, "O");
test_net->add_destination(t_gate_dst, "I0");
EXPECT_FALSE(test_net->is_unrouted());
}
{
// Net has no destination
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate_src = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_source(t_gate_src, "O");
EXPECT_TRUE(test_net->is_unrouted());
}
{
// Net has no source
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
auto t_gate_dst = test_utils::create_test_gate(nl.get(), MIN_GATE_ID + 1);
test_net->add_destination(t_gate_dst, "I0");
EXPECT_TRUE(test_net->is_unrouted());
}
TEST_END
}
/**
* Testing the handling of global nets
*
* Functions: mark_global_input_net, mark_global_input_net, mark_global_inout_net,
* unmark_global_input_net, unmark_global_input_net, unmark_global_inout_net
* is_global_input_net, is_global_input_net, is_global_inout_net
*/
TEST_F(NetTest, check_global_nets) {
TEST_START
{
// mark and unmark a global input Net
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
test_net->mark_global_input_net();
EXPECT_TRUE(test_net->is_global_input_net());
EXPECT_TRUE(nl->is_global_input_net(test_net));
test_net->unmark_global_input_net();
EXPECT_FALSE(test_net->is_global_input_net());
EXPECT_FALSE(nl->is_global_input_net(test_net));
}
{
// mark and unmark a global output Net
auto nl = test_utils::create_empty_netlist(MIN_NETLIST_ID + 0);
Net* test_net = nl->create_net(MIN_NET_ID + 1, "test_net");
test_net->mark_global_output_net();
EXPECT_TRUE(test_net->is_global_output_net());
EXPECT_TRUE(nl->is_global_output_net(test_net));
test_net->unmark_global_output_net();
EXPECT_FALSE(test_net->is_global_output_net());
EXPECT_FALSE(nl->is_global_output_net(test_net));
}
TEST_END
}
/**
* Testing the get_grouping function
*
* Functions: get_grouping
*/
TEST_F(NetTest, check_get_grouping) {
TEST_START
{
// get the grouping of a net (nullptr), then add it to another grouping and check again
auto nl = test_utils::create_empty_netlist();
Net* test_net = nl->create_net("test_net");
EXPECT_EQ(test_net->get_grouping(), nullptr);
// move the net in the test_grouping
Grouping* test_grouping = nl->create_grouping("test_grouping");
test_grouping->assign_net(test_net);
EXPECT_EQ(test_net->get_grouping(), test_grouping);
// -- delete the test_grouping, so the net should be nullptr again
nl->delete_grouping(test_grouping);
EXPECT_EQ(test_net->get_grouping(), nullptr);
}
TEST_END
}
/*************************************
* Event System
*************************************/
/**
* Testing the triggering of events.
*/
TEST_F(NetTest, check_events) {
TEST_START
const u32 NO_DATA = 0xFFFFFFFF;
std::unique_ptr<Netlist> test_nl = test_utils::create_example_netlist();
Net* test_net = test_nl->get_net_by_id(MIN_NET_ID + 13);
Gate* new_gate = test_nl->create_gate(test_utils::get_gate_type_by_name("gate_1_to_1"), "new_gate");
// Small functions that should trigger certain events exactly once (these operations are executed in this order)
std::function<void(void)> trigger_name_changed = [=](){test_net->set_name("new_name");};
std::function<void(void)> trigger_src_added = [=](){test_net->add_source(new_gate, "O");};
std::function<void(void)> trigger_src_removed = [=](){test_net->remove_source(new_gate, "O");};
std::function<void(void)> trigger_dst_added = [=](){test_net->add_destination(new_gate, "I");};
std::function<void(void)> trigger_dst_removed = [=](){test_net->remove_destination(new_gate, "I");};
// The events that are tested
std::vector<net_event_handler::event> event_type = {
net_event_handler::event::name_changed, net_event_handler::event::src_added,
net_event_handler::event::src_removed, net_event_handler::event::dst_added,
net_event_handler::event::dst_removed};
// A list of the functions that will trigger its associated event exactly once
std::vector<std::function<void(void)>> trigger_event = { trigger_name_changed, trigger_src_added,
trigger_src_removed, trigger_dst_added, trigger_dst_removed };
// The parameters of the events that are expected
std::vector<std::tuple<net_event_handler::event, Net*, u32>> expected_parameter = {
std::make_tuple(net_event_handler::event::name_changed, test_net, NO_DATA),
std::make_tuple(net_event_handler::event::src_added, test_net, new_gate->get_id()),
std::make_tuple(net_event_handler::event::src_removed, test_net, new_gate->get_id()),
std::make_tuple(net_event_handler::event::dst_added, test_net, new_gate->get_id()),
std::make_tuple(net_event_handler::event::dst_removed, test_net, new_gate->get_id())
};
// Check all events in a for-loop
for(u32 event_idx = 0; event_idx < event_type.size(); event_idx++)
{
// Create the listener for the tested event
test_utils::EventListener<void, net_event_handler::event, Net*, u32> listener;
std::function<void(net_event_handler::event, Net*, u32)> cb = listener.get_conditional_callback(
[=](net_event_handler::event ev, Net* n, u32 id){return ev == event_type[event_idx] && n == test_net;}
);
std::string cb_name = "net_event_callback_" + std::to_string((u32)event_type[event_idx]);
// Register a callback of the listener
net_event_handler::register_callback(cb_name, cb);
// Trigger the event
trigger_event[event_idx]();
EXPECT_EQ(listener.get_event_count(), 1);
EXPECT_EQ(listener.get_last_parameters(), expected_parameter[event_idx]);
// Unregister the callback
net_event_handler::unregister_callback(cb_name);
}
// Test the events 'created' and 'removed'
// -- 'created' event
test_utils::EventListener<void, net_event_handler::event, Net*, u32> listener_created;
std::function<void(net_event_handler::event, Net*, u32)> cb_created = listener_created.get_conditional_callback(
[=](net_event_handler::event ev, Net* m, u32 id){return ev == net_event_handler::created;}
);
std::string cb_name_created = "net_event_callback_created";
net_event_handler::register_callback(cb_name_created, cb_created);
// Create a new mod
Net* new_net = test_nl->create_net("new_net");
EXPECT_EQ(listener_created.get_event_count(), 1);
EXPECT_EQ(listener_created.get_last_parameters(), std::make_tuple(net_event_handler::event::created, new_net, NO_DATA));
net_event_handler::unregister_callback(cb_name_created);
// -- 'removed' event
test_utils::EventListener<void, net_event_handler::event, Net*, u32> listener_removed;
std::function<void(net_event_handler::event, Net*, u32)> cb_removed = listener_removed.get_conditional_callback(
[=](net_event_handler::event ev, Net* m, u32 id){return ev == net_event_handler::removed;}
);
std::string cb_name_removed = "net_event_callback_removed";
net_event_handler::register_callback(cb_name_removed, cb_removed);
// Delete the module which was created in the previous part
test_nl->delete_net(new_net);
EXPECT_EQ(listener_removed.get_event_count(), 1);
EXPECT_EQ(listener_removed.get_last_parameters(), std::make_tuple(net_event_handler::event::removed, new_net, NO_DATA));
net_event_handler::unregister_callback(cb_name_removed);
TEST_END
}
} //namespace hal
| 45.904348 | 132 | 0.564375 | [
"vector"
] |
9ec7a2fd71dc88a100d5aa2e707b1b74b3b128c8 | 16,710 | cpp | C++ | opt/nomad/src/Eval/Evaluator.cpp | scikit-quant/scikit-quant | 397ab0b6287f3815e9bcadbfadbe200edbee5a23 | [
"BSD-3-Clause-LBNL"
] | 31 | 2019-02-05T16:39:18.000Z | 2022-03-11T23:14:11.000Z | opt/nomad/src/Eval/Evaluator.cpp | scikit-quant/scikit-quant | 397ab0b6287f3815e9bcadbfadbe200edbee5a23 | [
"BSD-3-Clause-LBNL"
] | 20 | 2020-04-13T09:22:53.000Z | 2021-08-16T16:14:13.000Z | opt/nomad/src/Eval/Evaluator.cpp | scikit-quant/scikit-quant | 397ab0b6287f3815e9bcadbfadbe200edbee5a23 | [
"BSD-3-Clause-LBNL"
] | 6 | 2020-04-21T17:43:47.000Z | 2021-03-10T04:12:34.000Z | /*---------------------------------------------------------------------------------*/
/* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct Search - */
/* */
/* NOMAD - Version 4 has been created by */
/* Viviane Rochon Montplaisir - Polytechnique Montreal */
/* Christophe Tribes - Polytechnique Montreal */
/* */
/* The copyright of NOMAD - version 4 is owned by */
/* Charles Audet - Polytechnique Montreal */
/* Sebastien Le Digabel - Polytechnique Montreal */
/* Viviane Rochon Montplaisir - Polytechnique Montreal */
/* Christophe Tribes - Polytechnique Montreal */
/* */
/* NOMAD 4 has been funded by Rio Tinto, Hydro-Québec, Huawei-Canada, */
/* NSERC (Natural Sciences and Engineering Research Council of Canada), */
/* InnovÉÉ (Innovation en Énergie Électrique) and IVADO (The Institute */
/* for Data Valorization) */
/* */
/* NOMAD v3 was created and developed by Charles Audet, Sebastien Le Digabel, */
/* Christophe Tribes and Viviane Rochon Montplaisir and was funded by AFOSR */
/* and Exxon Mobil. */
/* */
/* NOMAD v1 and v2 were created and developed by Mark Abramson, Charles Audet, */
/* Gilles Couture, and John E. Dennis Jr., and were funded by AFOSR and */
/* Exxon Mobil. */
/* */
/* Contact information: */
/* Polytechnique Montreal - GERAD */
/* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */
/* e-mail: nomad@gerad.ca */
/* */
/* This program is free software: you can redistribute it and/or modify it */
/* under the terms of the GNU Lesser General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or (at your */
/* option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, but WITHOUT */
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */
/* for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* You can find information on the NOMAD software at www.gerad.ca/nomad */
/*---------------------------------------------------------------------------------*/
#include "../Eval/Evaluator.hpp"
#include "../Output/OutputQueue.hpp"
#include "../Util/fileutils.hpp"
#include <fstream> // For ofstream
#include <stdio.h> // For popen
#ifndef _WIN32
#include <unistd.h> // for getpid
#else
#include <process.h>
#define getpid _getpid
#define popen _popen
#define pclose _pclose
#endif
// Initialize statics
std::vector<std::string> NOMAD::Evaluator::_tmpFiles = std::vector<std::string>();
namespace {
// the cleanup of temporary files at program shutdown needs to remain with this
// translation unit to guarantee the correct destruction order
struct TmpFilesCleanup {
~TmpFilesCleanup() { NOMAD::Evaluator::removeTmpFiles(); }
} _TmpFilesCleanup;
}
//
// Constructor
//
// NOTE: The full path to BB_EXE is added during check
NOMAD::Evaluator::Evaluator(
const std::shared_ptr<NOMAD::EvalParameters> &evalParams,
const NOMAD::EvalType evalType,
const NOMAD::EvalXDefined evalXDefined)
: _evalParams(evalParams),
_evalXDefined(evalXDefined),
_evalType(evalType)
{
}
NOMAD::Evaluator::~Evaluator()
{
}
void NOMAD::Evaluator::initializeTmpFiles(const std::string& tmpDir)
{
// Initialize tmp files for Evaluators
int nbThreads = 1;
#ifdef _OPENMP
nbThreads = omp_get_max_threads();
#endif
std::string tmppath = tmpDir;
NOMAD::ensureDirPath(tmppath);
// Use the pid in the file name in case two nomad run at the same time.
int pid = getpid();
// Create a temporary file fo blackbox input. One for each thread number,
// for each nomad pid. Add the file names to _tmpFiles.
_tmpFiles.clear();
for (auto threadNum = 0; threadNum < nbThreads; threadNum++)
{
std::string tmpfilestr = tmppath + "nomadtmp." + std::to_string(pid) + "." + std::to_string(threadNum);
_tmpFiles.push_back(tmpfilestr);
}
}
void NOMAD::Evaluator::removeTmpFiles()
{
// Remove all temporary files, so that they do not linger around.
auto nbThreads = _tmpFiles.size();
for (size_t i = 0; i < nbThreads; i++)
{
remove(_tmpFiles[i].c_str());
}
_tmpFiles.clear();
}
// Default eval_x: System call to a black box that was provided
// via parameter BB_EXE and set through Evaluator::setBBExe().
bool NOMAD::Evaluator::eval_x(NOMAD::EvalPoint &x,
const NOMAD::Double& hMax,
bool &countEval) const
{
// The user might have defined his own eval_x() for NOMAD::EvalPoint.
// In the NOMAD code, we do not use this method.
//
// Implemented to be used by the Runner. In the case of the Runner,
// eval_x is redefined. When batch mode is used (for instance for
// Styrene), this eval_x is called. So in fact we really want to
// use the executable defined by BB_EXE.
_evalXDefined = NOMAD::EvalXDefined::USE_BB_EVAL;
// Create a block of one point and evaluate it.
NOMAD::Block block;
std::shared_ptr<NOMAD::EvalPoint> epp = std::make_shared<NOMAD::EvalPoint>(x);
block.push_back(epp);
std::vector<bool> countEvalVector(1, countEval);
std::vector<bool> evalOkVector(1, false);
// Call eval_block
evalOkVector = eval_block(block, hMax, countEvalVector);
// Update x and countEval
x = *epp;
countEval = countEvalVector[0];
return evalOkVector[0];
}
// Default eval_block: for block
// This is used even for blocks of 1 point.
// If we never go through this eval_block(),
// it means that eval_block was redefined by the user,
// using library mode.
std::vector<bool> NOMAD::Evaluator::eval_block(NOMAD::Block &block,
const NOMAD::Double &hMax,
std::vector<bool> &countEval) const
{
std::vector<bool> evalOk(block.size(), false);
countEval.resize(block.size(), false);
// Verify there is at least one point to evaluate
if (0 == block.size())
{
throw NOMAD::Exception(__FILE__, __LINE__, "Evaluator: eval_block called with an empty block");
}
// Verify all points are completely defined
for (auto it = block.begin(); it != block.end(); it++)
{
if (!(*it)->isComplete())
{
throw NOMAD::Exception(__FILE__, __LINE__, "Evaluator: Incomplete point " + (*it)->display());
}
}
// Start evaluation
for (auto it = block.begin(); it != block.end(); it++)
{
// Debugging. EVAL should already be IN_PROGRESS.
if (NOMAD::EvalStatusType::EVAL_IN_PROGRESS != (*it)->getEvalStatus(_evalType))
{
#ifdef _OPENMP
#pragma omp critical(warningEvalX)
#endif
{
std::cerr << "Warning: EVAL should already be IN_PROGRESS for point " << (*it)->display() << std::endl;
}
}
}
if (NOMAD::EvalXDefined::EVAL_BLOCK_DEFINED_BY_USER == _evalXDefined)
{
// First time that eval_block() is called.
// Obviously, eval_block() was not redefined by user.
// If the blackbox is external, USE_BB_EVAL is already set by the
// constructor. Hence, eval_x() is defined by user.
_evalXDefined = NOMAD::EvalXDefined::EVAL_X_DEFINED_BY_USER;
}
if (NOMAD::EvalXDefined::USE_BB_EVAL == _evalXDefined)
{
evalOk = evalXBBExe(block, hMax, countEval);
}
else if (NOMAD::EvalXDefined::EVAL_X_DEFINED_BY_USER == _evalXDefined)
{
for (size_t index = 0; index < block.size(); index++)
{
bool countEval1 = false;
evalOk[index] = eval_x(*block[index], hMax, countEval1);
countEval[index] = countEval1;
}
}
else
{
std::string s = "Error: This value of EvalXDefined is not processed: ";
s += std::to_string((int)_evalXDefined);
throw NOMAD::Exception(__FILE__, __LINE__, s);
}
return evalOk;
}
// eval_x() called in batch. Use system command and use the blackbox executable
// provided by parameter BB_EXE.
std::vector<bool> NOMAD::Evaluator::evalXBBExe(NOMAD::Block &block,
const NOMAD::Double &hMax,
std::vector<bool> &countEval) const
{
std::vector<bool> evalOk(block.size(), false);
// At this point, we are for sure in batch mode.
// Verify blackbox executable defined by BB_EXE is available and executable.
std::string bbExe;
switch (_evalType)
{
case NOMAD::EvalType::BB:
bbExe = _evalParams->getAttributeValue<std::string>("BB_EXE");
break;
case NOMAD::EvalType::SURROGATE:
bbExe = _evalParams->getAttributeValue<std::string>("SURROGATE_EXE");
break;
default:
std::string err = "Evaluator: No executable supported for EvalType ";
err += NOMAD::evalTypeToString(_evalType);
throw NOMAD::Exception(__FILE__,__LINE__,err);
}
if (bbExe.empty())
{
throw NOMAD::Exception(__FILE__, __LINE__, "Evaluator: No blackbox executable defined.");
}
const int threadNum = NOMAD::getThreadNum();
// Write a temp file for x0 and give that file as argument to bbExe.
if ((size_t)threadNum >= _tmpFiles.size())
{
std::cerr << "Error: Evaluator: No temp file available." << std::endl;
// Ugly early return
return evalOk;
}
std::string tmpfile = _tmpFiles[threadNum];
// System command
std::ofstream xfile;
// Open xfile and clear it (trunc)
xfile.open(tmpfile.c_str(), std::ofstream::trunc);
if (xfile.fail())
{
for (auto it = block.begin(); it != block.end(); it++)
{
(*it)->setEvalStatus(NOMAD::EvalStatusType::EVAL_ERROR, _evalType);
std::cerr << "Error writing point " << (*it)->display() << " to temporary file \"" << tmpfile << "\"" << std::endl;
}
// Ugly early return
return evalOk;
}
auto evalFormat = _evalParams->getAttributeValue<NOMAD::ArrayOfDouble>("BB_EVAL_FORMAT");
for (auto it = block.begin(); it != block.end(); it++)
{
std::shared_ptr<NOMAD::EvalPoint> x = (*it);
for (size_t i = 0; i < x->size(); i++)
{
if (i != 0)
{
xfile << " ";
}
xfile << (*x)[i].display(static_cast<int>(evalFormat[i].todouble()));
}
xfile << std::endl;
}
xfile.close();
std::string cmd = bbExe + " " + tmpfile;
std::string s;
OUTPUT_DEBUG_START
s = "System command: " + cmd;
NOMAD::OutputQueue::Add(s, NOMAD::OutputLevel::LEVEL_DEBUGDEBUG);
OUTPUT_DEBUG_END
FILE *fresult = popen(cmd.c_str(), "r");
if (!fresult)
{
// Something went wrong with the evaluation.
// Point could be re-submitted.
for (auto it = block.begin(); it != block.end(); it++)
{
(*it)->setEvalStatus(NOMAD::EvalStatusType::EVAL_ERROR, _evalType);
#ifdef _OPENMP
#pragma omp critical(warningEvalX)
#endif
{
std::cerr << "Warning: Evaluation error with point " << (*it)->display() << std::endl;
}
}
}
else
{
for (size_t index = 0; index < block.size(); index++)
{
std::shared_ptr<NOMAD::EvalPoint> x = block[index];
char buffer[1024];
char *outputLine = nullptr;
size_t nbTries=0;
while (nbTries < 5)
{
nbTries++;
outputLine = fgets(buffer, sizeof(buffer), fresult);
if( feof(fresult) )
{ // c-stream eof detected. Output is empty, break the loop
x->setEvalStatus(NOMAD::EvalStatusType::EVAL_ERROR, _evalType);
#ifdef _OPENMP
#pragma omp critical(warningEvalX)
#endif
{
std::cerr << "Warning: Evaluation error with point " << x->display() << ": output is empty" << std::endl;
}
break;
}
if (NULL != outputLine)
{
// Evaluation succeeded. Get and process blackbox output.
std::string bbo(outputLine);
// delete trailing '\n'
bbo.erase(bbo.size() - 1);
// Process blackbox output
auto bbOutputTypeList = _evalParams->getAttributeValue<NOMAD::BBOutputTypeList>("BB_OUTPUT_TYPE");
x->setBBO(bbo, bbOutputTypeList, _evalType);
auto bbOutput = x->getEval(_evalType)->getBBOutput();
evalOk[index] = bbOutput.getEvalOk();
countEval[index] = bbOutput.getCountEval(bbOutputTypeList);
break;
}
}
// The number of tries has been reached (not eof) and still cannot read output file.
if( ! feof(fresult) && NULL == outputLine )
{
// Something went wrong with the evaluation.
// Point could be re-submitted.
x->setEvalStatus(NOMAD::EvalStatusType::EVAL_ERROR, _evalType);
#ifdef _OPENMP
#pragma omp critical(warningEvalX)
#endif
{
std::cerr << "Warning: Evaluation error with point " << x->display() << ": output is empty" << std::endl;
}
}
}
// Get exit status of the bb.exe. If it is not 0, there was an error.
int exitStatus = pclose(fresult);
size_t index = 0; // used to update evalOk
for (auto it = block.begin(); it != block.end(); it++)
{
std::shared_ptr<NOMAD::EvalPoint> x = (*it);
if (exitStatus)
{
evalOk[index] = false;
x->setEvalStatus(NOMAD::EvalStatusType::EVAL_ERROR, _evalType);
s = "Warning: Evaluator returned exit status ";
s += std::to_string(exitStatus);
s += " for point: " + x->getX()->NOMAD::Point::display();
NOMAD::OutputQueue::Add(s, NOMAD::OutputLevel::LEVEL_WARNING);
#ifdef _OPENMP
#pragma omp critical(warningEvalX)
#endif
{
std::cerr << s << std::endl;
}
}
else if (!evalOk[index])
{
x->setEvalStatus(NOMAD::EvalStatusType::EVAL_FAILED, _evalType);
}
else
{
x->setEvalStatus(NOMAD::EvalStatusType::EVAL_OK, _evalType);
}
index++;
}
}
return evalOk;
}
| 38.951049 | 129 | 0.524237 | [
"mesh",
"vector"
] |
9ecababb8517318d6ccd8bf33b333eba9f3d499b | 2,983 | hpp | C++ | src/ParallelAlgorithms/Interpolation/Events/Interpolate.hpp | Shabibti/spectre | 0fa0353e209ef2bc53100f7101bd05f12e812f5e | [
"MIT"
] | null | null | null | src/ParallelAlgorithms/Interpolation/Events/Interpolate.hpp | Shabibti/spectre | 0fa0353e209ef2bc53100f7101bd05f12e812f5e | [
"MIT"
] | null | null | null | src/ParallelAlgorithms/Interpolation/Events/Interpolate.hpp | Shabibti/spectre | 0fa0353e209ef2bc53100f7101bd05f12e812f5e | [
"MIT"
] | null | null | null | // Distributed under the MIT License.
// See LICENSE.txt for details.
#pragma once
#include <cstddef>
#include <pup.h>
#include <string>
#include "Options/Options.hpp"
#include "Parallel/CharmPupable.hpp"
#include "ParallelAlgorithms/EventsAndTriggers/Event.hpp"
#include "ParallelAlgorithms/Interpolation/Interpolate.hpp"
#include "Utilities/TMPL.hpp"
/// \cond
template <size_t Dim>
class Mesh;
template <size_t VolumeDim>
class ElementId;
namespace Parallel {
template <typename Metavariables>
class GlobalCache;
} // namespace Parallel
namespace domain::Tags {
template <size_t VolumeDim>
struct Mesh;
} // namespace domain::Tags
/// \endcond
namespace intrp {
namespace Events {
/// Does an interpolation onto InterpolationTargetTag by calling Actions on
/// the Interpolator and InterpolationTarget components.
template <size_t VolumeDim, typename InterpolationTargetTag, typename Tensors>
class Interpolate;
template <size_t VolumeDim, typename InterpolationTargetTag,
typename... Tensors>
class Interpolate<VolumeDim, InterpolationTargetTag, tmpl::list<Tensors...>>
: public Event {
/// \cond
explicit Interpolate(CkMigrateMessage* /*unused*/) {}
using PUP::able::register_constructor;
WRAPPED_PUPable_decl_template(Interpolate); // NOLINT
/// \endcond
using options = tmpl::list<>;
static constexpr Options::String help =
"Starts interpolation onto the given InterpolationTargetTag.";
static std::string name() { return Options::name<InterpolationTargetTag>(); }
Interpolate() = default;
using compute_tags_for_observation_box = tmpl::list<>;
using argument_tags = tmpl::list<typename InterpolationTargetTag::temporal_id,
domain::Tags::Mesh<VolumeDim>, Tensors...>;
template <typename Metavariables, typename ParallelComponent>
void operator()(
const typename InterpolationTargetTag::temporal_id::type& temporal_id,
const Mesh<VolumeDim>& mesh, const typename Tensors::type&... tensors,
Parallel::GlobalCache<Metavariables>& cache,
const ElementId<VolumeDim>& array_index,
const ParallelComponent* const /*meta*/) const {
interpolate<InterpolationTargetTag, tmpl::list<Tensors...>>(
temporal_id, mesh, cache, array_index, tensors...);
}
using is_ready_argument_tags = tmpl::list<>;
template <typename Metavariables, typename ArrayIndex, typename Component>
bool is_ready(Parallel::GlobalCache<Metavariables>& /*cache*/,
const ArrayIndex& /*array_index*/,
const Component* const /*meta*/) const {
return true;
}
bool needs_evolved_variables() const override { return true; }
};
/// \cond
template <size_t VolumeDim, typename InterpolationTargetTag,
typename... Tensors>
PUP::able::PUP_ID Interpolate<VolumeDim, InterpolationTargetTag,
tmpl::list<Tensors...>>::my_PUP_ID = 0; // NOLINT
/// \endcond
} // namespace Events
} // namespace intrp
| 32.075269 | 80 | 0.720416 | [
"mesh"
] |
9ecbbd2d367f41d4c025968612608597c12b5781 | 8,885 | cpp | C++ | sdk/identity/azure-identity/src/client_certificate_credential.cpp | JinmingHu-MSFT/azure-sdk-for-cpp | 933486385a54a5a09a7444dbd823425f145ad75a | [
"MIT"
] | 1 | 2022-01-19T22:54:41.000Z | 2022-01-19T22:54:41.000Z | sdk/identity/azure-identity/src/client_certificate_credential.cpp | LarryOsterman/azure-sdk-for-cpp | d96216f50909a2bd39b555c9088f685bf0f7d6e6 | [
"MIT"
] | null | null | null | sdk/identity/azure-identity/src/client_certificate_credential.cpp | LarryOsterman/azure-sdk-for-cpp | d96216f50909a2bd39b555c9088f685bf0f7d6e6 | [
"MIT"
] | null | null | null | // Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "azure/identity/client_certificate_credential.hpp"
#include "private/token_credential_impl.hpp"
#include <azure/core/base64.hpp>
#include <azure/core/datetime.hpp>
#include <azure/core/uuid.hpp>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <utility>
#include <vector>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/ossl_typ.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
using namespace Azure::Identity;
namespace {
template <typename T> std::vector<uint8_t> ToUInt8Vector(T const& in)
{
const size_t size = in.size();
std::vector<uint8_t> outVec(size);
for (size_t i = 0; i < size; ++i)
{
outVec[i] = static_cast<uint8_t>(in[i]);
}
return outVec;
}
} // namespace
ClientCertificateCredential::ClientCertificateCredential(
std::string const& tenantId,
std::string const& clientId,
std::string const& clientCertificatePath,
Azure::Core::Credentials::TokenCredentialOptions const& options)
: m_tokenCredentialImpl(std::make_unique<_detail::TokenCredentialImpl>(options)),
m_pkey(nullptr)
{
BIO* bio = nullptr;
X509* x509 = nullptr;
try
{
{
using Azure::Core::Credentials::AuthenticationException;
// Open certificate file, then get private key and X509:
if ((bio = BIO_new_file(clientCertificatePath.c_str(), "r")) == nullptr)
{
throw AuthenticationException("Failed to open certificate file.");
}
if ((m_pkey = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr)) == nullptr)
{
throw AuthenticationException("Failed to read certificate private key.");
}
if ((x509 = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr)) == nullptr)
{
static_cast<void>(BIO_seek(bio, 0));
if ((x509 = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr)) == nullptr)
{
throw AuthenticationException("Failed to read certificate private key.");
}
}
static_cast<void>(BIO_free(bio));
bio = nullptr;
// Get certificate thumbprint:
{
using Azure::Core::_internal::Base64Url;
std::string thumbprintHexStr;
std::string thumbprintBase64Str;
{
std::vector<unsigned char> mdVec(EVP_MAX_MD_SIZE);
{
unsigned int mdLen = 0;
const auto digestResult = X509_digest(x509, EVP_sha1(), mdVec.data(), &mdLen);
X509_free(x509);
x509 = nullptr;
if (!digestResult)
{
throw AuthenticationException("Failed to get certificate thumbprint.");
}
// Drop unused buffer space:
const auto mdLenSz = static_cast<decltype(mdVec)::size_type>(mdLen);
if (mdVec.size() > mdLenSz)
{
mdVec.resize(mdLenSz);
}
// Get thumbprint as hex string:
{
std::ostringstream thumbprintStream;
for (const auto md : mdVec)
{
thumbprintStream << std::uppercase << std::hex << std::setfill('0') << std::setw(2)
<< static_cast<int>(md);
}
thumbprintHexStr = thumbprintStream.str();
}
}
// Get thumbprint as Base64:
thumbprintBase64Str = Base64Url::Base64UrlEncode(ToUInt8Vector(mdVec));
}
// Form a JWT token:
const auto tokenHeader = std::string("{\"x5t\":\"") + thumbprintBase64Str + "\",\"kid\":\""
+ thumbprintHexStr + "\",\"alg\":\"RS256\",\"typ\":\"JWT\"}";
const auto tokenHeaderVec
= std::vector<std::string::value_type>(tokenHeader.begin(), tokenHeader.end());
m_tokenHeaderEncoded = Base64Url::Base64UrlEncode(ToUInt8Vector(tokenHeaderVec));
}
}
using Azure::Core::Url;
{
m_requestUrl = Url("https://login.microsoftonline.com/");
m_requestUrl.AppendPath(tenantId);
m_requestUrl.AppendPath("oauth2/v2.0/token");
}
m_tokenPayloadStaticPart = std::string("{\"aud\":\"") + m_requestUrl.GetAbsoluteUrl()
+ "\",\"iss\":\"" + clientId + "\",\"sub\":\"" + clientId + "\",\"jti\":\"";
{
std::ostringstream body;
body
<< "grant_type=client_credentials"
"&client_assertion_type="
"urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer" // cspell:disable-line
"&client_id="
<< Url::Encode(clientId);
m_requestBody = body.str();
}
}
catch (...)
{
if (bio != nullptr)
{
static_cast<void>(BIO_free(bio));
}
if (x509 != nullptr)
{
X509_free(x509);
}
if (m_pkey != nullptr)
{
EVP_PKEY_free(static_cast<EVP_PKEY*>(m_pkey));
}
throw;
}
}
ClientCertificateCredential::ClientCertificateCredential(
std::string const& tenantId,
std::string const& clientId,
std::string const& clientCertificatePath,
ClientCertificateCredentialOptions const& options)
: ClientCertificateCredential(
tenantId,
clientId,
clientCertificatePath,
static_cast<Azure::Core::Credentials::TokenCredentialOptions const&>(options))
{
}
ClientCertificateCredential::~ClientCertificateCredential()
{
EVP_PKEY_free(static_cast<EVP_PKEY*>(m_pkey));
}
Azure::Core::Credentials::AccessToken ClientCertificateCredential::GetToken(
Azure::Core::Credentials::TokenRequestContext const& tokenRequestContext,
Azure::Core::Context const& context) const
{
return m_tokenCredentialImpl->GetToken(context, [&]() {
using _detail::TokenCredentialImpl;
using Azure::Core::Http::HttpMethod;
std::ostringstream body;
body << m_requestBody;
{
auto const& scopes = tokenRequestContext.Scopes;
if (!scopes.empty())
{
body << "&scope=" << TokenCredentialImpl::FormatScopes(scopes, false);
}
}
std::string assertion = m_tokenHeaderEncoded;
{
using Azure::Core::_internal::Base64Url;
// Form the assertion to sign.
{
std::string payloadStr;
// Add GUID, current time, and expiration time to the payload
{
using Azure::Core::Uuid;
using Azure::Core::_internal::PosixTimeConverter;
std::ostringstream payloadStream;
const Azure::DateTime now = std::chrono::system_clock::now();
const Azure::DateTime exp = now + std::chrono::minutes(10);
payloadStream << m_tokenPayloadStaticPart << Uuid::CreateUuid().ToString()
<< "\",\"nbf\":" << PosixTimeConverter::DateTimeToPosixTime(now)
<< ",\"exp\":" << PosixTimeConverter::DateTimeToPosixTime(exp) << "}";
payloadStr = payloadStream.str();
}
// Concatenate JWT token header + "." + encoded payload
const auto payloadVec
= std::vector<std::string::value_type>(payloadStr.begin(), payloadStr.end());
assertion += std::string(".") + Base64Url::Base64UrlEncode(ToUInt8Vector(payloadVec));
}
// Get assertion signature.
std::string signature;
if (auto mdCtx = EVP_MD_CTX_new())
{
try
{
EVP_PKEY_CTX* signCtx = nullptr;
if ((EVP_DigestSignInit(
mdCtx, &signCtx, EVP_sha256(), nullptr, static_cast<EVP_PKEY*>(m_pkey))
== 1)
&& (EVP_PKEY_CTX_set_rsa_padding(signCtx, RSA_PKCS1_PADDING) == 1))
{
size_t sigLen = 0;
if (EVP_DigestSign(mdCtx, nullptr, &sigLen, nullptr, 0) == 1)
{
const auto bufToSign = reinterpret_cast<const unsigned char*>(assertion.data());
const auto bufToSignLen = static_cast<size_t>(assertion.size());
std::vector<unsigned char> sigVec(sigLen);
if (EVP_DigestSign(mdCtx, sigVec.data(), &sigLen, bufToSign, bufToSignLen) == 1)
{
signature = Base64Url::Base64UrlEncode(ToUInt8Vector(sigVec));
}
}
}
if (signature.empty())
{
throw Azure::Core::Credentials::AuthenticationException(
"Failed to sign token request.");
}
EVP_MD_CTX_free(mdCtx);
}
catch (...)
{
EVP_MD_CTX_free(mdCtx);
throw;
}
}
// Add signature to the end of assertion
assertion += std::string(".") + signature;
}
body << "&client_assertion=" << Azure::Core::Url::Encode(assertion);
auto request = std::make_unique<TokenCredentialImpl::TokenRequest>(
HttpMethod::Post, m_requestUrl, body.str());
return request;
});
}
| 30.016892 | 102 | 0.598312 | [
"vector"
] |
19b084c57ad0ba1bf43f584993544260c6427b13 | 5,308 | cpp | C++ | src/ofxGFNet.cpp | mikiec84/ofxGFTensorflow | e5951f7a4b7668bfbb8da2fde190ad253dc293d4 | [
"Apache-2.0"
] | 25 | 2018-10-17T16:13:48.000Z | 2021-12-16T11:09:16.000Z | src/ofxGFNet.cpp | mikiec84/ofxGFTensorflow | e5951f7a4b7668bfbb8da2fde190ad253dc293d4 | [
"Apache-2.0"
] | null | null | null | src/ofxGFNet.cpp | mikiec84/ofxGFTensorflow | e5951f7a4b7668bfbb8da2fde190ad253dc293d4 | [
"Apache-2.0"
] | 5 | 2019-10-02T21:54:58.000Z | 2021-09-07T09:42:40.000Z | //
// Created by G.F. Duivesteijn on 08/10/2018.
//
#include "ofxGFNet.h"
gf::dnn::Net::Net() {
}
gf::dnn::Net::~Net() {
if (session != nullptr) {
session->Close();
}
delete session;
}
void gf::dnn::Net::readNet(const std::string &graph_file_name) {
tensorflow::GraphDef graph_def;
tensorflow::Status status;
status = ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
if (!status.ok()) {
std::cout << status.ToString() << std::endl;
}
status = tensorflow::NewSession(tensorflow::SessionOptions(), &session);
if (!status.ok()) {
std::cout << status.ToString() << std::endl;
}
status = session->Create(graph_def);
if (!status.ok()) {
std::cout << status.ToString() << std::endl;
}
}
tensorflow::Tensor gf::dnn::Net::tensorFromCvImageFast(cv::Mat image, const double scale, const cv::Size size,
const int channels, const cv::Scalar &mean, bool swapRB, bool crop, int ddepth) {
const auto n_elements_per_image = size.height * size.width * channels;
tensorflow::TensorShape shape = tensorflow::TensorShape({1, size.height, size.width, channels});
tensorflow::Tensor _tensor(tensorflow::DT_FLOAT, shape);
auto _tensor_ptr = _tensor.flat<float>().data();
image = preprocess(image, scale, size, mean, swapRB, ddepth);
auto _image_ptr = (float *) image.data;
std::memcpy(_tensor_ptr, _image_ptr, n_elements_per_image * sizeof(float));
return _tensor;
}
tensorflow::Tensor gf::dnn::Net::tensorFromCvImagesFast(std::vector<cv::Mat> images, const double scale,
const cv::Size size, const int channels, const cv::Scalar &mean, bool swapRB, bool crop, int ddepth) {
const auto n_elements_per_image = size.height * size.width * channels;
tensorflow::TensorShape _tensor_shape = tensorflow::TensorShape({static_cast<int64>(images.size()), size.height, size.width, channels});
tensorflow::Tensor _tensor(tensorflow::DT_FLOAT, _tensor_shape);
auto _tensor_ptr = _tensor.flat<float>().data();
for (int i = 0; i < images.size(); i++) {
images[i] = preprocess(images[i], scale, size, mean, swapRB, ddepth);
auto _image_ptr = (float *) images[i].data;
std::memcpy(_tensor_ptr + i * n_elements_per_image, _image_ptr, n_elements_per_image * sizeof(float));
}
return _tensor;
}
tensorflow::Tensor gf::dnn::Net::tensorFromCvImage(cv::Mat image, const double scale, const cv::Size size,
const int channels, const cv::Scalar &mean, bool swapRB, bool crop, int ddepth) {
std::vector<cv::Mat> images(1, image);
return tensorFromCvImages(images, scale, size, channels, mean, swapRB, crop, ddepth);
}
tensorflow::Tensor gf::dnn::Net::tensorFromCvImages(std::vector<cv::Mat> images, const double scale, cv::Size size,
const int channels, const cv::Scalar &mean, bool swapRB, bool crop, int ddepth) {
for (int i = 0; i < images.size(); i++) {
images[i] = preprocess(images[i], scale, size, mean, swapRB, ddepth);
}
tensorflow::TensorShape shape = tensorflow::TensorShape({static_cast<int64>(images.size()), size.height, size.width,
channels});
tensorflow::Tensor input_tensor(tensorflow::DT_FLOAT, shape);
auto input_tensor_mapped = input_tensor.tensor<float, 4>();
int N = 0;
for (auto &image: images) {
const int _rows = image.rows;
const int _cols = image.cols;
const int _channels = image.channels();
const float *data = (float *) image.data;
for (int H = 0; H < _rows; ++H) {
for (int W = 0; W < _cols; ++W) {
for (int C = 0; C < _channels; ++C) {
input_tensor_mapped(N, H, W, C) = *(data + (H * _cols + W) * _channels + C);
}
}
}
N++;
}
return input_tensor;
}
std::vector<tensorflow::Tensor> gf::dnn::Net::forward(const tensorflow::Tensor input_tensor,
const std::string &input_layer_name, const std::string &output_layer_name) {
const std::vector<std::pair<std::string, tensorflow::Tensor>> feed_dict = {{input_layer_name, input_tensor}};
return forward(input_tensor, feed_dict, output_layer_name);
}
std::vector<tensorflow::Tensor> gf::dnn::Net::forward(const tensorflow::Tensor input_tensor,
const std::vector<std::pair<std::string, tensorflow::Tensor>> feed_dict, const std::string &output_layer_name) {
tensorflow::Status status;
std::vector<tensorflow::Tensor> outputs;
status = session->Run(feed_dict, {output_layer_name}, {}, &outputs);
if (!status.ok()) {
std::cout << status.ToString() << std::endl;
}
return outputs;
}
cv::Mat gf::dnn::Net::preprocess(const cv::Mat &src, const double scale, const cv::Size &size,
const cv::Scalar &mean, bool swapRB, int ddepth) {
cv::Mat dst = src.clone();
cv::Size _image_size = dst.size();
if (size != _image_size) {
resize(dst, dst, size, 0, 0, cv::INTER_LINEAR);
}
if (dst.depth() == CV_8U && ddepth == CV_32F)
dst.convertTo(dst, CV_32F);
cv::Scalar _mean = mean;
if (swapRB) {
std::swap(_mean[0], _mean[2]);
cvtColor(dst, dst, cv::COLOR_BGR2RGB);
}
dst -= _mean;
dst *= scale;
return dst;
}
| 36.108844 | 140 | 0.638093 | [
"shape",
"vector"
] |
19b886103ef0a693c66a0135fe1b53f16dde088e | 3,142 | cpp | C++ | Algo_Ds_Notes-master/Algo_Ds_Notes-master/Tree_Verticalorder_Traversal/Tree_Verticalorder_Traversal.cpp | rajatenzyme/Coding-Journey- | 65a0570153b7e3393d78352e78fb2111223049f3 | [
"MIT"
] | null | null | null | Algo_Ds_Notes-master/Algo_Ds_Notes-master/Tree_Verticalorder_Traversal/Tree_Verticalorder_Traversal.cpp | rajatenzyme/Coding-Journey- | 65a0570153b7e3393d78352e78fb2111223049f3 | [
"MIT"
] | null | null | null | Algo_Ds_Notes-master/Algo_Ds_Notes-master/Tree_Verticalorder_Traversal/Tree_Verticalorder_Traversal.cpp | rajatenzyme/Coding-Journey- | 65a0570153b7e3393d78352e78fb2111223049f3 | [
"MIT"
] | null | null | null | /* Vertical Order Traversal of Binary Tree is a traversal in which all nodes that fall in the same vertical line are visited together, starting from the leftmost vertical line and ending at the rightmost vertical line. The horizontal distance is measured with root serving as reference, then we measure the left and right deviations of the each node. */
#include <bits/stdc++.h>
using namespace std;
#define mkp make_pair
// Node of Binary Tree storing data, horizontal distance from root, left and right child information
struct Node
{
int data;
int distance;
Node *left, *right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
// Function to print Binary Tree in Vertical Order
void VerticalOrderTraversal(Node *root)
{
if (root == NULL)
return;
// initialising variables
queue<Node *> q;
q.push(root);
root->distance = 0;
map<int, vector<int>> mp;
// variable to store distance of nodes
int distance;
// asigning horizontal distance to each node of Binary Tree and storing all nodes of same horizontal distance in a map with key as distance
while (!q.empty())
{
// extract the node at the front of queue
Node *temp = q.front();
distance = temp->distance;
// make key as distance and data as value for map
mp[distance].push_back(temp->data);
// remove the extract node from queue
q.pop();
// when left child exists, assign horizontal distance to it, and push it to the queue
if (temp->left != NULL)
{
temp->left->distance = distance - 1;
q.push(temp->left);
}
// when right child exists, assign horizontal distance to it, and push it to the queue
if (temp->right != NULL)
{
temp->right->distance = distance + 1;
q.push(temp->right);
}
}
/* Map mp contains:
[-2] -> 4
[-1] -> 2, 8
[0] -> 1, 5, 6
[1] -> 3, 9
[2] -> 7
*/
cout<<"Vertical Order Traversal of Tree: "<<endl;
map<int, vector<int>>::iterator it;
vector<int> row;
// Iterate over the map keys i.e -2, -1, 0, 1, 2
for (it = mp.begin(); it != mp.end(); it++)
{
row = it->second;
for (int i = 0; i < row.size(); i++)
cout << row[i] << " ";
cout << endl;
}
}
// Driver Function
int main()
{
/* Contructing Binary Tree as:
1
/ \
2 3
/ \ / \
4 5 6 7
/ \
/ \
8 9
*/
Node *root = new Node(1);
root->left = new Node(2);
root->right = new Node(3);
root->left->left = new Node(4);
root->left->right = new Node(5);
root->right->left = new Node(6);
root->right->right = new Node(7);
root->left->right->left = new Node(8);
root->left->right->right = new Node(9);
// call to VerticalOrderTraversal function
VerticalOrderTraversal(root);
return 0;
}
/* Output:
Vertical Order Traversal of Tree:
4
2 8
1 5 6
3 9
7
*/
| 27.561404 | 353 | 0.560789 | [
"vector"
] |
19b9520687ceb637f29434dd4639a26ed6f4c00b | 11,385 | cpp | C++ | Ethereal/Private/Characters/Enemy/Boss/FrostCaptain.cpp | SoveranceStudios/EtherealLegends | 4d03aba462cc3a51988e2776e182cea05f0e4376 | [
"Apache-2.0"
] | 216 | 2016-08-28T18:22:06.000Z | 2022-03-22T09:08:15.000Z | Ethereal/Private/Characters/Enemy/Boss/FrostCaptain.cpp | SoveranceStudios/EtherealLegends | 4d03aba462cc3a51988e2776e182cea05f0e4376 | [
"Apache-2.0"
] | 1 | 2017-08-10T06:14:32.000Z | 2017-08-12T00:16:27.000Z | Ethereal/Private/Characters/Enemy/Boss/FrostCaptain.cpp | SoveranceStudios/EtherealLegends | 4d03aba462cc3a51988e2776e182cea05f0e4376 | [
"Apache-2.0"
] | 49 | 2016-08-28T18:22:31.000Z | 2022-02-23T16:22:37.000Z | // © 2014 - 2017 Soverance Studios
// http://www.soverance.com
// 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 "Ethereal.h"
#include "FrostCaptain.h"
#define LOCTEXT_NAMESPACE "EtherealText"
AFrostCaptain::AFrostCaptain(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
static ConstructorHelpers::FObjectFinder<USkeletalMesh> EnemyMesh(TEXT("SkeletalMesh'/Game/InfinityBladeAdversaries/Enemy/Enemy_Frost_Giant/SK_Enemy_FrostGiant_Captain.SK_Enemy_FrostGiant_Captain'"));
static ConstructorHelpers::FObjectFinder<UClass> AnimBP(TEXT("AnimBlueprint'/Game/InfinityBladeAdversaries/Enemy/Enemy_Frost_Giant/Anim_GiantCaptain.Anim_GiantCaptain_C'"));
static ConstructorHelpers::FObjectFinder<USoundCue> AggroAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Aggro_Cue.FrostGiant_Aggro_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> HitAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Aggro_Cue.FrostGiant_Aggro_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> SnortAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_LobStart_Cue.FrostGiant_LobStart_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> StompAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Aggro_Cue.FrostGiant_Aggro_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> RoarAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Aggro_Cue.FrostGiant_Aggro_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> FirstDropAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Death_FirstDrop_Cue.FrostGiant_Death_FirstDrop_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> SecondDropAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Death_SecondDrop_Cue.FrostGiant_Death_SecondDrop_Cue'"));
static ConstructorHelpers::FObjectFinder<USoundCue> DeathAudioObject(TEXT("SoundCue'/Game/Audio/Party/FrostGiant_Death_Cue.FrostGiant_Death_Cue'"));
// Set Default Objects
S_AggroAudio = AggroAudioObject.Object;
S_HitAudio = HitAudioObject.Object;
S_SnortAudio = SnortAudioObject.Object;
S_StompAudio = StompAudioObject.Object;
S_RoarAudio = RoarAudioObject.Object;
S_FirstDropAudio = FirstDropAudioObject.Object;
S_SecondDropAudio = SecondDropAudioObject.Object;
S_DeathAudio = DeathAudioObject.Object;
// Default Config
Name = EEnemyNames::EN_FrostCaptain;
NameText = LOCTEXT("FrostCaptainText", "Frost Captain");
Realm = ERealms::R_Boreal;
BattleType = EBattleTypes::BT_Boss;
CommonDrop = EMasterGearList::GL_IceSignet;
UncommonDrop = EMasterGearList::GL_Marauder;
RareDrop = EMasterGearList::GL_Hauteclaire;
AttackDelay = 5.0f;
BaseEyeHeight = 16;
GetCapsuleComponent()->SetRelativeScale3D(FVector(2.0f, 2.0f, 2.0f));
GetCharacterMovement()->MaxAcceleration = 30;
MapMarkerFX->SetColorParameter(FName(TEXT("BeamColor")), FLinearColor::Yellow);
// Pawn A.I. config
PawnSensing->HearingThreshold = 1200;
PawnSensing->LOSHearingThreshold = 1500;
PawnSensing->SightRadius = 1200;
PawnSensing->SetPeripheralVisionAngle(50.0f);
AcceptanceRadius = 500.0f;
RunAI = false;
// Mesh Config
GetMesh()->SkeletalMesh = EnemyMesh.Object;
GetMesh()->SetAnimInstanceClass(AnimBP.Object);
GetMesh()->SetRelativeScale3D(FVector(0.5f, 0.5f, 0.5f));
GetMesh()->SetRelativeLocation(FVector(0, 0, -90));
GetMesh()->SetRelativeRotation(FRotator(0, -90, 0));
// Melee Radius Config
MeleeRadius->SetSphereRadius(125);
MeleeRadius->SetRelativeLocation(FVector(50, 0, -80));
// Targeting Reticle config
TargetingReticle->SetRelativeLocation(FVector(0, 0, 130));
TargetingReticle->SetRelativeRotation(FRotator(0, 0, 180));
TargetingReticle->SetRelativeScale3D(FVector(0.2f, 0.2f, 0.2f));
// Death FX Config
DeathFX->SetRelativeLocation(FVector(0, 0, -90));
DeathFX->SetRelativeScale3D(FVector(0.8f, 0.8f, 0.8f));
HitFX->SetRelativeLocation(FVector(0, 0, 30));
DisappearFX->SetRelativeLocation(FVector(0, 0, -20));
// Enemy-Specific Object Config
AggroAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("AggroAudio"));
AggroAudio->Sound = S_AggroAudio;
AggroAudio->bAutoActivate = false;
HitAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("HitAudio"));
HitAudio->Sound = S_HitAudio;
HitAudio->bAutoActivate = false;
SnortAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("SnortAudio"));
SnortAudio->Sound = S_SnortAudio;
SnortAudio->bAutoActivate = false;
StompAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("StompAudio"));
StompAudio->Sound = S_StompAudio;
StompAudio->bAutoActivate = false;
RoarAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("RoarAudio"));
RoarAudio->Sound = S_RoarAudio;
RoarAudio->bAutoActivate = false;
FirstDropAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("FirstDropAudio"));
FirstDropAudio->Sound = S_FirstDropAudio;
FirstDropAudio->bAutoActivate = false;
SecondDropAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("SecondDropAudio"));
SecondDropAudio->Sound = S_SecondDropAudio;
SecondDropAudio->bAutoActivate = false;
DeathAudio = ObjectInitializer.CreateDefaultSubobject<UAudioComponent>(this, TEXT("DeathAudio"));
DeathAudio->Sound = S_DeathAudio;
DeathAudio->bAutoActivate = false;
DoAggro = false;
DoHaymaker = false;
DoStomp = false;
DoBlizzard = false;
}
// Called when the game starts or when spawned
void AFrostCaptain::BeginPlay()
{
Super::BeginPlay();
PawnSensing->OnHearNoise.AddDynamic(this, &AFrostCaptain::OnHearNoise); // bind the OnHearNoise event
PawnSensing->OnSeePawn.AddDynamic(this, &AFrostCaptain::OnSeePawn); // bind the OnSeePawn event
OnDeath.AddDynamic(this, &AFrostCaptain::CustomDeath); // bind the death fuction to the OnDeath event
OnReachedTarget.AddDynamic(this, &AFrostCaptain::AttackRound); // bind the attack function to the OnReachedTarget event
// Get the placement actor
for (TActorIterator<AFrostCaptain_Placement> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
Placement = *ActorItr; // get the instance of the Placement actor
Placement->FrostCaptain = this;
}
}
// Called every frame
void AFrostCaptain::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Melee Attack function
void AFrostCaptain::AttackRound()
{
if (!Target->IsDead)
{
if (!IsAttacking)
{
IsAttacking = true;
TArray<AActor*> Overlapping; // define a local array to store hits
MeleeRadius->GetOverlappingActors(Overlapping, AEtherealPlayerMaster::StaticClass()); // check for overlapping players within the stomp radius
if (Overlapping.Num() > 0)
{
for (AActor* Actor : Overlapping) // for each actor found overlapping
{
AEtherealPlayerMaster* Player = Cast<AEtherealPlayerMaster>(Actor); // cast to Player Master
if (Player) // if succeeded
{
Target = Player;
EnemyDealDamage(15);
int32 RandomAtk = FMath::RandRange(0, 5); // get a random int
// To make this guy harder, he'll use the Stomp attack on rare occasions
if (!IsDead)
{
if (RandomAtk <= 2)
{
CastHaymaker();
}
if (RandomAtk > 2)
{
CastStomp(); // Cast Stomp
}
}
}
}
}
if (Overlapping.Num() == 0)
{
if (!IsDead)
{
EnemyDealDamage(15);
CastBlizzard(); // if the player is outside the melee radius, cast Blizzard
}
}
}
}
}
void AFrostCaptain::CustomDeath()
{
IsDead = true;
DeathAudio->Play();
// SIGNET RING
//EMasterGearList SignetRing = EMasterGearList::GL_IceSignet; // Players get the Signet Ring at a 100% drop rate
//Target->EtherealPlayerState->EnemyKillReward(0, SignetRing, SignetRing, SignetRing); // reward the player with the appropriate signet ring, but give no EXP
}
void AFrostCaptain::CastHaymaker()
{
EnemyDealDamage(20);
DoHaymaker = true; // should set DoHaymaker to false based on anim notify
// Restart the Attack Cycle after a short delay
FTimerHandle EndTimer;
GetWorldTimerManager().SetTimer(EndTimer, this, &AFrostCaptain::ShouldPowerCore, AttackDelay, false);
}
void AFrostCaptain::CastStomp()
{
EnemyDealDamage(20);
DoStomp = true;
// Restart the Attack Cycle after a short delay
FTimerHandle EndTimer;
GetWorldTimerManager().SetTimer(EndTimer, this, &AFrostCaptain::ShouldPowerCore, AttackDelay, false);
}
void AFrostCaptain::CastBlizzard()
{
EnemyDealDamage(20);
DoBlizzard = true;
AggroAudio->Play();
// Restart the Attack Cycle after a short delay
FTimerHandle EndTimer;
GetWorldTimerManager().SetTimer(EndTimer, this, &AFrostCaptain::ShouldPowerCore, AttackDelay, false);
}
void AFrostCaptain::ShouldPowerCore()
{
if (PoweredCoreCount < 2)
{
switch (PoweredCoreCount)
{
case 0:
if (HP_Current < (HP_Max * 0.75f))
{
PoweredCoreCount = 1;
PowerCore();
}
else
{
RunToTarget();
}
break;
case 1:
if (HP_Current < (HP_Max * 0.30f))
{
PoweredCoreCount = 2;
PowerCore();
}
else
{
RunToTarget();
}
break;
}
}
}
void AFrostCaptain::PowerCore()
{
if (!IsDead)
{
Targetable = false; // cannot target during this phase
RunAI = false;
DoLeap = true; // leap animation
Placement->LeapToCore(); // Leap to Core
}
}
// A.I. Hearing
void AFrostCaptain::OnHearNoise(APawn* PawnInstigator, const FVector& Location, float Volume)
{
if (!IsDead)
{
if (!IsAggroed)
{
DoAggro = true;
AudioManager->Play_BattleMusic(EBattleTypes::BT_Boss); // play the boss battle music
EtherealGameInstance->BlackBox->HasEngagedBoss = true; // Engage Boss
// Delay Aggro so this guy can finish his aggro animation
FTimerDelegate DelegateAggro;
DelegateAggro.BindUFunction(this, FName("Aggro"), PawnInstigator);
FTimerHandle AggroTimer;
GetWorldTimerManager().SetTimer(AggroTimer, DelegateAggro, 7.5f, false);
}
}
}
// A.I. Sight
void AFrostCaptain::OnSeePawn(APawn* Pawn)
{
if (!IsDead)
{
if (!IsAggroed)
{
DoAggro = true;
AudioManager->Play_BattleMusic(EBattleTypes::BT_Boss); // play the boss battle music
EtherealGameInstance->BlackBox->HasEngagedBoss = true; // Engage Boss
// Delay Aggro so this guy can finish his aggro animation
FTimerDelegate DelegateAggro;
DelegateAggro.BindUFunction(this, FName("Aggro"), Pawn);
FTimerHandle AggroTimer;
GetWorldTimerManager().SetTimer(AggroTimer, DelegateAggro, 7.5f, false);
}
}
}
#undef LOCTEXT_NAMESPACE
| 34.086826 | 202 | 0.726834 | [
"mesh",
"object"
] |
19bd0638b2ff7e2c41856194eda959578363083a | 6,014 | cpp | C++ | src/RESTAPI/RESTAPI_entity_handler.cpp | Telecominfraproject/wlan-cloud-owprov | 6d29c8e5ce6af7b4f4f4e4ad2a5332d78dc520aa | [
"BSD-3-Clause"
] | null | null | null | src/RESTAPI/RESTAPI_entity_handler.cpp | Telecominfraproject/wlan-cloud-owprov | 6d29c8e5ce6af7b4f4f4e4ad2a5332d78dc520aa | [
"BSD-3-Clause"
] | null | null | null | src/RESTAPI/RESTAPI_entity_handler.cpp | Telecominfraproject/wlan-cloud-owprov | 6d29c8e5ce6af7b4f4f4e4ad2a5332d78dc520aa | [
"BSD-3-Clause"
] | null | null | null | //
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include "RESTAPI_entity_handler.h"
#include "RESTObjects/RESTAPI_ProvObjects.h"
#include "RESTObjects/RESTAPI_SecurityObjects.h"
#include "StorageService.h"
#include "RESTAPI_db_helpers.h"
namespace OpenWifi{
void RESTAPI_entity_handler::DoGet() {
std::string UUID = GetBinding("uuid", "");
ProvObjects::Entity Existing;
if(UUID.empty() || !DB_.GetRecord("id",UUID,Existing)) {
return NotFound();
}
Poco::JSON::Object Answer;
Existing.to_json(Answer);
if(NeedAdditionalInfo())
AddExtendedInfo( Existing, Answer);
ReturnObject(Answer);
}
void RESTAPI_entity_handler::DoDelete() {
std::string UUID = GetBinding("uuid", "");
ProvObjects::Entity Existing;
if(UUID.empty() || !DB_.GetRecord("id",UUID,Existing)) {
return NotFound();
}
if(UUID == EntityDB::RootUUID()) {
return BadRequest(RESTAPI::Errors::CannotDeleteRoot);
}
if( !Existing.children.empty() || !Existing.devices.empty() || !Existing.venues.empty() || !Existing.locations.empty()
|| !Existing.contacts.empty() || !Existing.configurations.empty()) {
return BadRequest(RESTAPI::Errors::StillInUse);
}
MoveUsage(StorageService()->PolicyDB(),DB_,Existing.managementPolicy,"",Existing.info.id);
DB_.DeleteRecord("id",UUID);
DB_.DeleteChild("id",Existing.parent,UUID);
return OK();
}
void RESTAPI_entity_handler::DoPost() {
std::string UUID = GetBinding("uuid", "");
if(UUID.empty()) {
return BadRequest(RESTAPI::Errors::MissingUUID);
}
if(UUID==EntityDB::RootUUID()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
auto Obj = ParseStream();
ProvObjects::Entity NewEntity;
if (!NewEntity.from_json(Obj)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(!ProvObjects::CreateObjectInfo(Obj,UserInfo_.userinfo,NewEntity.info)) {
return BadRequest(RESTAPI::Errors::NameMustBeSet);
}
// When creating an entity, it cannot have any relations other that parent, notes, name, description. Everything else
// must be conveyed through PUT.
NewEntity.info.id = (UUID==EntityDB::RootUUID()) ? UUID : MicroService::CreateUUID();
if(UUID==EntityDB::RootUUID()) {
NewEntity.parent="";
} else if(NewEntity.parent.empty() || !DB_.Exists("id",NewEntity.parent)) {
return BadRequest(RESTAPI::Errors::ParentUUIDMustExist);
}
if(!NewEntity.managementPolicy.empty() && !StorageService()->PolicyDB().Exists("id", NewEntity.managementPolicy)){
return BadRequest(RESTAPI::Errors::UnknownManagementPolicyUUID);
}
if(!NewEntity.sourceIP.empty() && !CIDR::ValidateIpRanges(NewEntity.sourceIP)) {
return BadRequest(RESTAPI::Errors::InvalidIPRanges);
}
NewEntity.venues.clear();
NewEntity.children.clear();
NewEntity.contacts.clear();
NewEntity.locations.clear();
NewEntity.deviceConfiguration.clear();
NewEntity.managementRoles.clear();
if(DB_.CreateRecord(NewEntity)) {
MoveUsage(StorageService()->PolicyDB(),DB_,"",NewEntity.managementPolicy,NewEntity.info.id);
DB_.AddChild("id",NewEntity.parent,NewEntity.info.id);
Poco::JSON::Object Answer;
NewEntity.to_json(Answer);
return ReturnObject(Answer);
}
InternalError(RESTAPI::Errors::RecordNotCreated);
}
/*
* Put is a complex operation, it contains commands only.
* addContact=UUID, delContact=UUID,
* addLocation=UUID, delLocation=UUID,
* addVenue=UUID, delVenue=UUID,
* addEntity=UUID, delEntity=UUID
* addDevice=UUID, delDevice=UUID
*/
void RESTAPI_entity_handler::DoPut() {
std::string UUID = GetBinding("uuid", "");
ProvObjects::Entity Existing;
if(UUID.empty() || !DB_.GetRecord("id",UUID,Existing)) {
return NotFound();
}
auto RawObject = ParseStream();
ProvObjects::Entity NewEntity;
if(!NewEntity.from_json(RawObject)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(!UpdateObjectInfo(RawObject, UserInfo_.userinfo, Existing.info)) {
return BadRequest(RESTAPI::Errors::NameMustBeSet);
}
std::string FromPolicy, ToPolicy;
if(!CreateMove(RawObject,"managementPolicy",&EntityDB::RecordName::managementPolicy, Existing, FromPolicy, ToPolicy, StorageService()->PolicyDB()))
return BadRequest(RESTAPI::Errors::UnknownManagementPolicyUUID);
if(RawObject->has("sourceIP")) {
if(!NewEntity.sourceIP.empty() && !CIDR::ValidateIpRanges(NewEntity.sourceIP)) {
return BadRequest(RESTAPI::Errors::InvalidIPRanges);
}
Existing.sourceIP = NewEntity.sourceIP;
}
std::string Error;
if(!StorageService()->Validate(Parameters_,Error)) {
return BadRequest(Error);
}
AssignIfPresent(RawObject, "rrm", Existing.rrm);
if(DB_.UpdateRecord("id",UUID,Existing)) {
MoveUsage(StorageService()->PolicyDB(),DB_,FromPolicy,ToPolicy,Existing.info.id);
Poco::JSON::Object Answer;
ProvObjects::Entity NewRecord;
StorageService()->EntityDB().GetRecord("id",UUID, NewRecord);
NewRecord.to_json(Answer);
return ReturnObject(Answer);
}
InternalError(RESTAPI::Errors::RecordNotUpdated);
}
} | 36.228916 | 155 | 0.622547 | [
"object"
] |
19c7590fbb57e3b38b89a559e9615efc3d334afd | 11,700 | cc | C++ | src/vnsw/agent/uve/agent_stats.cc | sysbot/contrail-controller | 893de3e41aa7b8e40092fba4a5da34284f5ee00f | [
"Apache-2.0"
] | 1 | 2015-11-08T07:28:10.000Z | 2015-11-08T07:28:10.000Z | src/vnsw/agent/uve/agent_stats.cc | sysbot/contrail-controller | 893de3e41aa7b8e40092fba4a5da34284f5ee00f | [
"Apache-2.0"
] | null | null | null | src/vnsw/agent/uve/agent_stats.cc | sysbot/contrail-controller | 893de3e41aa7b8e40092fba4a5da34284f5ee00f | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
*/
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/genetlink.h>
#include <linux/if_tun.h>
#include <db/db.h>
#include <cmn/agent_cmn.h>
#include <oper/interface.h>
#include <oper/mirror_table.h>
#include "vr_genetlink.h"
#include "vr_interface.h"
#include "vr_types.h"
#include "nl_util.h"
#include <uve/stats_collector.h>
#include <uve/agent_stats.h>
#include <uve/uve_init.h>
#include <uve/uve_client.h>
void AgentStatsCollector::SendIntfBulkGet() {
vr_interface_req encoder;
AgentStatsSandeshContext *ctx = AgentUve::GetInstance()->
GetIntfStatsSandeshContext();
encoder.set_h_op(sandesh_op::DUMP);
encoder.set_vifr_context(0);
encoder.set_vifr_marker(ctx->GetMarker());
SendRequest(encoder, IntfStatsType);
}
void AgentStatsCollector::SendVrfStatsBulkGet() {
vr_vrf_stats_req encoder;
AgentStatsSandeshContext *ctx = AgentUve::GetInstance()->GetVrfStatsSandeshContext();
encoder.set_h_op(sandesh_op::DUMP);
encoder.set_vsr_rid(0);
encoder.set_vsr_family(AF_INET);
encoder.set_vsr_type(RT_UCAST);
encoder.set_vsr_marker(ctx->GetMarker());
SendRequest(encoder, VrfStatsType);
}
void AgentStatsCollector::SendDropStatsBulkGet() {
vr_drop_stats_req encoder;
encoder.set_h_op(sandesh_op::GET);
encoder.set_vds_rid(0);
SendRequest(encoder, DropStatsType);
}
bool AgentStatsCollector::SendRequest(Sandesh &encoder, StatsType type) {
int encode_len;
int error;
uint8_t *buf = (uint8_t *)malloc(KSYNC_DEFAULT_MSG_SIZE);
encode_len = encoder.WriteBinary(buf, KSYNC_DEFAULT_MSG_SIZE, &error);
SendAsync((char*)buf, encode_len, type);
return true;
}
void AgentStatsCollector::SendAsync(char* buf, uint32_t buf_len, StatsType type) {
KSyncSock *sock = KSyncSock::Get(0);
uint32_t seq = sock->AllocSeqNo();
AgentStatsSandeshContext *ctx;
IoContext *ioc = NULL;
switch (type) {
case IntfStatsType:
ctx = AgentUve::GetInstance()->GetIntfStatsSandeshContext();
ioc = new IntfStatsIoContext(buf_len, buf, seq, ctx,
IoContext::UVE_Q_ID);
break;
case VrfStatsType:
ctx = AgentUve::GetInstance()->GetVrfStatsSandeshContext();
ioc = new VrfStatsIoContext(buf_len, buf, seq, ctx,
IoContext::UVE_Q_ID);
break;
case DropStatsType:
ctx = AgentUve::GetInstance()->GetDropStatsSandeshContext();
ioc = new DropStatsIoContext(buf_len, buf, seq, ctx,
IoContext::UVE_Q_ID);
break;
default:
break;
}
if (ioc) {
sock->GenericSend(buf_len, buf, ioc);
}
}
void vr_interface_req::Process(SandeshContext *context) {
AgentSandeshContext *ioc = static_cast<AgentSandeshContext *>(context);
ioc->IfMsgHandler(this);
}
void AgentStatsCollector::AddIfStatsEntry(const Interface *intf) {
IntfToIfStatsTree::iterator it;
it = if_stats_tree_.find(intf);
if (it == if_stats_tree_.end()) {
AgentStatsCollector::IfStats stats;
stats.name = intf->GetName();
if_stats_tree_.insert(IfStatsPair(intf, stats));
}
}
void AgentStatsCollector::DelIfStatsEntry(const Interface *intf) {
IntfToIfStatsTree::iterator it;
it = if_stats_tree_.find(intf);
if (it != if_stats_tree_.end()) {
if_stats_tree_.erase(it);
}
}
void AgentStatsCollector::AddNamelessVrfStatsEntry() {
AgentStatsCollector::VrfStats stats;
stats.name = GetNamelessVrf();
vrf_stats_tree_.insert(VrfStatsPair(GetNamelessVrfId(), stats));
}
void AgentStatsCollector::AddUpdateVrfStatsEntry(const VrfEntry *vrf) {
VrfIdToVrfStatsTree::iterator it;
it = vrf_stats_tree_.find(vrf->GetVrfId());
if (it == vrf_stats_tree_.end()) {
AgentStatsCollector::VrfStats stats;
stats.name = vrf->GetName();
vrf_stats_tree_.insert(VrfStatsPair(vrf->GetVrfId(), stats));
} else {
/* Vrf could be deleted in agent oper DB but not in Kernel. To handle
* this case we maintain vrfstats object in AgentStatsCollector even
* when vrf is absent in agent oper DB. Since vrf could get deleted and
* re-added we need to update the name in vrfstats object.
*/
AgentStatsCollector::VrfStats *stats = &it->second;
stats->name = vrf->GetName();
}
}
void AgentStatsCollector::DelVrfStatsEntry(const VrfEntry *vrf) {
VrfIdToVrfStatsTree::iterator it;
it = vrf_stats_tree_.find(vrf->GetVrfId());
if (it != vrf_stats_tree_.end()) {
AgentStatsCollector::VrfStats *stats = &it->second;
stats->prev_discards = stats->k_discards;
stats->prev_resolves = stats->k_resolves;
stats->prev_receives = stats->k_receives;
stats->prev_tunnels = stats->k_tunnels;
stats->prev_composites = stats->k_composites;
stats->prev_encaps = stats->k_encaps;
}
}
bool AgentStatsCollector::Run() {
SendIntfBulkGet();
SendVrfStatsBulkGet();
SendDropStatsBulkGet();
return true;
}
void AgentStatsCollector::SendStats() {
UveClient::GetInstance()->SendVnStats();
UveClient::GetInstance()->SendVmStats();
}
AgentStatsCollector::IfStats *AgentStatsCollector::GetIfStats(const Interface *intf) {
IntfToIfStatsTree::iterator it;
it = if_stats_tree_.find(intf);
if (it == if_stats_tree_.end()) {
return NULL;
}
return &it->second;
}
AgentStatsCollector::VrfStats *AgentStatsCollector::GetVrfStats(int vrf_id) {
VrfIdToVrfStatsTree::iterator it;
it = vrf_stats_tree_.find(vrf_id);
if (it == vrf_stats_tree_.end()) {
return NULL;
}
return &it->second;
}
void IntfStatsIoContext::Handler() {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
collector->run_counter_++;
AgentUve::GetInstance()->GetStatsCollector()->SendStats();
/* Reset the marker for query during next timer interval, if there is
* no additional records for the current query */
AgentStatsSandeshContext *ctx = AgentUve::GetInstance()->
GetIntfStatsSandeshContext();
if (!ctx->MoreData()) {
ctx->SetMarker(-1);
}
}
void IntfStatsIoContext::ErrorHandler(int err) {
LOG(ERROR, "Error reading Interface Stats. Error <" << err << ": "
<< strerror(err) << ": Sequence No : " << GetSeqno());
}
void VrfStatsIoContext::Handler() {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
collector->vrf_stats_responses_++;
UveClient::GetInstance()->SendVnStats();
/* Reset the marker for query during next timer interval, if there is
* no additional records for the current query */
AgentStatsSandeshContext *ctx = AgentUve::GetInstance()->
GetVrfStatsSandeshContext();
if (!ctx->MoreData()) {
ctx->SetMarker(-1);
}
}
void VrfStatsIoContext::ErrorHandler(int err) {
LOG(ERROR, "Error reading Vrf Stats. Error <" << err << ": "
<< strerror(err) << ": Sequence No : " << GetSeqno());
}
void DropStatsIoContext::Handler() {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
collector->drop_stats_responses_++;
}
void DropStatsIoContext::ErrorHandler(int err) {
LOG(ERROR, "Error reading Drop Stats. Error <" << err << ": "
<< strerror(err) << ": Sequence No : " << GetSeqno());
}
int AgentStatsSandeshContext::VrResponseMsgHandler(vr_response *r) {
int code = r->get_resp_code();
SetResponseCode(code);
if (code > 0) {
/* Positive value indicates the number of records returned in the
* response from Kernel. Kernel response includes vr_response along
* with actual response.
*/
return 0;
}
if (code < 0) {
LOG(ERROR, "Error: " << strerror(-code));
return -code;
}
return 0;
}
void AgentStatsSandeshContext::IfMsgHandler(vr_interface_req *req) {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
SetMarker(req->get_vifr_idx());
const Interface *intf = InterfaceTable::GetInstance()->FindInterface(req->get_vifr_idx());
if (intf == NULL) {
return;
}
AgentStatsCollector::IfStats *stats = collector->GetIfStats(intf);
if (!stats) {
return;
}
if (intf->GetType() == Interface::VMPORT) {
AgentStats::GetInstance()->IncrInPkts(req->get_vifr_ipackets() - stats->in_pkts);
AgentStats::GetInstance()->IncrInBytes(req->get_vifr_ibytes() - stats->in_bytes);
AgentStats::GetInstance()->IncrOutPkts(req->get_vifr_opackets() - stats->out_pkts);
AgentStats::GetInstance()->IncrOutBytes(req->get_vifr_obytes() - stats->out_bytes);
}
stats->in_pkts = req->get_vifr_ipackets();
stats->in_bytes = req->get_vifr_ibytes();
stats->out_pkts = req->get_vifr_opackets();
stats->out_bytes = req->get_vifr_obytes();
stats->speed = req->get_vifr_speed();
stats->duplexity = req->get_vifr_duplex();
}
void AgentStatsSandeshContext::VrfStatsMsgHandler(vr_vrf_stats_req *req) {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
SetMarker(req->get_vsr_vrf());
bool vrf_present = true;
const VrfEntry *vrf = Agent::GetInstance()->GetVrfTable()->
FindVrfFromId(req->get_vsr_vrf());
if (vrf == NULL) {
if (req->get_vsr_vrf() != collector->GetNamelessVrfId()) {
vrf_present = false;
} else {
return;
}
}
AgentStatsCollector::VrfStats *stats = collector->GetVrfStats(req->get_vsr_vrf());
if (!stats) {
LOG(DEBUG, "Vrf not present in stats tree <" << vrf->GetName() << ">");
return;
}
if (!vrf_present) {
stats->prev_discards = req->get_vsr_discards();
stats->prev_resolves = req->get_vsr_resolves();
stats->prev_receives = req->get_vsr_receives();
stats->prev_tunnels = req->get_vsr_tunnels();
stats->prev_composites = req->get_vsr_composites();
stats->prev_encaps = req->get_vsr_encaps();
} else {
stats->discards = req->get_vsr_discards() - stats->prev_discards;
stats->resolves = req->get_vsr_resolves() - stats->prev_resolves;
stats->receives = req->get_vsr_receives() - stats->prev_receives;
stats->tunnels = req->get_vsr_tunnels() - stats->prev_tunnels;
stats->composites = req->get_vsr_composites() - stats->prev_composites;
stats->encaps = req->get_vsr_encaps() - stats->prev_encaps;
/* Update the last read values from Kernel in the following fields.
* This will be used to update prev_* fields on receiving vrf delete
* notification
*/
if (req->get_vsr_vrf() != collector->GetNamelessVrfId()) {
stats->k_discards = req->get_vsr_discards();
stats->k_resolves = req->get_vsr_resolves();
stats->k_receives = req->get_vsr_receives();
stats->k_tunnels = req->get_vsr_tunnels();
stats->k_composites = req->get_vsr_composites();
stats->k_encaps = req->get_vsr_encaps();
}
}
}
void AgentStatsSandeshContext::DropStatsMsgHandler(vr_drop_stats_req *req) {
AgentStatsCollector *collector = AgentUve::GetInstance()->GetStatsCollector();
collector->SetDropStats(*req);
}
| 34.411765 | 94 | 0.652821 | [
"object"
] |
19c904fd7c1367c2369bab553ceaa44e15ba10ef | 904 | cpp | C++ | Google/Problem1.cpp | sachanakshat/Competitive_Practice | 63170d87398bf5bd163febecdcfef8db21c632c7 | [
"MIT"
] | null | null | null | Google/Problem1.cpp | sachanakshat/Competitive_Practice | 63170d87398bf5bd163febecdcfef8db21c632c7 | [
"MIT"
] | null | null | null | Google/Problem1.cpp | sachanakshat/Competitive_Practice | 63170d87398bf5bd163febecdcfef8db21c632c7 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <chrono>
using namespace std;
using namespace std::chrono;
void print(vector<int> vect)
{
cout<<"\n-------------------------------"<<endl;
for(int i=0; i<vect.size(); i++)
{
cout<<vect[i]<<" ";
}
cout<<"\n-------------------------------"<<endl;
}
void print(int * arr, int n)
{
cout<<"\n-------------------------------"<<endl;
for(int i=0; i<n; i++)
{
cout<<arr[i]<<" ";
}
cout<<"\n-------------------------------"<<endl;
}
int main()
{
auto start = high_resolution_clock::now();
cout<<"\nMaximum value of subarrays = "<<maxsum<<endl;
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
cout <<"\nExecution time: "<<duration.count() <<" microseconds"<<endl;
return 0;
} | 22.6 | 74 | 0.493363 | [
"vector"
] |
19cef014e29f72adbab00aa2caf5ceb60cb543bd | 2,236 | cpp | C++ | STL/lambda/lambda_1.cpp | liangjisheng/C-Cpp | 8b33ba1f43580a7bdded8bb4ce3d92983ccedb81 | [
"MIT"
] | 5 | 2019-09-17T09:12:15.000Z | 2021-05-29T10:54:39.000Z | STL/lambda/lambda_1.cpp | liangjisheng/C-Cpp | 8b33ba1f43580a7bdded8bb4ce3d92983ccedb81 | [
"MIT"
] | null | null | null | STL/lambda/lambda_1.cpp | liangjisheng/C-Cpp | 8b33ba1f43580a7bdded8bb4ce3d92983ccedb81 | [
"MIT"
] | 2 | 2021-07-26T06:36:12.000Z | 2022-01-23T15:20:30.000Z | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
auto basiclambda = []{ cout << "hello from lambda" << endl; };
// 普通函数调用语法调用lambda 表达式
basiclambda();
// 接受参数的 lambda 表达式,如果不接受参数,可以使用空圆括号或忽略括号
auto parameters =
[](int value) { cout << "The value is :" << value << endl; };
parameters(2);
// 拖尾返回类型
auto returninglambda = [](int a, int b) -> int { return a + b; };
cout << returninglambda(11,22) << endl;
// lambda 表达式可以在其作用域内捕捉变量
double data = 1.23;
// 只写变量名,表示按值捕捉
auto capturinglambda = [data] { cout << "Data = " << data << endl; };
capturinglambda();
const double cData = 2.34;
auto cCapturinglambda =
[cData] { cout << "const Data = " << cData << endl; };
cCapturinglambda();
// 对于lambda表示式,这个函数调用运算符默认标记为const,
// 这表示,即使在lambda表达式中按值捕捉了非const变量,
// lambda也不能修改其副本。把lambda表达式指定为mutable,
// 就可以把函数调用运算符标记为非const
double d1 = 3.45;
auto capturinglambda_1 =
[d1] () mutable { d1 *= 2; cout << "Data = " << d1 << endl; };
capturinglambda_1();
// 如果指定了mutable,就必须给参数指定圆括号,即使圆括号为空,也是如此
// 在变量名前加上&,就可以按引用捕捉变量
double d2 = 4.56;
auto capturinglambda_2 =
[&d2] { d2 *= 2; cout << "Data2 = " << d2 << endl; };
capturinglambda_2();
// [=]: 通过值捕捉所有变量
// [&]: 通过引用捕捉作用域中的所有变量
// [&x]: 只通过应用捕捉x,不捕捉其它变量
// [x]: 只通过值捕捉x,不捕捉其它变量
// [=,&x,&y]: 默认通过值捕捉,变量x和变量y例外,通过引用捕捉
// [&,x]: 默认通过引用捕捉,变量x例外,通过值捕捉
// [&x,&x]: 非法,标识符不允许重复。
// [this]: 捕捉周围对象。即使没有使用this->,也可以在lambda表达式
// 中访问这个对象。
// 即使可行,也不建议在内部作用域中使用[=],[&],或默认捕捉所有变量
// 而应选择捕捉需要的变量。
// 从C++14开始,lambda表达式的参数就有自动推断类型功能,无需显示指定
vector<int> Ints{11,55,101,155};
vector<double> Doubles{11.1,55.5,101.1,155.5};
auto isGreaterThan100 = [](auto i) { return i > 100; };
auto it1 = find_if(Ints.begin(),Ints.end(),isGreaterThan100);
if(it1 != Ints.end()){
cout << "Found a value > 100 : " << *it1 << endl;
}
auto it2 = find_if(Doubles.begin(),Doubles.end(),
isGreaterThan100);
if(it2 != Doubles.end()) {
cout << "Found a value > 100 : " << *it2 << endl;
}
return 0;
}
| 26.619048 | 73 | 0.572451 | [
"vector"
] |
19d0e7839564da8b6d88f5880d9faf52b47a948e | 2,005 | hpp | C++ | src/day9.hpp | theShmoo/aoc2020 | b507c33b5ca47e0c73bd5c6b4ec9d2f087598028 | [
"Unlicense"
] | null | null | null | src/day9.hpp | theShmoo/aoc2020 | b507c33b5ca47e0c73bd5c6b4ec9d2f087598028 | [
"Unlicense"
] | null | null | null | src/day9.hpp | theShmoo/aoc2020 | b507c33b5ca47e0c73bd5c6b4ec9d2f087598028 | [
"Unlicense"
] | null | null | null | #pragma once
#include <deque>
#include "input_utils.hpp"
#include <range/v3/all.hpp>
template<size_t PreambleSize> struct preamble_finder
{
using preamble = std::array<int, PreambleSize>;
static auto find_pair(preamble &p, size_t ¤t_pos, const int num) -> bool
{
auto sorted{ p };
ranges::sort(sorted);
auto l = std::begin(sorted);
auto r = std::prev(std::end(sorted));
auto found = false;
while (l < r) {
auto const sum = *l + *r;
if (sum == num) {
found = true;
break;
}
if (sum < num)
++l;
else
--r;
}
if (!found) return true;
p[current_pos] = num;
current_pos = (current_pos + 1) % PreambleSize;
return false;
}
static auto find_wrong_number(std::vector<int> const &numbers) -> auto
{
preamble preamble{};
std::copy_n(numbers.begin(), PreambleSize, preamble.begin());
size_t current_pos = 0;
auto const found =
ranges::find_if(numbers | ranges::views::drop(PreambleSize),
[&preamble, ¤t_pos](
const int value) { return find_pair(preamble, current_pos, value); });
return found;
}
static auto solve_part1(std::istream &input) -> std::string
{
auto const numbers = utils::split<int>(input);
auto const found = find_wrong_number(numbers);
return std::to_string(*found);
}
static auto solve_part2(std::istream &input) -> std::string
{
auto const numbers = utils::split<int>(input);
auto const found = *find_wrong_number(numbers);
std::deque<int> range{};
auto sum = 0;
auto range_end =
ranges::find_if(numbers, [found, &sum, &range](auto const num) {
sum += num;
range.push_back(num);
while (sum > found) {
auto const f = range.front();
sum -= f;
range.pop_front();
}
return found == sum;
});
const auto [min, max] = ranges::minmax_element(range);
return std::to_string(*min + *max);
}
}; | 26.733333 | 80 | 0.595511 | [
"vector"
] |
19d338611969d34313aadae6c19f81052e9ebd29 | 29,887 | cpp | C++ | drivers/wdm/bda/samples/bdacapture/capture.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | drivers/wdm/bda/samples/bdacapture/capture.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | drivers/wdm/bda/samples/bdacapture/capture.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /**************************************************************************
AVStream Simulated Hardware Sample
Copyright (c) 2001, Microsoft Corporation.
File:
capture.cpp
Abstract:
This file contains source for the video capture pin on the capture
filter. The capture sample performs "fake" DMA directly into
the capture buffers. Common buffer DMA will work slightly differently.
For common buffer DMA, the general technique would be DPC schedules
processing with KsPinAttemptProcessing. The processing routine grabs
the leading edge, copies data out of the common buffer and advances.
Cloning would not be necessary with this technique. It would be
similiar to the way "AVSSamp" works, but it would be pin-centric.
History:
created 3/8/2001
**************************************************************************/
#include "BDACap.h"
/**************************************************************************
PAGEABLE CODE
**************************************************************************/
#ifdef ALLOC_PRAGMA
#pragma code_seg("PAGE")
#endif // ALLOC_PRAGMA
CCapturePin::
CCapturePin (
IN PKSPIN Pin
) :
m_Pin (Pin)
/*++
Routine Description:
Construct a new capture pin.
Arguments:
Pin -
The AVStream pin object corresponding to the capture pin
Return Value:
None
--*/
{
PAGED_CODE();
PKSDEVICE Device = KsPinGetDevice (Pin);
//
// Set up our device pointer. This gives us access to "hardware I/O"
// during the capture routines.
//
m_Device = reinterpret_cast <CCaptureDevice *> (Device -> Context);
}
/*************************************************/
NTSTATUS
CCapturePin::
DispatchCreate (
IN PKSPIN Pin,
IN PIRP Irp
)
/*++
Routine Description:
Create a new capture pin. This is the creation dispatch for
the video capture pin.
Arguments:
Pin -
The pin being created
Irp -
The creation Irp
Return Value:
Success / Failure
--*/
{
PAGED_CODE();
NTSTATUS Status = STATUS_SUCCESS;
CCapturePin *CapPin = new (NonPagedPool, MS_SAMPLE_CAPTURE_POOL_TAG) CCapturePin (Pin);
if (!CapPin) {
//
// Return failure if we couldn't create the pin.
//
Status = STATUS_INSUFFICIENT_RESOURCES;
} else {
//
// Add the item to the object bag if we we were successful.
// Whenever the pin closes, the bag is cleaned up and we will be
// freed.
//
Status = KsAddItemToObjectBag (
Pin -> Bag,
reinterpret_cast <PVOID> (CapPin),
reinterpret_cast <PFNKSFREE> (CCapturePin::Cleanup)
);
if (!NT_SUCCESS (Status)) {
delete CapPin;
} else {
Pin -> Context = reinterpret_cast <PVOID> (CapPin);
}
}
//
// If we succeeded so far, stash the video info header away and change
// our allocator framing to reflect the fact that only now do we know
// the framing requirements based on the connection format.
//
PBDA_TRANSPORT_INFO TransportInfo = NULL;
if (NT_SUCCESS (Status)) {
TransportInfo = CapPin -> CaptureBdaTransportInfo ();
if (!TransportInfo) {
Status = STATUS_INSUFFICIENT_RESOURCES;
}
}
if (NT_SUCCESS (Status)) {
//
// We need to edit the descriptor to ensure we don't mess up any other
// pins using the descriptor or touch read-only memory.
//
Status = KsEdit (Pin, &Pin -> Descriptor, 'aChS');
if (NT_SUCCESS (Status)) {
Status = KsEdit (
Pin,
&(Pin -> Descriptor -> AllocatorFraming),
'aChS'
);
}
//
// If the edits proceeded without running out of memory, adjust
// the framing based on the video info header.
//
if (NT_SUCCESS (Status)) {
//
// We've KsEdit'ed this... I'm safe to cast away constness as
// long as the edit succeeded.
//
PKSALLOCATOR_FRAMING_EX Framing =
const_cast <PKSALLOCATOR_FRAMING_EX> (
Pin -> Descriptor -> AllocatorFraming
);
Framing -> FramingItem [0].Frames = 8;
//
// The physical and optimal ranges must be biSizeImage. We only
// support one frame size, precisely the size of each capture
// image.
//
Framing -> FramingItem [0].PhysicalRange.MinFrameSize =
Framing -> FramingItem [0].PhysicalRange.MaxFrameSize =
Framing -> FramingItem [0].FramingRange.Range.MinFrameSize =
Framing -> FramingItem [0].FramingRange.Range.MaxFrameSize =
TransportInfo -> ulcbPhyiscalFrame;
Framing -> FramingItem [0].PhysicalRange.Stepping =
Framing -> FramingItem [0].FramingRange.Range.Stepping =
0;
}
}
return Status;
}
/*************************************************/
PBDA_TRANSPORT_INFO
CCapturePin::
CaptureBdaTransportInfo (
)
/*++
Routine Description:
Capture the video info header out of the connection format. This
is what we use to base synthesized images off.
Arguments:
None
Return Value:
The captured video info header or NULL if there is insufficient
memory.
--*/
{
PAGED_CODE();
m_TransportInfo = reinterpret_cast <PBDA_TRANSPORT_INFO> (
ExAllocatePool (
NonPagedPool,
sizeof(BDA_TRANSPORT_INFO)
)
);
if (!m_TransportInfo)
return NULL;
//
// Bag the newly allocated header space. This will get cleaned up
// automatically when the pin closes.
//
NTSTATUS Status =
KsAddItemToObjectBag (
m_Pin -> Bag,
reinterpret_cast <PVOID> (m_TransportInfo),
NULL
);
if (!NT_SUCCESS (Status)) {
ExFreePool (m_TransportInfo);
return NULL;
} else {
m_TransportInfo->ulcbPhyiscalPacket = 188;
m_TransportInfo->ulcbPhyiscalFrame = 188 * 312;
m_TransportInfo->ulcbPhyiscalFrameAlignment = 1;
m_TransportInfo->AvgTimePerFrame = (19200 * 10000 * 8) / (188 * 312);
}
return m_TransportInfo;
}
/*************************************************/
NTSTATUS
CCapturePin::
Process (
)
/*++
Routine Description:
The process dispatch for the pin bridges to this location.
We handle setting up scatter gather mappings, etc...
Arguments:
None
Return Value:
Success / Failure
--*/
{
PAGED_CODE();
NTSTATUS Status = STATUS_SUCCESS;
PKSSTREAM_POINTER Leading;
Leading = KsPinGetLeadingEdgeStreamPointer (
m_Pin,
KSSTREAM_POINTER_STATE_LOCKED
);
while (NT_SUCCESS (Status) && Leading) {
PKSSTREAM_POINTER ClonePointer;
PSTREAM_POINTER_CONTEXT SPContext;
//
// For optimization sake in this particular sample, I will only keep
// one clone stream pointer per frame. This complicates the logic
// here but simplifies the completions.
//
// I'm also choosing to do this since I need to keep track of the
// virtual addresses corresponding to each mapping since I'm faking
// DMA. It simplifies that too.
//
if (!m_PreviousStreamPointer) {
//
// First thing we need to do is clone the leading edge. This allows
// us to keep reference on the frames while they're in DMA.
//
Status = KsStreamPointerClone (
Leading,
NULL,
sizeof (STREAM_POINTER_CONTEXT),
&ClonePointer
);
//
// I use this for easy chunking of the buffer. We're not really
// dealing with physical addresses. This keeps track of what
// virtual address in the buffer the current scatter / gather
// mapping corresponds to for the fake hardware.
//
if (NT_SUCCESS (Status)) {
//
// Set the stream header data used to 0. We update this
// in the DMA completions. For queues with DMA, we must
// update this field ourselves.
//
ClonePointer -> StreamHeader -> DataUsed = 0;
SPContext = reinterpret_cast <PSTREAM_POINTER_CONTEXT>
(ClonePointer -> Context);
SPContext -> BufferVirtual =
reinterpret_cast <PUCHAR> (
ClonePointer -> StreamHeader -> Data
);
}
} else {
ClonePointer = m_PreviousStreamPointer;
SPContext = reinterpret_cast <PSTREAM_POINTER_CONTEXT>
(ClonePointer -> Context);
Status = STATUS_SUCCESS;
}
//
// If the clone failed, likely we're out of resources. Break out
// of the loop for now. We may end up starving DMA.
//
if (!NT_SUCCESS (Status)) {
KsStreamPointerUnlock (Leading, FALSE);
break;
}
//
// Program the fake hardware. I would use Clone -> OffsetOut.*, but
// because of the optimization of one stream pointer per frame, it
// doesn't make complete sense.
//
ULONG MappingsUsed =
m_Device -> ProgramScatterGatherMappings (
&(SPContext -> BufferVirtual),
Leading -> OffsetOut.Mappings,
Leading -> OffsetOut.Remaining
);
//
// In order to keep one clone per frame and simplify the fake DMA
// logic, make a check to see if we completely used the mappings in
// the leading edge. Set a flag.
//
if (MappingsUsed == Leading -> OffsetOut.Remaining) {
m_PreviousStreamPointer = NULL;
} else {
m_PreviousStreamPointer = ClonePointer;
}
if (MappingsUsed) {
//
// If any mappings were added to scatter / gather queues,
// advance the leading edge by that number of mappings. If
// we run off the end of the queue, Status will be
// STATUS_DEVICE_NOT_READY. Otherwise, the leading edge will
// point to a new frame. The previous one will not have been
// dismissed (unless "DMA" completed) since there's a clone
// pointer referencing the frames.
//
Status =
KsStreamPointerAdvanceOffsets (
Leading,
0,
MappingsUsed,
FALSE
);
} else {
//
// The hardware was incapable of adding more entries. The S/G
// table is full.
//
Status = STATUS_PENDING;
break;
}
}
//
// If the leading edge failed to lock (this is always possible, remember
// that locking CAN occassionally fail), don't blow up passing NULL
// into KsStreamPointerUnlock. Also, set m_PendIo to kick us later...
//
if (!Leading) {
m_PendIo = TRUE;
//
// If the lock failed, there's no point in getting called back
// immediately. The lock could fail due to insufficient memory,
// etc... In this case, we don't want to get called back immediately.
// Return pending. The m_PendIo flag will cause us to get kicked
// later.
//
Status = STATUS_PENDING;
}
//
// If we didn't run the leading edge off the end of the queue, unlock it.
//
if (NT_SUCCESS (Status) && Leading) {
KsStreamPointerUnlock (Leading, FALSE);
} else {
//
// DEVICE_NOT_READY indicates that the advancement ran off the end
// of the queue. We couldn't lock the leading edge.
//
if (Status == STATUS_DEVICE_NOT_READY) Status = STATUS_SUCCESS;
}
//
// If we failed with something that requires pending, set the pending I/O
// flag so we know we need to start it again in a completion DPC.
//
if (!NT_SUCCESS (Status) || Status == STATUS_PENDING) {
m_PendIo = TRUE;
}
return Status;
}
/*************************************************/
NTSTATUS
CCapturePin::
CleanupReferences (
)
/*++
Routine Description:
Clean up any references we're holding on frames after we abruptly
stop the hardware.
Arguments:
None
Return Value:
Success / Failure
--*/
{
PAGED_CODE();
PKSSTREAM_POINTER Clone = KsPinGetFirstCloneStreamPointer (m_Pin);
PKSSTREAM_POINTER NextClone = NULL;
//
// Walk through the clones, deleting them, and setting DataUsed to
// zero since we didn't use any data!
//
while (Clone) {
NextClone = KsStreamPointerGetNextClone (Clone);
Clone -> StreamHeader -> DataUsed = 0;
KsStreamPointerDelete (Clone);
Clone = NextClone;
}
return STATUS_SUCCESS;
}
/*************************************************/
NTSTATUS
CCapturePin::
SetState (
IN KSSTATE ToState,
IN KSSTATE FromState
)
/*++
Routine Description:
This is called when the caputre pin transitions state. The routine
attempts to acquire / release any hardware resources and start up
or shut down capture based on the states we are transitioning to
and away from.
Arguments:
ToState -
The state we're transitioning to
FromState -
The state we're transitioning away from
Return Value:
Success / Failure
--*/
{
PAGED_CODE();
NTSTATUS Status = STATUS_SUCCESS;
switch (ToState) {
case KSSTATE_STOP:
//
// First, stop the hardware if we actually did anything to it.
//
if (m_HardwareState != HardwareStopped) {
Status = m_Device -> Stop ();
ASSERT (NT_SUCCESS (Status));
m_HardwareState = HardwareStopped;
}
//
// We've stopped the "fake hardware". It has cleared out
// it's scatter / gather tables and will no longer be
// completing clones. We had locks on some frames that were,
// however, in hardware. This will clean them up. An
// alternative location would be in the reset dispatch.
// Note, however, that the reset dispatch can occur in any
// state and this should be understood.
//
// Some hardware may fill all S/G mappings before stopping...
// in this case, you may not have to do this. The
// "fake hardware" here simply stops filling mappings and
// cleans its scatter / gather tables out on the Stop call.
//
Status = CleanupReferences ();
//
// Release any hardware resources related to this pin.
//
if (m_AcquiredResources) {
//
// If we got an interface to the clock, we must release it.
//
if (m_Clock) {
m_Clock -> Release ();
m_Clock = NULL;
}
m_Device -> ReleaseHardwareResources (
);
m_AcquiredResources = FALSE;
}
break;
case KSSTATE_ACQUIRE:
//
// Acquire any hardware resources related to this pin. We should
// only acquire them here -- **NOT** at filter create time.
// This means we do not fail creation of a filter because of
// limited hardware resources.
//
if (FromState == KSSTATE_STOP) {
Status = m_Device -> AcquireHardwareResources (
this,
m_TransportInfo
);
if (NT_SUCCESS (Status)) {
m_AcquiredResources = TRUE;
//
// Attempt to get an interface to the master clock.
// This will fail if one has not been assigned. Since
// one must be assigned while the pin is still in
// KSSTATE_STOP, this is a guranteed method of getting
// the clock should one be assigned.
//
if (!NT_SUCCESS (
KsPinGetReferenceClockInterface (
m_Pin,
&m_Clock
)
)) {
//
// If we could not get an interface to the clock,
// don't use one.
//
m_Clock = NULL;
}
} else {
m_AcquiredResources = FALSE;
}
} else {
//
// Standard transport pins will always receive transitions in
// +/- 1 manner. This means we'll always see a PAUSE->ACQUIRE
// transition before stopping the pin.
//
// The below is done because on DirectX 8.0, when the pin gets
// a message to stop, the queue is inaccessible. The reset
// which comes on every stop happens after this (at which time
// the queue is inaccessible also). So, for compatibility with
// DirectX 8.0, I am stopping the "fake" hardware at this
// point and cleaning up all references we have on frames. See
// the comments above regarding the CleanupReferences call.
//
// If this sample were targeting XP only, the below code would
// not be here. Again, I only do this so the sample does not
// hang when it is stopped running on a configuration such as
// Win2K + DX8.
//
if (m_HardwareState != HardwareStopped) {
Status = m_Device -> Stop ();
ASSERT (NT_SUCCESS (Status));
m_HardwareState = HardwareStopped;
}
Status = CleanupReferences ();
}
break;
case KSSTATE_PAUSE:
//
// Stop the hardware simulation if we're coming down from run.
//
if (FromState == KSSTATE_RUN) {
Status = m_Device -> Pause (TRUE);
if (NT_SUCCESS (Status)) {
m_HardwareState = HardwarePaused;
}
}
break;
case KSSTATE_RUN:
//
// Start the hardware simulation or unpause it depending on
// whether we're initially running or we've paused and restarted.
//
if (m_HardwareState == HardwarePaused) {
Status = m_Device -> Pause (FALSE);
} else {
Status = m_Device -> Start ();
}
if (NT_SUCCESS (Status)) {
m_HardwareState = HardwareRunning;
}
break;
}
return Status;
}
/**************************************************************************
LOCKED CODE
**************************************************************************/
#ifdef ALLOC_PRAGMA
#pragma code_seg()
#endif // ALLOC_PRAGMA
void
CCapturePin::
CompleteMappings (
IN ULONG NumMappings
)
/*++
Routine Description:
Called to notify the pin that a given number of scatter / gather
mappings have completed. Let the buffers go if possible.
We're called at DPC.
Arguments:
NumMappings -
The number of mappings that have completed.
Return Value:
None
--*/
{
ULONG MappingsRemaining = NumMappings;
//
// Walk through the clones list and delete clones whose time has come.
// The list is guaranteed to be kept in the order they were cloned.
//
PKSSTREAM_POINTER Clone = KsPinGetFirstCloneStreamPointer (m_Pin);
while (MappingsRemaining && Clone) {
PKSSTREAM_POINTER NextClone = KsStreamPointerGetNextClone (Clone);
//
// Count up the number of bytes we've completed and mark this
// in the Stream Header. In mapped queues
// (KSPIN_FLAG_GENERATE_MAPPINGS), this is the responsibility of
// the minidriver. In non-mapped queues, AVStream performs this.
//
ULONG MappingsToCount =
(MappingsRemaining > Clone -> OffsetOut.Remaining) ?
Clone -> OffsetOut.Remaining :
MappingsRemaining;
//
// Update DataUsed according to the mappings.
//
for (ULONG CurMapping = 0; CurMapping < MappingsToCount; CurMapping++) {
Clone -> StreamHeader -> DataUsed +=
Clone -> OffsetOut.Mappings [CurMapping].ByteCount;
}
//
// If we have completed all remaining mappings in this clone, it
// is an indication that the clone is ready to be deleted and the
// buffer released. Set anything required in the stream header which
// has not yet been set. If we have a clock, we can timestamp the
// sample.
//
if (MappingsRemaining >= Clone -> OffsetOut.Remaining) {
Clone -> StreamHeader -> Duration =
m_TransportInfo -> AvgTimePerFrame;
Clone -> StreamHeader -> PresentationTime.Numerator =
Clone -> StreamHeader -> PresentationTime.Denominator = 1;
//
// If a clock has been assigned, timestamp the packets with the
// time shown on the clock.
//
if (m_Clock) {
LONGLONG ClockTime = m_Clock -> GetTime ();
Clone -> StreamHeader -> PresentationTime.Time = ClockTime;
Clone -> StreamHeader -> OptionsFlags =
KSSTREAM_HEADER_OPTIONSF_TIMEVALID |
KSSTREAM_HEADER_OPTIONSF_DURATIONVALID;
} else {
//
// If there is no clock, don't time stamp the packets.
//
Clone -> StreamHeader -> PresentationTime.Time = 0;
}
//
// If all of the mappings in this clone have been completed,
// delete the clone. We've already updated DataUsed above.
//
MappingsRemaining -= Clone -> OffsetOut.Remaining;
KsStreamPointerDelete (Clone);
} else {
//
// If only part of the mappings in this clone have been completed,
// update the pointers. Since we're guaranteed this won't advance
// to a new frame by the check above, it won't fail.
//
KsStreamPointerAdvanceOffsets (
Clone,
0,
MappingsRemaining,
FALSE
);
MappingsRemaining = 0;
}
//
// Go to the next clone.
//
Clone = NextClone;
}
//
// If we've used all the mappings in hardware and pended, we can kick
// processing to happen again if we've completed mappings.
//
if (m_PendIo) {
m_PendIo = TRUE;
KsPinAttemptProcessing (m_Pin, TRUE);
}
}
/**************************************************************************
DISPATCH AND DESCRIPTOR LAYOUT
**************************************************************************/
#define TS_PAYLOAD 188
#define TS_PACKETS_PER_BUFFER 312
//
// This is the data range description of the capture output pin.
//
const
KSDATARANGE FormatCaptureOut =
{
// insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KSDATARANGE), // FormatSize
0, // Flags - (N/A)
TS_PACKETS_PER_BUFFER * TS_PAYLOAD, // SampleSize
0, // Reserved
{ STATIC_KSDATAFORMAT_TYPE_STREAM }, // MajorFormat
{ STATIC_KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT },// SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_NONE } // Specifier
}
};
//
// This is the data range description of the capture input pin.
//
const
KS_DATARANGE_BDA_TRANSPORT FormatCaptureIn =
{
// insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KS_DATARANGE_BDA_TRANSPORT), // FormatSize
0, // Flags - (N/A)
0, // SampleSize - (N/A)
0, // Reserved
{ STATIC_KSDATAFORMAT_TYPE_STREAM }, // MajorFormat
{ STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT }, // SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT } // Specifier
},
// insert the BDA_TRANSPORT_INFO here
{
TS_PAYLOAD, // ulcbPhyiscalPacket
TS_PACKETS_PER_BUFFER * TS_PAYLOAD, // ulcbPhyiscalFrame
0, // ulcbPhyiscalFrameAlignment (no requirement)
0 // AvgTimePerFrame (not known)
}
};
//
// CapturePinDispatch:
//
// This is the dispatch table for the capture pin. It provides notifications
// about creation, closure, processing, data formats, etc...
//
const
KSPIN_DISPATCH
CapturePinDispatch = {
CCapturePin::DispatchCreate, // Pin Create
NULL, // Pin Close
CCapturePin::DispatchProcess, // Pin Process
NULL, // Pin Reset
NULL, // Pin Set Data Format
CCapturePin::DispatchSetState, // Pin Set Device State
NULL, // Pin Connect
NULL, // Pin Disconnect
NULL, // Clock Dispatch
NULL // Allocator Dispatch
};
//
// InputPinDispatch:
//
// This is the dispatch table for the capture pin. It provides notifications
// about creation, closure, processing, data formats, etc...
//
const
KSPIN_DISPATCH
InputPinDispatch = {
CCapturePin::DispatchCreate, // Pin Create
NULL, // Pin Close
NULL, // Pin Process
NULL, // Pin Reset
NULL, // Pin Set Data Format
NULL, // Pin Set Device State
NULL, // Pin Connect
NULL, // Pin Disconnect
NULL, // Clock Dispatch
NULL // Allocator Dispatch
};
//
// CapturePinAllocatorFraming:
//
// This is the simple framing structure for the capture pin. Note that this
// will be modified via KsEdit when the actual capture format is determined.
//
DECLARE_SIMPLE_FRAMING_EX (
CapturePinAllocatorFraming, // FramingExName
STATICGUIDOF (KSMEMORY_TYPE_KERNEL_NONPAGED), // MemoryType
KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY |
KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY, // Flags
8, // Frames
0, // Alignment
188 * 312, // MinFrameSize
188 * 312 // MaxFrameSize
);
//
// CaptureOutPinDataRanges:
//
// This is the list of data ranges supported on the capture output pin.
//
const
PKSDATARANGE
CaptureOutPinDataRanges [CAPTURE_OUT_PIN_DATA_RANGE_COUNT] = {
(PKSDATARANGE) &FormatCaptureOut
};
//
// CaptureInPinDataRanges:
//
// This is the list of data ranges supported on the capture input pin.
//
const
PKSDATARANGE
CaptureInPinDataRanges [CAPTURE_IN_PIN_DATA_RANGE_COUNT] = {
(PKSDATARANGE) &FormatCaptureIn
};
| 29.272282 | 92 | 0.508448 | [
"object"
] |
19d44b46472e6b48a8b5d2b116284fd0014c4fec | 3,578 | cpp | C++ | src/abstractops.cpp | KKimj/mlir-tv | 585b2cdfa76312e74eac875e09a38769e616e36d | [
"Apache-2.0"
] | null | null | null | src/abstractops.cpp | KKimj/mlir-tv | 585b2cdfa76312e74eac875e09a38769e616e36d | [
"Apache-2.0"
] | null | null | null | src/abstractops.cpp | KKimj/mlir-tv | 585b2cdfa76312e74eac875e09a38769e616e36d | [
"Apache-2.0"
] | null | null | null | #include "abstractops.h"
#include "smt.h"
#include "value.h"
#include <map>
using namespace smt;
using namespace std;
namespace {
// Abstract representation of fp constants.
map<double, Expr> fpconst_absrepr;
unsigned fpconst_absrepr_num;
// TODO: this must be properly set
// What we need to do is to statically find how many 'different' fp values a
// program may observe.
const unsigned FP_BITS = 4;
}
namespace aop {
static AbsLevelDot alDot;
static UsedAbstractOps usedOps;
UsedAbstractOps getUsedAbstractOps() { return usedOps; }
void setAbstractionLevel(AbsLevelDot ad) {
alDot = ad;
memset(&usedOps, 0, sizeof(usedOps));
fpconst_absrepr.clear();
fpconst_absrepr_num = 0;
}
Sort fpSort() {
return Sort::bvSort(FP_BITS);
}
Expr fpConst(double f) {
// We don't explicitly encode f
auto itr = fpconst_absrepr.find(f);
if (itr != fpconst_absrepr.end())
return itr->second;
uint64_t absval;
if (f == 0.0)
absval = 0; // This is consistent with what mkZeroElemFromArr assumes
else {
assert(1 + fpconst_absrepr_num < (1ull << (uint64_t)FP_BITS));
absval = 1 + fpconst_absrepr_num++;
}
Expr e = Expr::mkBV(absval, FP_BITS);
fpconst_absrepr.emplace(f, e);
return e;
}
vector<double> fpPossibleConsts(const Expr &e) {
vector<double> vec;
for (auto &[k, v]: fpconst_absrepr) {
if (v.isIdentical(e))
vec.push_back(k);
}
return vec;
}
Expr mkZeroElemFromArr(const Expr &arr) {
unsigned bvsz = arr.select(Index::zero()).sort().bitwidth();
return Expr::mkBV(0, bvsz);
}
optional<FnDecl> sumfn, dotfn, fpaddfn, fpmulfn;
Expr fpAdd(const Expr &f1, const Expr &f2) {
usedOps.add = true;
auto fty = f1.sort();
if (!fpaddfn)
fpaddfn.emplace({fty, fty}, fty, "fp_add");
return fpaddfn->apply({f1, f2});
}
Expr fpMul(const Expr &a, const Expr &b) {
usedOps.mul = true;
// TODO: check that a.get_Sort() == b.get_Sort()
auto exprSort = a.sort();
if (!fpmulfn)
fpmulfn.emplace({exprSort, exprSort}, Float::sort(), "fp_mul");
return fpmulfn->apply({a, b}) + fpmulfn->apply({b, a});
}
Expr sum(const Expr &a, const Expr &n) {
usedOps.sum = true;
// TODO: check that a.Sort is Index::Sort() -> Float::Sort()
if (!sumfn)
sumfn.emplace(a.sort(), Float::sort(), "smt_sum");
auto i = Index::var("idx", VarType::BOUND);
Expr ai = a.select(i);
Expr zero = mkZeroElemFromArr(a);
return (*sumfn)(Expr::mkLambda(i, Expr::mkIte(((Expr)i).ult(n), ai, zero)));
}
Expr dot(const Expr &a, const Expr &b, const Expr &n) {
if (alDot == AbsLevelDot::FULLY_ABS) {
usedOps.dot = true;
// TODO: check that a.get_Sort() == b.get_Sort()
auto i = (Expr)Index::var("idx", VarType::BOUND);
auto fnSort = a.sort().toFnSort();
if (!dotfn)
dotfn.emplace({fnSort, fnSort}, Float::sort(), "smt_dot");
Expr ai = a.select(i), bi = b.select(i);
Expr zero = mkZeroElemFromArr(a);
Expr lhs = dotfn->apply({
Expr::mkLambda(i, Expr::mkIte(i.ult(n), ai, zero)),
Expr::mkLambda(i, Expr::mkIte(i.ult(n), bi, zero))});
Expr rhs = dotfn->apply({
Expr::mkLambda(i, Expr::mkIte(i.ult(n), bi, zero)),
Expr::mkLambda(i, Expr::mkIte(i.ult(n), ai, zero))});
return lhs + rhs;
} else if (alDot == AbsLevelDot::SUM_MUL) {
usedOps.mul = usedOps.sum = true;
// TODO: check that a.get_Sort() == b.get_Sort()
auto i = (Expr)Index::var("idx", VarType::BOUND);
Expr ai = a.select(i), bi = b.select(i);
return sum(Expr::mkLambda(i, fpMul(ai, bi)), n);
}
llvm_unreachable("Unknown abstraction level for dot");
}
}
| 26.503704 | 78 | 0.643656 | [
"vector"
] |
19d7e94a303cd40306b89e69ca5b72816c52bf5e | 70,579 | cpp | C++ | c++/tools/zenbu_upload.cpp | jessica-severin/ZENBU_2.11.1 | 694dd8fb178f3cbde2e058b8ee6a57e5a4c09cc7 | [
"Unlicense"
] | null | null | null | c++/tools/zenbu_upload.cpp | jessica-severin/ZENBU_2.11.1 | 694dd8fb178f3cbde2e058b8ee6a57e5a4c09cc7 | [
"Unlicense"
] | null | null | null | c++/tools/zenbu_upload.cpp | jessica-severin/ZENBU_2.11.1 | 694dd8fb178f3cbde2e058b8ee6a57e5a4c09cc7 | [
"Unlicense"
] | null | null | null | /* $Id: zenbu_upload.cpp,v 1.20 2017/01/05 08:51:27 severin Exp $ */
/****
NAME
zdxtools - DESCRIPTION of Object
DESCRIPTION
zdxtools is a ZENBU system command line tool to access and process data both
remotely on ZENBU federation servers and locally with ZDX file databases.
The API is designed to both enable ZENBU advanced features, but also to provide
a backward compatibility to samtools and bedtools so that zdxtools can be a "drop in"
replacement for these other tools.
CONTACT
Jessica Severin <jessica.severin@gmail.com>
LICENSE
* Software License Agreement (BSD License)
* MappedQueryDB [MQDB] toolkit
* copyright (c) 2006-2009 Jessica Severin
* 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 Jessica Severin 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 ''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 COPYRIGHT HOLDERS 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.
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
***/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string>
#include <iostream>
#include <math.h>
#include <sys/time.h>
#include <sys/dir.h>
#include <sys/types.h>
#include <pwd.h>
#include <curl/curl.h>
#include <openssl/hmac.h>
#include <rapidxml.hpp> //rapidxml must be include before boost
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <MQDB/Database.h>
#include <MQDB/MappedQuery.h>
#include <MQDB/DBStream.h>
#include <EEDB/Assembly.h>
#include <EEDB/Chrom.h>
#include <EEDB/Metadata.h>
#include <EEDB/Symbol.h>
#include <EEDB/MetadataSet.h>
#include <EEDB/Datatype.h>
#include <EEDB/FeatureSource.h>
#include <EEDB/Experiment.h>
#include <EEDB/EdgeSource.h>
#include <EEDB/Peer.h>
#include <EEDB/Feature.h>
#include <EEDB/JobQueue/Job.h>
#include <EEDB/User.h>
#include <EEDB/Collaboration.h>
#include <EEDB/SPStream.h>
#include <EEDB/SPStreams/Dummy.h>
#include <EEDB/SPStreams/SourceStream.h>
#include <EEDB/SPStreams/MultiMergeStream.h>
#include <EEDB/SPStreams/FederatedSourceStream.h>
#include <EEDB/SPStreams/FeatureEmitter.h>
#include <EEDB/SPStreams/TemplateCluster.h>
#include <EEDB/SPStreams/OSCFileDB.h>
#include <EEDB/SPStreams/BAMDB.h>
#include <EEDB/SPStreams/RemoteServerStream.h>
#include <EEDB/Tools/OSCFileParser.h>
#include <EEDB/Tools/RemoteUserTool.h>
#include <EEDB/WebServices/WebBase.h>
#include <EEDB/WebServices/UploadServer.h>
#include <math.h>
#include <sys/time.h>
using namespace std;
using namespace MQDB;
vector<EEDB::mdedit_t> _mdata_edit_commands;
map<string,string> _parameters;
EEDB::User *_user_profile=NULL;
long _login_retry_count = 0;
map<string, EEDB::WebServices::UploadFile*> _upload_file_list;
void usage();
bool get_cmdline_user();
bool verify_remote_user();
bool list_uploads();
bool list_collaborations();
void show_upload_queue();
bool upload_file_prep();
bool upload_file_send(string orig_filename);
bool bulk_upload_filelist();
bool delete_upload();
bool share_upload(string source_id);
void append_metadata_edit_command(string id_filter, string mode, string tag, string newvalue, string oldvalue);
bool send_mdata_edit_commands();
bool read_mdedit_file();
void show_mdedit_commands();
int main(int argc, char *argv[]) {
//seed random with usec of current time
struct timeval starttime;
gettimeofday(&starttime, NULL);
srand(starttime.tv_usec);
if(argc==1) { usage(); }
_parameters["mode"] = "";
for(int argi=1; argi<argc; argi++) {
if(argv[argi][0] != '-') { continue; }
string arg = argv[argi];
vector<string> argvals;
while((argi+1<argc) and (argv[argi+1][0] != '-')) {
argi++;
argvals.push_back(argv[argi]);
}
if(arg == "-help") { usage(); }
if(arg == "-ids") {
string ids;
for(unsigned int j=0; j<argvals.size(); j++) {
ids += " "+ argvals[j];
}
_parameters["ids"] += ids;
}
if(arg == "-list") { _parameters["mode"] = "list_uploads"; continue; }
if(arg == "-queue") { _parameters["mode"] = "show_queue"; continue; }
if(arg == "-collabs") { _parameters["mode"] = "list_collaborations"; continue; }
if(arg == "-singletag_exp") {
if(argvals.empty()) {
_parameters["singletagmap_expression"] = "tagcount";
} else {
_parameters["singletagmap_expression"] = argvals[0];
}
continue;
}
if(arg == "-allow_duplicates") { _parameters["check_duplicates"] = "false"; continue; }
if(argvals.empty()) {
fprintf(stderr, "ERROR: option %s needs parameters\n\n", arg.c_str());
usage();
}
if(arg == "-file") { _parameters["mode"] = "upload"; _parameters["_input_file"] = argvals[0]; }
if(arg == "-f") { _parameters["mode"] = "upload"; _parameters["_input_file"] = argvals[0]; }
if(arg == "-filelist") { _parameters["mode"] = "uploadlist"; _parameters["_input_filelist"] = argvals[0]; }
if(arg == "-url") { _parameters["_url"] = argvals[0]; }
if(arg == "-assembly") { _parameters["assembly"] = argvals[0]; }
if(arg == "-asm") { _parameters["assembly"] = argvals[0]; }
if(arg == "-asmb") { _parameters["assembly"] = argvals[0]; }
if(arg == "-assembly_name") { _parameters["assembly"] = argvals[0]; }
if(arg == "-name") { _parameters["display_name"] = argvals[0]; }
if(arg == "-displayname") { _parameters["display_name"] = argvals[0]; }
if(arg == "-display_name") { _parameters["display_name"] = argvals[0]; }
if(arg == "-description") { _parameters["description"] = argvals[0]; }
if(arg == "-desc") { _parameters["description"] = argvals[0]; }
if(arg == "-gff_mdata") { _parameters["gff_mdata"] = argvals[0]; }
if(arg == "-filter") { _parameters["filter"] = argvals[0]; }
if(arg == "-platform") { _parameters["platform"] = argvals[0]; }
if(arg == "-score_express") { _parameters["bedscore_expression"] = argvals[0]; }
if(arg == "-score_exp") { _parameters["bedscore_expression"] = argvals[0]; }
if(arg == "-format") { _parameters["format"] = argvals[0]; }
if(arg == "-share") { _parameters["_collab_uuid"] = argvals[0]; }
if(arg == "-collab_uuid") { _parameters["_collab_uuid"] = argvals[0]; }
if(arg == "-collab_filter") { _parameters["_collab_filter"] = argvals[0]; }
if(arg == "-delete") { _parameters["mode"] = "delete"; _parameters["_delete_id"] = argvals[0]; }
//metadata interface
//if(arg == "-mdata") { //adding metadata
// _parameters["mode"] = "mdedit";
// string tag = argvals[0];
// string value = argvals[1];
// append_metadata_edit_command("add", tag, value, "");
//}
if(arg == "-mdedit") {
if(argvals.size() < 2) {
fprintf(stderr, "ERROR -mdedit must specify at least 2 paramters <id/filter> and <cmd>\n\n");
usage();
}
_parameters["mode"] = "mdedit";
string id_filter = argvals[0];
string cmd = argvals[1];
if(cmd == "add") {
if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "add", tag, value, "");
} else {
fprintf(stderr, "ERROR -mdedit add must specify 2 additional parameters\n\n");
usage();
}
}
if(cmd == "delete") {
if(argvals.size() ==3) {
string tag = argvals[2];
append_metadata_edit_command(id_filter, "delete", tag, "", "");
} else if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "delete", tag, value, "");
} else {
fprintf(stderr, "ERROR -mdedit delete must specify either 1 or 2 additional parameters\n\n");
usage();
}
}
if(cmd == "change") {
if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "change", tag, value, "");
} else if(argvals.size() ==5) {
string tag = argvals[2];
string value = argvals[3];
string oldvalue = argvals[4];
append_metadata_edit_command(id_filter, "change", tag, value, oldvalue);
} else {
fprintf(stderr, "ERROR -mdedit change must specify either 2 or 3 additional parameters\n\n");
usage();
}
}
if(cmd == "extract_keywords") {
append_metadata_edit_command(id_filter, "extract_keywords", "keyword", " ", " ");
}
}
if(arg == "-mdfile") {
_parameters["_mdedit_file"] = argvals[0];
read_mdedit_file();
}
}
get_cmdline_user();
if(!_user_profile) {
printf("\nERROR: unable to read your ~/.zenbu/id_hmac file to identify your login identify. Please create file according to documentation.\nhttps://zenbu-wiki.gsc.riken.jp/zenbu/wiki/index.php/Data_loading#Bulk_command-line_upload_of_datafiles\n\n");
usage();
}
if(_parameters.find("_url") == _parameters.end()) {
printf("\nERROR: must specify -url to remote ZENBU system\n\n");
usage();
}
bool login_ok = verify_remote_user();
while(!login_ok && _login_retry_count<3) {
_login_retry_count++;
printf("\nERROR: unable to login to remote server [%s] as user [%s] -- try %ld\n",
_parameters["_url"].c_str(), _user_profile->email_identity().c_str(), _login_retry_count);
sleep(_login_retry_count * 2);
login_ok = verify_remote_user();
}
if(!login_ok) { usage(); }
if(_parameters["mode"] == "upload") {
if(!upload_file_prep()) { usage(); }
if(!upload_file_send(_parameters["_input_file"])) { usage(); }
} else if(_parameters["mode"] == "uploadlist") {
if(!bulk_upload_filelist()) { usage(); }
} else if(_parameters["mode"] == "list_uploads") {
list_uploads();
} else if(_parameters["mode"] == "list_collaborations") {
list_collaborations();
} else if(_parameters["mode"] == "show_queue") {
show_upload_queue();
} else if(_parameters["mode"] == "delete") {
if(!delete_upload()) { usage(); }
} else if(_parameters["mode"] == "mdedit") {
if(!send_mdata_edit_commands()) { usage(); }
} else {
usage();
}
exit(1);
}
void usage() {
printf("zenbu_upload [options]\n");
printf(" -help : print this help\n");
printf(" -url <url> : http url for specified ZENBU server\n");
printf(" -collabs : show list of my collaborations\n");
printf(" -format <type> : display format for listing collaborations (list, detail, xml, simplexml)\n");
printf(" -queue : show list of users pending upload queue\n");
printf(" -list : show list of previous uploads\n");
printf(" -filter <keywords> : filter upload list\n");
printf(" -collab_filter <uuid> : filter list for specific collaboration. Will show all data from all collaborators not just your contribution.\n");
printf(" -share <collab_uuid> : share listed data to specified collaboration\n");
printf(" -format <type> : display format for list/collabs/queue (list, detail, xml, simplexml)\n");
printf(" -file <path> : upload file to your account on specified server\n");
printf(" -assembly <genome name> : genome assembly name for coordinate space of upload\n");
printf(" -name <text> : display name for upload data source(s)\n");
printf(" -desc <text> : description for upload data source(s)\n");
printf(" -gff_mdata <text> : metadata to associate with upload. In GFF attribute format like -gff_mdata \"tag1=value1;tag2=long value with spaces;tag3=value2\"\n");
printf(" -platform <text> : platform metadata for upload data source(s)\n");
printf(" -score_exp <datatype> : use bed score column as expression value with <datatype>\n");
printf(" -singletag_exp <datatype> : each line of file gets expression value of 1 with <datatype>: default 'tagcount'\n");
printf(" -collab_uuid <uuid> : share this uploaded data to specified collaboration\n");
printf(" -allow_duplicates : do not perform the duplicate-uploads checks\n");
printf(" -filelist <control_file> : bulk upload files. In control_file give fullpath list of files to upload. Takes same additional params as -file\n");
printf(" -delete <safename/uuid> : delete uploaded file via either the unique safe filename or peer_uuid\n");
printf(" -mdedit <id/filter> <cmd> ... : edit metadata of specified source via id or search filter eg: \"encode rnaseq\"\n");
printf(" <cmd> options are listed below with additional parameter options\n");
printf(" add <tag> <value> : add metadata eg: -mdedit <..> add eedb:display_name \"some description\"\n");
printf(" delete <tag> : delete all metadata with <tag>\n");
printf(" delete <tag> <value-filter> : delete all metadata with <tag> and search-like <value>\n");
printf(" change <tag> <newvalue> : change all metadata with <tag> to have new value\n");
printf(" change <tag> <newval> <filter> : change all metadata with <tag> and matching value-filter to <new-value>\n");
printf(" extract_keywords : delete all previous keywords and rebuild from other metadata\n");
printf(" -mdfile <path> : ability to specify a block of mdedit commands in a single control file\n");
printf(" file is tab-separated columns following the same logic as the -mdedit cmdline option\n");
printf(" <id/filter> -tab- <cmd> -tab- <optional columns depending on cmd>\n");
printf("zenbu_upload v%s\n", EEDB::WebServices::WebBase::zenbu_version);
exit(1);
}
////////////////////////////////////////////////////////////////////////////
//
// libcurl callback code
//
////////////////////////////////////////////////////////////////////////////
static size_t _rss_curl_writeMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp) {
size_t realsize = size * nmemb;
struct RSS_curl_buffer *mem = (struct RSS_curl_buffer *)userp;
//fprintf(stderr, "_rss_curl_writeMemoryCallback %ld\n", realsize);
if(mem->size + realsize + 1 >= mem->alloc_size) {
mem->alloc_size += realsize + 2*1024*1024;
mem->memory = (char*)realloc(mem->memory, mem->alloc_size);
//fprintf(stderr, "realloc %ld\n", mem->alloc_size);
}
if(mem->memory == NULL) {
// out of memory!
fprintf(stderr, "curl not enough memory (realloc returned NULL)\n");
exit(EXIT_FAILURE);
}
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
return realsize;
}
////////////////////////////////////////////////////////////////////////////
//
// user query methods
//
////////////////////////////////////////////////////////////////////////////
bool get_cmdline_user() {
//reads ~/.zenbu/id_hmac to get hmac authentication secret
int fildes;
off_t cfg_len;
char* config_text;
if(_user_profile) { return true; }
struct passwd *pw = getpwuid(getuid());
string path = pw->pw_dir;
path += "/.zenbu/id_hmac";
fildes = open(path.c_str(), O_RDONLY, 0x700);
if(fildes<0) { return false; } //error
cfg_len = lseek(fildes, 0, SEEK_END);
//printf("config file %lld bytes long\n", (long long)cfg_len);
lseek(fildes, 0, SEEK_SET);
config_text = (char*)malloc(cfg_len+1);
memset(config_text, 0, cfg_len+1);
read(fildes, config_text, cfg_len);
char* email = strtok(config_text, " \t\n");
char* secret = strtok(NULL, " \t\n");
char* url = strtok(NULL, " \t\n");
//printf("[%s] -> [%s]\n", email, secret);
_user_profile = new EEDB::User();
if(email) { _user_profile->email_address(email); }
if(secret) { _user_profile->hmac_secretkey(secret); }
if(url) { _parameters["_url"] = url; }
free(config_text);
close(fildes);
return true;
}
bool verify_remote_user() {
//collaborations user is member/owner of
//might also need to cache peers, but for now try to do without caching
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>user</mode>";
paramXML += "</zenbu_query>";
//fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_user.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<user");
if(!start_ptr) { free(chunk.memory); return false; }
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) { free(chunk.memory); return false; }
rapidxml::xml_node<> *node = root_node->first_node("eedb_user");
EEDB::User *user = NULL;
if(node) {
user = new EEDB::User(node);
}
if(!user) { return false; }
//fprintf(stderr, "%s\n", user->xml().c_str());
free(chunk.memory);
doc.clear();
return true;
}
////////////////////////////////////////////////////////////////////////////
//
// upload methods
//
////////////////////////////////////////////////////////////////////////////
bool upload_file_prep() {
if(!_user_profile) { return false; }
//
//check file, get file size
//
if(_parameters.find("_input_file") == _parameters.end()) {
printf("\nERROR: must specify -file to upload\n\n");
}
int fildes = open(_parameters["_input_file"].c_str(), O_RDONLY, 0x700);
if(fildes<0) {
fprintf(stderr, "ERROR: unable to open file [%s]\n", _parameters["_input_file"].c_str());
return false;
}
//fprintf(stderr, "file [%s] ", _parameters["_input_file"].c_str());
off_t file_len = lseek(fildes, 0, SEEK_END);
if(file_len > 1024*1024) {
printf("%1.3f MBytes long\n", (double)file_len/1024.0/1024.0);
} else if (file_len > 1024) {
printf("%1.3f KBytes long\n", (double)file_len/1024.0);
} else {
printf("%lld bytes long\n", (long long)file_len);
}
lseek(fildes, 0, SEEK_SET);
close(fildes);
//
//phase1 send metadata information and get safe-filename
//
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>uploadprep</mode>";
paramXML += "<upload_file ";
paramXML += "filename=\""+html_escape(_parameters["_input_file"])+"\">";
if(_parameters.find("gff_mdata") != _parameters.end()) {
paramXML += "<gff_mdata>"+_parameters["gff_mdata"]+"</gff_mdata>";
}
paramXML += "</upload_file>";
if(_parameters.find("display_name") != _parameters.end()) {
paramXML += "<display_name>"+_parameters["display_name"]+"</display_name>";
}
if(_parameters.find("description") != _parameters.end()) {
paramXML += "<description>"+_parameters["description"]+"</description>";
}
if(_parameters.find("assembly") != _parameters.end()) {
paramXML += "<assembly>"+_parameters["assembly"]+"</assembly>";
}
if(_parameters.find("platform") != _parameters.end()) {
paramXML += "<platform>"+_parameters["platform"]+"</platform>";
}
if(_parameters.find("bedscore_expression") != _parameters.end()) {
paramXML += "<bedscore_expression>"+_parameters["bedscore_expression"]+"</bedscore_expression>";
paramXML += "<datatype>"+_parameters["bedscore_expression"]+"</datatype>";
}
if(_parameters.find("singletagmap_expression") != _parameters.end()) {
paramXML += "<singletagmap_expression>"+_parameters["singletagmap_expression"]+"</singletagmap_expression>";
paramXML += "<datatype>"+_parameters["singletagmap_expression"]+"</datatype>";
}
if(_parameters["check_duplicates"] != "false") {
paramXML += "<check_duplicates>true</check_duplicates>";
}
if(_parameters.find("_collab_uuid") != _parameters.end()) {
paramXML += "<collaboration_uuid>"+_parameters["_collab_uuid"]+"</collaboration_uuid>";
}
//metadata
if(!_mdata_edit_commands.empty()) {
paramXML += "<mdata_commands>";
vector<EEDB::mdedit_t>::iterator edit_cmd;
for(edit_cmd = _mdata_edit_commands.begin(); edit_cmd != _mdata_edit_commands.end(); edit_cmd++) {
paramXML += "<edit mode=\"" + edit_cmd->mode +"\"";
if(!edit_cmd->tag.empty()) {
paramXML += " tag=\"" + html_escape(edit_cmd->tag) +"\"";
}
paramXML += ">";
if(edit_cmd->mode == "change") {
if(!edit_cmd->oldvalue.empty()) { paramXML += "<old>" + html_escape(edit_cmd->oldvalue) +"</old>"; }
if(!edit_cmd->newvalue.empty()) { paramXML += "<new>" + html_escape(edit_cmd->newvalue) +"</new>"; }
} else {
if(!edit_cmd->newvalue.empty()) { paramXML += html_escape(edit_cmd->newvalue); }
}
paramXML += "</edit>";
}
paramXML += "</mdata_commands>";
}
paramXML += "</zenbu_query>";
fprintf(stderr, "POSTi---\n%s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_upload.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<upload");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_node<> *errornode = root_node->first_node("upload_error");
if(errornode) {
fprintf(stderr, "ERROR: %s\n", errornode->value());
return false;
}
/*
rapidxml::xml_node<> *node = root_node->first_node("safe_file");
if(!node) {
fprintf(stderr, "ERROR: upload prep did not return a unique safe file id\n");
return false;
}
string safe_file = node->value();
fprintf(stderr, "upload_unique_name[%s]\n", safe_file.c_str());
free(chunk.memory);
doc.clear();
_parameters["_safe_filename"] = safe_file;
*/
rapidxml::xml_node<> *node = root_node->first_node("upload_file");
if(!node) {
fprintf(stderr, "ERROR: upload prep did not return any files to upload. maybe all duplicates\n");
return true;
}
while(node) {
EEDB::WebServices::UploadFile *upload_file = new EEDB::WebServices::UploadFile(node);;
if(upload_file) {
_upload_file_list[upload_file->orig_filename] = upload_file;
}
node = node->next_sibling("upload_file");
}
fprintf(stderr, "PREP returned %ld safenames (avoiding reload) for actual upload\n", _upload_file_list.size());
return true;
}
bool bulk_upload_filelist() {
if(!_user_profile) { return false; }
CURL *curl = curl_easy_init();
if(!curl) { return false; }
//
//check file, get file size
//
if(_parameters.find("_input_filelist") == _parameters.end()) {
printf("\nERROR: must specify -filelist to upload\n\n");
}
gzFile gz = gzopen(_parameters["_input_filelist"].c_str(), "r");
if(!gz) {
fprintf(stderr, "ERROR: unable to open file [%s]\n", _parameters["_input_filelist"].c_str());
return false;
}
long long buflen = 10*1024*1024; //10MB
char* _data_buffer = (char*)malloc(buflen);
bzero(_data_buffer, buflen);
//
//phase1 send metadata information and get safe-filenames
//
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>uploadprep</mode>";
//default parameters to apply to all files
if(_parameters.find("display_name") != _parameters.end()) {
paramXML += "<display_name>"+_parameters["display_name"]+"</display_name>";
}
if(_parameters.find("description") != _parameters.end()) {
paramXML += "<description>"+_parameters["description"]+"</description>";
}
if(_parameters.find("assembly") != _parameters.end()) {
paramXML += "<assembly>"+_parameters["assembly"]+"</assembly>";
}
if(_parameters.find("platform") != _parameters.end()) {
paramXML += "<platform>"+_parameters["platform"]+"</platform>";
}
if(_parameters.find("bedscore_expression") != _parameters.end()) {
paramXML += "<bedscore_expression>"+_parameters["bedscore_expression"]+"</bedscore_expression>";
paramXML += "<datatype>"+_parameters["bedscore_expression"]+"</datatype>";
}
if(_parameters.find("singletagmap_expression") != _parameters.end()) {
paramXML += "<singletagmap_expression>"+_parameters["singletagmap_expression"]+"</singletagmap_expression>";
paramXML += "<datatype>"+_parameters["singletagmap_expression"]+"</datatype>";
}
paramXML += "<check_duplicates>true</check_duplicates>";
if(_parameters.find("_collab_uuid") != _parameters.end()) {
paramXML += "<collaboration_uuid>"+_parameters["_collab_uuid"]+"</collaboration_uuid>";
}
//
while(gzgets(gz, _data_buffer, buflen) != NULL) {
if(_data_buffer[0] == '#') { continue; }
//if(_data_buffer[strlen(_data_buffer)-1] == '\n') { _data_buffer[strlen(_data_buffer)-1] = '\0'; }
long colnum=1;
string filename, display_name, description, gff_mdata;
char *tok, *line=_data_buffer;
while((tok = strsep(&line, "\t\n")) != NULL) {
switch(colnum) {
case 1: filename = tok; break;
case 2: display_name = tok; break;
case 3: description = tok; break;
case 4: gff_mdata = tok; break;
default: break;
}
colnum++;
}
if(filename.empty()) { continue; }
paramXML += "<upload_file ";
paramXML += "filename=\""+html_escape(filename)+"\" ";
if(!display_name.empty()) { paramXML += "display_name=\""+html_escape(display_name)+"\" "; }
if(!description.empty()) { paramXML += "description=\""+html_escape(description)+"\" "; }
paramXML += ">";
if(!gff_mdata.empty()) { paramXML += "<gff_mdata>"+html_escape(gff_mdata)+"</gff_mdata>"; }
paramXML += "</upload_file>\n";
}
paramXML += "</zenbu_query>";
fprintf(stderr, "POST: %s\n", paramXML.c_str());
free(_data_buffer);
gzclose(gz); //close input file
string url = _parameters["_url"] + "/cgi/eedb_upload.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<upload");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_node<> *errornode = root_node->first_node("upload_error");
if(errornode) {
fprintf(stderr, "ERROR: %s\n", errornode->value());
return false;
}
rapidxml::xml_node<> *node = root_node->first_node("upload_file");
if(!node) {
fprintf(stderr, "upload prep did not return any files to upload. maybe all duplicates. no new uploads\n");
return true;
}
while(node) {
EEDB::WebServices::UploadFile *upload_file = new EEDB::WebServices::UploadFile(node);;
if(upload_file) {
_upload_file_list[upload_file->orig_filename] = upload_file;
}
node = node->next_sibling("upload_file");
}
fprintf(stderr, "PREP returned %ld safenames (avoiding reload) for actual upload\n", _upload_file_list.size());
map<string, EEDB::WebServices::UploadFile*>::iterator it1;
long count=1;
for(it1=_upload_file_list.begin(); it1!=_upload_file_list.end(); it1++) {
fprintf(stderr, "SEND %ld orig:[%s] zenbu:[%s]\n", count++, it1->second->orig_filename.c_str(), it1->second->safename.c_str());
upload_file_send(it1->second->orig_filename);
}
return true;
}
bool upload_file_send(string input_file) {
struct timeval starttime,endtime,difftime;
if(!_user_profile) { return false; }
//_parameters["_input_file"]
EEDB::WebServices::UploadFile *ufile = _upload_file_list[input_file];
if(!ufile) { return true; }
string safe_filename = ufile->safename;
//get file size
int fildes = open(input_file.c_str(), O_RDONLY, 0x700);
if(fildes<0) {
fprintf(stderr, "ERROR: unable to open file [%s]\n", input_file.c_str());
return false;
}
off_t file_len = lseek(fildes, 0, SEEK_END);
close(fildes);
gettimeofday(&starttime, NULL);
fprintf(stderr, "SEND orig:[%s] zenbu:[%s] : ", ufile->orig_filename.c_str(), ufile->safename.c_str());
if(file_len > 1024*1024) {
printf("%1.3f MBytes long\n", (double)file_len/1024.0/1024.0);
} else if (file_len > 1024) {
printf("%1.3f KBytes long\n", (double)file_len/1024.0);
} else {
printf("%lld bytes long\n", (long long)file_len);
}
//
//phase2 send file content
//
FILE *fd = fopen(input_file.c_str(), "rb");
if(!fd) {
fprintf(stderr, "ERROR: can not open file for sending\n");
}
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string url = _parameters["_url"] + "/cgi/eedb_upload.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
curl_easy_setopt(curl, CURLOPT_READDATA, (void*)fd);
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_len);
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "Content-Type:application/octet-stream");
//HTTP_X_ZENBU_UPLOAD
string safe_creds = string("x-zenbu-upload:") + safe_filename;
slist = curl_slist_append(slist, safe_creds.c_str());
//HTTP_X_ZENBU_USER_EMAIL
string email_creds = string("x-zenbu-user-email:") + _user_profile->email_identity();
slist = curl_slist_append(slist, email_creds.c_str());
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)safe_filename.c_str(),
safe_filename.length(),
NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
//fprintf(stderr,"signature [%s]\n", res_hexstring);
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
char *start_ptr = strstr(chunk.memory, "<upload");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply when sending file content\n");
return false;
}
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
gettimeofday(&endtime, NULL);
timersub(&endtime, &starttime, &difftime);
double duration = (double)difftime.tv_sec + ((double)difftime.tv_usec)/1000000.0;
fprintf(stderr, " sent in %1.6f sec : %1.3f kb/sec\n", duration, file_len/1024.0/duration);
return true;
}
////////////////////////////////////////////////////////////////////////////
//
// list methods
//
////////////////////////////////////////////////////////////////////////////
bool list_uploads() {
if(_parameters.find("format") == _parameters.end()) { _parameters["format"] = "list"; }
map<string, EEDB::Peer*> peer_map;
map<string, vector<EEDB::DataSource*> > my_uploads;
//map<string, long> peer_source_count;
long exp_count=0;
long fsrc_count=0;
EEDB::SPStreams::FederatedSourceStream *stream = new EEDB::SPStreams::FederatedSourceStream;
EEDB::Peer *seed = EEDB::Peer::new_from_url(_parameters["_url"]);
if(!seed or !seed->is_valid()) {
printf("\nERROR: problem connecting to remote url [%s]\n\n", _parameters["_url"].c_str());
return false;
}
stream->add_seed_peer(seed);
EEDB::SPStreams::RemoteServerStream::set_current_user(_user_profile);
if(_parameters.find("_collab_filter") != _parameters.end()) {
EEDB::SPStreams::RemoteServerStream::set_collaboration_filter(_parameters["_collab_filter"]);
} else {
EEDB::SPStreams::RemoteServerStream::set_collaboration_filter("private");
}
// peers
stream->stream_peers();
while(MQDB::DBObject* obj = stream->next_in_stream()) {
if(!obj) { continue; }
EEDB::Peer *peer = (EEDB::Peer*)obj;
if(!(peer->is_valid())) { continue; }
peer_map[peer->uuid()] = peer;
my_uploads[peer->uuid()].clear();
//peer_source_count[peer->uuid()] = 0;
}
//printf("%ld peers\n", my_uploads.size());
// sources
if(_parameters.find("filter") != _parameters.end()) {
stream->stream_data_sources("", _parameters["filter"]);
} else {
stream->stream_data_sources("");
}
while(MQDB::DBObject* obj = stream->next_in_stream()) {
if(obj->classname() == EEDB::Peer::class_name) {
EEDB::Peer *peer = (EEDB::Peer*)obj;
peer_map[peer->uuid()] = peer;
continue;
}
string uuid, objClass;
long int objID;
MQDB::unparse_dbid(obj->db_id(), uuid, objID, objClass);
//printf(" uuid: %s\n", uuid.c_str());
EEDB::Peer *peer = EEDB::Peer::check_cache(uuid);
//peer_source_count[uuid]++;
EEDB::DataSource* source = (EEDB::DataSource*)obj;
if(obj->classname() == EEDB::Experiment::class_name) { exp_count++; }
if(obj->classname() == EEDB::FeatureSource::class_name) { fsrc_count++; }
//if(obj->primary_id() == 1) {
my_uploads[uuid].push_back(source);
}
// show
printf("-------------\n");
long upload_count=0;
map<string, vector<EEDB::DataSource*> >::iterator it1;
for(it1 = my_uploads.begin(); it1!=my_uploads.end(); it1++) {
string uuid = (*it1).first;
vector<EEDB::DataSource*> sources = (*it1).second;
if(sources.empty()) { continue; }
upload_count++;
if(_parameters["format"] == "list") {
printf("%30s [%s] (%ld sources) ::: %s\n",
uuid.c_str(),
sources[0]->display_name().c_str(),
sources.size(),
sources[0]->description().c_str() );
} else if(_parameters["format"] == "detail") {
printf("-------------\n");
printf(" uuid: %s\n", uuid.c_str());
printf(" name: %s\n", sources[0]->display_name().c_str());
printf(" description: %s\n", sources[0]->description().c_str());
printf(" sources : %ld\n", sources.size());
} else {
//show all sources
vector<EEDB::DataSource*>::iterator it2;
for(it2 = sources.begin(); it2!=sources.end(); it2++) {
EEDB::DataSource* source = (*it2);
if(_parameters["format"] == "xml") {
printf("%s\n", source->xml().c_str());
}
else if((_parameters["format"] == "simplexml") || (_parameters["format"] == "simple_xml")) {
printf("%s", source->simple_xml().c_str());
}
}
}
//collaboration sharing for peer uuid
if(_parameters.find("_collab_uuid") != _parameters.end()) {
if(share_upload(sources[0]->db_id())) {
printf(" shared to collaboration [%s]\n", _parameters["_collab_uuid"].c_str());
}
}
}
printf("-------------\n");
printf("%ld uploads --- %ld featuresources --- %ld experiments --- [%ld total sources]\n", upload_count, fsrc_count, exp_count, fsrc_count+exp_count);
stream->disconnect();
return true;
}
bool list_collaborations() {
if(_parameters.find("format") == _parameters.end()) { _parameters["format"] = "list"; }
//collaborations user is member/owner of
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>collaborations</mode>";
paramXML += "<format>xml</format>";
paramXML += "</zenbu_query>";
//fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_user.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<collaborations");
if(!start_ptr) { free(chunk.memory); return false; }
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) { free(chunk.memory); return false; }
long collab_count=0;
long total_share=0;
rapidxml::xml_node<> *node = NULL;
if((node = root_node->first_node("collaboration")) != NULL) {
while(node) {
EEDB::Collaboration *collab = new EEDB::Collaboration(node);;
if(collab) {
collab_count++;
long share_count = collab->shared_data_peers().size();
total_share += share_count;
if(_parameters["format"] == "xml") {
printf("%s\n", collab->xml().c_str());
}
else if((_parameters["format"] == "simplexml") || (_parameters["format"] == "simple_xml")) {
printf("%s", collab->simple_xml().c_str());
}
else if(_parameters["format"] == "detail") {
printf("-------------\n");
printf(" uuid: %s\n", collab->group_uuid().c_str());
printf(" name: %s\n", collab->display_name().c_str());
printf(" status: %s\n", collab->member_status().c_str());
printf(" description: %s\n", collab->description().c_str());
printf(" shared data: %ld\n", share_count);
} else {
printf("%30s [%s] :: %ld shared uploads\n", collab->group_uuid().c_str(), collab->display_name().c_str(), share_count);
}
}
node = node->next_sibling("collaboration");
}
}
printf("%ld collaborations --- [%ld total shared uploads]\n", collab_count, total_share);
free(chunk.memory);
doc.clear();
return true;
}
void show_upload_queue() {
if(_parameters.find("format") == _parameters.end()) { _parameters["format"] = "list"; }
//collaborations user is member/owner of
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
CURL *curl = curl_easy_init();
if(!curl) { return; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>queuestatus</mode>";
paramXML += "</zenbu_query>";
//fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_upload.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<upload_queue");
if(!start_ptr) { free(chunk.memory); return; }
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) { free(chunk.memory); return; }
long job_count=0;
long total_share=0;
rapidxml::xml_node<> *node = NULL;
if((node = root_node->first_node("job")) != NULL) {
while(node) {
EEDB::JobQueue::Job *job = new EEDB::JobQueue::Job(node);
if(job) {
job_count++;
EEDB::Metadata *md;
if(_parameters["format"] == "xml") {
printf("%s\n", job->xml().c_str());
}
else if((_parameters["format"] == "simplexml") || (_parameters["format"] == "simple_xml")) {
printf("%s", job->simple_xml().c_str());
}
else if(_parameters["format"] == "detail") {
printf("-------------\n");
printf(" status: %s\n", job->status().c_str());
printf(" name: %s\n", job->display_name().c_str());
printf(" description: %s\n", job->description().c_str());
printf(" genome: %s\n", job->genome_name().c_str());
printf(" upload date: %s\n", job->created_date_string().c_str());
} else {
printf("%7s : %40s : %s : %s\n",
job->status().c_str(),
job->display_name().c_str(),
job->genome_name().c_str(),
job->created_date_string().c_str());
}
}
node = node->next_sibling("job");
}
}
printf("%ld active upload jobs\n", job_count);
free(chunk.memory);
doc.clear();
}
////////////////////////////////////////////////////////////////////////////
//
// delete & share methods
//
////////////////////////////////////////////////////////////////////////////
bool share_upload(string source_id) {
if(_parameters.find("_collab_uuid") == _parameters.end()) { return false; }
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>sharedb</mode>";
paramXML += "<sharedb>"+ source_id +"</sharedb>";
paramXML += "<collaboration_uuid>"+_parameters["_collab_uuid"]+"</collaboration_uuid>";
paramXML += "</zenbu_query>";
//fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_user.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<share_uploaded_database");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
/*
rapidxml::xml_node<> *errornode = root_node->first_node("upload_error");
if(errornode) {
fprintf(stderr, "ERROR: %s\n", errornode->value());
return false;
}
rapidxml::xml_node<> *node = root_node->first_node("deleted");
if(node) {
rapidxml::xml_node<> *node2 = node->first_node("peer");
if(node2) {
EEDB::Peer *peer = EEDB::Peer::new_from_xml(node2);
if(peer) { printf("deleted :: %s\n", peer->xml().c_str()); }
}
}
*/
free(chunk.memory);
doc.clear();
return true;
}
bool delete_upload() {
if(!_user_profile) { return false; }
//
//check file, get file size
//
if(_parameters.find("_delete_id") == _parameters.end()) {
printf("\nERROR: must specify -delete id/name of upload\n\n");
return false;
}
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>delete</mode>";
paramXML += "<deletedb>"+_parameters["_delete_id"]+"</deletedb>";
paramXML += "</zenbu_query>";
//fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_upload.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
//fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<upload");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_node<> *errornode = root_node->first_node("upload_error");
if(errornode) {
fprintf(stderr, "ERROR: %s\n", errornode->value());
return false;
}
rapidxml::xml_node<> *node = root_node->first_node("deleted");
if(node) {
rapidxml::xml_node<> *node2 = node->first_node("peer");
if(node2) {
EEDB::Peer *peer = EEDB::Peer::new_from_xml(node2);
if(peer) { printf("deleted :: %s\n", peer->xml().c_str()); }
}
}
free(chunk.memory);
doc.clear();
return true;
}
//-------------------------------------------------------------------
//
// metadata editing section
//
//-------------------------------------------------------------------
void append_metadata_edit_command(string id_filter, string mode, string tag, string newvalue, string oldvalue) {
//first get the source_ids which we will later use to configure FederatedSourceStream
if(mode.empty()) { return; }
if(tag.empty() and newvalue.empty()) { return; }
EEDB::mdedit_t edit_cmd;
edit_cmd.mode = mode;
edit_cmd.tag = tag;
//determine if id_filter is id or filter
string uuid, objClass;
long int objID;
MQDB::unparse_dbid(id_filter, uuid, objID, objClass);
if(uuid.empty()) {
edit_cmd.obj_filter = id_filter;
} else {
edit_cmd.db_id = id_filter;
}
if(edit_cmd.mode == "change") {
edit_cmd.oldvalue = oldvalue;
edit_cmd.newvalue = newvalue;
} else {
edit_cmd.newvalue = newvalue;
}
//post filters to avoid bad commands
if(edit_cmd.tag.empty()) { return; }
//if(edit_cmd.tag == "eedb:name") { return; } //might need this
if(edit_cmd.tag == "eedb:assembly_name") { return; }
if(edit_cmd.tag == "assembly_name") { return; }
if(edit_cmd.tag == "genome_assembly") { return; }
if(edit_cmd.tag == "uuid") { return; }
if(edit_cmd.tag == "eedb:owner_nickname") { return; }
if(edit_cmd.tag == "eedb:owner_OpenID") { return; }
if(edit_cmd.tag == "eedb:owner_email") { return; }
if(edit_cmd.tag == "configXML") { return; }
if(edit_cmd.tag == "eedb:configXML") { return; }
_mdata_edit_commands.push_back(edit_cmd);
}
bool send_mdata_edit_commands() {
if(!_user_profile) { return false; }
if(_mdata_edit_commands.empty()) { return true; } //nothing to do
CURL *curl = curl_easy_init();
if(!curl) { return false; }
struct RSS_curl_buffer chunk;
chunk.memory = NULL; // will be grown as needed
chunk.size = 0; // no data at this point
chunk.alloc_size = 0; // no data at this point
string paramXML = "<zenbu_query>";
if(_user_profile) {
paramXML += "<authenticate><email>"+ _user_profile->email_identity() +"</email>";
struct timeval expiretime;
gettimeofday(&expiretime, NULL); //set to 5min in the future
long value = expiretime.tv_sec+300;
paramXML += "<expires>" +l_to_string(value) + "</expires>";
paramXML += "</authenticate>";
}
paramXML += "<mode>search_edit_metadata</mode>";
if(_parameters.find("filter") != _parameters.end()) {
paramXML += "<filter>" + _parameters["filter"] + "</filter>";
}
paramXML += "<mdata_edit_commands>";
vector<EEDB::mdedit_t>::iterator edit_cmd;
for(edit_cmd = _mdata_edit_commands.begin(); edit_cmd != _mdata_edit_commands.end(); edit_cmd++) {
paramXML += "<edit mode=\"" + edit_cmd->mode +"\"";
if(!edit_cmd->db_id.empty()) {
paramXML += " id=\"" + html_escape(edit_cmd->db_id) +"\"";
}
if(!edit_cmd->obj_filter.empty()) {
paramXML += " filter=\"" + html_escape(edit_cmd->obj_filter) +"\"";
}
if(!edit_cmd->tag.empty()) {
paramXML += " tag=\"" + html_escape(edit_cmd->tag) +"\"";
}
paramXML += ">";
if(edit_cmd->mode == "change") {
if(!edit_cmd->oldvalue.empty()) { paramXML += "<old>" + html_escape(edit_cmd->oldvalue) +"</old>"; }
if(!edit_cmd->newvalue.empty()) { paramXML += "<new>" + html_escape(edit_cmd->newvalue) +"</new>"; }
} else {
if(!edit_cmd->newvalue.empty()) { paramXML += html_escape(edit_cmd->newvalue); }
}
paramXML += "</edit>";
}
paramXML += "</mdata_edit_commands>";
paramXML += "</zenbu_query>";
fprintf(stderr, "POST: %s\n", paramXML.c_str());
string url = _parameters["_url"] + "/cgi/eedb_user.cgi";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, paramXML.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, paramXML.length());
struct curl_slist *slist = NULL;
slist = curl_slist_append(NULL, "Content-Type: text/xml; charset=utf-8"); // or whatever charset your XML is really using...
if(_user_profile) {
string key = _user_profile->hmac_secretkey();
unsigned int md_len;
unsigned char* result = HMAC(EVP_sha256(),
(const unsigned char*)key.c_str(), key.length(),
(const unsigned char*)paramXML.c_str(), paramXML.length(), NULL, &md_len);
static char res_hexstring[64]; //expect 32 so this is safe
bzero(res_hexstring, 64);
for(unsigned i = 0; i < md_len; i++) { sprintf(&(res_hexstring[i * 2]), "%02x", result[i]); }
string credentials = string("x-zenbu-magic: ") + res_hexstring;
slist = curl_slist_append(slist, credentials.c_str());
}
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _rss_curl_writeMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
curl_easy_perform(curl);
if(slist) { curl_slist_free_all(slist); }
curl_easy_cleanup(curl);
fprintf(stderr, "returned-----\n%s\n", chunk.memory);
char *start_ptr = strstr(chunk.memory, "<edit_metadata");
if(!start_ptr) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
rapidxml::xml_document<> doc;
rapidxml::xml_node<> *root_node;
doc.parse<rapidxml::parse_declaration_node | rapidxml::parse_no_data_nodes>(start_ptr);
root_node = doc.first_node();
if(!root_node) {
free(chunk.memory);
fprintf(stderr, "ERROR: malformed webservice reply\n");
return false;
}
/*
rapidxml::xml_node<> *errornode = root_node->first_node("upload_error");
if(errornode) {
fprintf(stderr, "ERROR: %s\n", errornode->value());
return false;
}
rapidxml::xml_node<> *node = root_node->first_node("deleted");
if(node) {
rapidxml::xml_node<> *node2 = node->first_node("peer");
if(node2) {
EEDB::Peer *peer = EEDB::Peer::new_from_xml(node2);
if(peer) { printf("deleted :: %s\n", peer->xml().c_str()); }
}
}
*/
doc.clear();
free(chunk.memory);
return true;
}
bool read_mdedit_file() {
//
//check file, get file size
//
if(_parameters.find("_mdedit_file") == _parameters.end()) {
printf("\nERROR: must specify -mdfile <path>\n\n");
return false;
}
int fildes = open(_parameters["_mdedit_file"].c_str(), O_RDONLY, 0x700);
if(fildes<0) {
fprintf(stderr, "ERROR: unable to open file [%s]\n", _parameters["_mdedit_file"].c_str());
return false;
}
off_t file_len = lseek(fildes, 0, SEEK_END);
lseek(fildes, 0, SEEK_SET);
char* mdedit_text = (char*)malloc(file_len+1);
memset(mdedit_text, 0, file_len+1);
read(fildes, mdedit_text, file_len);
//printf("config:::%s\n=========\n", mdedit_text);
close(fildes);
char *p1 = mdedit_text;
char *cline = mdedit_text;
int count=1;
while(p1 - mdedit_text < file_len) {
cline = p1;
while((p1 - mdedit_text < file_len) && (*p1 != '\0') && (*p1 != '\n') && (*p1 != '\r')) { p1++; }
if(*p1 != '\0') {
*p1 = '\0'; //null terminate the line
}
p1++;
//printf("[%d] %s\n", count++, cline);
char *tok = strtok(cline, "\t");
vector<string> argvals;
while(tok!=NULL) {
argvals.push_back(tok);
tok = strtok(NULL, "\t");
}
string id_filter = argvals[0];
string cmd = argvals[1];
if(cmd == "add") {
if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "add", tag, value, "");
} else {
fprintf(stderr, "ERROR -mdedit add must specify 2 additional parameters\n\n");
usage();
}
}
if(cmd == "delete") {
if(argvals.size() ==3) {
string tag = argvals[2];
append_metadata_edit_command(id_filter, "delete", tag, "", "");
} else if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "delete", tag, value, "");
} else {
fprintf(stderr, "ERROR -mdedit delete must specify either 1 or 2 additional parameters\n\n");
usage();
}
}
if(cmd == "change") {
if(argvals.size() ==4) {
string tag = argvals[2];
string value = argvals[3];
append_metadata_edit_command(id_filter, "change", tag, value, "");
} else if(argvals.size() ==5) {
string tag = argvals[2];
string value = argvals[3];
string oldvalue = argvals[4];
append_metadata_edit_command(id_filter, "change", tag, value, oldvalue);
} else {
fprintf(stderr, "ERROR -mdedit change must specify either 2 or 3 additional parameters\n\n");
usage();
}
}
if(cmd == "extract_keywords") {
append_metadata_edit_command(id_filter, "extract_keywords", "keyword", " ", " ");
}
}
//printf("generated %d commands\n", _mdata_edit_commands.size());
_parameters["mode"] = "mdedit";
return true;
}
void show_mdedit_commands() {
//show commands
vector<EEDB::mdedit_t>::iterator edit_cmd;
for(edit_cmd = _mdata_edit_commands.begin(); edit_cmd != _mdata_edit_commands.end(); edit_cmd++) {
string paramXML = "<edit mode=\"" + edit_cmd->mode +"\"";
if(!edit_cmd->db_id.empty()) {
paramXML += " id=\"" + html_escape(edit_cmd->db_id) +"\"";
}
if(!edit_cmd->obj_filter.empty()) {
paramXML += " filter=\"" + html_escape(edit_cmd->obj_filter) +"\"";
}
if(!edit_cmd->tag.empty()) {
paramXML += " tag=\"" + html_escape(edit_cmd->tag) +"\"";
}
paramXML += ">";
if(edit_cmd->mode == "change") {
if(!edit_cmd->oldvalue.empty()) { paramXML += "<old>" + html_escape(edit_cmd->oldvalue) +"</old>"; }
if(!edit_cmd->newvalue.empty()) { paramXML += "<new>" + html_escape(edit_cmd->newvalue) +"</new>"; }
} else {
if(!edit_cmd->newvalue.empty()) { paramXML += html_escape(edit_cmd->newvalue); }
}
paramXML += "</edit>";
printf("%s\n", paramXML.c_str());
}
}
| 37.44244 | 254 | 0.624208 | [
"object",
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.