Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-20 Thread dmitrey
Travis E. Oliphant wrote:
> Hi everybody,
>
> In writing some generic code, I've encountered situations where it would 
> reduce code complexity to allow NumPy scalars to be "indexed" in the 
> same number of limited ways, that 0-d arrays support.
>
> For example, 0-d arrays can be indexed with
>
> * Boolean masks
> * Ellipses x[...]  and x[..., newaxis]
> * Empty tuple x[()]
>
> I think that numpy scalars should also be indexable in these particular 
> cases as well (read-only of course,  i.e. no setting of the value would 
> be possible).
>
> This is an easy change to implement, and I don't think it would cause 
> any backward compatibility issues.
>
> Any opinions from the list?
>
>
> Best regards,
>
> -Travis O.
>
>   
As for me I would be glad to see same behavior for numbers as for arrays 
at all, like it's implemented in MATLAB, i.e.
 >>a=80
 >>disp(a)
80
 >>disp(a(1,1))
80
ok, for numpy having at least possibility to use
a=array(80)
print a[0]
would be very convenient, now atleast_1d(a) is required very often, and 
sometimes errors occur only some times later, already during execution 
of user-installed code, when user usually pass several-variables arrays 
and some time later suddenly single-variable array have been encountered.
I guess it could be implemented via a simple check:
if user calls for a[0] and a is array of shape () (i.e. like 
a=array(80)) then return a[()]
D.

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-20 Thread Konrad Hinsen
On 21.02.2008, at 08:41, Francesc Altet wrote:

> Well, it seems like a non-intrusive modification, but I like the  
> scalars
> to remain un-indexable, mainly because it would be useful to raise an
> error when you are trying to index them.  In fact, I thought that when
> you want a kind of scalar but indexable, you should use a 0-d array.

I agree. In fact, I'd rather see NumPy scalars move towards Python  
scalars rather than towards NumPy arrays in behaviour. In particular,  
their nasty habit of coercing everything they are combined with into  
arrays is still my #1 source of compatibility problems with porting  
code from Numeric to NumPy. I end up converting NumPy scalars to  
Python scalars explicitly in lots of places.

Konrad.

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-20 Thread Francesc Altet
A Thursday 21 February 2008, Travis E. Oliphant escrigué:
> Hi everybody,
>
> In writing some generic code, I've encountered situations where it
> would reduce code complexity to allow NumPy scalars to be "indexed"
> in the same number of limited ways, that 0-d arrays support.
>
> For example, 0-d arrays can be indexed with
>
> * Boolean masks
> * Ellipses x[...]  and x[..., newaxis]
> * Empty tuple x[()]
>
> I think that numpy scalars should also be indexable in these
> particular cases as well (read-only of course,  i.e. no setting of
> the value would be possible).
>
> This is an easy change to implement, and I don't think it would cause
> any backward compatibility issues.
>
> Any opinions from the list?

Well, it seems like a non-intrusive modification, but I like the scalars 
to remain un-indexable, mainly because it would be useful to raise an 
error when you are trying to index them.  In fact, I thought that when 
you want a kind of scalar but indexable, you should use a 0-d array.

So, my vote is -0.

Cheers,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-20 Thread Travis E. Oliphant

Hi everybody,

In writing some generic code, I've encountered situations where it would 
reduce code complexity to allow NumPy scalars to be "indexed" in the 
same number of limited ways, that 0-d arrays support.

For example, 0-d arrays can be indexed with

* Boolean masks
* Ellipses x[...]  and x[..., newaxis]
* Empty tuple x[()]

I think that numpy scalars should also be indexable in these particular 
cases as well (read-only of course,  i.e. no setting of the value would 
be possible).

This is an easy change to implement, and I don't think it would cause 
any backward compatibility issues.

Any opinions from the list?


Best regards,

-Travis O.



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Rename record array fields

2008-02-20 Thread Stefan van der Walt
Hi Sameer

On Wed, Feb 20, 2008 at 03:10:16PM -0600, Sameer DCosta wrote:
> Is there a way to rename record array fields without making a copy of
> the whole record array?
> 
> Thanks in advance for your replies.

Simply view the array as a new dtype:

In [2]: x
Out[2]: 
array([(1, 2), (3, 4)], 
  dtype=[('a', 'http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] bug in numpy.histogram?

2008-02-20 Thread Alan G Isaac
On Wed, 20 Feb 2008, Alan G Isaac apparently wrote:
>  so you need ``np.any``

Or I could notice you included a patch ...
sorry for the noise.

Alan


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] bug in numpy.histogram?

2008-02-20 Thread Alan G Isaac
On Wed, 20 Feb 2008, John Hunter apparently wrote:
>   File 
>   
> "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/function_base.py",
> line 155, in histogram 
> if(any(bins[1:]-bins[:-1] < 0)):
> NameError: global name 'any' is not defined 

``any`` was introduced in Python 2.5, so you need ``np.any`` 
here.

Cheers,
Alan Isaac



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] bug in numpy.histogram?

2008-02-20 Thread Robert Kern
On Wed, Feb 20, 2008 at 3:49 PM, John Hunter <[EMAIL PROTECTED]> wrote:
> We recently deprecated matplotlib.mlab.hist, and I am now hitting a
>  bug in numpy's historgram, which appears to be caused by the use of
>  "any" that does not exist in the namespace.  Small patch attached.

Fixed in SVN. Thank you.

-- 
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
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Rename record array fields

2008-02-20 Thread Robert Kern
On Wed, Feb 20, 2008 at 3:10 PM, Sameer DCosta <[EMAIL PROTECTED]> wrote:
> Is there a way to rename record array fields without making a copy of
>  the whole record array?

Make a new dtype object with the new names. Use the .view() method on
arrays to get a view of the array with the new dtype.


In [1]: from numpy import *

In [2]: olddt = dtype([('foo', int), ('bar', float)])

In [3]: a = zeros(10, olddt)

In [4]: a
Out[4]:
array([(0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0),
   (0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0)],
  dtype=[('foo', 'http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] bug in numpy.histogram?

2008-02-20 Thread John Hunter
We recently deprecated matplotlib.mlab.hist, and I am now hitting a
bug in numpy's historgram, which appears to be caused by the use of
"any" that does not exist in the namespace.  Small patch attached.
The example below exposes the bug:

Python 2.4.2 (#1, Feb 23 2006, 12:48:31)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.3.svn.r2876 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import numpy as np

In [2]: np.__file__
Out[2]: '/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/__init__.pyc'

In [3]: np.__version__
Out[3]: '1.0.5.dev4814'

In [4]: x = np.random.randn(100)

In [5]: bins = np.linspace(x.min(), x.max(), 40)

In [6]: y = np.histogram(x, bins=bins)

Traceback (most recent call last):
  File "", line 1, in ?
  File 
"/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/function_base.py",
line 155, in histogram
if(any(bins[1:]-bins[:-1] < 0)):
NameError: global name 'any' is not defined
Index: numpy/lib/function_base.py
===
--- numpy/lib/function_base.py	(revision 4814)
+++ numpy/lib/function_base.py	(working copy)
@@ -152,7 +152,7 @@
 bins = linspace(mn, mx, bins, endpoint=False)
 else:
 bins = asarray(bins)
-if(any(bins[1:]-bins[:-1] < 0)):
+if(bins[1:]-bins[:-1] < 0).any():
 raise AttributeError, 'bins must increase monotonically.'
 
 # best block size probably depends on processor cache size
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Rename record array fields

2008-02-20 Thread Sameer DCosta
Is there a way to rename record array fields without making a copy of
the whole record array?

Thanks in advance for your replies.

Sameer
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] numpy record array segfault

2008-02-20 Thread Sameer DCosta
On Wed, Feb 20, 2008 at 1:22 AM, Nils Wagner
<[EMAIL PROTECTED]> wrote:
>
> On Tue, 19 Feb 2008 17:10:10 -0600
>   "Sameer DCosta" <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  > I'm getting a segfault when using python objects with
>  >record arrays.
>  > The code (below) basically assigns a single datetime
>  >object to a slice
>  > of a column in the record array and then python
>  >segfaults as soon as I
>  > try to access those array values. I'm using the latest
>  >svn version of
>  > numpy compiled with gcc 3.4.1 on Solaris (intel). Any
>  >ideas why this
>  > is happening? A reference counting problem maybe? Thanks
>  >for taking a
>  > look.
>  >
>  > Sameer
>  >
>  > [EMAIL PROTECTED]:~> gcc --version
>  > gcc (GCC) 3.4.1
>  > Copyright (C) 2004 Free Software Foundation, Inc.
>  > This is free software; see the source for copying
>  >conditions.  There is NO
>  > warranty; not even for MERCHANTABILITY or FITNESS FOR A
>  >PARTICULAR PURPOSE.
>  >
>  > [EMAIL PROTECTED]:~> uname -a
>  > SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc
>  > [EMAIL PROTECTED]:~> python -V
>  > Python 2.4.2
>  > [EMAIL PROTECTED]:~> cat tmp.py
>  > import datetime
>  > import numpy as np
>  >
>  > print np.__version__
>  >
>  > def myfunc(N):
>  >   newrec = np.empty(N, dtype=[('date', '|O4'), ('age',
>  >int)])
>  >   newrec['date'] = datetime.date(2002,1,1)
>  >   newrec['age'] = 22
>  >
>  >
>  >   newrec['date'][1:12] = datetime.date(2003,1,1)
>  >   return newrec.view(np.recarray)
>  >
>  >
>  > if __name__=='__main__':
>  >   newrec = myfunc(29)
>  >   print newrec['date']
>  >
>  > [EMAIL PROTECTED]:~> python ~/tmp.py
>  > 1.0.5.dev4812
>  > Segmentation Fault (core dumped)
>  > ___
>  > Numpy-discussion mailing list
>  > Numpy-discussion@scipy.org
>  > http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
>  No problem here
>
>  python tmp.py
>  1.0.5.dev4811
>  [2002-01-01 2003-01-01 2003-01-01 2003-01-01 2003-01-01
>  2003-01-01
>   2003-01-01 2003-01-01 2003-01-01 2003-01-01 2003-01-01
>  2003-01-01
>   2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01
>  2002-01-01
>   2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01
>  2002-01-01
>   2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01]
>
>  Can you send a backtrace (gdb) ?
>
>  Nils
>  ___
>  Numpy-discussion mailing list
>  Numpy-discussion@scipy.org
>  http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

Thanks for taking a look Nils. Can you try with a larger array (change
the value of N from 29 to 2900)? I have attached the backtrace below.

Program terminated with signal 11, Segmentation fault.
#0  PyObject_Malloc (nbytes=24) at ../Objects/obmalloc.c:605

warning: Source file is more recent than executable.
605 if ((pool->freeblock = *(block **)bp) != NULL) {
(gdb) backtrace
#0  PyObject_Malloc (nbytes=24) at ../Objects/obmalloc.c:605
#1  0x08084eee in _PyObject_New (tp=0x8154980) at ../Objects/object.c:188
#2  0x0810a3f2 in range_iter (seq=0x841b676) at ../Objects/rangeobject.c:266
#3  0x08064d32 in PyObject_GetIter (o=0x841b676) at ../Objects/abstract.c:2228
#4  0x080bc202 in PyEval_EvalFrame (f=0x844ac1c) at ../Python/ceval.c:2107
#5  0x080bf87d in PyEval_EvalFrame (f=0x822e7dc) at ../Python/ceval.c:3640
#6  0x080c0272 in PyEval_EvalCodeEx (co=0x83ab4e0, globals=0x2,
locals=0x81373e8, args=0x822e928, argcount=6, kws=0x81be290, kwcount=0,
defs=0x82cb9d8, defcount=2, closure=0x0) at ../Python/ceval.c:2736
#7  0x080bdaf8 in PyEval_EvalFrame (f=0x81be104) at ../Python/ceval.c:3650
#8  0x080c0272 in PyEval_EvalCodeEx (co=0x83ab5e0, globals=0x2,
locals=0x81373e8, args=0x0, argcount=7, kws=0x81a2ef0, kwcount=0,
defs=0x83ae878, defcount=6, closure=0x0) at ../Python/ceval.c:2736
#9  0x080bdaf8 in PyEval_EvalFrame (f=0x81a2d74) at ../Python/ceval.c:3650
#10 0x080c0272 in PyEval_EvalCodeEx (co=0x83a87a0, globals=0x2,
locals=0x81373e8, args=0x1, argcount=1, kws=0x0, kwcount=0,
defs=0x83ac628, defcount=3, closure=0x0) at ../Python/ceval.c:2736
#11 0x08108e8e in function_call (func=0x83b3a04, arg=0x81f50ac, kw=0x0)
at ../Objects/funcobject.c:548
#12 0x0806412c in PyObject_Call (func=0x841b000, arg=0x81f50ac, kw=0x0)
at ../Objects/abstract.c:1795
#13 0x080b8427 in PyEval_CallObjectWithKeywords (func=0x83b3a04,
arg=0x81f50ac, kw=0x0) at ../Python/ceval.c:3425
#14 0xd009f393 in array_str (self=0x2) at numpy/core/src/arrayobject.c:4259
#15 0x080850d2 in PyObject_Str (v=0x2) at ../Objects/object.c:347
#16 0x08085212 in internal_print (op=0x82a6708, fp=0x815bf90, flags=1,
nesting=0) at ../Objects/object.c:241
#17 0x0806eafb in PyFile_WriteObject (v=0x82a6708, f=0x82a6708, flags=1)
at ../Objects/fileobject.c:2036
#18 0x080bcc84 in PyEval_EvalFrame (f=0x819ccbc) at ../Python/ceval.c:1538
#19 0x080c0272 in PyEval_EvalCodeEx (co=0x81e70a0, globals=0x2,
locals=0x81373e8, args=

Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread Javier Maria Torres
Hi,

I would also like to know what Java package you're using. I find Weka PCA 
differs from Matlab (whereas previous experiments with Scipy PCA didn't show 
significant differences from Matlab), but I'm still looking into the cause.

Thanks, and greetings,

Javier Torres

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: miércoles, 20 de febrero de 2008 14:45
To: numpy-discussion@scipy.org
Subject: Re: [Numpy-discussion] finding eigenvectors etc


> How are you using the values? How significant are the differences?
>

i am using these eigenvectors to do PCA on a set of images(of faces).I sort the 
eigenvectors in descending order of their eigenvalues and this is multiplied 
with the  (orig data of some images viz a matrix)to obtain a facespace.
like
#pseudocode...
sortedeigenvectors=mysort(eigenvectors)
facespace=sortedeigenvectors*adjfaces  /* adjfaces is a matrix */

if i do this in python i get a facespace [[-1028755.44341439,  
1480864.32750018,  1917712.0162213, -983526.60328021,
  -1662357.13091294,  -499792.41540038,   208696.97376238,
-916628.92613255,
  -1454071.95225114, -1563209.39113008,  -231969.96968212 , -768417.98606125]
 [ -866174.88336972,  1212934.33524067,   543013.86361006,
-1352625.86282073,
   -309872.30710619 ,  466301.12884198,
216088.93319292 ,-1512378.8688779,
   2581349.03171275,  1797812.01270033,  1876754.7339826 ,
751781.8166291 ]
 [  -57026.32567001 ,  -69918.94570563,  -399715.51441018, -233720.8360051,
188227.41229887,   177341.47889165 ,  -65241.23138424 ,
-311917.28253664,
   1133399.70627111,  1089028.99019462,   684854.41725944 ,
413465.86494352]
 [  405955.15245412,   562832.78296479 ,  864334.63457882 ,
629752.80210603,
894768.52572026,   578460.80766675 ,  629146.32442893 ,
768037.57754708,
   -485157.28573271, -1718776.11176486 , -780929.18155991 , -165391.19551137]]

whereas the same steps
in java
[
[-516653.73649950844, 274000.54127598763, -108557.2732037272, 
-799041.4108906921, -495577.7478765989, -49125.38109725664, 
-162041.57505147497, -917033.3002665655, 1207264.8912226136, 
1384551.3481945703, 1056098.9289163304, 357801.9553511339], 
[-956064.0724430305, 1424775.0801567277, 898684.8188346579, 
-1385008.5401600213, -514677.038573372, 387195.56502804917, 281164.65362325957, 
-1512307.8891047493, 2114204.697920214, 1280391.7056360755, 1650660.0594245053, 
554096.482085637], [-666313.7580419029, 1365981.2428742633, 2011095.455319733, 
-453217.29083790665, -1199981.2283586136, -358852.32104592584, 
375855.4012532809, -311436.16701894277, -2033000.776565753, -2418152.391663846, 
-847661.841421182, -926486.0374297247], [593030.0669844414, 121955.63569302124, 
124121.99904933537, 697146.7418886195, 1321002.514808584, 743093.1371151333, 
493712.52017493406, 767889.8563902564, 487050.6874229272, -641935.1621667973, 
-310387.14691965195, 246026.029544] ]

such difference causes diff results in all calculations involving the facespace

dn
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread Matthieu Brucher
You should have such differences, that's strange. Are you sure you're using
the correct eigenvectors ?

Matthieu

2008/2/20, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
>
> > How are you using the values? How significant are the differences?
> >
>
>
> i am using these eigenvectors to do PCA on a set of images(of faces).I
> sort the eigenvectors in descending order of their eigenvalues and
> this is multiplied with the  (orig data of some images viz a matrix)to
> obtain a facespace.
> like
> #pseudocode...
> sortedeigenvectors=mysort(eigenvectors)
> facespace=sortedeigenvectors*adjfaces  /* adjfaces is a matrix */
>
> if i do this in python i get a facespace
> [[-1028755.44341439,  1480864.32750018,  1917712.0162213,
> -983526.60328021,
>   -1662357.13091294,  -499792.41540038,   208696.97376238,
> -916628.92613255,
>   -1454071.95225114, -1563209.39113008,  -231969.96968212 ,
> -768417.98606125]
>   [ -866174.88336972,  1212934.33524067,   543013.86361006,
> -1352625.86282073,
>-309872.30710619 ,  466301.12884198,
> 216088.93319292 ,-1512378.8688779,
>2581349.03171275,  1797812.01270033,  1876754.7339826 ,
> 751781.8166291 ]
>   [  -57026.32567001 ,  -69918.94570563,  -399715.51441018,
> -233720.8360051,
> 188227.41229887,   177341.47889165 ,  -65241.23138424 ,
> -311917.28253664,
>1133399.70627111,  1089028.99019462,   684854.41725944 ,
> 413465.86494352]
>   [  405955.15245412,   562832.78296479 ,  864334.63457882 ,
> 629752.80210603,
> 894768.52572026,   578460.80766675 ,  629146.32442893 ,
> 768037.57754708,
>-485157.28573271, -1718776.11176486 , -780929.18155991 ,
> -165391.19551137]]
>
> whereas the same steps
> in java
> [
> [-516653.73649950844, 274000.54127598763, -108557.2732037272,
> -799041.4108906921, -495577.7478765989, -49125.38109725664,
> -162041.57505147497, -917033.3002665655, 1207264.8912226136,
> 1384551.3481945703, 1056098.9289163304, 357801.9553511339],
> [-956064.0724430305, 1424775.0801567277, 898684.8188346579,
> -1385008.5401600213, -514677.038573372, 387195.56502804917,
> 281164.65362325957, -1512307.8891047493, 2114204.697920214,
> 1280391.7056360755, 1650660.0594245053, 554096.482085637],
> [-666313.7580419029, 1365981.2428742633, 2011095.455319733,
> -453217.29083790665, -1199981.2283586136, -358852.32104592584,
> 375855.4012532809, -311436.16701894277, -2033000.776565753,
> -2418152.391663846, -847661.841421182, -926486.0374297247],
> [593030.0669844414, 121955.63569302124, 124121.99904933537,
> 697146.7418886195, 1321002.514808584, 743093.1371151333,
> 493712.52017493406, 767889.8563902564, 487050.6874229272,
> -641935.1621667973, -310387.14691965195, 246026.029544]
> ]
>
> such difference causes diff results in all calculations involving the
> facespace
>
>
> dn
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread [EMAIL PROTECTED]

> How are you using the values? How significant are the differences?
>

i am using these eigenvectors to do PCA on a set of images(of faces).I
sort the eigenvectors in descending order of their eigenvalues and
this is multiplied with the  (orig data of some images viz a matrix)to
obtain a facespace.
like
#pseudocode...
sortedeigenvectors=mysort(eigenvectors)
facespace=sortedeigenvectors*adjfaces  /* adjfaces is a matrix */

if i do this in python i get a facespace
[[-1028755.44341439,  1480864.32750018,  1917712.0162213,
-983526.60328021,
  -1662357.13091294,  -499792.41540038,   208696.97376238,
-916628.92613255,
  -1454071.95225114, -1563209.39113008,  -231969.96968212 ,
-768417.98606125]
 [ -866174.88336972,  1212934.33524067,   543013.86361006,
-1352625.86282073,
   -309872.30710619 ,  466301.12884198,
216088.93319292 ,-1512378.8688779,
   2581349.03171275,  1797812.01270033,  1876754.7339826 ,
751781.8166291 ]
 [  -57026.32567001 ,  -69918.94570563,  -399715.51441018,
-233720.8360051,
188227.41229887,   177341.47889165 ,  -65241.23138424 ,
-311917.28253664,
   1133399.70627111,  1089028.99019462,   684854.41725944 ,
413465.86494352]
 [  405955.15245412,   562832.78296479 ,  864334.63457882 ,
629752.80210603,
894768.52572026,   578460.80766675 ,  629146.32442893 ,
768037.57754708,
   -485157.28573271, -1718776.11176486 , -780929.18155991 ,
-165391.19551137]]

whereas the same steps
in java
[
[-516653.73649950844, 274000.54127598763, -108557.2732037272,
-799041.4108906921, -495577.7478765989, -49125.38109725664,
-162041.57505147497, -917033.3002665655, 1207264.8912226136,
1384551.3481945703, 1056098.9289163304, 357801.9553511339],
[-956064.0724430305, 1424775.0801567277, 898684.8188346579,
-1385008.5401600213, -514677.038573372, 387195.56502804917,
281164.65362325957, -1512307.8891047493, 2114204.697920214,
1280391.7056360755, 1650660.0594245053, 554096.482085637],
[-666313.7580419029, 1365981.2428742633, 2011095.455319733,
-453217.29083790665, -1199981.2283586136, -358852.32104592584,
375855.4012532809, -311436.16701894277, -2033000.776565753,
-2418152.391663846, -847661.841421182, -926486.0374297247],
[593030.0669844414, 121955.63569302124, 124121.99904933537,
697146.7418886195, 1321002.514808584, 743093.1371151333,
493712.52017493406, 767889.8563902564, 487050.6874229272,
-641935.1621667973, -310387.14691965195, 246026.029544]
]

such difference causes diff results in all calculations involving the
facespace

dn
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] mixed mode arithmetic

2008-02-20 Thread Neal Becker
I've been browsing the numpy source.  I'm wondering about mixed-mode
arithmetic on arrays.  I believe the way numpy handles this is that it
never does mixed arithmetic, but instead converts arrays to a common type. 
Arguably, that might be efficient for a mix of say, double and float. 
Maybe not.

But for a mix of complex and a scalar type (say, CDouble * Double), it's
clearly suboptimal in efficiency.

So, do I understand this correctly?  If so, is that something we should
improve?

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] partial_sum/adj_difference?

2008-02-20 Thread Stefan van der Walt
On Tue, Feb 19, 2008 at 05:36:52PM -0700, Charles R Harris wrote:
> On Feb 19, 2008 2:20 PM, Stefan van der Walt <[EMAIL PROTECTED]> wrote:
> 
> On Tue, Feb 19, 2008 at 01:50:04PM -0700, Charles R Harris wrote:
> > And here I thought you were going to fix that. Deleting the
> > "blahs" isn't a > fix, it's a coverup. Now there is no extended
> > documentation at all.
> 
> I wouldn't call "Blah, blah" extended documentation -- in fact, I
> would've been rather embarrassed if that showed up on my screen during
> a workshop.
> 
> "Blah, blah" also doesn't strike me as the ideal TODO marker.  We can
> maybe use some more sensible text, or write a decorator to mark these
> functions.
> 
> It has certainly been effective in practice.

Yes, ironically :)

http://projects.scipy.org/scipy/numpy/changeset/4813
http://projects.scipy.org/scipy/numpy/changeset/4814

The first courtesy of Matthew Brett.

Regards
Stéfan
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread Charles R Harris
On Feb 20, 2008 1:00 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> > Different implementations follow different conventions as to which
> > is which.
>
> thank you for the replies ..the reason why i asked was that the most
> significant eigenvectors ( sorted according to eigenvalues) are  later
> used in calculations and then the results obtained differ  in java and
> python..so i was worried as to which one to use
>

How are you using the values? How significant are the differences?

Chuck
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread Warren Focke
The vectors that you used to build your covariance matrix all lay in or close 
to 
a 3-dimensional subspace of the 4-dimensional space in which they were 
represented.  So one of the eigenvalues of the covariance matrix is 0, or close 
to it; the matrix is singular.  Condition is the ratio of the largest 
eigenvalue 
to the smallest, large values can be troublesome.  Here it is ~1e17, which is 
the dynamic range of doubles.  Which means that the value you observe for the 
smallest eigenvaulue is just the result of rounding errors.

w

On Wed, 20 Feb 2008, [EMAIL PROTECTED] wrote:

>> Different implementations follow different conventions as to which
>> is which.
>
> thank you for the replies ..the reason why i asked was that the most
> significant eigenvectors ( sorted according to eigenvalues) are  later
> used in calculations and then the results obtained differ  in java and
> python..so i was worried as to which one to use
>
>> Your matrix is almost singular, is badly conditionned,
>
> Mathew, can you explain that..i didn't quite get it..
> dn
>
> ___
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread Matthieu Brucher
>
> >Your matrix is almost singular, is badly conditionned,
>
> Mathew, can you explain that..i didn't quite get it..
> dn
>

The condition number is the ratio between the biggest eigenvalue and the
lowest one. In your case, it is 10E-16, so the precision of the double
numbers. That means that some computations that depend on this ratio (like
inversions) can lead to numerical errors. In your case, it is OK, but you
should keep in mind this kind of trouble (read what you can on numerical
computations ;))

Matthieu
-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] finding eigenvectors etc

2008-02-20 Thread [EMAIL PROTECTED]
> Different implementations follow different conventions as to which
> is which.

thank you for the replies ..the reason why i asked was that the most
significant eigenvectors ( sorted according to eigenvalues) are  later
used in calculations and then the results obtained differ  in java and
python..so i was worried as to which one to use

>Your matrix is almost singular, is badly conditionned,

Mathew, can you explain that..i didn't quite get it..
dn

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion