コード例 #1
0
ファイル: numbersgen.cpp プロジェクト: ah744/ScaffCC_RKQC
void numbersGenerator<de>::add_number( int a, int b , int c, int d, int ipxx )
{
    int m1 = ( a == 0 ? 1 : 2 );
    int m2 = ( b == 0 ? 1 : 2 );
    int m3 = ( c == 0 ? 1 : 2 );
    int m4 = ( d == 0 ? 1 : 2 );

    static const int s[2] = {1,-1};

    for ( int i1 = 0; i1 < m1 ; ++i1 )
        for ( int i2 = 0; i2 < m2 ; ++i2 )
            for ( int i3 = 0; i3 < m3 ; ++i3 )
                for ( int i4 = 0; i4 < m4 ; ++i4 )
                {
                    ri x( a * s[i1], b * s[i2], c * s[i3], d * s[i4]);
                    int ipQxx = x.ipQxx();

                    static const double SQRT2 =
                            1.4142135623730950488016887242096980785696718753769;

                    ri abs2x( ipxx, ipQxx, 0, -ipQxx );
                    auto res = abs2x.toComplex( 2 * denom_exp );

                    if( abs( res ) <= 1.0000001 )
                    {
                        if( sdes[ ipxx ][ ipQxx + ipQ_offset ] == sde_not_computed )
                            sdes[ ipxx ][ ipQxx + ipQ_offset ]
                                    = sde( 2 * denom_exp,  abs2x.gde() );
                        vals[ ipxx ][ ipQxx + ipQ_offset ].push_back( x );
                        m_total_numbers++;
                    }
                }
}
コード例 #2
0
ファイル: main.cpp プロジェクト: sputnikas/programs
void TestSDE(double *y0, int n, double t0, double tmax, int N, const char *ch){
    int k =10;
    double y[n*N*k], t = t0, step = (tmax-t0)/(N-1);
    sde(y, y0, t0, tmax, n, N, r_p, EULER);
    sde(&y[n*N*1], y0, t0, tmax, n, N, r_p, RUNGESA);
    sde(&y[n*N*2], y0, t0, tmax, n, N, r_p, RUNGESB);
    sde(&y[n*N*3], y0, t0, tmax, n, N, r_p, RUNGESC);
    sde(&y[n*N*4], y0, t0, tmax, n, N, r_p, RUNGET);
    sde(&y[n*N*5], y0, t0, tmax, n, N, r_p, RUNGEFA);
    sde(&y[n*N*6], y0, t0, tmax, n, N, r_p, RUNGEFB);
    sde(&y[n*N*7], y0, t0, tmax, n, N, r_p, ADAMSS);
    sde(&y[n*N*8], y0, t0, tmax, n, N, r_p, ADAMST);
    sde(&y[n*N*9], y0, t0, tmax, n, N, r_p, ADAMSF);
    FILE *f;
    f = fopen(ch, "w");
    fprintf(f, "# ");
    for (int i = 0; i<k; i++){
        fprintf(f, "%s(", name[i]);
        for (int p = 0; p<n; p++){
            fprintf(f, "y%d, ", p);
        }
        fprintf(f, ") ");
    }
    fprintf(f, "\n");
    for (int i = 0; i<N; i++){
        fprintf(f, "%f", t);
        for (int p = 0; p<k; p++){
            for (int j = 0; j<n; j++){
                fprintf(f, " %f", y[N*n*p+i*n+j]);
            }
        }
        t+=step;
        fprintf(f, "\n");
    }
    fclose(f);
}
コード例 #3
0
ファイル: sde.c プロジェクト: csgillespie/hybrid-pmcmc
void SDE(st_part_at* prop_part, double tstep)
{
  if(tstep < 0.0001) return;
  sde(prop_part->params, tstep, prop_part->sps);
}