You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by gs...@apache.org on 2009/11/23 17:35:07 UTC
svn commit: r883399 [4/7] - in /lucene/mahout/trunk/matrix: ./
src/main/java/org/apache/mahout/jet/math/
src/main/java/org/apache/mahout/jet/random/
src/main/java/org/apache/mahout/jet/random/engine/
src/main/java/org/apache/mahout/jet/random/sampling/...
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3D.java Mon Nov 23 16:34:55 2009
@@ -6,11 +6,11 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.list.DoubleArrayList;
-import org.apache.mahout.colt.list.IntArrayList;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix3D;
+import org.apache.mahout.matrix.list.DoubleArrayList;
+import org.apache.mahout.matrix.list.IntArrayList;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix3D;
/**
Abstract base class for 3-d matrices holding <tt>double</tt> elements.
First see the <a href="package-summary.html">package summary</a> and javadoc <a href="package-tree.html">tree view</a> to get the broad picture.
@@ -59,7 +59,7 @@
@return the aggregated measure.
@see org.apache.mahout.jet.math.Functions
*/
-public double aggregate(org.apache.mahout.colt.function.DoubleDoubleFunction aggr, org.apache.mahout.colt.function.DoubleFunction f) {
+public double aggregate(org.apache.mahout.matrix.function.DoubleDoubleFunction aggr, org.apache.mahout.matrix.function.DoubleFunction f) {
if (size()==0) return Double.NaN;
double a = f.apply(getQuick(slices-1,rows-1,columns-1));
int d = 1; // last cell already done
@@ -110,7 +110,7 @@
@throws IllegalArgumentException if <tt>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public double aggregate(DoubleMatrix3D other, org.apache.mahout.colt.function.DoubleDoubleFunction aggr, org.apache.mahout.colt.function.DoubleDoubleFunction f) {
+public double aggregate(DoubleMatrix3D other, org.apache.mahout.matrix.function.DoubleDoubleFunction aggr, org.apache.mahout.matrix.function.DoubleDoubleFunction f) {
checkShape(other);
if (size()==0) return Double.NaN;
double a = f.apply(getQuick(slices-1,rows-1,columns-1),other.getQuick(slices-1,rows-1,columns-1));
@@ -189,7 +189,7 @@
@return <tt>this</tt> (for convenience only).
@see org.apache.mahout.jet.math.Functions
*/
-public DoubleMatrix3D assign(org.apache.mahout.colt.function.DoubleFunction function) {
+public DoubleMatrix3D assign(org.apache.mahout.matrix.function.DoubleFunction function) {
for (int slice=slices; --slice >= 0; ) {
for (int row=rows; --row >= 0; ) {
for (int column=columns; --column >= 0; ) {
@@ -251,7 +251,7 @@
@throws IllegalArgumentException if <tt>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public DoubleMatrix3D assign(DoubleMatrix3D y, org.apache.mahout.colt.function.DoubleDoubleFunction function) {
+public DoubleMatrix3D assign(DoubleMatrix3D y, org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
checkShape(y);
for (int slice=slices; --slice >= 0; ) {
for (int row=rows; --row >= 0; ) {
@@ -294,7 +294,7 @@
* @return <tt>true</tt> if all cells are equal to the given value, <tt>false</tt> otherwise.
*/
public boolean equals(double value) {
- return org.apache.mahout.colt.matrix.linalg.Property.DEFAULT.equals(this,value);
+ return org.apache.mahout.matrix.matrix.linalg.Property.DEFAULT.equals(this,value);
}
/**
* Compares this object against the specified object.
@@ -311,7 +311,7 @@
if (obj == null) return false;
if (!(obj instanceof DoubleMatrix3D)) return false;
- return org.apache.mahout.colt.matrix.linalg.Property.DEFAULT.equals(this,(DoubleMatrix3D) obj);
+ return org.apache.mahout.matrix.matrix.linalg.Property.DEFAULT.equals(this,(DoubleMatrix3D) obj);
}
/**
* Returns the matrix cell value at coordinate <tt>[slice,row,column]</tt>.
@@ -485,10 +485,10 @@
}
/**
* Returns a string representation using default formatting.
- * @see org.apache.mahout.colt.matrix.doublealgo.Formatter
+ * @see org.apache.mahout.matrix.matrix.doublealgo.Formatter
*/
public String toString() {
- return new org.apache.mahout.colt.matrix.doublealgo.Formatter().toString(this);
+ return new org.apache.mahout.matrix.matrix.doublealgo.Formatter().toString(this);
}
/**
* Constructs and returns a new view equal to the receiver.
@@ -748,13 +748,13 @@
/**
Sorts the matrix slices into ascending order, according to the <i>natural ordering</i> of the matrix values in the given <tt>[row,column]</tt> position.
This sort is guaranteed to be <i>stable</i>.
-For further information, see {@link org.apache.mahout.colt.matrix.doublealgo.Sorting#sort(DoubleMatrix3D,int,int)}.
-For more advanced sorting functionality, see {@link org.apache.mahout.colt.matrix.doublealgo.Sorting}.
+For further information, see {@link org.apache.mahout.matrix.matrix.doublealgo.Sorting#sort(DoubleMatrix3D,int,int)}.
+For more advanced sorting functionality, see {@link org.apache.mahout.matrix.matrix.doublealgo.Sorting}.
@return a new sorted vector (matrix) view.
@throws IndexOutOfBoundsException if <tt>row < 0 || row >= rows() || column < 0 || column >= columns()</tt>.
*/
public DoubleMatrix3D viewSorted(int row, int column) {
- return org.apache.mahout.colt.matrix.doublealgo.Sorting.mergeSort.sort(this,row,column);
+ return org.apache.mahout.matrix.matrix.doublealgo.Sorting.mergeSort.sort(this,row,column);
}
/**
Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
@@ -790,7 +790,7 @@
* @param procedure a procedure object taking as argument the current cell's value. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEach(final org.apache.mahout.colt.function.DoubleProcedure procedure) {
+private boolean xforEach(final org.apache.mahout.matrix.function.DoubleProcedure procedure) {
for (int slice=slices; --slice >= 0;) {
for (int row=rows; --row >= 0;) {
for (int column=columns; --column >= 0;) {
@@ -819,7 +819,7 @@
* @param procedure a procedure object taking as first argument the current slice, as second argument the current row, and as third argument the current column. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEachCoordinate(final org.apache.mahout.colt.function.IntIntIntProcedure procedure) {
+private boolean xforEachCoordinate(final org.apache.mahout.matrix.function.IntIntIntProcedure procedure) {
for (int column=columns; --column >= 0;) {
for (int slice=slices; --slice >=0;) {
for (int row=rows; --row >= 0;) {
@@ -863,7 +863,7 @@
final double alpha = 0.25;
final double beta = 0.75;
-org.apache.mahout.colt.function.Double27Function f = new org.apache.mahout.colt.function.Double27Function() {
+org.apache.mahout.matrix.function.Double27Function f = new org.apache.mahout.matrix.function.Double27Function() {
public final double apply(
double a000, double a001, double a002,
double a010, double a011, double a012,
@@ -887,7 +887,7 @@
@throws NullPointerException if <tt>function==null</tt>.
@throws IllegalArgumentException if <tt>rows() != B.rows() || columns() != B.columns() || slices() != B.slices() </tt>.
*/
-public void zAssign27Neighbors(DoubleMatrix3D B, org.apache.mahout.colt.function.Double27Function function) {
+public void zAssign27Neighbors(DoubleMatrix3D B, org.apache.mahout.matrix.function.Double27Function function) {
if (function==null) throw new NullPointerException("function must not be null.");
checkShape(B);
if (rows<3 || columns<3 || slices<3) return; // nothing to do
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3DProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3DProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3DProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/DoubleMatrix3DProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
/**
* Interface that represents a condition or procedure object: takes
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory1D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory1D.java Mon Nov 23 16:34:55 2009
@@ -6,10 +6,10 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.matrix.impl.DenseObjectMatrix1D;
-import org.apache.mahout.colt.matrix.impl.SparseObjectMatrix1D;
+import org.apache.mahout.matrix.matrix.impl.DenseObjectMatrix1D;
+import org.apache.mahout.matrix.matrix.impl.SparseObjectMatrix1D;
/**
Factory for convenient construction of 1-d matrices holding <tt>Object</tt> cells.
Use idioms like <tt>ObjectFactory1D.dense.make(1000)</tt> to construct dense matrices,
@@ -34,7 +34,7 @@
* @deprecated until unit tests are in place. Until this time, this class/interface is unsupported.
*/
@Deprecated
-public class ObjectFactory1D extends org.apache.mahout.colt.PersistentObject {
+public class ObjectFactory1D extends org.apache.mahout.matrix.PersistentObject {
/**
* A factory producing dense matrices.
*/
@@ -108,7 +108,7 @@
* @param values The values to be filled into the new matrix.
* @return a new matrix.
*/
-public ObjectMatrix1D make(org.apache.mahout.colt.list.ObjectArrayList values) {
+public ObjectMatrix1D make(org.apache.mahout.matrix.list.ObjectArrayList values) {
int size = values.size();
ObjectMatrix1D vector = make(size);
for (int i=size; --i >= 0; ) vector.set(i, values.get(i));
@@ -138,9 +138,9 @@
* @param values The values to be filled into the new list.
* @return a new list.
*/
-public org.apache.mahout.colt.list.ObjectArrayList toList(ObjectMatrix1D values) {
+public org.apache.mahout.matrix.list.ObjectArrayList toList(ObjectMatrix1D values) {
int size = values.size();
- org.apache.mahout.colt.list.ObjectArrayList list = new org.apache.mahout.colt.list.ObjectArrayList(size);
+ org.apache.mahout.matrix.list.ObjectArrayList list = new org.apache.mahout.matrix.list.ObjectArrayList(size);
list.setSize(size);
for (int i=size; --i >= 0; ) list.set(i, values.get(i));
return list;
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory2D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory2D.java Mon Nov 23 16:34:55 2009
@@ -6,10 +6,10 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.matrix.impl.DenseObjectMatrix2D;
-import org.apache.mahout.colt.matrix.impl.SparseObjectMatrix2D;
+import org.apache.mahout.matrix.matrix.impl.DenseObjectMatrix2D;
+import org.apache.mahout.matrix.matrix.impl.SparseObjectMatrix2D;
/**
Factory for convenient construction of 2-d matrices holding <tt>Object</tt>
cells. Also provides convenient methods to compose (concatenate) and decompose
@@ -64,7 +64,7 @@
* @deprecated until unit tests are in place. Until this time, this class/interface is unsupported.
*/
@Deprecated
-public class ObjectFactory2D extends org.apache.mahout.colt.PersistentObject {
+public class ObjectFactory2D extends org.apache.mahout.matrix.PersistentObject {
/**
* A factory producing dense matrices.
*/
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory3D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectFactory3D.java Mon Nov 23 16:34:55 2009
@@ -6,10 +6,10 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.matrix.impl.DenseObjectMatrix3D;
-import org.apache.mahout.colt.matrix.impl.SparseObjectMatrix3D;
+import org.apache.mahout.matrix.matrix.impl.DenseObjectMatrix3D;
+import org.apache.mahout.matrix.matrix.impl.SparseObjectMatrix3D;
/**
Factory for convenient construction of 3-d matrices holding <tt>Object</tt> cells.
Use idioms like <tt>ObjectFactory3D.dense.make(4,4,4)</tt> to construct dense matrices,
@@ -34,7 +34,7 @@
* @deprecated until unit tests are in place. Until this time, this class/interface is unsupported.
*/
@Deprecated
-public class ObjectFactory3D extends org.apache.mahout.colt.PersistentObject {
+public class ObjectFactory3D extends org.apache.mahout.matrix.PersistentObject {
/**
* A factory producing dense matrices.
*/
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1D.java Mon Nov 23 16:34:55 2009
@@ -6,11 +6,11 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.list.IntArrayList;
-import org.apache.mahout.colt.list.ObjectArrayList;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix1D;
+import org.apache.mahout.matrix.list.IntArrayList;
+import org.apache.mahout.matrix.list.ObjectArrayList;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix1D;
/**
Abstract base class for 1-d matrices (aka <i>vectors</i>) holding <tt>Object</tt> elements.
First see the <a href="package-summary.html">package summary</a> and javadoc <a href="package-tree.html">tree view</a> to get the broad picture.
@@ -51,7 +51,7 @@
@param f a function transforming the current cell value.
@return the aggregated measure.
*/
-public Object aggregate(org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectFunction f) {
+public Object aggregate(org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectFunction f) {
if (size==0) return null;
Object a = f.apply(getQuick(size-1));
for (int i=size-1; --i >= 0; ) {
@@ -84,7 +84,7 @@
@return the aggregated measure.
@throws IllegalArgumentException if <tt>size() != other.size()</tt>.
*/
-public Object aggregate(ObjectMatrix1D other, org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectObjectFunction f) {
+public Object aggregate(ObjectMatrix1D other, org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectObjectFunction f) {
checkSize(other);
if (size==0) return null;
Object a = f.apply(getQuick(size-1),other.getQuick(size-1));
@@ -128,7 +128,7 @@
@return <tt>this</tt> (for convenience only).
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix1D assign(org.apache.mahout.colt.function.ObjectFunction function) {
+public ObjectMatrix1D assign(org.apache.mahout.matrix.function.ObjectFunction function) {
for (int i=size; --i >= 0; ) {
setQuick(i, function.apply(getQuick(i)));
}
@@ -174,7 +174,7 @@
@throws IllegalArgumentException if <tt>size() != y.size()</tt>.
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix1D assign(ObjectMatrix1D y, org.apache.mahout.colt.function.ObjectObjectFunction function) {
+public ObjectMatrix1D assign(ObjectMatrix1D y, org.apache.mahout.matrix.function.ObjectObjectFunction function) {
checkSize(y);
for (int i=size; --i >= 0; ) {
setQuick(i, function.apply(getQuick(i), y.getQuick(i)));
@@ -438,10 +438,10 @@
}
/**
* Returns a string representation using default formatting.
- * @see org.apache.mahout.colt.matrix.objectalgo.Formatter
+ * @see org.apache.mahout.matrix.matrix.objectalgo.Formatter
*/
public String toString() {
- return new org.apache.mahout.colt.matrix.objectalgo.Formatter().toString(this);
+ return new org.apache.mahout.matrix.matrix.objectalgo.Formatter().toString(this);
}
/**
* Constructs and returns a new view equal to the receiver.
@@ -548,7 +548,7 @@
@param condition The condition to be matched.
@return the new view.
*/
-public ObjectMatrix1D viewSelection(org.apache.mahout.colt.function.ObjectProcedure condition) {
+public ObjectMatrix1D viewSelection(org.apache.mahout.matrix.function.ObjectProcedure condition) {
IntArrayList matches = new IntArrayList();
for (int i=0; i < size; i++) {
if (condition.apply(getQuick(i))) matches.add(i);
@@ -566,12 +566,12 @@
/**
Sorts the vector into ascending order, according to the <i>natural ordering</i>.
This sort is guaranteed to be <i>stable</i>.
-For further information, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting#sort(ObjectMatrix1D)}.
-For more advanced sorting functionality, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting}.
+For further information, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting#sort(ObjectMatrix1D)}.
+For more advanced sorting functionality, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting}.
@return a new sorted vector (matrix) view.
*/
public ObjectMatrix1D viewSorted() {
- return org.apache.mahout.colt.matrix.objectalgo.Sorting.mergeSort.sort(this);
+ return org.apache.mahout.matrix.matrix.objectalgo.Sorting.mergeSort.sort(this);
}
/**
Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
@@ -600,7 +600,7 @@
* @param procedure a procedure object taking as argument the current cell's value. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEach(final org.apache.mahout.colt.function.ObjectProcedure procedure) {
+private boolean xforEach(final org.apache.mahout.matrix.function.ObjectProcedure procedure) {
for (int i=size; --i >= 0;) {
if (!procedure.apply(getQuick(i))) return false;
}
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1DProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1DProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1DProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix1DProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
/**
* Interface that represents a condition or procedure object: takes
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2D.java Mon Nov 23 16:34:55 2009
@@ -6,11 +6,11 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.list.IntArrayList;
-import org.apache.mahout.colt.list.ObjectArrayList;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix2D;
+import org.apache.mahout.matrix.list.IntArrayList;
+import org.apache.mahout.matrix.list.ObjectArrayList;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix2D;
/**
Abstract base class for 2-d matrices holding <tt>Object</tt> elements.
First see the <a href="package-summary.html">package summary</a> and javadoc <a href="package-tree.html">tree view</a> to get the broad picture.
@@ -56,7 +56,7 @@
@return the aggregated measure.
@see org.apache.mahout.jet.math.Functions
*/
-public Object aggregate(org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectFunction f) {
+public Object aggregate(org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectFunction f) {
if (size()==0) return null;
Object a = f.apply(getQuick(rows-1,columns-1));
int d = 1; // last cell already done
@@ -99,7 +99,7 @@
@throws IllegalArgumentException if <tt>columns() != other.columns() || rows() != other.rows()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public Object aggregate(ObjectMatrix2D other, org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectObjectFunction f) {
+public Object aggregate(ObjectMatrix2D other, org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectObjectFunction f) {
checkShape(other);
if (size()==0) return null;
Object a = f.apply(getQuick(rows-1,columns-1),other.getQuick(rows-1,columns-1));
@@ -156,7 +156,7 @@
@return <tt>this</tt> (for convenience only).
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix2D assign(org.apache.mahout.colt.function.ObjectFunction function) {
+public ObjectMatrix2D assign(org.apache.mahout.matrix.function.ObjectFunction function) {
for (int row=rows; --row >= 0; ) {
for (int column=columns; --column >= 0; ) {
setQuick(row,column, function.apply(getQuick(row,column)));
@@ -214,7 +214,7 @@
@throws IllegalArgumentException if <tt>columns() != other.columns() || rows() != other.rows()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix2D assign(ObjectMatrix2D y, org.apache.mahout.colt.function.ObjectObjectFunction function) {
+public ObjectMatrix2D assign(ObjectMatrix2D y, org.apache.mahout.matrix.function.ObjectObjectFunction function) {
checkShape(y);
for (int row=rows; --row >= 0; ) {
for (int column=columns; --column >= 0; ) {
@@ -486,10 +486,10 @@
}
/**
* Returns a string representation using default formatting.
- * @see org.apache.mahout.colt.matrix.objectalgo.Formatter
+ * @see org.apache.mahout.matrix.matrix.objectalgo.Formatter
*/
public String toString() {
- return new org.apache.mahout.colt.matrix.objectalgo.Formatter().toString(this);
+ return new org.apache.mahout.matrix.matrix.objectalgo.Formatter().toString(this);
}
/**
* Constructs and returns a new view equal to the receiver.
@@ -778,13 +778,13 @@
/**
Sorts the matrix rows into ascending order, according to the <i>natural ordering</i> of the matrix values in the given column.
This sort is guaranteed to be <i>stable</i>.
-For further information, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting#sort(ObjectMatrix2D,int)}.
-For more advanced sorting functionality, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting}.
+For further information, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting#sort(ObjectMatrix2D,int)}.
+For more advanced sorting functionality, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting}.
@return a new sorted vector (matrix) view.
@throws IndexOutOfBoundsException if <tt>column < 0 || column >= columns()</tt>.
*/
public ObjectMatrix2D viewSorted(int column) {
- return org.apache.mahout.colt.matrix.objectalgo.Sorting.mergeSort.sort(this,column);
+ return org.apache.mahout.matrix.matrix.objectalgo.Sorting.mergeSort.sort(this,column);
}
/**
Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
@@ -816,7 +816,7 @@
* @param procedure a procedure object taking as argument the current cell's value. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEach(final org.apache.mahout.colt.function.ObjectProcedure procedure) {
+private boolean xforEach(final org.apache.mahout.matrix.function.ObjectProcedure procedure) {
for (int row=rows; --row >= 0;) {
for (int column=columns; --column >= 0;) {
if (!procedure.apply(getQuick(row,column))) return false;
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2DProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2DProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2DProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix2DProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
/**
* Interface that represents a condition or procedure object: takes
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3D.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3D.java Mon Nov 23 16:34:55 2009
@@ -6,11 +6,11 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
-import org.apache.mahout.colt.list.IntArrayList;
-import org.apache.mahout.colt.list.ObjectArrayList;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix3D;
+import org.apache.mahout.matrix.list.IntArrayList;
+import org.apache.mahout.matrix.list.ObjectArrayList;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix3D;
/**
Abstract base class for 3-d matrices holding <tt>Object</tt> elements.
First see the <a href="package-summary.html">package summary</a> and javadoc <a href="package-tree.html">tree view</a> to get the broad picture.
@@ -59,7 +59,7 @@
@return the aggregated measure.
@see org.apache.mahout.jet.math.Functions
*/
-public Object aggregate(org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectFunction f) {
+public Object aggregate(org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectFunction f) {
if (size()==0) return null;
Object a = f.apply(getQuick(slices-1,rows-1,columns-1));
int d = 1; // last cell already done
@@ -110,7 +110,7 @@
@throws IllegalArgumentException if <tt>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public Object aggregate(ObjectMatrix3D other, org.apache.mahout.colt.function.ObjectObjectFunction aggr, org.apache.mahout.colt.function.ObjectObjectFunction f) {
+public Object aggregate(ObjectMatrix3D other, org.apache.mahout.matrix.function.ObjectObjectFunction aggr, org.apache.mahout.matrix.function.ObjectObjectFunction f) {
checkShape(other);
if (size()==0) return null;
Object a = f.apply(getQuick(slices-1,rows-1,columns-1),other.getQuick(slices-1,rows-1,columns-1));
@@ -174,7 +174,7 @@
@return <tt>this</tt> (for convenience only).
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix3D assign(org.apache.mahout.colt.function.ObjectFunction function) {
+public ObjectMatrix3D assign(org.apache.mahout.matrix.function.ObjectFunction function) {
for (int slice=slices; --slice >= 0; ) {
for (int row=rows; --row >= 0; ) {
for (int column=columns; --column >= 0; ) {
@@ -236,7 +236,7 @@
@throws IllegalArgumentException if <tt>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt>
@see org.apache.mahout.jet.math.Functions
*/
-public ObjectMatrix3D assign(ObjectMatrix3D y, org.apache.mahout.colt.function.ObjectObjectFunction function) {
+public ObjectMatrix3D assign(ObjectMatrix3D y, org.apache.mahout.matrix.function.ObjectObjectFunction function) {
checkShape(y);
for (int slice=slices; --slice >= 0; ) {
for (int row=rows; --row >= 0; ) {
@@ -513,10 +513,10 @@
}
/**
* Returns a string representation using default formatting.
- * @see org.apache.mahout.colt.matrix.objectalgo.Formatter
+ * @see org.apache.mahout.matrix.matrix.objectalgo.Formatter
*/
public String toString() {
- return new org.apache.mahout.colt.matrix.objectalgo.Formatter().toString(this);
+ return new org.apache.mahout.matrix.matrix.objectalgo.Formatter().toString(this);
}
/**
* Constructs and returns a new view equal to the receiver.
@@ -776,13 +776,13 @@
/**
Sorts the matrix slices into ascending order, according to the <i>natural ordering</i> of the matrix values in the given <tt>[row,column]</tt> position.
This sort is guaranteed to be <i>stable</i>.
-For further information, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting#sort(ObjectMatrix3D,int,int)}.
-For more advanced sorting functionality, see {@link org.apache.mahout.colt.matrix.objectalgo.Sorting}.
+For further information, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting#sort(ObjectMatrix3D,int,int)}.
+For more advanced sorting functionality, see {@link org.apache.mahout.matrix.matrix.objectalgo.Sorting}.
@return a new sorted vector (matrix) view.
@throws IndexOutOfBoundsException if <tt>row < 0 || row >= rows() || column < 0 || column >= columns()</tt>.
*/
public ObjectMatrix3D viewSorted(int row, int column) {
- return org.apache.mahout.colt.matrix.objectalgo.Sorting.mergeSort.sort(this,row,column);
+ return org.apache.mahout.matrix.matrix.objectalgo.Sorting.mergeSort.sort(this,row,column);
}
/**
Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
@@ -818,7 +818,7 @@
* @param procedure a procedure object taking as argument the current cell's value. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEach(final org.apache.mahout.colt.function.ObjectProcedure procedure) {
+private boolean xforEach(final org.apache.mahout.matrix.function.ObjectProcedure procedure) {
for (int slice=slices; --slice >= 0;) {
for (int row=rows; --row >= 0;) {
for (int column=columns; --column >= 0;) {
@@ -847,7 +847,7 @@
* @param procedure a procedure object taking as first argument the current slice, as second argument the current row, and as third argument the current column. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
-private boolean xforEachCoordinate(final org.apache.mahout.colt.function.IntIntIntProcedure procedure) {
+private boolean xforEachCoordinate(final org.apache.mahout.matrix.function.IntIntIntProcedure procedure) {
for (int column=columns; --column >= 0;) {
for (int slice=slices; --slice >=0;) {
for (int row=rows; --row >= 0;) {
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3DProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3DProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3DProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/ObjectMatrix3DProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix;
+package org.apache.mahout.matrix.matrix;
/**
* Interface that represents a condition or procedure object: takes
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkKernel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkKernel.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkKernel.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkKernel.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.bench;
+package org.apache.mahout.matrix.matrix.bench;
/**
* Not yet documented.
@@ -83,7 +83,7 @@
};
// build string matrix
- org.apache.mahout.colt.matrix.ObjectMatrix2D matrix = new org.apache.mahout.colt.matrix.impl.DenseObjectMatrix2D(properties.length,2);
+ org.apache.mahout.matrix.matrix.ObjectMatrix2D matrix = new org.apache.mahout.matrix.matrix.impl.DenseObjectMatrix2D(properties.length,2);
matrix.viewColumn(0).assign(properties);
// retrieve property values
@@ -94,7 +94,7 @@
}
// format matrix
- org.apache.mahout.colt.matrix.objectalgo.Formatter formatter = new org.apache.mahout.colt.matrix.objectalgo.Formatter();
+ org.apache.mahout.matrix.matrix.objectalgo.Formatter formatter = new org.apache.mahout.matrix.matrix.objectalgo.Formatter();
formatter.setPrintShape(false);
return formatter.toString(matrix);
}
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkMatrix.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkMatrix.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkMatrix.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/BenchmarkMatrix.java Mon Nov 23 16:34:55 2009
@@ -6,17 +6,17 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.bench;
+package org.apache.mahout.matrix.matrix.bench;
-import org.apache.mahout.colt.matrix.DoubleFactory2D;
-import org.apache.mahout.colt.matrix.DoubleFactory3D;
-import org.apache.mahout.colt.matrix.DoubleMatrix2D;
-import org.apache.mahout.colt.matrix.DoubleMatrix3D;
+import org.apache.mahout.matrix.matrix.DoubleFactory2D;
+import org.apache.mahout.matrix.matrix.DoubleFactory3D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix3D;
/**
Configurable matrix benchmark.
Runs the operations defined in main(args) or in the file specified by args.
-To get <a href="doc-files/usage.txt">this overall help</a> on usage type <tt>java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help</tt>.
-To get help on usage of a given command, type <tt>java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help <command></tt>.
+To get <a href="doc-files/usage.txt">this overall help</a> on usage type <tt>java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help</tt>.
+To get help on usage of a given command, type <tt>java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help <command></tt>.
Here is the <a href="doc-files/usage_dgemm.txt">help ouput for the dgemm</a> command.
<a href="../doc-files/dgemmColt1.0.1ibm1.3LxPIII_2.txt">Here</a> is a sample result.
For more results see the <a href="../doc-files/performanceLog.html">performance log</a>.
@@ -63,7 +63,7 @@
return;
}
- org.apache.mahout.colt.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.colt.matrix.linalg.SeqBlas.seqBlas);
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.matrix.matrix.linalg.SeqBlas.seqBlas);
Double2DProcedure fun = fun_dgemm(transposeA,transposeB);
String title = fun.toString();
String params = transposeA +", "+transposeB+", 1, A, B, 0, C";
@@ -98,7 +98,7 @@
return;
}
- org.apache.mahout.colt.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.colt.matrix.linalg.SeqBlas.seqBlas);
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.matrix.matrix.linalg.SeqBlas.seqBlas);
Double2DProcedure fun = fun_dgemv(transposeA);
String title = fun.toString();
String params = transposeA +", 1, A, B, 0, C";
@@ -133,7 +133,7 @@
return;
}
- org.apache.mahout.colt.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.colt.matrix.linalg.SeqBlas.seqBlas);
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.matrix.matrix.linalg.SeqBlas.seqBlas);
Double2DProcedure fun = fun_pow(exponent);
String title = fun.toString();
String params = "A,"+exponent;
@@ -166,7 +166,7 @@
return;
}
- org.apache.mahout.colt.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.colt.matrix.linalg.SeqBlas.seqBlas);
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.allocateBlas(cpus, org.apache.mahout.matrix.matrix.linalg.SeqBlas.seqBlas);
String title = fun.toString();
run(minSecs,title,fun,types,sizes,densities);
}
@@ -184,13 +184,13 @@
public String toString() { return "Blas matrix-matrix mult"; }
public void setParameters(DoubleMatrix2D G, DoubleMatrix2D H) {
super.setParameters(G,H);
- D = new org.apache.mahout.colt.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
+ D = new org.apache.mahout.matrix.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
C = D.copy();
B = D.copy();
}
public void init() { C.assign(D); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.dgemm(transposeA,transposeB,1,A,B,0,C);
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.dgemm(transposeA,transposeB,1,A,B,0,C);
}
public double operations() { // Mflops
double m = A.rows();
@@ -208,13 +208,13 @@
public String toString() { return "Blas matrix-vector mult"; }
public void setParameters(DoubleMatrix2D G, DoubleMatrix2D H) {
super.setParameters(G,H);
- D = new org.apache.mahout.colt.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
+ D = new org.apache.mahout.matrix.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
C = D.copy();
B = D.copy();
}
public void init() { C.viewRow(0).assign(D.viewRow(0)); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.dgemv(transposeA,1,A,B.viewRow(0),0,C.viewRow(0));
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.dgemv(transposeA,1,A,B.viewRow(0),0,C.viewRow(0));
}
public double operations() { // Mflops
double m = A.rows();
@@ -233,17 +233,17 @@
public String toString() { return "matrix to the power of an exponent"; }
public void setParameters(DoubleMatrix2D A, DoubleMatrix2D B) {
if (k<0) { // must be nonsingular for inversion
- if (!org.apache.mahout.colt.matrix.linalg.Property.ZERO.isDiagonallyDominantByRow(A) ||
- !org.apache.mahout.colt.matrix.linalg.Property.ZERO.isDiagonallyDominantByColumn(A)) {
- org.apache.mahout.colt.matrix.linalg.Property.ZERO.generateNonSingular(A);
+ if (!org.apache.mahout.matrix.matrix.linalg.Property.ZERO.isDiagonallyDominantByRow(A) ||
+ !org.apache.mahout.matrix.matrix.linalg.Property.ZERO.isDiagonallyDominantByColumn(A)) {
+ org.apache.mahout.matrix.matrix.linalg.Property.ZERO.generateNonSingular(A);
}
super.setParameters(A,B);
}
}
public void init() {}
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.Algebra.DEFAULT.pow(A,k);
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.Algebra.DEFAULT.pow(A,k);
}
public double operations() { // Mflops
double m = A.rows();
@@ -272,7 +272,7 @@
return new Double2DProcedure() {
public String toString() { return "A.assign(B) [Mops/sec]"; }
public void init() { A.assign(0); }
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
A.assign(B);
}
};
@@ -284,7 +284,7 @@
return new Double2DProcedure() {
public String toString() { return "A.assign(B) via get and set [Mops/sec]"; }
public void init() { A.assign(0); }
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
int rows=B.rows();
int columns=B.columns();
/*
@@ -309,7 +309,7 @@
return new Double2DProcedure() {
public String toString() { return "A.assign(B) via getQuick and setQuick [Mops/sec]"; }
public void init() { A.assign(0); }
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
int rows=B.rows();
int columns=B.columns();
//for (int row=rows; --row >= 0; ) {
@@ -329,8 +329,8 @@
return new Double2DProcedure() {
public String toString() { return "A[i,j] = log(A[i,j]) via Blas.assign(fun) [Mflops/sec]"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.assign(A, org.apache.mahout.jet.math.Functions.log);
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.assign(A, org.apache.mahout.jet.math.Functions.log);
}
};
}
@@ -341,8 +341,8 @@
return new Double2DProcedure() {
public String toString() { return "A[i,j] = A[i,j] + s*B[i,j] via Blas.assign(fun) [Mflops/sec]"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.assign(A,B, org.apache.mahout.jet.math.Functions.plusMult(0.5));
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.assign(A,B, org.apache.mahout.jet.math.Functions.plusMult(0.5));
}
public double operations() { // Mflops
double m = A.rows();
@@ -361,9 +361,9 @@
public void setParameters(DoubleMatrix2D A, DoubleMatrix2D B) {
super.setParameters(A.viewDice(),B); // transposed --> faster (memory aware) iteration in correlation algo
}
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.doublealgo.Statistic.correlation(
- org.apache.mahout.colt.matrix.doublealgo.Statistic.covariance(A));
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.doublealgo.Statistic.correlation(
+ org.apache.mahout.matrix.matrix.doublealgo.Statistic.covariance(A));
}
public double operations() { // Mflops
double m = A.rows();
@@ -379,8 +379,8 @@
return new Double2DProcedure() {
public String toString() { return "A.assign(F.mult(0.5)) via Blas [Mflops/sec]"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.assign(A, org.apache.mahout.jet.math.Functions.mult(0.5));
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.assign(A, org.apache.mahout.jet.math.Functions.mult(0.5));
}
};
}
@@ -391,8 +391,8 @@
return new Double2DProcedure() {
public String toString() { return "A.assign(B,F.mult) via Blas [Mflops/sec]"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) {
- org.apache.mahout.colt.matrix.linalg.SmpBlas.smpBlas.assign(A,B, org.apache.mahout.jet.math.Functions.mult);
+ public void apply(org.apache.mahout.matrix.Timer timer) {
+ org.apache.mahout.matrix.matrix.linalg.SmpBlas.smpBlas.assign(A,B, org.apache.mahout.jet.math.Functions.mult);
}
};
}
@@ -404,7 +404,7 @@
public double dummy;
public String toString() { return "xxxxxxx"; }
public void init() {}
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
int rows=B.rows();
int columns=B.columns();
double sum =0;
@@ -424,10 +424,10 @@
*/
protected static Double2DProcedure funLUDecompose() {
return new Double2DProcedure() {
- org.apache.mahout.colt.matrix.linalg.LUDecompositionQuick lu = new org.apache.mahout.colt.matrix.linalg.LUDecompositionQuick(0);
+ org.apache.mahout.matrix.matrix.linalg.LUDecompositionQuick lu = new org.apache.mahout.matrix.matrix.linalg.LUDecompositionQuick(0);
public String toString() { return "LU.decompose(A) [Mflops/sec]"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
lu.decompose(A);
}
public double operations() { // Mflops
@@ -441,20 +441,20 @@
*/
protected static Double2DProcedure funLUSolve() {
return new Double2DProcedure() {
- org.apache.mahout.colt.matrix.linalg.LUDecompositionQuick lu;
+ org.apache.mahout.matrix.matrix.linalg.LUDecompositionQuick lu;
public String toString() { return "LU.solve(A) [Mflops/sec]"; }
public void setParameters(DoubleMatrix2D A, DoubleMatrix2D B) {
lu = null;
- if (!org.apache.mahout.colt.matrix.linalg.Property.ZERO.isDiagonallyDominantByRow(A) ||
- !org.apache.mahout.colt.matrix.linalg.Property.ZERO.isDiagonallyDominantByColumn(A)) {
- org.apache.mahout.colt.matrix.linalg.Property.ZERO.generateNonSingular(A);
+ if (!org.apache.mahout.matrix.matrix.linalg.Property.ZERO.isDiagonallyDominantByRow(A) ||
+ !org.apache.mahout.matrix.matrix.linalg.Property.ZERO.isDiagonallyDominantByColumn(A)) {
+ org.apache.mahout.matrix.matrix.linalg.Property.ZERO.generateNonSingular(A);
}
super.setParameters(A,B);
- lu = new org.apache.mahout.colt.matrix.linalg.LUDecompositionQuick(0);
+ lu = new org.apache.mahout.matrix.matrix.linalg.LUDecompositionQuick(0);
lu.decompose(A);
}
public void init() { B.assign(D); }
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
lu.solve(B);
}
public double operations() { // Mflops
@@ -477,7 +477,7 @@
this.C = A.copy();
}
public void init() { C.assign(0); }
- public void apply(org.apache.mahout.colt.Timer timer) { A.zMult(B,C); }
+ public void apply(org.apache.mahout.matrix.Timer timer) { A.zMult(B,C); }
public double operations() { // Mflops
double m = A.rows();
double n = A.columns();
@@ -494,12 +494,12 @@
public String toString() { return "xxxxxxx"; }
public void setParameters(DoubleMatrix2D G, DoubleMatrix2D H) {
super.setParameters(G,H);
- D = new org.apache.mahout.colt.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
+ D = new org.apache.mahout.matrix.matrix.impl.DenseDoubleMatrix2D(A.rows(),A.columns()).assign(0.5);
C = D.copy();
B = D.copy();
}
public void init() { C.viewRow(0).assign(D.viewRow(0)); }
- public void apply(org.apache.mahout.colt.Timer timer) { A.zMult(B.viewRow(0),C.viewRow(0)); }
+ public void apply(org.apache.mahout.matrix.Timer timer) { A.zMult(B.viewRow(0),C.viewRow(0)); }
public double operations() { // Mflops
double m = A.rows();
double n = A.columns();
@@ -522,7 +522,7 @@
current = 4*seed+1;
density = A.cardinality() / (double) A.size();
}
- public void apply(org.apache.mahout.colt.Timer timer) {
+ public void apply(org.apache.mahout.matrix.Timer timer) {
int rows=B.rows();
int columns=B.columns();
//for (int row=rows; --row >= 0; ) {
@@ -551,7 +551,7 @@
double omega = 1.25;
final double alpha = omega * 0.25;
final double beta = 1-omega;
- org.apache.mahout.colt.function.Double9Function function = new org.apache.mahout.colt.function.Double9Function() {
+ org.apache.mahout.matrix.function.Double9Function function = new org.apache.mahout.matrix.function.Double9Function() {
public final double apply(
double a00, double a01, double a02,
double a10, double a11, double a12,
@@ -561,7 +561,7 @@
};
public String toString() { return "A.zAssign8Neighbors(5 point function) [Mflops/sec]"; }
public void init() { B.assign(D); }
- public void apply(org.apache.mahout.colt.Timer timer) { A.zAssign8Neighbors(B,function); }
+ public void apply(org.apache.mahout.matrix.Timer timer) { A.zAssign8Neighbors(B,function); }
public double operations() { // Mflops
double n = A.columns();
double m = A.rows();
@@ -578,7 +578,7 @@
double omega = 1.25;
final double alpha = omega * 0.25;
final double beta = 1-omega;
- org.apache.mahout.colt.function.Double9Function function = new org.apache.mahout.colt.function.Double9Function() {
+ org.apache.mahout.matrix.function.Double9Function function = new org.apache.mahout.matrix.function.Double9Function() {
public final double apply(
double a00, double a01, double a02,
double a10, double a11, double a12,
@@ -588,7 +588,7 @@
};
public String toString() { return "A.zAssign8Neighbors(9 point function) [Mflops/sec]"; }
public void init() { B.assign(D); }
- public void apply(org.apache.mahout.colt.Timer timer) { A.zAssign8Neighbors(B,function); }
+ public void apply(org.apache.mahout.matrix.Timer timer) { A.zAssign8Neighbors(B,function); }
public double operations() { // Mflops
double n = A.columns();
double m = A.rows();
@@ -603,7 +603,7 @@
return new Double2DProcedure() {
public String toString() { return "xxxxxxx"; }
public void init() { A.assign(C); }
- public void apply(org.apache.mahout.colt.Timer timer) { A.viewSorted(0); }
+ public void apply(org.apache.mahout.matrix.Timer timer) { A.viewSorted(0); }
};
}
/**
@@ -665,7 +665,7 @@
}
/**
* Runs the matrix benchmark operations defined in args or in the file specified by args0.
- * To get detailed help on usage type java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help
+ * To get detailed help on usage type java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help
*/
public static void main(String[] args) {
int n = args.length;
@@ -688,9 +688,9 @@
// TODO print out real version info?
System.out.println("Colt Version is [unknown - now in Mahout]" + "\n");
- org.apache.mahout.colt.Timer timer = new org.apache.mahout.colt.Timer().start();
+ org.apache.mahout.matrix.Timer timer = new org.apache.mahout.matrix.Timer().start();
if (!args[0].equals("-file")) { // interactive mode, commands supplied via java class args
- System.out.println("\n\nExecuting command = "+new org.apache.mahout.colt.list.ObjectArrayList(args)+" ...");
+ System.out.println("\n\nExecuting command = "+new org.apache.mahout.matrix.list.ObjectArrayList(args)+" ...");
handle(args);
}
else { // batch mode, read commands from file
@@ -712,7 +712,7 @@
stream.slashSlashComments(true); // allow // comments
stream.slashStarComments(true); // allow /* comments */
try {
- org.apache.mahout.colt.list.ObjectArrayList words = new org.apache.mahout.colt.list.ObjectArrayList();
+ org.apache.mahout.matrix.list.ObjectArrayList words = new org.apache.mahout.matrix.list.ObjectArrayList();
int token;
while ((token = stream.nextToken()) != stream.TT_EOF) { // while not end of file
if (token == stream.TT_EOL) { // execute a command line at a time
@@ -729,7 +729,7 @@
}
else {
String word;
- org.apache.mahout.colt.matrix.impl.Former formatter = new org.apache.mahout.colt.matrix.impl.FormerFactory().create("%G");
+ org.apache.mahout.matrix.matrix.impl.Former formatter = new org.apache.mahout.matrix.matrix.impl.FormerFactory().create("%G");
// ok: 2.0 -> 2 wrong: 2.0 -> 2.0 (kills Integer.parseInt())
if (token == stream.TT_NUMBER)
word = formatter.form(stream.nval);
@@ -775,7 +775,7 @@
//double[] densities = {0.1};
DoubleMatrix3D timings = DoubleFactory3D.dense.make(types.length,sizes.length,densities.length);
- org.apache.mahout.colt.Timer runTime = new org.apache.mahout.colt.Timer().start();
+ org.apache.mahout.matrix.Timer runTime = new org.apache.mahout.matrix.Timer().start();
for (int k=0; k<types.length; k++) {
//DoubleFactory2D factory = (k==0 ? DoubleFactory2D.dense : k==1 ? DoubleFactory2D.sparse : DoubleFactory2D.rowCompressed);
//DoubleFactory2D factory = (k==0 ? DoubleFactory2D.dense : k==1 ? DoubleFactory2D.sparse : k==2 ? DoubleFactory2D.rowCompressed : DoubleFactory2D.rowCompressedModified);
@@ -834,11 +834,11 @@
String tmp = rowAxisName; rowAxisName = colAxisName; colAxisName = tmp;
String[] tmp2 = rowNames; rowNames = colNames; colNames = tmp2;
timings = timings.viewDice(0,2,1);
- //System.out.println(new org.apache.mahout.colt.matrix.doublealgo.Formatter("%1.3G").toTitleString(timings,sliceNames,rowNames,colNames,sliceAxisName,rowAxisName,colAxisName,"Performance of "+title,aggr));
+ //System.out.println(new org.apache.mahout.matrix.matrix.doublealgo.Formatter("%1.3G").toTitleString(timings,sliceNames,rowNames,colNames,sliceAxisName,rowAxisName,colAxisName,"Performance of "+title,aggr));
/*
title = "Speedup of dense over sparse";
- DoubleMatrix2D speedup = org.apache.mahout.colt.matrix.doublealgo.Transform.div(timings.viewSlice(0).copy(),timings.viewSlice(1));
- System.out.println("\n"+new org.apache.mahout.colt.matrix.doublealgo.Formatter("%1.3G").toTitleString(speedup,rowNames,colNames,rowAxisName,colAxisName,title,aggr));
+ DoubleMatrix2D speedup = org.apache.mahout.matrix.matrix.doublealgo.Transform.div(timings.viewSlice(0).copy(),timings.viewSlice(1));
+ System.out.println("\n"+new org.apache.mahout.matrix.matrix.doublealgo.Formatter("%1.3G").toTitleString(speedup,rowNames,colNames,rowAxisName,colAxisName,title,aggr));
*/
System.out.println("Run took a total of "+runTime+". End of run.");
}
@@ -851,7 +851,7 @@
boolean[] sparses = {true};
DoubleMatrix2D timings = DoubleFactory2D.dense.make(sizes.length,4);
- org.apache.mahout.colt.Timer runTime = new org.apache.mahout.colt.Timer().start();
+ org.apache.mahout.matrix.Timer runTime = new org.apache.mahout.matrix.Timer().start();
for (int i=0; i<sizes.length; i++) {
int size = sizes[i];
double density = densities[i];
@@ -885,7 +885,7 @@
String rowAxisName = null;
String colAxisName = null;
System.out.println("*");
- //System.out.println(new org.apache.mahout.colt.matrix.doublealgo.Formatter("%1.3G").toTitleString(timings,rowNames,colNames,rowAxisName,colAxisName,title,aggr));
+ //System.out.println(new org.apache.mahout.matrix.matrix.doublealgo.Formatter("%1.3G").toTitleString(timings,rowNames,colNames,rowAxisName,colAxisName,title,aggr));
System.out.println("Run took a total of "+runTime+". End of run.");
}
@@ -894,14 +894,14 @@
*/
protected static String usage() {
String usage =
-"\nUsage (help): To get this help, type java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help\n"+
-"To get help on a command's args, omit args and type java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help <command>\n" +
+"\nUsage (help): To get this help, type java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help\n"+
+"To get help on a command's args, omit args and type java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help <command>\n" +
"Available commands: "+commands()+"\n\n"+
-"Usage (direct): java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix command {args}\n"+
+"Usage (direct): java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix command {args}\n"+
"Example: dgemm dense 2 2.0 0.999 false true 5 10 25 50 100 250 500\n\n"+
-"Usage (batch mode): java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -file <file>\nwhere <file> is a text file with each line holding a command followed by appropriate args (comments and empty lines ignored).\n\n"+
+"Usage (batch mode): java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -file <file>\nwhere <file> is a text file with each line holding a command followed by appropriate args (comments and empty lines ignored).\n\n"+
"Example file's content:\n" +
"dgemm dense 1 2.0 0.999 false true 5 10 25 50 100 250 500\n"+
"dgemm dense 2 2.0 0.999 false true 5 10 25 50 100 250 500\n\n"+
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/Double2DProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/Double2DProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/Double2DProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/Double2DProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,9 +6,9 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.bench;
+package org.apache.mahout.matrix.matrix.bench;
-import org.apache.mahout.colt.matrix.DoubleMatrix2D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
abstract class Double2DProcedure implements TimerProcedure {
public DoubleMatrix2D A;
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/TimerProcedure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/TimerProcedure.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/TimerProcedure.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/TimerProcedure.java Mon Nov 23 16:34:55 2009
@@ -6,7 +6,7 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.bench;
+package org.apache.mahout.matrix.matrix.bench;
/**
* Interface that represents a procedure object: a procedure that takes
@@ -24,7 +24,7 @@
* @param element element passed to the procedure.
* @return a flag to inform the object calling the procedure.
*/
-public void apply(org.apache.mahout.colt.Timer element);
+public void apply(org.apache.mahout.matrix.Timer element);
/**
* Prepare parameters before calling apply()
*/
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/doc-files/usage.txt
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/doc-files/usage.txt?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/doc-files/usage.txt (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/bench/doc-files/usage.txt Mon Nov 23 16:34:55 2009
@@ -1,12 +1,12 @@
-Usage (help): To get this help, type java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help
-To get help on a command's args, omit args and type java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -help <command>
+Usage (help): To get this help, type java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help
+To get help on a command's args, omit args and type java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -help <command>
Available commands: dgemm, dgemv, pow, assign, assignGetSet, assignGetSetQuick, assignLog, assignPlusMult, elementwiseMult, elementwiseMultB, SOR5, SOR8, LUDecompose, LUSolve
-Usage (direct): java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix command {args}
+Usage (direct): java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix command {args}
Example: dgemm dense 2 2.0 0.999 false true 5 10 25 50 100 250 500
-Usage (batch mode): java org.apache.mahout.colt.matrix.bench.BenchmarkMatrix -file <file>
+Usage (batch mode): java org.apache.mahout.matrix.matrix.bench.BenchmarkMatrix -file <file>
where <file> is a text file with each line holding a command followed by appropriate args (comments and empty lines ignored).
Example file's content:
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix1DComparator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix1DComparator.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix1DComparator.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix1DComparator.java Mon Nov 23 16:34:55 2009
@@ -6,13 +6,13 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.doublealgo;
+package org.apache.mahout.matrix.matrix.doublealgo;
-import org.apache.mahout.colt.matrix.DoubleMatrix1D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
/**
* A comparison function which imposes a <i>total ordering</i> on some
* collection of elements. Comparators can be passed to a sort method (such as
- * <tt>org.apache.mahout.colt.matrix.doublealgo.Sorting.quickSort</tt>) to allow precise control over the sort order.<p>
+ * <tt>org.apache.mahout.matrix.matrix.doublealgo.Sorting.quickSort</tt>) to allow precise control over the sort order.<p>
*
* Note: It is generally a good idea for comparators to implement
* <tt>java.io.Serializable</tt>, as they may be used as ordering methods in
@@ -24,7 +24,7 @@
* @version 1.0, 09/24/99
* @see java.util.Comparator
* @see org.apache.mahout.colt
- * @see org.apache.mahout.colt.Sorting
+ * @see org.apache.mahout.matrix.Sorting
*/
/**
* @deprecated until unit tests are in place. Until this time, this class/interface is unsupported.
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix2DComparator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix2DComparator.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix2DComparator.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/DoubleMatrix2DComparator.java Mon Nov 23 16:34:55 2009
@@ -6,13 +6,13 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.doublealgo;
+package org.apache.mahout.matrix.matrix.doublealgo;
-import org.apache.mahout.colt.matrix.DoubleMatrix2D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
/**
* A comparison function which imposes a <i>total ordering</i> on some
* collection of elements. Comparators can be passed to a sort method (such as
- * <tt>org.apache.mahout.colt.matrix.doublealgo.Sorting.quickSort</tt>) to allow precise control over the sort order.<p>
+ * <tt>org.apache.mahout.matrix.matrix.doublealgo.Sorting.quickSort</tt>) to allow precise control over the sort order.<p>
*
* Note: It is generally a good idea for comparators to implement
* <tt>java.io.Serializable</tt>, as they may be used as ordering methods in
@@ -24,7 +24,7 @@
* @version 1.0, 09/24/99
* @see java.util.Comparator
* @see org.apache.mahout.colt
- * @see org.apache.mahout.colt.Sorting
+ * @see org.apache.mahout.matrix.Sorting
*/
/**
* @deprecated until unit tests are in place. Until this time, this class/interface is unsupported.
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Formatter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Formatter.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Formatter.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Formatter.java Mon Nov 23 16:34:55 2009
@@ -6,16 +6,16 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.doublealgo;
+package org.apache.mahout.matrix.matrix.doublealgo;
-import org.apache.mahout.colt.matrix.DoubleMatrix1D;
-import org.apache.mahout.colt.matrix.DoubleMatrix2D;
-import org.apache.mahout.colt.matrix.DoubleMatrix3D;
-import org.apache.mahout.colt.matrix.impl.AbstractFormatter;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix1D;
-import org.apache.mahout.colt.matrix.impl.AbstractMatrix2D;
-import org.apache.mahout.colt.matrix.impl.DenseDoubleMatrix1D;
-import org.apache.mahout.colt.matrix.impl.Former;
+import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix3D;
+import org.apache.mahout.matrix.matrix.impl.AbstractFormatter;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix1D;
+import org.apache.mahout.matrix.matrix.impl.AbstractMatrix2D;
+import org.apache.mahout.matrix.matrix.impl.DenseDoubleMatrix1D;
+import org.apache.mahout.matrix.matrix.impl.Former;
/**
Flexible, well human readable matrix print formatting; By default decimal point aligned. Build on top of the C-like <i>sprintf</i> functionality
provided by the Format class written by Cay Horstmann.
@@ -302,7 +302,7 @@
// now the processing
int size = formats.length;
-DoubleMatrix2D matrix = org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values);
+DoubleMatrix2D matrix = org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values);
String[] strings = new String[size];
String[] sourceCodes = new String[size];
String[] htmlStrings = new String[size];
@@ -314,8 +314,8 @@
sourceCodes[i] = new Formatter(format).toSourceCode(matrix);
// may not compile because of packages not included in the distribution
- //htmlStrings[i] = org.apache.mahout.colt.matrixpattern.Converting.toHTML(strings[i]);
- //htmlSourceCodes[i] = org.apache.mahout.colt.matrixpattern.Converting.toHTML(sourceCodes[i]);
+ //htmlStrings[i] = org.apache.mahout.matrix.matrixpattern.Converting.toHTML(strings[i]);
+ //htmlSourceCodes[i] = org.apache.mahout.matrix.matrixpattern.Converting.toHTML(sourceCodes[i]);
}
System.out.println("original:\n"+new Formatter().toString(matrix));
@@ -372,10 +372,10 @@
* Demonstrates how to use this class.
*/
public static void demo3(int size, double value) {
- org.apache.mahout.colt.Timer timer = new org.apache.mahout.colt.Timer();
+ org.apache.mahout.matrix.Timer timer = new org.apache.mahout.matrix.Timer();
String s;
StringBuffer buf;
- DoubleMatrix2D matrix = org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(size,size, value);
+ DoubleMatrix2D matrix = org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(size,size, value);
timer.reset().start();
buf = new StringBuffer();
@@ -388,7 +388,7 @@
timer.stop().display();
timer.reset().start();
- org.apache.mahout.colt.matrix.impl.Former format = new org.apache.mahout.colt.matrix.impl.FormerFactory().create("%G");
+ org.apache.mahout.matrix.matrix.impl.Former format = new org.apache.mahout.matrix.matrix.impl.FormerFactory().create("%G");
buf = new StringBuffer();
for (int i=size; --i >= 0; ) {
for (int j=size; --j >= 0; ) {
@@ -435,7 +435,7 @@
//String[] columnNames = { "0.1", "0.3" };
//String[] rowNames = { "SunJDK1.2.2 classic", "IBMJDK1.1.8"};
-DoubleMatrix2D matrix = org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values);
+DoubleMatrix2D matrix = org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values);
System.out.println("\n\n"+new Formatter("%G").toTitleString(matrix,rowNames,columnNames,"rowAxis","colAxis","VM Performance: Provider vs. matrix density"));
}
/**
@@ -463,8 +463,8 @@
//String[] columnNames = { "0.1", "0.3" };
//String[] rowNames = { "SunJDK1.2.2 classic", "IBMJDK1.1.8"};
-System.out.println(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values));
-System.out.println(new Formatter("%G").toTitleString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,"vendor","density","title"));
+System.out.println(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values));
+System.out.println(new Formatter("%G").toTitleString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,"vendor","density","title"));
}
/**
* Demonstrates how to use this class.
@@ -492,10 +492,10 @@
//String[] columnNames = { "0.1", "0.3" };
//String[] rowNames = { "SunJDK1.2.2 classic", "IBMJDK1.1.8"};
-//System.out.println(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values));
-//System.out.println(new Formatter().toSourceCode(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values)));
-System.out.println(new Formatter().toString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values)));
-System.out.println(new Formatter().toTitleString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,"vendor","density","title"));
+//System.out.println(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values));
+//System.out.println(new Formatter().toSourceCode(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values)));
+System.out.println(new Formatter().toString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values)));
+System.out.println(new Formatter().toTitleString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,"vendor","density","title"));
}
/**
* Demonstrates how to use this class.
@@ -530,12 +530,12 @@
//String[] rowNames = { "SunJDK1.2.2 classic", "IBMJDK1.1.8", "SunJDK1.3 Hotspot", "other1", "other2", "mean", "median", "sum" };
//hep.aida.bin.BinFunction1D[] aggr = {F.mean, F.median, F.sum};
-//System.out.println(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values));
-//System.out.println(new Formatter().toSourceCode(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values)));
-//System.out.println(new Formatter().toString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values)));
-//System.out.println(new Formatter().toTitleString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title));
-//System.out.println(new Formatter(format).toTitleString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title, aggr));
-//System.out.println(org.apache.mahout.colt.matrixpattern.Converting.toHTML(new Formatter(format).toTitleString(org.apache.mahout.colt.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title, aggr)));
+//System.out.println(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values));
+//System.out.println(new Formatter().toSourceCode(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values)));
+//System.out.println(new Formatter().toString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values)));
+//System.out.println(new Formatter().toTitleString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title));
+//System.out.println(new Formatter(format).toTitleString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title, aggr));
+//System.out.println(org.apache.mahout.matrix.matrixpattern.Converting.toHTML(new Formatter(format).toTitleString(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.make(values),rowNames,columnNames,rowAxisName,columnAxisName,title, aggr)));
}
/**
* Converts a given cell to a String; no alignment considered.
@@ -680,7 +680,7 @@
//this.alignment = DECIMAL;
align(s);
//this.alignment = oldAlignment;
- return new org.apache.mahout.colt.matrix.objectalgo.Formatter().toTitleString(org.apache.mahout.colt.matrix.ObjectFactory2D.dense.make(s), rowNames,columnNames,rowAxisName,columnAxisName,title);
+ return new org.apache.mahout.matrix.matrix.objectalgo.Formatter().toTitleString(org.apache.mahout.matrix.matrix.ObjectFactory2D.dense.make(s), rowNames,columnNames,rowAxisName,columnAxisName,title);
}
/**
Same as <tt>toTitleString</tt> except that additionally statistical aggregates (mean, median, sum, etc.) of rows and columns are printed.
@@ -704,8 +704,8 @@
DoubleMatrix2D rowStats = matrix.like(matrix.rows(), aggr.length); // hold row aggregations
DoubleMatrix2D colStats = matrix.like(aggr.length, matrix.columns()); // hold column aggregations
- org.apache.mahout.colt.matrix.doublealgo.Statistic.aggregate(matrix, aggr, colStats); // aggregate an entire column at a time
- org.apache.mahout.colt.matrix.doublealgo.Statistic.aggregate(matrix.viewDice(), aggr, rowStats.viewDice()); // aggregate an entire row at a time
+ org.apache.mahout.matrix.matrix.doublealgo.Statistic.aggregate(matrix, aggr, colStats); // aggregate an entire column at a time
+ org.apache.mahout.matrix.matrix.doublealgo.Statistic.aggregate(matrix.viewDice(), aggr, rowStats.viewDice()); // aggregate an entire row at a time
// turn into strings
// tmp holds "matrix" plus "colStats" below (needed so that numbers in a columns can be decimal point aligned)
@@ -718,7 +718,7 @@
String[][] s2 = format(rowStats); align(s2); rowStats = null;
// copy strings into a large matrix holding the source matrix and all aggregations
- org.apache.mahout.colt.matrix.ObjectMatrix2D allStats = org.apache.mahout.colt.matrix.ObjectFactory2D.dense.make(matrix.rows()+aggr.length, matrix.columns()+aggr.length+1);
+ org.apache.mahout.matrix.matrix.ObjectMatrix2D allStats = org.apache.mahout.matrix.matrix.ObjectFactory2D.dense.make(matrix.rows()+aggr.length, matrix.columns()+aggr.length+1);
allStats.viewPart(0,0,matrix.rows()+aggr.length,matrix.columns()).assign(s1);
allStats.viewColumn(matrix.columns()).assign("|");
allStats.viewPart(0,matrix.columns()+1,matrix.rows(),aggr.length).assign(s2);
@@ -726,7 +726,7 @@
// append a vertical "|" separator plus names of aggregation functions to line holding columnNames
if (columnNames!=null) {
- org.apache.mahout.colt.list.ObjectArrayList list = new org.apache.mahout.colt.list.ObjectArrayList(columnNames);
+ org.apache.mahout.matrix.list.ObjectArrayList list = new org.apache.mahout.matrix.list.ObjectArrayList(columnNames);
list.add("|");
for (int i=0; i<aggr.length; i++) list.add(aggr[i].name()); // add names of aggregation functions
columnNames = new String[list.size()];
@@ -735,14 +735,14 @@
// append names of aggregation functions to line holding rowNames
if (rowNames!=null) {
- org.apache.mahout.colt.list.ObjectArrayList list = new org.apache.mahout.colt.list.ObjectArrayList(rowNames);
+ org.apache.mahout.matrix.list.ObjectArrayList list = new org.apache.mahout.matrix.list.ObjectArrayList(rowNames);
for (int i=0; i<aggr.length; i++) list.add(aggr[i].name()); // add names of aggregation functions
rowNames = new String[list.size()];
list.toArray(rowNames);
}
// turn large matrix into string
- String s = new org.apache.mahout.colt.matrix.objectalgo.Formatter().toTitleString(allStats, rowNames,columnNames,rowAxisName,columnAxisName,title);
+ String s = new org.apache.mahout.matrix.matrix.objectalgo.Formatter().toTitleString(allStats, rowNames,columnNames,rowAxisName,columnAxisName,title);
// insert a horizontal "----------------------" separation line above the column stats
// determine insertion position and line width
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Partitioning.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Partitioning.java?rev=883399&r1=883398&r2=883399&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Partitioning.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/doublealgo/Partitioning.java Mon Nov 23 16:34:55 2009
@@ -6,12 +6,12 @@
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
-package org.apache.mahout.colt.matrix.doublealgo;
+package org.apache.mahout.matrix.matrix.doublealgo;
-import org.apache.mahout.colt.Swapper;
-import org.apache.mahout.colt.function.IntComparator;
-import org.apache.mahout.colt.matrix.DoubleMatrix1D;
-import org.apache.mahout.colt.matrix.DoubleMatrix2D;
+import org.apache.mahout.matrix.Swapper;
+import org.apache.mahout.matrix.function.IntComparator;
+import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
+import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
/**
* Given some interval boundaries, partitions matrices such that cell values falling into an interval are placed next to each other.
* <p>
@@ -21,7 +21,7 @@
* Partitioning into k intervals is <tt>O( N * log(k))</tt>.
* Constants factors are minimized.
*
- * @see org.apache.mahout.colt.Partitioning "Partitioning arrays (provides more documentation)"
+ * @see org.apache.mahout.matrix.Partitioning "Partitioning arrays (provides more documentation)"
*
* @author wolfgang.hoschek@cern.ch
* @version 1.0, 09/24/99
@@ -36,7 +36,7 @@
*/
protected Partitioning() {}
/**
-Same as {@link org.apache.mahout.colt.Partitioning#partition(int[],int,int,int[],int,int,int[])}
+Same as {@link org.apache.mahout.matrix.Partitioning#partition(int[],int,int,int[],int,int,int[])}
except that it <i>synchronously</i> partitions the rows of the given matrix by the values of the given matrix column;
This is essentially the same as partitioning a list of composite objects by some instance variable;
In other words, two entire rows of the matrix are swapped, whenever two column values indicate so.
@@ -151,10 +151,10 @@
};
// generic partitioning does the main work of reordering row indexes
- org.apache.mahout.colt.Partitioning.genericPartition(rowFrom,rowTo,splitFrom,splitTo,splitIndexes,comp,comp2,comp3,swapper);
+ org.apache.mahout.matrix.Partitioning.genericPartition(rowFrom,rowTo,splitFrom,splitTo,splitIndexes,comp,comp2,comp3,swapper);
}
/**
-Same as {@link org.apache.mahout.colt.Partitioning#partition(int[],int,int,int[],int,int,int[])}
+Same as {@link org.apache.mahout.matrix.Partitioning#partition(int[],int,int,int[],int,int,int[])}
except that it <i>synchronously</i> partitions the rows of the given matrix by the values of the given matrix column;
This is essentially the same as partitioning a list of composite objects by some instance variable;
In other words, two entire rows of the matrix are swapped, whenever two column values indicate so.
@@ -317,7 +317,7 @@
}
// Find the splitter closest to the pivot, i.e. the splitter that best splits the list into two equal sized sublists.
- medianIndex = org.apache.mahout.colt.Sorting.binarySearchFromTo(splitters,column.getQuick(m),splitFrom,splitTo);
+ medianIndex = org.apache.mahout.matrix.Sorting.binarySearchFromTo(splitters,column.getQuick(m),splitFrom,splitTo);
if (medianIndex < 0) medianIndex = -medianIndex - 1; // not found
if (medianIndex > splitTo) medianIndex = splitTo; // not found, one past the end