Beispiel #1
0
shared_ptr<RandomAdjMatGen::AdjMatT> copyAndPermute(shared_ptr<RandomAdjMatGen::AdjMatT> org_ptr) {
    L("Generating random permutation...");
    RandomAdjMatGen::AdjMatT& org = *org_ptr;
    int n = org.size1();

    std::vector<int> idxs;
    for(int i=0; i<n; i++)
        idxs.push_back(i);

    int r = (int) pow(2,drand48()*n);
    std::vector<int>::iterator start=idxs.begin(),end=idxs.end();
    random_shuffle (idxs.begin(), idxs.end());

    cout << "Random Permutation: ";
    for(int i=0; i<n; i++) {
        cout << idxs[i]<<" ";
        idxmap[idxs[i]] = i;
    }
    cout << endl;

    // create new matrix
    shared_ptr<RandomAdjMatGen::AdjMatT> ret_ptr(new RandomAdjMatGen::AdjMatT(org.size1(),org.size2()));
    RandomAdjMatGen::AdjMatT& ret = *ret_ptr;


    // fill with values
    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            ret(i,j) = org(idxmap[i],idxmap[j]);

    return ret_ptr;
}
  bufobj_ptr_t buf_obj_t::create_bo
      (
          const GLvoid* sp, // src_ptr
          const GLenum &st, // src_type
          const GLuint &sc, // src_comp
          const GLenum &t, // target
          const GLuint &siz, // size
          const GLuint &str //stride
          )
  {

    bufobj_ptr_t ret_ptr(new buf_obj_t(sp,st,sc,t,siz,str ));

    return ret_ptr;

  }
  bufobj_ptr_t buf_obj_t::create_bo()
  {
    bufobj_ptr_t ret_ptr(new buf_obj_t());

    return ret_ptr;
  }
Beispiel #4
0
void access_field_in_ife_branch() {
  int z = 1 ? (ret_ptr(4))->field : 0;
}
Beispiel #5
0
void call_ife_then_access_field() {
  int z = (ret_ptr(1 ? 2 : 3))->field;
}