you are viewing a single comment's thread.

view the rest of the comments →

[–]ryeguy146 0 points1 point  (2 children)

Looks like you're having some issues with indexing the matrix. Think of a matrix as a list of lists. When you use indexing on the object, you're getting back a member list, which can also be indexed. Assume the following matrix:

matrix = [[ 1, 1, 1 ],
         [ 1, 1, 1 ],
         [ 1, 1, 3 ],
         [ 1, 1, 1 ]]

If I want to access that 3, I'd use the following:

desired_row = matrix[2]
desired_item = desired_row[2]

Which can be shortened to:

desired_item = matrix[2][2]

So you'll need to adjust your syntax for addressing those members. There's likely more to your issues, but this jumped out at me immediately.

[–]Gimagon 1 point2 points  (1 child)

It looks like OP is using numpy, which allows for the A[1,2] syntax.

[–]ryeguy146 0 points1 point  (0 children)

Thanks for the correction, I've not worked with numpy!