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

This manual is preliminary and incomplete.
While our Core implementation implements all functions given in the standard we are still working on completing this documentation.

Please refer to the VSIPL standard for a complete function reference of the Core profile until we have completed work on this documentation.

4.5.2 vsip_vand_p - Boolean Vector Logical AND

void vsip_vand_bl(const vsip_vview_bl *a, const vsip_vview_bl *b, const vsip_vview_bl *r);
Description

This function performs a logical AND 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 AND:

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_vand_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);