taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.49k stars 2.28k forks source link

ti.Matrix.Identity(), this function need a python-scope version. #4029

Open virgilwjj opened 2 years ago

virgilwjj commented 2 years ago

My code always to use temp mat4x4 in python scope, and I always to type below code:

m = ti.Matrix([
    [1.0, 0.0, 0.0, 0.0],
    [0.0, 1.0, 0.0, 0.0],
    [0.0, 0.0, 1.0, 0.0],
    [0.0, 0.0, 0.0, 1.0],
])

ti.Matrix.Identity(), only be allowed to use in taichi scope. 😭 ones(), zeros() also.

k-ye commented 2 years ago

Hi, could you be more specific about your use case a bit? Initialize matrices within Python, doing matrix computations?