Lattice Hx () { Lattice H(2,cpx(.5,sqrt(3)/2)); H.bond(0,1).bond(0,1,coo(-1,0)).bond(0,1,coo(0,-1)); H.z[0]=0; H.z[1]=cpx(1,1)/cpx(3); return H; }
Lattice T2 () { Lattice T2(2,cpx(0,sqrt(3.0))); T2.bond(0,1).bond(0,0,coo(1,0)).bond(1,0,coo(1,0)).bond(1,0,coo(0,1)).bond(1,0,coo(1,1)).bond(1,1,coo(1,0)); T2.z[0]=0; T2.z[1]=cpx(.5,.5); return T2; }
Lattice Z2C () { Lattice Z2C(2); Z2C.bond(0,0,coo(1,0)).bond(0,0,coo(0,1)).bond(0,1).bond(0,1,coo(-1,0)).bond(0,1,coo(0,-1)).bond(0,1,coo(-1,-1)); Z2C.z[0]=0; Z2C.z[1]=cpx(.5,.5); return Z2C; }
Lattice K () { Lattice K(3,cpx(.5,sqrt(3)/2)); K.bond(0,1).bond(0,2).bond(1,2).bond(1,0,coo(1,0)).bond(2,0,coo(0,1)).bond(1,2,coo(1,-1)); K.z[0]=0; K.z[1]=.5; K.z[2]=cpx(0,.5); return K; }
Lattice H2 () { Lattice H2(4,cpx(0,sqrt(3.0))); H2.bond(0,1).bond(1,2).bond(2,3).bond(3,0,coo(0,1)).bond(2,1,coo(1,0)).bond(3,0,coo(1,1)); H2.z[0]=0; H2.z[1]=cpx(0,1.0/3); H2.z[2]=cpx(.5,.5); H2.z[3]=cpx(.5,5.0/6); return H2; }
Lattice SO () { Lattice SO(4); SO.bond(0,1).bond(1,2).bond(2,3).bond(3,0).bond(2,0,coo(0,1)).bond(1,3,coo(1,0)); SO.z[0]=cpx(.5,.25); SO.z[1]=cpx(.75,.5); SO.z[2]=cpx(.5,.75); SO.z[3]=cpx(.25,.5); return SO; }
void QuadTree::split () { ch = store.size(); store.push_back (std::make_unique <QuadTree> (ul, center, m)); store.push_back (std::make_unique <QuadTree> (coo(center.x,ul.y), coo(br.x,center.y), m)); store.push_back (std::make_unique <QuadTree> (coo(ul.x,center.y), coo(center.x,br.y), m)); store.push_back (std::make_unique <QuadTree> (center, br, m)); for (auto & z : pts) store[ch+index(z)] -> insert (z); std::vector<coo>().swap(pts); }
void QuadTree::paint (Image & img, coo ul, int w) { if (w==1) { img.at(ul) = (n>0) ? GREEN : BLACK; return; } if (n>m) { store[ch+0] -> paint (img, ul, w/2); store[ch+1] -> paint (img, ul+coo(w/2,0), w/2); store[ch+2] -> paint (img, ul+coo(0,w/2), w/2); store[ch+3] -> paint (img, ul+coo(w/2,w/2), w/2); return; } for (int i=0; i<w; ++i) { img.at(ul+coo(i,0)) = Color(128,0,0); img.at(ul+coo(0,i)) = Color(128,0,0); } }
Lattice C5 () { Lattice C5(5); C5.bond(1,0).bond(1,4).bond(0,2).bond(0,3).bond(0,4).bond(2,3).bond(3,4).bond(2,1,coo(1,0)).bond(2,4,coo(1,0)) .bond(3,4,coo(1,0)).bond(3,1,coo(1,1)).bond(3,0,coo(1,1)).bond(3,2,coo(0,1)).bond(3,0,coo(0,1)).bond(4,0,coo(0,1)); C5.z[0]=.25; C5.z[1]=cpx(0,.125); C5.z[2]=cpx(.75,.25); C5.z[3]=cpx(.75,.75); C5.z[4]=cpx(.25,.5); return C5; }
Lattice K2 () { Lattice K2(6,cpx(0,sqrt(3))); K2.bond(0,1).bond(0,2).bond(1,2).bond(2,3).bond(2,4).bond(3,4).bond(4,5) .bond(1,0,coo(1,0)).bond(4,3,coo(1,0)).bond(5,3,coo(1,0)).bond(5,1,coo(0,1)).bond(5,0,coo(1,1)); K2.z[0]=0; K2.z[1]=.5; K2.z[2]=cpx(.25,.25); K2.z[3]=cpx(0,.5); K2.z[4]=cpx(.5,.5); K2.z[5]=cpx(.75,.75); return K2; }
static void locationListened( JNIEnv *env, jobject obj ,jdouble longitude, jdouble latitude, jdouble altitude, jstring city ) { Q_UNUSED(env) Q_UNUSED(city) AsemanAndroidLocationListenerCore *all = getLocationListenerObject(obj); if(!all) return; QGeoCoordinate coo(latitude, longitude, altitude); QGeoPositionInfo info(coo, QDateTime::currentDateTime()); QMetaObject::invokeMethod(all, "positionUpdated", Q_ARG(QGeoPositionInfo, info)); }
Lattice G67 () { Lattice G67(3, cpx(0,sqrt(6.0/7))); G67.bond(0,1).bond(0,2).bond(1,2).bond(0,0,coo(1,0)).bond(0,0,coo(0,1)).bond(0,1,coo(-1,0)) .bond(0,1,coo(0,-1)).bond(0,1,coo(-1,-1)).bond(2,0,coo(0,1)); G67.z[0]=0; G67.z[1]=cpx(.5,.5); G67.z[2]=cpx(1.0/6,.5); return G67; }
int main() { int x = aoo() | boo() | coo() | doo() | foo() | groo() | qoo() | yoo() ; printf("test02 foo()=%d\n", x); return 0; }
Lattice SV () { Lattice SV(4); SV.bond(0,1).bond(1,2).bond(2,3).bond(3,0).bond(1,3).bond(1,0,coo(1,0)).bond(2,3,coo(1,0)) .bond(1,3,coo(1,0)).bond(0,3,coo(0,-1)).bond(1,2,coo(0,-1)).bond(2,0,coo(1,1)).bond(3,1,coo(0,1)); SV.z[0]=0; SV.z[1]=.5; SV.z[2]=cpx(.5,.5); SV.z[3]=cpx(0,.5); return SV; }
ObjectSettings BonusBlock::get_settings() { ObjectSettings result = Block::get_settings(); result.options.push_back( ObjectOption(MN_SCRIPT, _("Script"), &script)); result.options.push_back( ObjectOption(MN_INTFIELD, _("Count"), &hit_counter)); ObjectOption coo(MN_STRINGSELECT, _("Content"), &contents); coo.select.push_back(_("coin")); coo.select.push_back(_("Growth (fire flower)")); coo.select.push_back(_("Growth (ice flower)")); coo.select.push_back(_("Growth (air flower)")); coo.select.push_back(_("Growth (earth flower)")); coo.select.push_back(_("Star")); coo.select.push_back(_("Tux doll")); coo.select.push_back(_("Custom")); coo.select.push_back(_("Script")); coo.select.push_back(_("Light")); coo.select.push_back(_("Trampoline")); coo.select.push_back(_("Coin rain")); coo.select.push_back(_("Coin explosion")); result.options.push_back(coo); return result; }
Cube::Cube (int x, int y, int z) : Bitmap <Adder> (x+z,y+z), sx(x), sy(y), sz(z), data(sx*sy*sz,0) { for (int x=0; x<sz; ++x) for (int y=0; y<sz; ++y) at(coo(sx+x,sy+y)) = (x/10+y/10) % 2 ? 200 : 150; for (int x=0; x<sx; ++x) for (int y=0; y<sy; ++y) at(coo(x,y)).dim(sz); for (int x=0; x<sx; ++x) for (int z=0; z<sz; ++z) at(coo(x,z+sy)).dim(sy); for (int y=0; y<sy; ++y) for (int z=0; z<sz; ++z) at(coo(z+sx,y)).dim(sx); }
cpx Lattice::shift (int k, int l) const { const Lattice_place &m (adj[k][l]); return (*this)(m.z,m.k) - (*this)(coo(0,0),k); }
int test() { namespace ublas = ::boost::numeric::ublas ; namespace mumps = ::boost::numeric::bindings::mumps ; int const n = 10 ; typedef ublas::coordinate_matrix<T, ublas::column_major, 1, ublas::unbounded_array<int> > coo_type ; coo_type coo( n, n, n + 6 ) ; for (int i=0; i<n; ++i) coo(i,i) = i+1.0 ; coo(2,3) = T(1.0) ; coo(2,4) = T(1.0) ; coo(5,6) = T(-1.0) ; coo(2,6) = T(1.0) ; coo(9,0) = T(1.0) ; coo(2,7) = T(-1.0) ; coo.sort() ; std::cout << "matrix " << coo << std::endl ; ublas::vector<T> v( 10 ) ; ublas::vector<T> w( 10 ) ; std::fill( w.begin(), w.end(), 1.0 ) ; for (int i=1; i<n; ++i) { w(i) += w(i-1) ; } for (int i=0; i<n; ++i) { v[i] = T(coo(i,i)) * w[i] ; } v[2] += T(coo(2,3)) * w[3] ; v[2] += T(coo(2,4)) * w[4] ; v[5] += T(coo(5,6)) * w[6] ; v[2] += T(coo(2,6)) * w[6] ; v[9] += T(coo(9,0)) * w[0] ; v[2] += T(coo(2,7)) * w[7] ; std::cout << "rhs : " << v << std::endl ; mumps::mumps< coo_type > mumps_coo ; mumps_coo.icntl[2]=mumps_coo.icntl[3] = 0 ; // Analysis mumps_coo.job = 1 ; matrix_integer_data( mumps_coo, coo ) ; driver( mumps_coo ) ; // Factorization mumps_coo.job = 2 ; matrix_value_data( mumps_coo, coo ) ; driver( mumps_coo ) ; // Solve mumps_coo.job = 3 ; rhs_sol_value_data( mumps_coo, v ) ; driver( mumps_coo ) ; std::cout << "w : " << w << std::endl ; std::cout << "v : " << v << std::endl ; if ( norm_2( v - w ) > 1.e-10 * norm_2( v ) ) return 1 ; return 0 ; }
Lattice Z2() { Lattice Z2(2); Z2.bond(0,0,coo(1,0)).bond(0,0,coo(0,1)); Z2.z[0]=0; return Z2; }
Lattice T() { Lattice T(1,cpx(.5,sqrt(3)/2)); T.bond(0,0,coo(1,0)).bond(0,0,coo(0,1)).bond(0,0,coo(-1,1)); T.z[0]=0; return T; }