From: Bill B. <wb...@gm...> - 2006-08-24 04:41:55
|
On 8/24/06, Sebastian Haase <ha...@ms...> wrote: > > > I'm not sure what this question is asking, so I'll answer what I think > > it is asking. > > > > The mean, min, max, and average functions are *not* ufuncs. They are > > methods of particular ufuncs. > > > Yes - that's what wanted to hear ! I'm just trying to bring in the > "user's" point of view: Not thinking about how they are implemented > under the hood: mean,min,max,average have a very similar "feeling" to > them as "abs". While we're on the subject of the "user's" point of view, the term "ufunc" is not very new-user friendly, yet it gets slung around fairly often. I'm not sure what to do about it exactly, but maybe for starters it would be nice to add a concise definition of "ufunc" to the numpy glossary: http://www.scipy.org/Numpy_Glossary. Can anyone come up with such a definition? Here's my stab at it: ufunc: A function that operates element-wise on arrays. But I have a feeling there's more to it than that. --bb |
From: Sasha <nd...@ma...> - 2006-08-24 13:27:57
|
On 8/24/06, Bill Baxter <wb...@gm...> wrote: >[snip] it would be > nice to add a concise definition of "ufunc" to the numpy glossary: > http://www.scipy.org/Numpy_Glossary. > done > Can anyone come up with such a definition? I copied the definition from the old Numeric manual. > Here's my stab at it: > > ufunc: A function that operates element-wise on arrays. > This is not entirely correct. Ufuncs operate on anything that can be passed to asarray: arrays, python lists, tuples or scalars. |
From: Bill B. <wb...@gm...> - 2006-08-25 00:39:57
|
On 8/24/06, Sasha <nd...@ma...> wrote: > On 8/24/06, Bill Baxter <wb...@gm...> wrote: > >[snip] it would be > > nice to add a concise definition of "ufunc" to the numpy glossary: > > http://www.scipy.org/Numpy_Glossary. > > > > done > > > Can anyone come up with such a definition? > > I copied the definition from the old Numeric manual. > > > Here's my stab at it: > > > > ufunc: A function that operates element-wise on arrays. > > > This is not entirely correct. Ufuncs operate on anything that can be > passed to asarray: arrays, python lists, tuples or scalars. Hey Sasha. Your defnition may be more correct, but I have to confess I don't understand it. "Universal function. Universal functions follow similar rules for broadcasting, coercion and "element-wise operation"." What is "coercion"? (Who or what is being coerced to do what?) and what does it mean to "follow similar rules for ... coercion"? Similar to what? --bill |
From: Sasha <nd...@ma...> - 2006-08-25 03:10:29
|
On 8/24/06, Bill Baxter <wb...@gm...> wrote: [snip] > Hey Sasha. Your defnition may be more correct, but I have to confess > I don't understand it. > > "Universal function. Universal functions follow similar rules for > broadcasting, coercion and "element-wise operation"." > > What is "coercion"? (Who or what is being coerced to do what?) and > what does it mean to "follow similar rules for ... coercion"? Similar > to what? This is not my definition, I just rephrased the introductory paragraph from the ufunc section of the "Numerical Python" <http://numpy.scipy.org/numpydoc/numpy-7.html#pgfId-36127>. Feel free to edit it so that it makes more sense. Please note that I originally intended the "Numpy Glossary" not as a place to learn new terms, but as a guide for those who know more than one meaning of the terms or more than one way to call something. (See the preamble.) This may explain why I did not include "ufunc" to begin with. (I remember deciding not to include "ufunc", but I don't remember the exact reason anymore.) I would welcome an effort to make the glossary more novice friendly, but not at the expense of oversimplifying things. BTW, do you think "Rank ... (2) number of orthogonal dimensions of a matrix" is clear? Considering that matrix is defined a "an array of rank 2"? Is "rank" in linear algebra sense common enough in numpy documentation to be included in the glossary? For comparison, here are a few alternative formulations of matrix rank definition: "The rank of a matrix or a linear map is the dimension of the image of the matrix or the linear map, corresponding to the number of linearly independent rows or columns of the matrix, or to the number of nonzero singular values of the map." <http://mathworld.wolfram.com/MatrixRank.html> "In linear algebra, the column rank (row rank respectively) of a matrix A with entries in some field is defined to be the maximal number of columns (rows respectively) of A which are linearly independent." <http://en.wikipedia.org/wiki/Rank_(linear_algebra)> |
From: Stefan v. d. W. <st...@su...> - 2006-08-25 07:45:41
|
On Thu, Aug 24, 2006 at 11:10:24PM -0400, Sasha wrote: > I would welcome an effort to make the glossary more novice friendly, > but not at the expense of oversimplifying things. >=20 > BTW, do you think "Rank ... (2) number of orthogonal dimensions of a > matrix" is clear? Considering that matrix is defined a "an array of > rank 2"? Is "rank" in linear algebra sense common enough in numpy > documentation to be included in the glossary? >=20 > For comparison, here are a few alternative formulations of matrix rank > definition: >=20 > "The rank of a matrix or a linear map is the dimension of the image of > the matrix or the linear map, corresponding to the number of linearly > independent rows or columns of the matrix, or to the number of nonzero > singular values of the map." > <http://mathworld.wolfram.com/MatrixRank.html> >=20 > "In linear algebra, the column rank (row rank respectively) of a > matrix A with entries in some field is defined to be the maximal > number of columns (rows respectively) of A which are linearly > independent." > <http://en.wikipedia.org/wiki/Rank_(linear_algebra)> I prefer the last definition. Introductory algebra courses teach the term "linearly independent" before "orthogonal" (IIRC). As for "linear map", it has other names, too, and doesn't (in my mind) clarify the definition of rank in this context. Regards St=E9fan |
From: Charles R H. <cha...@gm...> - 2006-08-25 13:34:23
|
Hi, On 8/25/06, Stefan van der Walt <st...@su...> wrote: > > On Thu, Aug 24, 2006 at 11:10:24PM -0400, Sasha wrote: > > I would welcome an effort to make the glossary more novice friendly, > > but not at the expense of oversimplifying things. > > > > BTW, do you think "Rank ... (2) number of orthogonal dimensions of a > > matrix" is clear? Considering that matrix is defined a "an array of > > rank 2"? Is "rank" in linear algebra sense common enough in numpy > > documentation to be included in the glossary? > > > > For comparison, here are a few alternative formulations of matrix rank > > definition: > > > > "The rank of a matrix or a linear map is the dimension of the image of > > the matrix or the linear map, corresponding to the number of linearly > > independent rows or columns of the matrix, or to the number of nonzero > > singular values of the map." > > <http://mathworld.wolfram.com/MatrixRank.html> > > > > "In linear algebra, the column rank (row rank respectively) of a > > matrix A with entries in some field is defined to be the maximal > > number of columns (rows respectively) of A which are linearly > > independent." > > <http://en.wikipedia.org/wiki/Rank_(linear_algebra)> > > I prefer the last definition. Introductory algebra courses teach the > term "linearly independent" before "orthogonal" (IIRC). As for > "linear map", it has other names, too, and doesn't (in my mind) > clarify the definition of rank in this context. Matrix rank has nothing to do with numpy rank. Numpy rank is simply the number of indices required to address an element of an ndarray. I always thought a better name for the Numpy rank would be dimensionality, but like everything else one gets used to the numpy jargon, it only needs to be defined someplace for what it is. Chuck |
From: Sasha <nd...@ma...> - 2006-08-25 13:48:57
|
On 8/25/06, Charles R Harris <cha...@gm...> wrote: > Matrix rank has nothing to do with numpy rank. Numpy rank is simply the > number of indices required to address an element of an ndarray. I always > thought a better name for the Numpy rank would be dimensionality, but like > everything else one gets used to the numpy jargon, it only needs to be > defined someplace for what it is. That's my point exactly. The rank(2) definition was added by Sebastian Haase who advocates the use of the term "ndims" instead of "rank". I've discussed the use of "dimentionality' in the preamble. Note that ndims stands for the number of dimensions, not dimensionality. I don't want to remove rank(2) without hearing from Sebastian first and I appreciate his effort to improve the glossary. Maybe we shold add a "matrix rank" entry instead. |
From: Sebastian H. <ha...@ms...> - 2006-08-25 15:34:36
|
Sasha wrote: > On 8/25/06, Charles R Harris <cha...@gm...> wrote: >> Matrix rank has nothing to do with numpy rank. Numpy rank is simply the >> number of indices required to address an element of an ndarray. I always >> thought a better name for the Numpy rank would be dimensionality, but like >> everything else one gets used to the numpy jargon, it only needs to be >> defined someplace for what it is. > > That's my point exactly. The rank(2) definition was added by > Sebastian Haase who advocates the use of the term "ndims" instead of > "rank". I've discussed the use of "dimentionality' in the preamble. > Note that ndims stands for the number of dimensions, not > dimensionality. > > I don't want to remove rank(2) without hearing from Sebastian first > and I appreciate his effort to improve the glossary. Maybe we shold > add a "matrix rank" entry instead. My phasing is certainly suboptimal (I only remember the German wording - and even that only faintly - "linear independent" !?) But I put it in, remembering the discussion in "numpy" on *why* array.rank (numarray) was changed to array.ndim (numpy) I just thought this page might be a good place to 'discourage usage of badly-defined terms' or at least give the argument for "ndim". [ OK: it's not "badly" defined: but there are two separate camps on *what* it should mean --- ndim is clear.] BTW: Does the "matrix" class have m.rank attribute !? Cheers, Sebastian. |
From: Robert K. <rob...@gm...> - 2006-08-25 18:02:49
|
Charles R Harris wrote: > Matrix rank has nothing to do with numpy rank. Numpy rank is simply the > number of indices required to address an element of an ndarray. I always > thought a better name for the Numpy rank would be dimensionality, but > like everything else one gets used to the numpy jargon, it only needs to > be defined someplace for what it is. "numpy rank" derives from "tensor rank" rather than "matrix rank". It's not *wrong*, but as with many things in mathematics, the term is overloaded and can be confusing. "dimensionality" is no better. A "three-dimensional array" might be [1, 2, 3], not [[[1]]]. http://mathworld.wolfram.com/TensorRank.html -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |