Multik version
0.3.1
Module
multik-default or multik-openblas
Platform
JVM
Operating System
Linux
Description
When using the default or openblas module (on linux), matrix vecctor multiplication yields a corrupted vector when transposing the matrix first, especially if the matrix is not square.
Interestingly, this does not happen when importing the kotlin only module.
Reproducer
// in build.gradle.kts
dependencies {
implementation("org.jetbrains.kotlinx:multik-default:0.3.1")
// or
// implementation("org.jetbrains.kotlinx:multik-openblas:0.3.1")
// Compare this to
// implementation("org.jetbrains.kotlinx:multik-kotlin:0.3.1")
// when testing
}
// snippet to test
fun main() {
val m1 = mk.d2array<Float>(20, 1000) { Random.nextFloat() }
val v1 = mk.d1array<Float>(20) { Random.nextFloat() }
val bug = m1.transpose() dot v1
println(bug.shape.contentToString())
println("amount of NaNs: " + bug.count { isNaN(it) })
println("amount of zeroes: " + bug.count { it == 0f })
}
// This yields 20 NaNs, and 980 zeroes using default, but none of both on kotlin
Additional information
This also does not seem to happen when you reshape the vector as a Nx1 matrix first, but nonetheless it still deviates from expected behaviour.
Let me know if you need more infos to reproduce or similar, i was just certain that this should definitely not be expected
Multik version
0.3.1
Module
multik-default or multik-openblas
Platform
JVM
Operating System
Linux
Description
When using the default or openblas module (on linux), matrix vecctor multiplication yields a corrupted vector when transposing the matrix first, especially if the matrix is not square.
Interestingly, this does not happen when importing the kotlin only module.
Reproducer
Additional information
This also does not seem to happen when you reshape the vector as a Nx1 matrix first, but nonetheless it still deviates from expected behaviour.
Let me know if you need more infos to reproduce or similar, i was just certain that this should definitely not be expected