Skip to main content

New answers tagged

2 votes

Determinant of matrix Python

Please make sure to copy paste code you've written into your post. You're missing import copy and a ] in your ...
Teepeemm's user avatar
  • 767
2 votes

Determinant of matrix Python

What I am looking for specifically is how 3x3 matrices are calculated, as I feel there is a better way instead of creating three matrices separately and indexing them. I don't know, it looks ...
user555045's user avatar
  • 9,994
3 votes

Determinant of matrix Python

doctest Thank you for the beautiful doctests. I assume you're using $ python -m doctest *.py every now and again to ensure they don't bit rot. You might use fewer <...
J_H's user avatar
  • 29.3k
2 votes

Python matrix class

Caching results A very minor tip: you can cache the result of functions and re-qualify some class methods as properties. Caching is useful when dealing repeatedly with computationally intensive ...
Kate's user avatar
  • 6,983
5 votes

Python matrix class

This signature isn't very precise: class Matrix: def __init__(self, arrays: list[list]) -> None: list[list] means ...
InSync's user avatar
  • 219
7 votes

Python matrix class

pre-condition / class invariant ...
J_H's user avatar
  • 29.3k
10 votes
Accepted

Python matrix class

Transposes the current Matrix, modifying the underlying arrays object. You can do it that way. However, it commonly happens in linear algebra code (especially when transcribing formulas from math ...
user555045's user avatar
  • 9,994
7 votes

Python matrix class

I like your implementation, most of it looks good to me. The issues I see are only minor: 1. blank lines from PEP 8: Surround top-level function and class definitions with two blank lines. Here, I ...
Aemyl's user avatar
  • 760

Top 50 recent answers are included