Beispiel #1
0
NT2_TEST_CASE_TPL( complexify3, BOOST_SIMD_REAL_TYPES )
{
  typedef typename nt2::meta::as_dry<T>::type dT;
  nt2::table<dT> a0 = nt2::ones(3, 3, nt2::meta::as_<dT>());
  //  NT2_DISPLAY(a0);
  NT2_DISPLAY(complexify(a0));
  NT2_DISPLAY(complexify(complexify(a0)));
  NT2_TEST_EQUAL(nt2::real(a0), nt2::real(complexify(a0)));
}
Beispiel #2
0
NT2_TEST_CASE_TPL( complexify2, BOOST_SIMD_REAL_TYPES )
{
  typedef typename nt2::meta::as_complex<T>::type cT;
  nt2::table<T>   a00 = nt2::ones(3, 3, nt2::meta::as_<T>());
  NT2_DISPLAY(a00);
  nt2::table<cT> a0 = cT(0, 1)*a00;

  for(int i=1; i < 9; i++)
  {
    std::cout << a0(i) << std::endl;
  }
  NT2_DISPLAY(complexify(a0));
  NT2_DISPLAY(complexify(complexify(a0)));
  NT2_TEST_EQUAL(complexify(a0), nt2::complexify(complexify(a0)));
}
Beispiel #3
0
NT2_TEST_CASE_TPL( complexify1, BOOST_SIMD_REAL_TYPES )
{
  nt2::table<T> a0 = nt2::_(T(1), T(3));
  NT2_DISPLAY(complexify(a0));
  NT2_DISPLAY(complexify(complexify(a0)));
  NT2_DISPLAY(complexify(nt2::_(T(1), T(3))));
  typedef typename nt2::meta::as_real<T>::type                          real_type;


  NT2_DISPLAY(nt2::complexify(nt2::_(real_type( 11)
                                     , real_type(-1)
                                     , real_type(0)
                                )));
  a0 = nt2::ones(3, 3, nt2::meta::as_<T>());
  NT2_TEST_EQUAL(a0, nt2::real(complexify(a0)));

}
Beispiel #4
0
void Mesh::random_complexify()
{
    int random_group_index = rand_lim(groups.size() - 1);
    int random_face_index = rand_lim(groups[random_group_index]->getFaces().size() - 1);

    face_selected.group_pos = random_group_index;
    face_selected.face_pos = random_face_index;
    face_selected.face = groups[random_group_index]->getFaceAt(random_face_index);
    selection = SELECTION_FACE;

    complexify();
}
Beispiel #5
0
static void complexify_tests(void)
{
    complexify_state_t *s;
    complexf_t cc;
    int16_t amp;
    int i;
    SNDFILE *outhandle;
    int outframes;
    int16_t out[40000];
    awgn_state_t noise1;

    if ((outhandle = sf_open_telephony_write(OUT_FILE_COMPLEXIFY, 2)) == NULL)
    {
        fprintf(stderr, "    Cannot create audio file '%s'\n", OUT_FILE_COMPLEXIFY);
        exit(2);
    }
    awgn_init_dbm0(&noise1, 1234567, -10.0f);
    s = complexify_init();
    for (i = 0;  i < 20000;  i++)
    {
        amp = awgn(&noise1);
        cc = complexify(s, amp);
        out[2*i] = cc.re;
        out[2*i + 1] = cc.im;
    }
    awgn_release(&noise1);
    complexify_free(s);
    outframes = sf_writef_short(outhandle, out, 20000);
    if (outframes != 20000)
    {
        fprintf(stderr, "    Error writing audio file\n");
        exit(2);
    }
    if (sf_close_telephony(outhandle))
    {
        fprintf(stderr, "    Cannot close audio file '%s'\n", OUT_FILE_COMPLEXIFY);
        exit(2);
    }
}
Beispiel #6
0
void Mesh::triangulate()
{
    stack<Mesh::FaceSel> not_a_triangle;

    for (unsigned int i = 0; i < groups.size(); i++)
    {
        for (unsigned int j = 0; j < groups[i]->getFaces().size(); j++)
        {
            Face* curr_face = groups[i]->getFaceAt(j);

            if (curr_face->getVerts().size() == 3)
                continue;

            Mesh::FaceSel sel;

            sel.group_pos = i;
            sel.face_pos = j;
            sel.face = curr_face;

            not_a_triangle.push(sel); 
        }
    }

    while (!not_a_triangle.empty())
    {
        Mesh::FaceSel nat = not_a_triangle.top();

        face_selected.group_pos = nat.group_pos;
        face_selected.face_pos = nat.face_pos;
        face_selected.face = nat.face;
        selection = SELECTION_FACE;

        not_a_triangle.pop();

        complexify();
    }
}