Example #1
0
BooleanMatrix BooleanMatrix::operator|(const BooleanMatrix & bm) {
    assert(row == bm.row);
    assert(columns == bm.columns);
    BooleanMatrix temp(row, columns);
    for (int i = 1; i <= row; i++) {
        for (int j = 1; j <= columns; j++) {
            temp.matrix[ELEMENT_POS(i, j)] =
            matrix[ELEMENT_POS(i, j)] | bm.matrix[ELEMENT_POS(i, j)];
        }
    }
    return temp;
}
Example #2
0
bool BooleanMatrix::replace(matrix_element_type e, int r, int c) {
    if (r <= row && c <= columns && r > 0 && columns > 0) {
        matrix[ELEMENT_POS(r, c)] = e;
        return true;
    }
    return false;
}
Example #3
0
 void display() const {
     for (int i = 1; i <= row; i++) {
         for (int j = 1; j <= columns; j++) {
             std::cout << matirx[ELEMENT_POS(i, j)] << " ";
         }
         std::cout << std::endl;
     }
 }
Example #4
0
BooleanMatrix BooleanMatrix::transpose() const {
    BooleanMatrix t(columns, row);
    for (int i = 1; i <= row; i++) {
        for (int j = 1; j <= columns; j++) {
            t.matrix[(j - 1) * t.columns + i - 1] = matrix[ELEMENT_POS(i, j)];
        }
    }
    return t;
}