The C++ interface for setunion. More...

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

Detailed Description

The C++ interface for setunion.

Creates a union of two sets

Function Documentation

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

Union 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); // -2 -1 0 1 2 3 4
Parameters
[in]A
[in]B
Returns
union of A and B
void af::setunion ( array &  U,
array &  IA,
array &  IB,
const array &  A,
const array &  B 
)

Union 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 u, idxa, idxb;
setunion(u, idxa, idxb, a, b);
print(u); // -2 -1 0 1 2 3 4
print(idxa); // 0 1 2 3 4
print(idxb); // 0 1
Parameters
[out]Uvalues found in either A or B
[out]IAindices of values present in A
[out]IBindices of values present in B but not in A
[in]A
[in]B