The C++ interface for setintersect. More...

array setintersect (const array &A, const array &B)
 Intersection of two vectors. More...
 
void setintersect (array &U, array &IA, array &IB, const array &A, const array &B)
 Intersection of two vectors and their indices. More...
 

Detailed Description

The C++ interface for setintersect.

Returns the intersect of two sets.

Function Documentation

array af::setintersect ( const array &  A,
const array &  B 
)

Intersection of two vectors.

array a = array(seq(5));
array b = array(seq(5))-2*constant(1,5);
print(a); // 0 1 2 3 4
print(b); // -2 -1 0 1 2
array c = setunion(a,b);
print(c); // 0 1 2
Parameters
[in]A
[in]B
Returns
values found in both vectors
void af::setintersect ( array &  U,
array &  IA,
array &  IB,
const array &  A,
const array &  B 
)

Intersection of two vectors and their indices.

array a = array(seq(5));
array b = array(seq(5))-2*constant(1,5);
print(a); // 0 1 2 3 4
print(b); // -2 -1 0 1 2
array i, idxa, idxb;
setintersect(i, idxa, idxb, a, b);
print(i); // 0 1 2
print(idxa); // 0 1 2
print(idxb); // 2 3 4
Parameters
[out]Uvalues found in both A and B
[out]IAThe indices of values in A present in B
[out]IBThe indices of values in B present in A
[in]A
[in]B