# Wiki

Clone wiki# blaze / Logical AND

## Vector/Vector Logical AND

Via the logical AND operator (i.e. `operator&&()`

) it is possible to compute an elementwise logical AND with dense vectors:

```
blaze::DynamicVector<bool> v1( 5UL ), v3;
blaze::DynamicVector<bool> v2( 5UL );
// ... Initializing the vectors
v3 = v1 && v2; // Elementwise logical AND of two dense column vectors
```

Note that it is necessary that both operands have exactly the same dimensions. Violating this precondition results in an exception. Also note that it is only possible to use vectors with the same transpose flag:

```
using blaze::columnVector;
using blaze::rowVector;
blaze::DynamicVector<bool,columnVector> v1( 5UL );
blaze::DynamicVector<bool,rowVector> v2( 5UL );
v1 && v2; // Compilation error: Cannot AND a column vector and a row vector
v1 && trans( v2 ); // OK: Logical AND of two column vectors
```

## Matrix/Matrix Logical AND

The logical AND operator (i.e. `operator&&()`

) can also be used to compute an elementwise logical AND with dense matrices:

```
using blaze::rowMajor;
using blaze::columnMajor;
blaze::DynamicMatrix<bool,columnMajor> M1( 7UL, 3UL );
blaze::DynamicMatrix<bool,rowMajor> M2( 7UL, 3UL ), M3;
// ... Initializing the matrices
M3 = M1 && M2; // Elementwise logical AND of two dense matrices
```

Note that it is necessary that both operands have exactly the same dimensions. Violating this precondition results in an exception. It is possible to use any combination of row-major and column-major matrices. Note however that in favor of performance using two matrices with the same storage order is favorable.

Previous: Logical NOT ---- Next: Logical OR

Updated