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

[Feature Request] diagonal= #190

Open
kojix2 opened this issue Jul 4, 2021 · 1 comment
Open

[Feature Request] diagonal= #190

kojix2 opened this issue Jul 4, 2021 · 1 comment

Comments

@kojix2
Copy link
Contributor

kojix2 commented Jul 4, 2021

Expected behavior

a = Numo::Int32.new(3,3).seq
a.diagonal = 0
a
# [[0, 1, 2], 
#  [3, 0, 5], 
#  [6, 7, 0]]

Actual behavior

Error

(irb):4:in `<main>': undefined method `diagonal=' for Numo::Int32#shape=[3,3] (NoMethodError)
[[0, 1, 2], 
 [3, 4, 5], 
 [6, 7, 8]]:Numo::Int32
Did you mean?  diagonal

workaround

a = Numo::Int32.new(3,3).seq
b = a.diagonal
b.store 0
a
# [[0, 1, 2], 
#  [3, 0, 5], 
#  [6, 7, 0]]
@kojix2
Copy link
Contributor Author

kojix2 commented Jul 10, 2021

hmm,

a = Numo::Int32.new(3,3).seq
a.diagonal.fill(0)

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

No branches or pull requests

1 participant