Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-25 Thread Colin J. Williams
Colin J. Williams wrote: > Alan G Isaac wrote: >> On Sat, 24 Mar 2007, Charles R Harris apparently wrote: >>> Yes, that is what I am thinking. Given that there are only the two >>> possibilities, row or column, choose the only one that is compatible with >>> the multiplying matrix. The result wi

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-25 Thread Colin J. Williams
Alan G Isaac wrote: > On Sat, 24 Mar 2007, Charles R Harris apparently wrote: >> Yes, that is what I am thinking. Given that there are only the two >> possibilities, row or column, choose the only one that is compatible with >> the multiplying matrix. The result will not always be a column vecto

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Alan G Isaac <[EMAIL PROTECTED]> wrote: On Sat, 24 Mar 2007, Anne Archibald apparently wrote: > Note that taking a vector and left-multiplying it by > a matrix is a very natural operation that won't work any > more if you treat all vectors as if they were row vectors. Can you be mor

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Sat, 24 Mar 2007, Anne Archibald apparently wrote: > Note that taking a vector and left-multiplying it by > a matrix is a very natural operation that won't work any > more if you treat all vectors as if they were row vectors. Can you be more specific on this "naturalness"? What is the cost

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Alan G Isaac wrote: > On Sat, 24 Mar 2007, Travis Oliphant apparently wrote: > >> My opinion is that a 1-d array in matrix-multiplication >> should always be interpreted as a row vector. Is this not >> what is currently done? If not, then

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Anne Archibald
On 24/03/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > My opinion is that a 1-d array in matrix-multiplication should always be > interpreted as a row vector. Is this not what is currently done? If > not, then it is a bug in my mind. An alternative approach, in line with the usual usage, is

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Sat, 24 Mar 2007, Travis Oliphant apparently wrote: > I'd be fine with an error raised on matrix multiplication > (as long as dot is not changed). In other words, I'd > like to see 1-d arrays always interpreted the same way (as > row vectors) when used in matrix multiplication. My prefer

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Alan G Isaac wrote: > On Sat, 24 Mar 2007, Travis Oliphant apparently wrote: > >> My opinion is that a 1-d array in matrix-multiplication >> should always be interpreted as a row vector. Is this not >> what is currently done? If not, then

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Travis Oliphant
Alan G Isaac wrote: > On Sat, 24 Mar 2007, Travis Oliphant apparently wrote: > >> My opinion is that a 1-d array in matrix-multiplication >> should always be interpreted as a row vector. Is this not >> what is currently done? If not, then it is a bug in my >> mind. >> > > N.

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Travis Oliphant
Charles R Harris wrote: > > > On 3/24/07, *Travis Oliphant* <[EMAIL PROTECTED] > > wrote: > > Alan G Isaac wrote: > > On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > > > >> Yes, that is what I am thinking. Given that there are only the two >

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Alan G Isaac wrote: > On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > >> Yes, that is what I am thinking. Given that there are only the two >> possibilities, row or column, choose the only one that is compatible with >> the multipl

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Sat, 24 Mar 2007, Travis Oliphant apparently wrote: > My opinion is that a 1-d array in matrix-multiplication > should always be interpreted as a row vector. Is this not > what is currently done? If not, then it is a bug in my > mind. >>> N.__version__ '1.0' >>> I matrix([[ 1., 0.],

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Travis Oliphant
Alan G Isaac wrote: > On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > >> Yes, that is what I am thinking. Given that there are only the two >> possibilities, row or column, choose the only one that is compatible with >> the multiplying matrix. The result will not always be a column

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > Yes, that is what I am thinking. Given that there are only the two > possibilities, row or column, choose the only one that is compatible with > the multiplying matrix. The result will not always be a column vector, for > instance, mat([

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Colin J. Williams <[EMAIL PROTECTED]> wrote: Charles R Harris wrote: > > > On 3/24/07, *Alan G Isaac* <[EMAIL PROTECTED] > > wrote: > > On Fri, 23 Mar 2007, Charles R Harris apparently wrote: > > the following gives the wrong result: > > In [15

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Colin J. Williams
Charles R Harris wrote: > > > On 3/24/07, *Alan G Isaac* <[EMAIL PROTECTED] > > wrote: > > On Fri, 23 Mar 2007, Charles R Harris apparently wrote: > > the following gives the wrong result: > > In [15]: I = matrix(eye(2)) > > In [16]: I*ones(2) >

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Alan G Isaac <[EMAIL PROTECTED]> wrote: On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > I think it is reasonable to raise an exception in this > case, but that is not how numpy currently works, so it is > a larger policy decision that I can't make on my own. For > the case

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Sat, 24 Mar 2007, Charles R Harris apparently wrote: > I think it is reasonable to raise an exception in this > case, but that is not how numpy currently works, so it is > a larger policy decision that I can't make on my own. For > the case under consideration it is possible to define 1-D >

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Alan G Isaac <[EMAIL PROTECTED]> wrote: >> On Fri, 23 Mar 2007, Charles R Harris apparently wrote: >>> the following gives the wrong result: >>> In [15]: I = matrix(eye(2)) >>> In [16]: I*ones(2) >>> Out[16]: matrix([[ 1., 1.]]) >>> where the output should be a column vector. > On

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
>> On Fri, 23 Mar 2007, Charles R Harris apparently wrote: >>> the following gives the wrong result: >>> In [15]: I = matrix(eye(2)) >>> In [16]: I*ones(2) >>> Out[16]: matrix([[ 1., 1.]]) >>> where the output should be a column vector. > On 3/24/07, Alan G Isaac <[EMAIL PROTECTED]> wrote:

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Charles R Harris
On 3/24/07, Alan G Isaac <[EMAIL PROTECTED]> wrote: On Fri, 23 Mar 2007, Charles R Harris apparently wrote: > the following gives the wrong result: > In [15]: I = matrix(eye(2)) > In [16]: I*ones(2) > Out[16]: matrix([[ 1., 1.]]) > where the output should be a column vector. Why should this ou

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Alan G Isaac
On Fri, 23 Mar 2007, Charles R Harris apparently wrote: > the following gives the wrong result: > In [15]: I = matrix(eye(2)) > In [16]: I*ones(2) > Out[16]: matrix([[ 1., 1.]]) > where the output should be a column vector. Why should this output a column? I would prefer an exception. Add the ax

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-24 Thread Bill Baxter
On 3/24/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 3/23/07, Anne Archibald <[EMAIL PROTECTED]> wrote: > > On 23/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > Anyone, > > > > > > What is the easiest way to detect in python/C if an object is a subclass > of > > > ndarray? > >

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Charles R Harris
On 3/23/07, Anne Archibald <[EMAIL PROTECTED]> wrote: On 23/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > Anyone, > > What is the easiest way to detect in python/C if an object is a subclass of > ndarray? Um, how about isinstance or issubclass? (if you want strictness you can look at whe

Re: [Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Anne Archibald
On 23/03/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > Anyone, > > What is the easiest way to detect in python/C if an object is a subclass of > ndarray? Um, how about isinstance or issubclass? (if you want strictness you can look at whether x.__class__ is zeros(1).__class__) Anne ___

[Numpy-discussion] Detect subclass of ndarray

2007-03-23 Thread Charles R Harris
Anyone, What is the easiest way to detect in python/C if an object is a subclass of ndarray? Chuck ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion