[racket] Optimizations at the library level.

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Tue Aug 31 11:43:51 EDT 2010

One option is to define a 'minilanguage' for matrix manipulations, and 
implement it as a new bit of syntax that you can implement with 
"syntax-rules" or "syntax-case":

(matrixy (multiply (transpose A) B))

If you want something that doesn't require operations to be structured 
like this syntactically to optimize them, then two more options:

* Make your matrix objects be 'lazy' about the operations.  So, for 
example, instead of actually performing the transpose, you represent the 
input to the transpose and the fact that a transpose operation should be 
applied.  Then you represent that a multiply should be applied.  Then, 
when you finally want access actual numbers within a matrix object, you 
see the sequence of transformations at once and can choose an efficient 
algorithm.  The user of the matrix object does not need to know that 
this is happening.

* Implement a language that translates to Scheme after reasoning about 
data flow.

These are off-the-cuff.  I'm sure there are more ideas out there.


Posted on the users mailing list.