So the sparse matrix implementation has begun (and almost ended). In the spirit of python I decided to try using python's built-in dictionaries for my sparse matrix implementation.
With limited experience in deep OOP, I've had to quickly learn the subtleties of OOP. The nature of scope really comes into play in a way that can be quite annoying.
*edit* 2 hours later, I have tasted it and it tastes good.
Monday, June 25, 2007
Tuesday, June 19, 2007
Circular imports
So in moving a function to solvers.py, I recently came across an interesting phenomenon in python. It's very well-illustrated here:
http://www.thescripts.com/forum/thread22561.html
It boils down to the fact that you can't do circular imports except in a specific manner. Now, I'm not one for hacking around this specific type of behaviour - I think you can just restructure the code so as not to do this - but what is the reasoning for why this works with "import *" but not with "from * import *". Interesting....
- C
http://www.thescripts.com/forum/thread22561.html
It boils down to the fact that you can't do circular imports except in a specific manner. Now, I'm not one for hacking around this specific type of behaviour - I think you can just restructure the code so as not to do this - but what is the reasoning for why this works with "import *" but not with "from * import *". Interesting....
- C
Thursday, June 14, 2007
Getting into the groove
Looks like I'm finally getting the hang of this project. The functionality is coming along nicely. Most of my first week was spent putting together some new manipulation functions including matrix slicing (i.e. a submatrix operator like M[0:2,:]). You can also assign values too which is handly.
This week has been focused on LU decomposition and making a solver for that (which will also yield a nice matrix inverter). I think I've finally got the pivoting working properly so I'm glad for that.
As someone who didn't do a terrible amount of coding as a undergrad I have to say that I finally see the appeal of the whole process.
Hope things are going well for the other SOC'ers,
Chris
This week has been focused on LU decomposition and making a solver for that (which will also yield a nice matrix inverter). I think I've finally got the pivoting working properly so I'm glad for that.
As someone who didn't do a terrible amount of coding as a undergrad I have to say that I finally see the appeal of the whole process.
Hope things are going well for the other SOC'ers,
Chris
Subscribe to:
Posts (Atom)