예제 #1
0
파일: Eschreyer.cpp 프로젝트: BertiniM2/M2
int GBKernelComputation::calc()
{
  // First find the skeleton
  for (int i = 0; i < gb.length(); i++) new_pairs(i);

  // Debug code
  GBMatrix *mm = new GBMatrix(G);
  for (int p = 0; p < syzygies.length(); p++)
    mm->append(GR->gbvector_copy(syzygies[p]));
  buffer o;
  Matrix *m = mm->to_matrix();
  if (M2_gbTrace >= 5)
    {
      o << "skeleton = " << newline;
      m->text_out(o);
      emit(o.str());
    }

  // Sort the skeleton now?

  // Now reduce each one of these elements
  for (int j = 0; j < syzygies.length(); j++)
    {
      gbvector *v = s_pair(syzygies[j]);
      reduce(v, syzygies[j]);
    }
  return COMP_DONE;
}
예제 #2
0
int main(int argc, char * argv[]){

  pair_t ** pairs = new_pairs(); //create a new pair array

  add_pair(pairs, 2, 10); //assign a new pair
  add_pair(pairs, 0, 3); //assign a new pair
  add_pair(pairs, 13, 7);

  print_pairs(pairs); //print pairs

  rm_pair(pairs, 1); //remove pair at index 1

  printf("------------\n");
  print_pairs(pairs); //print pairs (again)

  delete_pairs(pairs); //delete all pairs, no memleaks!

  return 0;
}