[Bf-committers] Change Representation and Initialisation of Matrices to Conform with Standard Notation

Andrew Hale trumanblending at gmail.com
Fri Dec 9 16:01:17 CET 2011


Perhaps we could consider this as two separate proposals;

   1. Change the repr function for matrices so that they print columns as
   columns.
   2. Change how Python gets/sets data from C so that matrices in Python
   maintain the standard math notation of matrix[row][column]

The first should not effect any scripts as it only relates to printing in
the console but should hopefully decrease confusion with users. The second
will break compatibility for some scripts and so will require more
discussion.

Thanks,
Andrew

On Sat, Dec 10, 2011 at 12:27 AM, Domino Marama
<domino at dominodesigns.info>wrote:

> On Fri, 2011-12-09 at 23:57 +1100, Andrew Hale wrote:
> > Also, note that MatLab stores arrays in column major format but still
> uses
> > matrix[row, column] for indexing entries.
>
> numpy also uses row, column indexing
>
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.matrix.html
>
> >>> import numpy
> >>> m = numpy.matrix("1 2; 3 4; 5 6")
> >>> m
> matrix([[1, 2],
>        [3, 4],
>        [5, 6]])
> >>> m[0]
> matrix([[1, 2]])
> >>> m[0,1]
> 2
>
> This is the order I'd expect for any matrix implementation without
> reading any docs too..
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list