void
  fastnc_detector<A>::new_particles(F& feature, PS& pset, const cpu&)
  {
    SCOPE_PROF(fastnc_new_particles_detector);
    memset(new_points_, 0);
    typename PS::kernel_type pset_ = pset;
    mt_apply2d(sizeof(i_float1), saliency_.domain() - border(8),
               [this, &feature, &pset_] (i_int2 p)
               {
                 if (pset_.has(p)) return;
                 if (saliency_(p) == 0) return;

                 for (int i = 0; i < 8; i++)
                 {
                   i_int2 n(p + i_int2(c8_h[i]));
                   if (saliency_(p) < saliency_(n) || pset_.has(n))
                     return;
                 }

                 new_points_(p) = p;
               }, cpu());

    st_apply2d(sizeof(i_float1), saliency_.domain() - border(8),
               [this, &feature, &pset] (i_int2 p)
               {
                 if (new_points_(p) != i_short2(0,0)) pset.add(p, feature(p));
               }, cpu());

  }
Example #2
0
int main()
        {
                Person person[5]={
                        {"aa",19},{"bb",20},{"cc",23},{"dd",21},{"ee",25}
                };
                PS ps;
                for(int i=0;i<5;++i){
                        ps.add(person+i);
                }
                while(1){
                        ps->show();
                        //ps.operator->()->show();
                        if(!(++ps))break;
                }
                return 0;
        }
  void
  dense_detector::new_particles(const F& feature, PS& pset_)
  {
    SCOPE_PROF(mdfl_new_particles_detector);
    typename PS::kernel_type pset = pset_;
    st_apply2d(sizeof(i_float1), feature.domain() - border(0),
               [this, &feature, &pset, &pset_] (i_int2 p)
               {
                 if (!pset.has(p))
									 pset_.add(p, feature(p));
               }, cpu());
  }
Example #4
0
    static sgx_status_t make_target_info(
        const PS& ps, const sgx_report_t& rpt, sgx_target_info_t& ti)
    {
        if (!ps.is_valid())
            return SGX_ERROR_INVALID_PARAMETER;

        memset_s(&ti, sizeof(ti), 0, sizeof(sgx_target_info_t));
        auto *d = reinterpret_cast<uint8_t*>(&ti);

        // Spectre
        sgx_lfence();

        for (int i = 1, to = 0; i <= ps.ts_count(); ++i)
        {
            int size = 1 << (ps.target_spec[i] & 0xf);
            to += size - 1;
            to &= -size;
            if (to + size > int(sizeof(ti)))
                return SGX_ERROR_UNEXPECTED;

            int from = int16_t(ps.target_spec[i]) >> 4;
            if (from >= 0)
            {
                if (from + size > int(sizeof(rpt)))
                    return SGX_ERROR_UNEXPECTED;
                memcpy(d + to, reinterpret_cast<const uint8_t*>(&rpt) + from, size);
            } else switch (from)
            {
                case -1:
                    break;
                default:
                    return SGX_ERROR_UNEXPECTED;
            }

            to += size;
        }

        return SGX_SUCCESS;
    }
Example #5
0
int main()
{
    double s8 = 1.0;
    double h = 0.7;
    double Om = 0.30;
    double ns = 1.0;
    
    double pc = 3.0 * 100.0 * 100.0 * h * h / (8.0 * M_PI * G);
    double p = Om * pc;
    
    //std::cerr << pc << std::endl;
    //std::cerr << p << std::endl;
    
    TF* tf = new TF_BBKS(Om, h);
    GF* gf = new GF_LCDM();
    
    PS* ps = new PS_LSS(tf, gf, h, s8, ns);
    
    MF* mf = new MF_PS(ps);
    
    double lnm_min = log(1.0e1 / p);
    double lnm_max = log(1.0e20 / p);
    
    for(double lnm = lnm_min; lnm < lnm_max; lnm += log(1.1))
    {
        double m = exp(lnm) * p;
        double r = exp(1.0/3.0 * (lnm + log(3.0 / (4.0 * M_PI))));
        double k = 1.0/r;
        double pk = ps->p(k, 0.0);
        double var = ps->sigma2_tophat(r, 0.0);
        double dndlnm = mf->dn_dlnm(lnm, 0.0);
        
        std::cout << m << " " << r << " " << k << " " << pk << " " << var << " " << exp(lnm) << " " << dndlnm << std::endl;
    }
    
    return 0;
}