diff --git a/math/src/main/codegen/breeze/linalg/operators/DenseMatrixOps.scala b/math/src/main/codegen/breeze/linalg/operators/DenseMatrixOps.scala index 070ed6fa9..99a0ed662 100644 --- a/math/src/main/codegen/breeze/linalg/operators/DenseMatrixOps.scala +++ b/math/src/main/codegen/breeze/linalg/operators/DenseMatrixOps.scala @@ -301,9 +301,9 @@ trait DenseMatrixMultiplyOps extends DenseMatrixExpandedOps with DenseMatrixMult // if we have a weird stride... val a: DenseMatrix[Double] = - if (_a.majorStride < math.max(if (_a.isTranspose) _a.cols else _a.rows, 1)) _a.copy else _a + if (_a.majorStride > math.max(if (_a.isTranspose) _a.cols else _a.rows, 1)) _a.copy else _a val b: DenseMatrix[Double] = - if (_b.majorStride < math.max(if (_b.isTranspose) _b.cols else _b.rows, 1)) _b.copy else _b + if (_b.majorStride > math.max(if (_b.isTranspose) _b.cols else _b.rows, 1)) _b.copy else _b blas.dgemm( transposeString(a), diff --git a/math/src/test/scala/breeze/linalg/DenseMatrixTest.scala b/math/src/test/scala/breeze/linalg/DenseMatrixTest.scala index e0d8047d7..421b9754c 100644 --- a/math/src/test/scala/breeze/linalg/DenseMatrixTest.scala +++ b/math/src/test/scala/breeze/linalg/DenseMatrixTest.scala @@ -846,6 +846,17 @@ class DenseMatrixTest extends AnyFunSuite with Checkers with DoubleImplicits wit assert(sm == sm.copy) } + test("#850 - transpose slice multiply bug") { + val Jɴ = DenseMatrix( (0.75, -0.25), (-0.25, 0.75)) + val matB = DenseMatrix( + (67.0, 33.0), + (69.0, 78.0), + (93.0, 57.0) + ).t + val B = matB(::, 1 until matB.cols) + Jɴ * B // should not crash + } + } trait MatrixTestUtils { diff --git a/math/src/test/scala/breeze/linalg/TextOperationsTest.scala b/math/src/test/scala/breeze/linalg/TextOperationsTest.scala index 680faf3c0..c9c2b497d 100644 --- a/math/src/test/scala/breeze/linalg/TextOperationsTest.scala +++ b/math/src/test/scala/breeze/linalg/TextOperationsTest.scala @@ -7,9 +7,10 @@ import org.scalatest.funsuite.AnyFunSuite * Created by Luca Puggini: lucapuggio@gmail.com on 19/02/16. */ class TextOperationsTest extends AnyFunSuite { + System.err.println(new File(".").getAbsolutePath) test("csvread and String2File methods") { // A csv file can be read both using the java File function and the toFile method of the string class - val file_path = if (new File(".").getAbsolutePath.endsWith("math/.")) { + val file_path = if (new File(".").getAbsolutePath.replace('\\', '/').endsWith("math/.")) { "src/test/resources/glass_data.txt" } else { "./math/src/test/resources/glass_data.txt" diff --git a/project/Build.scala b/project/Build.scala index 1ed6c5c13..c367ed3e2 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -13,7 +13,7 @@ object Common { } } - val buildCrossScalaVersions = Seq("3.1.3", "2.12.15", "2.13.8") + val buildCrossScalaVersions = Seq("3.4.2", "2.12.19", "2.13.14") lazy val buildScalaVersion = buildCrossScalaVersions.head