Consider using a matrix uchar_mat
which is a typdef for Mat<unsigned char>
, it should consume the same amount of memory as a matrix of boolean values.
The Armadillo documentation of version 7.8 states that a matrix Mat<type>
, can be of the following types:
float
, double
, std::complex<float>
, std::complex<double>
, short
, int
, long
, and unsigned
versions of short
, int
, and long
. The code on GitHub however contains typedef Mat <unsigned char> uchar_mat;
in the file include/armadillo_bits/typedef_mat.hpp so you should also be able to use uchar_mat
.
You will not save any memory by creating a matrix of bool
values compared to a matrix of unsigned char
values (a bool
type consumes 8 bits). This is because in C++ every data type must be addressable; it must be at least 1 byte long so that it is possible to create a pointer pointing to it.