[Numpy-discussion] numpy pprint?

Robert Kern robert.kern at gmail.com
Tue Nov 6 15:11:13 EST 2018


On Tue, Nov 6, 2018 at 6:43 AM Charles R Harris <charlesr.harris at gmail.com>
wrote:

>
> On Tue, Nov 6, 2018 at 3:56 AM Foad Sojoodi Farimani <
> f.s.farimani at gmail.com> wrote:
>
>> Dear András,
>>
>> Try those different option in MATLAB for example. or
>> Octave/Scilab/Sympy-Matrix... they are all the same.
>>
>
Of course, these are all systems with a focus on matrices per se rather
than general arrays. They take liberties with non-2-dim arrays that make
sense if the focus is on treating 2-dim arrays as matrices. One of the
motivating reason's for numpy's early development (as Numeric) was to get
away from those assumptions and limitations and be a general array
processing system. Part of the reason that we choose the terminology
"multidimensional array" is to emphasize those differences.


> The term "multidimensional arrays"  is a little bit vague. one might think
>> of multidimensional matrices ( I don't think there is such a thing in math)
>> if coming from MATLAB. I also think the row-major column major terminology
>> is confusing. there are no rows or columns for that matter.
>>
>
Granted, but it's long-established terminology, and not actually important
for a user to know unless if someone is working in C with a flat
representation of the allocated memory.


> Numpy ndarrays are homogeneous, uniform nested lists. one can represent
>> different layers of this list in different ways using rows or columns.
>>
>
You have to be careful here as well. "list" also has semantic baggage. Data
structures are generally only called "lists" in a wide variety of
programming languages if they have cheap appends and other such mutation
operations. numpy arrays don't (as well as the things that we call "arrays"
in FORTRAN and C/C++ that are distinct from what we would call "lists" in
those languages).

Please be assured that "multidimensional array" is terminology that we
didn't make up. It does derive from a tradition of mathematical programming
in FORTRAN and C and makes meaningful semantic distinctions within that
tradition. There are other traditions, and we might well have settled on
different terminology if we had derived from those. We do expect people to
come from a variety of traditions and have a period of adjustment as they
learn some new terminology. That's perfectly reasonable, which is good,
because it is entirely unavoidable. There isn't a universal set of
terminology that's going to work with everyone's experience out of the gate.

I think the current popular terminology is `tensors` for `multidimensional
> arrays`. Note that matrices are a different type of object.
>

Popular, but quite misleading, in the same way that not every 2-dim array
is a matrix. As someone who works on tensor machine learning methods once
complained to me.

-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181106/c8f1b65b/attachment.html>


More information about the NumPy-Discussion mailing list