0

I have a large sparse binary matrix, and I have to apply the Gauss method , so I need to do a lot of logical (XOR) operations on the rows.

In order to save space, I thought to use the bitset structure, but it has to be given a fixed dimension even in the prototype, whereas I wanted to include it in a class like this

class BinMat{
public:
    BinMat(int n,int m){
       ..
    }
    /* ..
    */
private:
    int row;
    int col;
    std::bitset** a;
};

is there a workaround, or similar structure in c++ that let me do such operations efficiently?

Exodd
  • 221
  • 1
  • 9
  • `std::vector` may be, but not very convenient with Boolean operations on groups of bits. The probably best way to go is to roll your own dynamic bitset, or use boosts. – πάντα ῥεῖ Oct 10 '15 at 10:31
  • `std::bitset` is not a sparse representation, so it does the opposite of saving space – harold Oct 10 '15 at 10:31
  • @harold forget the "sparse" property of the matrix, Gauss will fill it up anyway – Exodd Oct 10 '15 at 10:34

0 Answers0