You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2013/01/13 17:24:06 UTC
svn commit: r1432652 -
/commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
Author: psteitz
Date: Sun Jan 13 16:24:06 2013
New Revision: 1432652
URL: http://svn.apache.org/viewvc?rev=1432652&view=rev
Log:
Fixed error (reference to deleted class); added factory method example.
Modified:
commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
Modified: commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml?rev=1432652&r1=1432651&r2=1432652&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml Sun Jan 13 16:24:06 2013
@@ -51,15 +51,17 @@
<p>
Example:
<source>
-// Create a real matrix with two rows and three columns
+// Create a real matrix with two rows and three columns, using a factory
+// method that selects the implementation class for us.
double[][] matrixData = { {1d,2d,3d}, {2d,5d,3d}};
-RealMatrix m = new Array2DRowRealMatrix(matrixData);
+RealMatrix m = MatrixUtils.createRealMatrix(matrixData);
-// One more with three rows, two columns
+// One more with three rows, two columns, this time instantiating the
+// RealMatrix implementation class directly.
double[][] matrixData2 = { {1d,2d}, {2d,5d}, {1d, 7d}};
RealMatrix n = new Array2DRowRealMatrix(matrixData2);
-// Note: The constructor copies the input double[][] array.
+// Note: The constructor copies the input double[][] array in both cases.
// Now multiply m by n
RealMatrix p = m.multiply(n);
@@ -67,7 +69,7 @@ System.out.println(p.getRowDimension());
System.out.println(p.getColumnDimension()); // 2
// Invert p, using LU decomposition
-RealMatrix pInverse = new LUDecompositionImpl(p).getSolver().getInverse();
+RealMatrix pInverse = new LUDecomposition(p).getSolver().getInverse();
</source>
</p>
<p>