Sort complex numbers into complex conjugate pairs
B = cplxpair(A)
B = cplxpair(A,tol)
B = cplxpair(A,,dim)
B = cplxpair(A,tol,dim)
The conjugate pairs are ordered by increasing real part. Within a pair, the element with negative imaginary part comes first. The purely real values are returned following all the complex pairs. The complex conjugate pairs are forced to be exact complex conjugates. A default tolerance of 100*eps relative to abs(A(i)) determines which numbers are real and which elements are paired complex conjugates.
If A is a vector, cplxpair(A) returns A with complex conjugate pairs grouped together.
If A is a matrix, cplxpair(A) returns A with its columns sorted and complex conjugates paired.
If A is a multidimensional array, cplxpair(A) treats the values along the first non-singleton dimension as vectors, returning an array of sorted elements.