Wiki

Clone wiki

blaze / Logical OR


Vector/Vector Logical OR

Via the logical OR operator (i.e. operator||()) it is possible to perform an elementwise logical OR with dense vectors:

blaze::DynamicVector<bool> v1( 5UL ), v3;
blaze::DynamicVector<bool> v2( 5UL );

// ... Initializing the vectors

v3 = v1 || v2;  // Elementwise logical OR 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<unsigned int,columnVector> v1( 5UL );
blaze::DynamicVector<unsigned int,rowVector>    v2( 5UL );

v1 || v2;           // Compilation error: Cannot OR a column vector and a row vector
v1 || trans( v2 );  // OK: Logical OR of two column vectors

Matrix/Matrix Logical OR

The logical OR operator (i.e. operator||()) can also be used to perform an elementwise logical OR 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 OR 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 AND ---- Next: Shared Memory Parallelization

Updated