commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim van der Linde <...@kimvdlinde.com>
Subject Re: [math] API changes for RC2
Date Mon, 27 Sep 2004 18:21:21 GMT


Phil Steitz wrote:

> "Spooky" -- delightful word choice ;-)  The getDataRef  method is
> there to limit copy operations and to support hacking the underlying
> array -- evil, hazardous, breaks encapsulation -- altogether
> "spooky"; but users may want this in some cases.

I do:

Matrix diffMatrix = new Matrix(cases, variables);
double diffArray[][] = diffMatrix.getDataRef();
double baseArray[][] = baseMatrix.getDataRef();
//verbose(true, "Robust baseMatrix\n"+baseMatrix.toSquareString());
for (int x = 0; x < cases; x++)
{
   for (int y = 0; y < variables; y++)
   {
     diffArray[x][y] = baseArray[x][y] - robustMeans[y];
   }
}
//verbose(true, "Robust diffArray\n"+diffMatrix.toSquareString());
robustDist = Distances.mahalanobis(diffMatrix, robustCovar);
det = Math.sqrt(robustCovar.getDeterminant());

Just an example.......

Kim

-- 
http://www.kimvdlinde.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message