Python bug in my matrix class

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

32 Replies - 7678 Views - Last Post: 26 July 2012 - 04:05 PM Rate Topic: -----

#31 carnivroar  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 382
  • Joined: 18-September 11

Re: Python bug in my matrix class

Posted 24 July 2012 - 02:17 PM

Okay, thanks. I'm going to order this book. If you can recommend another one, let me know.

:withstupid:

I fixed it.

Still don't understand why my matrix keeps getting changed when I call the inverse() function.

Spoiler


I can now do this:

B = Matrix.identity(5)

A = B.identity()

And B should be equal to A but in order to make that possible I had to modify the identity() function... because Python doesn't allow function overloading. :dozingoff:

This post has been edited by carnivroar: 24 July 2012 - 02:30 PM

Was This Post Helpful? 0
  • +
  • -

#32 carnivroar  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 382
  • Joined: 18-September 11

Re: Python bug in my matrix class

Posted 24 July 2012 - 05:04 PM

Never mind, now I understand what you mean by copy. Rewrote my class to accept only arrays of Rationals.

LinearAlgebra.py:

Spoiler


Rational.py

Spoiler

This post has been edited by carnivroar: 24 July 2012 - 06:06 PM

Was This Post Helpful? 0
  • +
  • -

#33 carnivroar  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 382
  • Joined: 18-September 11

Re: Python bug in my matrix class

Posted 26 July 2012 - 04:05 PM

nvm

This post has been edited by carnivroar: 26 July 2012 - 05:01 PM

Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3