Example #1
0
/**
 * Asks the user for matrix input.
 * @return The IntMatrix object as specified in the user input.
 */
IntMatrix getMatrix()
{
	size_t rows, cols;
	cout << "number of rows:";
	cin >> rows;
	cout << "number of columns:";
	cin >> cols;
	cout << "Now insert the values of the matrix, row by row.\n"
		 << "After each cell add the char '" << INPUT_SEPARATOR << "' "
         <<  "(including after the last cell of a row).\n"
		 <<  "Each row should be in a separate line." << endl;
	IntMatrix inputMat = IntMatrix(rows, cols);
	cin >> inputMat;
	return inputMat;
}
Example #2
0
int fplll_lll(fmpz_mat_t A)
{
  IntMatrix b;
  int status;
  double delta = LLL_DEF_DELTA, eta = LLL_DEF_ETA;

  b = IntMatrix(A->r, A->c);
  flint_to_fplll(b, A);

  status = lllReduction(b, delta, eta, LM_PROVED, FT_DEFAULT, 0, 0);

  fplll_to_flint(A, b);
  b.clear();

  if (status != RED_SUCCESS) {
    cerr << "Failure: " << getRedStatusStr(status) << endl;
  }

  return status;
}
Example #3
0
int fplll_bkz(fmpz_mat_t A, int bs)
{
  BKZParam param;
  IntMatrix b;
  int status;

  param.blockSize = bs;
  b = IntMatrix(A->r, A->c);
  flint_to_fplll(b, A);


  status = bkzReduction(&b, NULL, param, FT_DEFAULT);

  fplll_to_flint(A, b);
  b.clear();

  if (status != RED_SUCCESS) {
    cerr << "Failure: " << getRedStatusStr(status) << endl;
  }

  return status;
}
Example #4
0
//@+node:gcross.20101224191604.2770: ** Functions
//@+node:gcross.20110114154616.2017: *3* channelMatrix
IntMatrix channelMatrix(Space& space, const BoolMatrix& matrix) {
    BoolVarArgs vars = matrix.get_array();
    IntVarArgs vars_as_ints(space,vars.size(),0,1);
    BOOST_FOREACH(const unsigned int i, irange(0u,(unsigned int)vars.size())) { channel(space,vars[i],vars_as_ints[i]); }
    return IntMatrix(vars_as_ints,matrix.width(),matrix.height());
}
Example #5
0
IntTensor::IntTensor(int Width, int Height, int Depth)
{
	for(int k=0; k<Depth; k++)
		push_back(IntMatrix(Width, Height, 0));
}