bool is_symmetric(const MATRIX &n) { unsigned int x, y; for (y = 0; y < n.GetHeight(); ++y) { for (x = 0; x < n.GetWidth(); ++x) { if (*n.Get(y, x) != *n.Get(x, y)) { return false; } } } return true; }
void MATRIX::SelectUniquelyFrom(int maxVal) { MATRIX *chosen = new MATRIX(1,maxVal,0); int j; int chosenVal; for (j=0;j<width;j++) { chosenVal = RandInt(0,maxVal-1); while ( chosen->Get(0,chosenVal) ) chosenVal = RandInt(0,maxVal-1); Set(0,j,chosenVal); chosen->Set(0,chosenVal,1); } delete chosen; chosen = NULL; }