jblas-project / jblas

Linear Algebra for Java
http://jblas.org
BSD 3-Clause "New" or "Revised" License
590 stars 149 forks source link

Logical error of function nei #123

Closed yanmingsohu closed 3 years ago

yanmingsohu commented 3 years ago

main/java/org/jblas/ComplexDoubleMatrix.java 1906 and 1922:

     public ComplexDoubleMatrix nei(ComplexDoubleMatrix other, ComplexDoubleMatrix result) {
        if (other.isScalar())
           return nei(other.scalar(), result);

        assertSameLength(other);
        ensureResultLength(other, result);

                ComplexDouble c1 = new ComplexDouble(0.0);
                ComplexDouble c2 = new ComplexDouble(0.0);

                for (int i = 0; i < length; i++)
                    result.put(i, get(i, c1).eq(other.get(i, c2)) ? 1.0 : 0.0); !!!!!! here, call ne() ?!
       return result;
     }
mikiobraun commented 3 years ago

Nice one! You are right.

Do you want to prepare a PR?

If not I can also fix it, let me know!

yanmingsohu commented 3 years ago

Nice one! You are right.

Do you want to prepare a PR?

If not I can also fix it, let me know!

could you fix it please