示例#1
0
ColumnVector Cluster::distance(ColumnVector point)
{
    if (point.dim1() != this->mu->dim1())
    {
        TRACE << "size mismatch: point:" << point.dim1() << "muDim:" << mu->dim1() << endl;
        return point;
    }

    ColumnVector retColumn = point - *(this->mu);
    for (int i = 0; i < point.dim1(); i++)
    {
        retColumn(i) = fabs(retColumn(i));
    }
    return retColumn;
}
示例#2
0
bool Cluster::isInCluster(ColumnVector &tr, ColumnVector &state)
{
    ColumnVector dist = distance(state);
    // TRACE << "dist: " << dist.transpose() << " tr: " << tr.transpose() << endl;
    for (int i = 0; i < tr.dim1(); i++)
    {
        if (dist(i) > tr(i))
        {
            return false;
        }
    }
    return true;
}