Python vs .Net

Greg Brunet gbrunet at nospamsempersoft.com
Wed Jan 8 21:23:27 CET 2003


> > Sorry - but my math is a bit rusty - wouldn't a matrix just be an
> array
> > of floats (or maybe complex numbers), that would seem to be a pretty
> > straightforward definition and one that wouldn't impose an undo
burden
> > on using the routine.
>
> A typical definition might be:
>
> typedef float[4][4] matrix
>
> But what if I want it to work with doubles? Or I do have a different
> implementation of matrix that uses a single array of 16 floating point
> types.

Brian:

I looking into it some more, and, even though I can use Singles where a
"ByVal" (value) function parameter calls for a Double, I can't do that
when it's "ByRef" (reference).  (I know that these are VB and not
generic terms, but you can probably catch their meaning).  Since I
expect that you're rotate function is operating on the matrix itself
instead of returning a new matrix, in VB I'd have to use ByRef - and
therefore would have to define both single and double versions of the
function.  There maybe some VB folks who understand this better than I
do and could come up with another solution, but I can't think of one
right now.

I am also curious how your matrix_rotate code could operate on both a
single and double-dimensioned array.  I would think that (in any
language) you would need to have some logic to find out how many
dimensions there are in order to process the information correctly.
Take care,

--
Greg






More information about the Python-list mailing list