#Elementwise addition of two matrices

3 messages · Page 1 of 1 (latest)

hoary fractalBOT
#

This post has been reserved for your question.

Hey @latent linden! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

valid abyss
#

If you debug this code you will realize that matrix.array[i][j] and this.array[i][j] always hold the same value. This is because your array variable is class level instead of instance level. So when you change the value of the array field in one instance it also changes it in all the other instances. You can resolve this by removing the static keyword.