You write really verbose matlab if you could port it to C in just 6 times as many lines. One project I was on, we told the team in charge of the ROM how many SLOC we had, they multiplied by 18 bytes/SLOC and told us that's how much ROM we could use. We begged for 10x as much because we were using C++, not C as they had assumed, and thus we could express a lot more machine instructions in one line of code. Then, I got tasked with getting the code down to just 180 bytes per line -- eventually we got there.
One thing I should probably have thought of, but wasn't thinking it since I don't usually write this kind of code: if you're basically trolling through dense matrices and vectors, then, yeah, making lots of structures is pretty silly (except for error handling, but your competition isn't doing that, which makes me weep). It matters a lot more when you have complex data structures all linked together by pointers -- which is what I usually deal with. And once I've gone down that bridge, somewhere I probably needed a vector, and so I want your dense linear algebra function to be able to take that vector type instead of forcing me to copy it into an array.
no subject
Date: 2008-09-12 05:18 pm (UTC)One thing I should probably have thought of, but wasn't thinking it since I don't usually write this kind of code: if you're basically trolling through dense matrices and vectors, then, yeah, making lots of structures is pretty silly (except for error handling, but your competition isn't doing that, which makes me weep). It matters a lot more when you have complex data structures all linked together by pointers -- which is what I usually deal with. And once I've gone down that bridge, somewhere I probably needed a vector, and so I want your dense linear algebra function to be able to take that vector type instead of forcing me to copy it into an array.