This is an automated email from the git hooks/post-receive script. tmancill pushed a commit to branch master in repository jblas.
commit 0d8b916229fb6d45f619e7c1bd0f8369d59a9c13 Author: tony mancill <[email protected]> Date: Tue Dec 31 15:19:21 2013 -0800 Imported Upstream version 1.1.1 --- Makefile | 2 +- README | 1 + RELEASE_NOTES | 12 ++++++++ build.xml | 2 +- src/org/jblas/ComplexDouble.java | 17 +++++++++-- src/org/jblas/ComplexDoubleMatrix.java | 52 ++++++++++++++++++++++++++-------- src/org/jblas/ComplexFloat.java | 17 +++++++++-- src/org/jblas/ComplexFloatMatrix.java | 52 ++++++++++++++++++++++++++-------- src/org/jblas/DoubleMatrix.java | 27 ++++++++++++++++-- src/org/jblas/Eigen.java | 4 +-- src/org/jblas/FloatMatrix.java | 27 ++++++++++++++++-- 11 files changed, 175 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index ba3a80e..19e07cd 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ## --- END LICENSE BLOCK --- -VERSION=1.1 +VERSION=1.1.1 ###################################################################### # diff --git a/README b/README index 739184f..aaffcba 100644 --- a/README +++ b/README @@ -1,6 +1,7 @@ jblas is a matrix library for Java which uses existing high performance BLAS and LAPACK libraries like ATLAS. +Version 1.1.1 Version 1.1, August 16, 2010 Version 1.0.2, February 26, 2010 Version 1.0.1, January 14, 2010 diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 9b5276d..0e627c6 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,3 +1,15 @@ +Release 1.1.1 + +Mostly bug fixes + +- remove spurious System.out.print in complex eigenvector routine. +- fixed get with ranges +- added some more variants of get with ranges +- added more functions to complex data types (in particular sqrt()) +- added hermitian() to Complex matrices to compute conjugate transposes. + +---------------------------------------------------------------------- + Release 1.1 - August 16, 2010 Added Singular Value Decomposition, some bugfixes diff --git a/build.xml b/build.xml index 02b2417..f02e923 100644 --- a/build.xml +++ b/build.xml @@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <!-- Define directories --> - <property name="version" value="1.1" /> + <property name="version" value="1.1.1" /> <property name="src" value="${basedir}/src" /> <property name="test" value="${basedir}/test" /> <property name="bin" value="${basedir}/bin" /> diff --git a/src/org/jblas/ComplexDouble.java b/src/org/jblas/ComplexDouble.java index 2f0664f..9656588 100644 --- a/src/org/jblas/ComplexDouble.java +++ b/src/org/jblas/ComplexDouble.java @@ -36,8 +36,6 @@ package org.jblas; -import static java.lang.Math.sqrt; - import java.nio.DoubleBuffer; /** @@ -255,7 +253,12 @@ public class ComplexDouble { /** Return the absolute value */ public double abs() { - return (double) sqrt(r * r + i * i); + return (double) Math.sqrt(r * r + i * i); + } + + /** Returns the argument of a complex number. */ + public double arg() { + return (double) Math.acos(r/abs()); } public ComplexDouble invi() { @@ -287,6 +290,14 @@ public class ComplexDouble { public ComplexDouble conj() { return dup().conji(); } + + public ComplexDouble sqrt() { + double a = abs(); + double s2 = (double)Math.sqrt(2); + double p = (double)Math.sqrt(a + r)/s2; + double q = (double)Math.sqrt(a - r)/s2 * Math.signum(i); + return new ComplexDouble(p, q); + } /** * Comparing two DoubleComplex values. diff --git a/src/org/jblas/ComplexDoubleMatrix.java b/src/org/jblas/ComplexDoubleMatrix.java index 4c7fe85..433e2d8 100644 --- a/src/org/jblas/ComplexDoubleMatrix.java +++ b/src/org/jblas/ComplexDoubleMatrix.java @@ -583,14 +583,44 @@ public class ComplexDoubleMatrix { /** Return transposed copy of this matrix */ public ComplexDoubleMatrix transpose() { ComplexDoubleMatrix result = new ComplexDoubleMatrix(columns, rows); - + + ComplexDouble c = new ComplexDouble(0); + for (int i = 0; i < rows; i++) for (int j = 0; j < columns; j++) - result.put(j, i, get(i, j)); + result.put(j, i, get(i, j, c)); return result; } - + + public ComplexDoubleMatrix hermitian() { + ComplexDoubleMatrix result = new ComplexDoubleMatrix(columns, rows); + + ComplexDouble c = new ComplexDouble(0); + + for (int i = 0; i < rows; i++) + for (int j = 0; j < columns; j++) + result.put(j, i, get(i, j, c).conji()); + return result; + } + + /** + * Compute complex conjugate (in-place). + */ + public ComplexDoubleMatrix conji() { + ComplexDouble c = new ComplexDouble(0.0); + for (int i = 0; i < length; i++) + put(i, get(i, c).conji()); + return this; + } + + /** + * Compute complex conjugate. + */ + public ComplexDoubleMatrix conj() { + return dup().conji(); + } + /** Compare two matrices. * @param o Object to compare to @@ -735,6 +765,11 @@ public class ComplexDoubleMatrix { int i = 2*index(rowIndex, columnIndex); return new ComplexDouble(data[i], data[i+1]); } + + /** Get matrix element, passing the variable to store the result. */ + public ComplexDouble get(int rowIndex, int columnIndex, ComplexDouble result) { + return get(index(rowIndex, columnIndex)); + } public DoubleMatrix getReal() { DoubleMatrix result = new DoubleMatrix(rows, columns); @@ -1206,13 +1241,6 @@ public class ComplexDoubleMatrix { public ComplexDoubleMatrix truth() { return dup().truthi(); } - - public ComplexDoubleMatrix conji() { - ComplexDouble c = new ComplexDouble(0.0); - for (int i = 0; i < length; i++) - put(i, get(i, c).conji()); - return this; - } /**************************************************************** * Rank one-updates @@ -1269,12 +1297,12 @@ public class ComplexDoubleMatrix { return sum().div((double)length); } - /* computes this^T * other */ + /** Computes this^T * other */ public ComplexDouble dotc(ComplexDoubleMatrix other) { return SimpleBlas.dotc(this, other); } - /* computs this^H * other */ + /** Computes this^H * other */ public ComplexDouble dotu(ComplexDoubleMatrix other) { return SimpleBlas.dotu(this, other); } diff --git a/src/org/jblas/ComplexFloat.java b/src/org/jblas/ComplexFloat.java index a44301a..c8538ab 100644 --- a/src/org/jblas/ComplexFloat.java +++ b/src/org/jblas/ComplexFloat.java @@ -36,8 +36,6 @@ package org.jblas; -import static java.lang.Math.sqrt; - import java.nio.FloatBuffer; /** @@ -255,7 +253,12 @@ public class ComplexFloat { /** Return the absolute value */ public float abs() { - return (float) sqrt(r * r + i * i); + return (float) Math.sqrt(r * r + i * i); + } + + /** Returns the argument of a complex number. */ + public float arg() { + return (float) Math.acos(r/abs()); } public ComplexFloat invi() { @@ -287,6 +290,14 @@ public class ComplexFloat { public ComplexFloat conj() { return dup().conji(); } + + public ComplexFloat sqrt() { + float a = abs(); + float s2 = (float)Math.sqrt(2); + float p = (float)Math.sqrt(a + r)/s2; + float q = (float)Math.sqrt(a - r)/s2 * Math.signum(i); + return new ComplexFloat(p, q); + } /** * Comparing two DoubleComplex values. diff --git a/src/org/jblas/ComplexFloatMatrix.java b/src/org/jblas/ComplexFloatMatrix.java index 9bb8a8f..271a2b7 100644 --- a/src/org/jblas/ComplexFloatMatrix.java +++ b/src/org/jblas/ComplexFloatMatrix.java @@ -583,14 +583,44 @@ public class ComplexFloatMatrix { /** Return transposed copy of this matrix */ public ComplexFloatMatrix transpose() { ComplexFloatMatrix result = new ComplexFloatMatrix(columns, rows); - + + ComplexFloat c = new ComplexFloat(0); + for (int i = 0; i < rows; i++) for (int j = 0; j < columns; j++) - result.put(j, i, get(i, j)); + result.put(j, i, get(i, j, c)); return result; } - + + public ComplexFloatMatrix hermitian() { + ComplexFloatMatrix result = new ComplexFloatMatrix(columns, rows); + + ComplexFloat c = new ComplexFloat(0); + + for (int i = 0; i < rows; i++) + for (int j = 0; j < columns; j++) + result.put(j, i, get(i, j, c).conji()); + return result; + } + + /** + * Compute complex conjugate (in-place). + */ + public ComplexFloatMatrix conji() { + ComplexFloat c = new ComplexFloat(0.0f); + for (int i = 0; i < length; i++) + put(i, get(i, c).conji()); + return this; + } + + /** + * Compute complex conjugate. + */ + public ComplexFloatMatrix conj() { + return dup().conji(); + } + /** Compare two matrices. * @param o Object to compare to @@ -735,6 +765,11 @@ public class ComplexFloatMatrix { int i = 2*index(rowIndex, columnIndex); return new ComplexFloat(data[i], data[i+1]); } + + /** Get matrix element, passing the variable to store the result. */ + public ComplexFloat get(int rowIndex, int columnIndex, ComplexFloat result) { + return get(index(rowIndex, columnIndex)); + } public FloatMatrix getReal() { FloatMatrix result = new FloatMatrix(rows, columns); @@ -1206,13 +1241,6 @@ public class ComplexFloatMatrix { public ComplexFloatMatrix truth() { return dup().truthi(); } - - public ComplexFloatMatrix conji() { - ComplexFloat c = new ComplexFloat(0.0f); - for (int i = 0; i < length; i++) - put(i, get(i, c).conji()); - return this; - } /**************************************************************** * Rank one-updates @@ -1269,12 +1297,12 @@ public class ComplexFloatMatrix { return sum().div((float)length); } - /* computes this^T * other */ + /** Computes this^T * other */ public ComplexFloat dotc(ComplexFloatMatrix other) { return SimpleBlas.dotc(this, other); } - /* computs this^H * other */ + /** Computes this^H * other */ public ComplexFloat dotu(ComplexFloatMatrix other) { return SimpleBlas.dotu(this, other); } diff --git a/src/org/jblas/DoubleMatrix.java b/src/org/jblas/DoubleMatrix.java index 03ba9d3..b1bf24a 100644 --- a/src/org/jblas/DoubleMatrix.java +++ b/src/org/jblas/DoubleMatrix.java @@ -645,8 +645,8 @@ public class DoubleMatrix implements Serializable { cs.init(0, columns); DoubleMatrix result = new DoubleMatrix(rs.length(), cs.length()); - for (; !rs.hasMore(); rs.next()) { - for (; !cs.hasMore(); cs.next()) { + for (; rs.hasMore(); rs.next()) { + for (; cs.hasMore(); cs.next()) { result.put(rs.index(), cs.index(), get(rs.value(), cs.value())); } } @@ -654,6 +654,29 @@ public class DoubleMatrix implements Serializable { return result; } + public DoubleMatrix get(Range rs, int c) { + rs.init(0, rows); + DoubleMatrix result = new DoubleMatrix(rs.length(), 1); + + for (; rs.hasMore(); rs.next()) { + result.put(rs.index(), 0, get(rs.value(), c)); + } + + return result; + } + + public DoubleMatrix get(int r, Range cs) { + cs.init(0, columns); + DoubleMatrix result = new DoubleMatrix(1, cs.length()); + + for (; cs.hasMore(); cs.next()) { + result.put(0, cs.index(), get(r, cs.value())); + } + + return result; + + } + /** Get elements specified by the non-zero entries of the passed matrix. */ public DoubleMatrix get(DoubleMatrix indices) { return get(indices.findIndices()); diff --git a/src/org/jblas/Eigen.java b/src/org/jblas/Eigen.java index 1eb9e09..7e5de6e 100644 --- a/src/org/jblas/Eigen.java +++ b/src/org/jblas/Eigen.java @@ -99,7 +99,7 @@ public class Eigen { // transferring the result ComplexDoubleMatrix E = new ComplexDoubleMatrix(WR, WI); ComplexDoubleMatrix V = new ComplexDoubleMatrix(A.rows, A.rows); - System.err.printf("VR = %s\n", VR.toString()); + //System.err.printf("VR = %s\n", VR.toString()); for (int i = 0; i < A.rows; i++) { if (E.get(i).isReal()) { V.putColumn(i, new ComplexDoubleMatrix(VR.getColumn(i))); @@ -172,7 +172,7 @@ public class Eigen { // transferring the result ComplexFloatMatrix E = new ComplexFloatMatrix(WR, WI); ComplexFloatMatrix V = new ComplexFloatMatrix(A.rows, A.rows); - System.err.printf("VR = %s\n", VR.toString()); + //System.err.printf("VR = %s\n", VR.toString()); for (int i = 0; i < A.rows; i++) { if (E.get(i).isReal()) { V.putColumn(i, new ComplexFloatMatrix(VR.getColumn(i))); diff --git a/src/org/jblas/FloatMatrix.java b/src/org/jblas/FloatMatrix.java index 6dac014..0e381a1 100644 --- a/src/org/jblas/FloatMatrix.java +++ b/src/org/jblas/FloatMatrix.java @@ -645,8 +645,8 @@ public class FloatMatrix implements Serializable { cs.init(0, columns); FloatMatrix result = new FloatMatrix(rs.length(), cs.length()); - for (; !rs.hasMore(); rs.next()) { - for (; !cs.hasMore(); cs.next()) { + for (; rs.hasMore(); rs.next()) { + for (; cs.hasMore(); cs.next()) { result.put(rs.index(), cs.index(), get(rs.value(), cs.value())); } } @@ -654,6 +654,29 @@ public class FloatMatrix implements Serializable { return result; } + public FloatMatrix get(Range rs, int c) { + rs.init(0, rows); + FloatMatrix result = new FloatMatrix(rs.length(), 1); + + for (; rs.hasMore(); rs.next()) { + result.put(rs.index(), 0, get(rs.value(), c)); + } + + return result; + } + + public FloatMatrix get(int r, Range cs) { + cs.init(0, columns); + FloatMatrix result = new FloatMatrix(1, cs.length()); + + for (; cs.hasMore(); cs.next()) { + result.put(0, cs.index(), get(r, cs.value())); + } + + return result; + + } + /** Get elements specified by the non-zero entries of the passed matrix. */ public FloatMatrix get(FloatMatrix indices) { return get(indices.findIndices()); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jblas.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

