Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange dot behaviour with row from a D2 array #153

Closed
davydes opened this issue Feb 17, 2023 · 3 comments
Closed

Strange dot behaviour with row from a D2 array #153

davydes opened this issue Feb 17, 2023 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@davydes
Copy link

davydes commented Feb 17, 2023

I faced with a bug, see below:

import org.jetbrains.kotlinx.multik.api.linalg.dot
import org.jetbrains.kotlinx.multik.api.mk
import org.jetbrains.kotlinx.multik.api.ndarray
import org.jetbrains.kotlinx.multik.ndarray.data.get

class Test {
  companion object {
    @JvmStatic
    fun main(args: Array<String>) {
      val v = mk.ndarray(mk[1.0, 1.0])
      val m = mk.ndarray(mk[mk[1.0, 2.0], mk[3.0, 4.0]])

      println("${m[0]} x $v = ${m[0] dot v}")
      println("${m[1]} x $v = ${m[1] dot v}")
    }
  }
}
[1.0, 2.0] x [1.0, 1.0] = 3.0
[3.0, 4.0] x [1.0, 1.0] = 3.0
@davydes davydes changed the title Stange dot behaviour with row from a D2 array Strange dot behaviour with row from a D2 array Feb 17, 2023
@devcrocod
Copy link
Collaborator

What exactly is wrong?

@davydes
Copy link
Author

davydes commented Feb 21, 2023

What does mean the result?
The first result is ok, the second is wrong [3.0, 4.0] x [1.0, 1.0] = 3 + 4 = 7

@devcrocod devcrocod added the bug Something isn't working label Feb 22, 2023
@devcrocod
Copy link
Collaborator

I didn't notice right away. This bug is due to incorrect stride in native code, in multik-kotlin it works correctly. I'll fix this bug and publish a new version of the library.

@devcrocod devcrocod added this to the 0.2.2 milestone Apr 25, 2023
@devcrocod devcrocod mentioned this issue May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants