[
https://issues.apache.org/jira/browse/MATH-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13667044#comment-13667044
]
Gilles commented on MATH-980:
-----------------------------
bq. [...] which could be avoided if the Vector classes would implement [...]
This much, I knew. My question was about how often one needs to cluster 1D, 2D
or 3D data, in real applications. My impression is that, usually, a "point" is
a higher dimension vector.
I.e. Making it slightly easier to write example programs is not enough to
warrant this coupling (IMHO).
I think that for the sake of maintainance, we must avoid adding code (à la
"just in case someone, some day, would need it") that is not directly used
within CM.
If some application (or example code) needs to cluster many of those primarily
spatial geometry objects, it could implement what you propose in its own
subclass e.g.
{noformat}
public class ClusterableVector3D extends Vector3D
implements Clusterable {
// ...
public double[] getPoint() {
return toArray();
}
}
{noformat}
I.e. the user is making the coupling (and the example code shows how to combine
different parts of CM).
bq. [...] (btw. you objected the DoublePoint class initially if I remember
correctly).
Probably, and I still don't like it, I think, because the "double[]" is wrapped
(referenced) inside "DoublePoint" which makes it prone to wrong usage. The same
danger exists with plain "double[]" but Java programmers should be aware that
they must make defensive copies if necessary.
In class "DoublePoint", the default is to reference, whereas I think that in
most (all?) other cases in CM, it is to copy.
> Let the VectorXD classes in the geometry package implement Clusterable
> ----------------------------------------------------------------------
>
> Key: MATH-980
> URL: https://issues.apache.org/jira/browse/MATH-980
> Project: Commons Math
> Issue Type: Improvement
> Reporter: Thomas Neidhart
> Priority: Minor
>
> It would be quite convenient if the Vector1D, Vector2D and Vector3D classes
> could be used directly by the clustering algorithms. The updated Clusterable
> interface now only requires one method:
> * double[] getPoint()
> which is already supported by these classes: toArray()
> We could let them implement the Clusterable interface by simply delegating
> the call to getPoint() to toArray().
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira