[Numpy-discussion] Unexpected conversion from matrix to array

2007-12-05 Thread Keith Goodman
 import numpy.matlib as M
 x = M.asmatrix(['a', 'b', 'c'])
 x == 'a'
array([[ True, False, False]], dtype=bool)   #   I expected a matrix

 x = M.asmatrix([1, 2, 3])
 x == 1
matrix([[ True, False, False]], dtype=bool)  #   This looks good

 M.__version__
'1.0.5.dev4445'
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] A quick f2py question

2007-12-05 Thread Pearu Peterson
On Wed, December 5, 2007 8:38 pm, Fernando Perez wrote:
...
 And I see this message in the build:

 In: mwrep.pyf:mwrep:unknown_interface:createblocks
 _get_depend_dict: no dependence info for 'len'

This is due to a typo introduced in r4511 and is now fixed in
r4553. This bug should not affect resulting extension module.

Thanks for the issue report,
Pearu

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


Re: [Numpy-discussion] site down...

2007-12-05 Thread Steven H. Rogers
Fernando Perez wrote:
 The whole scipy.org site seems down.  Is it just on my end?
   
Works for me, though it seems pretty slow.

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


Re: [Numpy-discussion] site down...

2007-12-05 Thread Robert Kern
Fernando Perez wrote:
 The whole scipy.org site seems down.  Is it just on my end?

No. Our new IT guy, Ryan Earl jre at enthought.com, is on the case.

-- 
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


[Numpy-discussion] site down...

2007-12-05 Thread Fernando Perez
The whole scipy.org site seems down.  Is it just on my end?

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


[Numpy-discussion] A quick f2py question

2007-12-05 Thread Fernando Perez
Hi all,

I have a quick question on f2py.  I have a fortran lib I've wrapped
for a while and was updating one routine today, when I noticed a
message I'm curious about.  The .pyf file contains this signature:

subroutine
createblocks(nnod,ll,nscale,nterms,pp,qq,aoffset,iflag,rintphi,rnorm)
! in :mwrep:createblocks.f
integer intent(in) :: nnod
integer intent(in) :: ll
integer intent(in) :: nscale
integer intent(hide),depend(pp) :: nterms = len(pp)
real*8 dimension(nterms),intent(in) :: pp
real*8 dimension(nterms),intent(in) :: qq
real*8 dimension(nterms),intent(in) :: aoffset
integer intent(in) :: iflag
real*8
dimension(nterms*nnod*nnod),intent(out),depend(nterms,nnod) :: rintphi
real*8 dimension(nterms),intent(out),depend(nterms):: rnorm
end subroutine createblocks

And I see this message in the build:

In: mwrep.pyf:mwrep:unknown_interface:createblocks
_get_depend_dict: no dependence info for 'len'

The build does actually continue, and in the end, this routine seems
to be correctly wrapped.  But I still worry that it may be getting the
right allocations by chance/accident.  Is this a real error message,
or just an internal warning from an intermediate pass?  Or has the
call for len() changed recently in f2py? (this code was originally
wrapped years ago, now I'm just doing minor updates).

Thanks for any info...

Cheers,

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


Re: [Numpy-discussion] A quick f2py question

2007-12-05 Thread Fernando Perez
On Dec 5, 2007 1:05 PM, Pearu Peterson [EMAIL PROTECTED] wrote:
 On Wed, December 5, 2007 8:38 pm, Fernando Perez wrote:
 ...
  And I see this message in the build:
 
  In: mwrep.pyf:mwrep:unknown_interface:createblocks
  _get_depend_dict: no dependence info for 'len'

 This is due to a typo introduced in r4511 and is now fixed in
 r4553. This bug should not affect resulting extension module.

 Thanks for the issue report,

Great, many thanks for the clarification and quick action.

Cheers,

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


[Numpy-discussion] multinomial question

2007-12-05 Thread Alan G Isaac
I would think that
multinomial(1,prob,size=ntrials).sum(axis=0)
would be equivalent to
multinomial(ntrials,prob)
but the first gives a surprising result.  (See below.)
Explanation?

Thank you,
Alan Isaac


 ntrials = 10
 prob = N.arange(100,dtype=N.float32)/4950
 multinomial(1,prob,size=ntrials).sum(axis=0)
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,0,0,0,
  0,0,0,0,0,0,0,0,  990, 1058,  996,
   1102, 1088, 1137, 1144, 1150, 1196, 1198, 1272, 1273, 1268, 1265,
   1380, 1336, 1371, 1405, 1348, 1420, 1515, 1506, 1571, 1499, 1556,
   1517, 1603, 1691, 1696, 1763, 1622, 1716, 1722, 1785, 1866, 1799,
   1918, 1818, 1868, 1938, 2010, 1916, 1950, 1983, 2062, 2079, 2224,
   2165, 2136, 2156, 2215, 2118, 2309, 2389, 2377, 2423, 2328, 2325,
   2469])
 multinomial(ntrials,prob)
array([   0,   27,   33,   55,  104,  104,  116,  153,  166,  181,  189,
199,  244,  262,  259,  303,  330,  343,  373,  360,  371,  437,
423,  470,  460,  550,  551,  497,  517,  593,  623,  623,  648,
660,  638,  718,  713,  754,  784,  831,  804,  868,  902,  851,
918,  932,  945,  972,  966, 1025, 1005, 1038, 1075, 1046, 1121,
   1069, 1121, 1152, 1209, 1148, 1196, 1261, 1288, 1304, 1250, 1324,
   1348, 1430, 1370, 1419, 1388, 1364, 1473, 1414, 1511, 1523, 1583,
   1574, 1575, 1575, 1613, 1559, 1665, 1666, 1712, 1728, 1715, 1709,
   1846, 1774, 1819, 1869, 1886, 1963, 1837, 1906, 1983, 1867, 1968,
   1916])




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


Re: [Numpy-discussion] site down...

2007-12-05 Thread Robert Kern
Steven H. Rogers wrote:
 Fernando Perez wrote:
 The whole scipy.org site seems down.  Is it just on my end?
   
 Works for me, though it seems pretty slow.

The system has been restarted.

-- 
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] multinomial question

2007-12-05 Thread Robert Kern
Alan G Isaac wrote:
 I would think that
 multinomial(1,prob,size=ntrials).sum(axis=0)
 would be equivalent to
 multinomial(ntrials,prob)
 but the first gives a surprising result.  (See below.)
 Explanation?

A bug in rk_binomial_inversion(). Unfortunately, this looks like a logical bug
in the sources I was deriving this code from. The safety bound on the search
inversion search cuts out too early. Now that I re-examine it, it looks the
bound (whichever of the multiple choice of bounds one could use) could always be
legitimately exceeded, so there shouldn't be a bound at all. I'll have to dive
deeper to figure out what is going on. This makes me grumpy.

-- 
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] multinomial question

2007-12-05 Thread Robert Kern
Alan G Isaac wrote:
 I would think that
 multinomial(1,prob,size=ntrials).sum(axis=0)
 would be equivalent to
 multinomial(ntrials,prob)
 but the first gives a surprising result.  (See below.)
 Explanation?

Pretty much anyone who derives their binomial distribution algorithm from
http://www.unc.edu/~gfish/fcmc.html is also wrong.

SVN now has a bound such that CDF(bound) is within 1e-16 (or so) of 1.0.

-- 
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