Statistics::Unique Function

void Unique(TMtxVec *Src, TVec *Dst, TVecInt *Counts = null);

Finds the unique elements in vector/matrix.

#NameTypeDescription
1SrcTMtxVec *Defines data unique elements search.
2DstTVec *Returns unique elements. Size and TMtxVec::Complex properties of Dst are adjusted automatically.
3Counts = nullTVecInt *If specifed, stores the count of each unique element in dataset.
Remarks:

Finds and sorts the unique elements in Src vector/matrix array. Sorted values are returned in Dst vector. An exception is raised if Src is Complex. Length and Complex properties of Dst vector are adjusted automatically.

Examples
#include "MtxExpr.h"
#include "Units.Statistics.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::Statistics;

void Example()
{
    Matrix m1(0,0);
    Vector uvec(0);
    m1.SetIt(4,3,false, DewArray<double>{ 1,2,3,
        4,2,1,
        3,2,3,
        3,3,1});
    Unique(m1,uvec,nullptr);
    // uvec elements are [1,2,3,4]
}
See Also: Statistics::Ranks, Statistics::TiedRanks
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler