Fix EJML to properly treat vectors as columns

This commit is contained in:
Alexander Nozik 2024-12-24 13:43:41 +03:00
parent 3aa387c544
commit cd46773f43

View File

@ -21,7 +21,7 @@ internal class EjmlVectorTest {
private val randomMatrix: DMatrixRMaj private val randomMatrix: DMatrixRMaj
get() { get() {
val d = DMatrixRMaj(1, random.nextInt(2, 100)) val d = DMatrixRMaj(random.nextInt(2, 100), 1)
RandomMatrices_DDRM.fillUniform(d, random.asJavaRandom()) RandomMatrices_DDRM.fillUniform(d, random.asJavaRandom())
return d return d
} }
@ -30,7 +30,7 @@ internal class EjmlVectorTest {
fun size() { fun size() {
val m = randomMatrix val m = randomMatrix
val w = EjmlDoubleVector(m) val w = EjmlDoubleVector(m)
assertEquals(m.numCols, w.size) assertEquals(m.numRows, w.size)
} }
@Test @Test
@ -46,7 +46,7 @@ internal class EjmlVectorTest {
val w = EjmlDoubleVector(m) val w = EjmlDoubleVector(m)
assertEquals( assertEquals(
m.iterator(true, 0, 0, 0, m.numCols - 1).asSequence().toList(), m.iterator(true, 0, 0, m.numRows - 1, 0).asSequence().toList(),
w.iterator().asSequence().toList() w.iterator().asSequence().toList()
) )
} }