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

Incorrct matrix multiplication : same value different type get different result #8503

Open
thematteroftime opened this issue Apr 1, 2024 · 0 comments

Comments

@thematteroftime
Copy link

Describe the bug
same matrix multiply same value with different type, one is int the other is float, but get different result

To Reproduce

import taichi as ti

arch = ti.cpu
ti.init(arch=arch)
n = 4
K = ti.linalg.SparseMatrixBuilder(n, n, max_num_triplets=100)


@ti.kernel
def fill(A: ti.types.sparse_matrix_builder()):
    for i in range(n):
        A[i, i] += 1


fill(K)
K.print_triplets()
A = K.build()

print("----------------")
print(A * 3)
print("----------------")
print(A * 3.0)

Log/Screenshots

$ python my_sample_code.py
[Taichi] version 1.7.0, llvm 15.0.1, commit 2fd24490, win, python 3.9.18
[Taichi] Starting on arch=x64
n=4, m=4, num_triplets=4 (max=100)
[0, 0] = 1.0
[1, 1] = 1.0
[2, 2] = 1.0
[3, 3] = 1.0
----------------
None
----------------
[3, 0, 0, 0]
[0, 3, 0, 0]
[0, 0, 3, 0]
[0, 0, 0, 3]
...

hope this issue will be fixed well
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant