sawyl: (Default)
[personal profile] sawyl
Implementing what should have been a relatively straightforward bit of mathematics, I was completely baffled by its obvious inability to produce the right results. I checked the array indices for Obi-Wan errors and scrutinised the logic of the logic of the tests, but everything appeared to be working as expected. So, suspecting a higher order problem, I went away and chased down another description of the algorithm and suddenly the root cause was obvious: the browser had incorrectly rendered a minus sign in one of the equations in the first description (the sign was there when I checked the page source) and as result I'd multiplied the terms instead of subtracting them...

ETA: Embarrassingly, the fancy version of the algorithm runs at around a third of the speed of the simple one it was supposed to replace. So, like bad workmen the world over, I'm going to blame my tools: in this case python's less than stellar numerical performance. Maybe, if I can be bothered, I'll drop the core code into C or Fortran just to see what happens...

ETA 2: I was right: shifting the heavy lifting into C makes the fancy version of the algorithm outperform the naive one by an order of magnitude. And as a biproduct, it also makes it trivially easy to massively reduce the memory footprint by switching the primary data structure from a python list to a series of bit fields. Excelsior!
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 06:45 am
Powered by Dreamwidth Studios