Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

4.7.3 vsip_vor_p - Boolean Vector Logical OR

void vsip_vor_bl(const vsip_vview_bl *a, const vsip_vview_bl *b, const vsip_vview_bl *r); 
void vsip_vor_i(const vsip_vview_i *a, const vsip_vview_i *b, const vsip_vview_i *r);
Description

This function performs a logical OR operation between corresponding elements of two boolean vectors a and b, storing the result in the output vector r. The operation performs element-wise logical OR:

ri= ai∨bi

for all i from 0 to n-1, where n is the length of the vectors.

Parameters
Example

vsip_vview_bl *a, *b, *r; 
vsip_length n = 10; 
 
// Create boolean vectors 
a = vsip_vcreate_bl(n, VSIP_MEM_NONE); 
b = vsip_vcreate_bl(n, VSIP_MEM_NONE); 
r = vsip_vcreate_bl(n, VSIP_MEM_NONE); 
 
// Initialize vectors with some boolean values 
// For example, set alternating true/false patterns 
for (vsip_length i = 0; i < n; i++) { 
    vsip_vput_bl(a, i, (i % 2) == 0);  // true for even indices 
    vsip_vput_bl(b, i, (i % 3) == 0);  // true for indices divisible by 3 
} 
 
// Perform logical AND operation 
vsip_vor_bl(a, b, r); 
 
// The result vector r will now contain true only where both 
// a and b had true values (indices 0, 6) 
 
// Clean up 
vsip_valldestroy_bl(a); 
vsip_valldestroy_bl(b); 
vsip_valldestroy_bl(r);