[Lang] Replace internal representation of Python-scope ti.Matrix with numpy arrays #7559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #7447
Brief Summary
This PR corresponds to step 3 of #7447. The code paths in
matrix.py
andops.py
have been significantly simplified:Matrix
class, which is for Python scope, now only contains two cases, numpy arrays for values and nested lists for host access ofSNode
/Ndarray
. Redundant internal functions have been removed.dt
now has effects because numpy arrays have types.element_wise_xxx
,uniform_matrix_inputs
and@unary, @binary
decorators. The full dispatching logic for ops is in unique entrances_unary_operation/_binary_operation
.Note that Python-scope matrix slicing is temporarily disabled in this PR because the feature itself is incomplete - only read is supported. It can be re-supported in a better way in the future. Taichi-scope matrix slicing still works properly.