Re: [Numpy-discussion] documentation bug: Matrix library page not populated

2012-04-18 Thread josef . pktd
On Wed, Apr 18, 2012 at 4:14 PM, Pauli Virtanen  wrote:
> Hi,
>
> 18.04.2012 19:57, Alan G Isaac kirjoitti:
>> http://docs.scipy.org/doc/numpy/reference/routines.matlib.html#module-numpy.matlib
>> promises a list of functions that does not appear (at the moment, anyway).
>
> This doesn't seem to be due to a technical reason, but rather than
> because nobody has written a list of the functions in the docstring of
> the module.

Is it a good idea to use this? Mixing namespaces would completely confuse me.

>>> for f in dir(numpy.matlib):
... try:
... if getattr(numpy.matlib, f).__module__ in ['numpy.matlib',
'numpy.matrixlib.defmatrix']: print f
... except: pass
...
asmatrix
bmat
empty
eye
identity
mat
matrix
ones
rand
randn
repmat
zeros

Josef

>
>        Pauli
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] mask array and add to list

2012-04-18 Thread questions anon
excellent thank you, that worked perfectly. I just need to remember this
feature next time I need it.
Thanks again

On Thu, Apr 12, 2012 at 11:41 PM, Tim Cera  wrote:

> Use 'ma.max' instead of 'np.max'.  This might be a bug OR an undocumented
> feature.  :-)
>
> import numpy.ma as ma
> marr = ma.array(range(10), mask=[0,0,0,0,0,1,1,1,1,1])
> np.max(marr)
> 4  # mask is used
>
> a = []
> a.append(marr)
> a.append(marr)
> np.max(a)
> 9  # mask is not used
>
> ma.max(a)
> 4  # mask is used
>
> Kindest regards,
> Tim
>
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] YouTrack testbed

2012-04-18 Thread Pauli Virtanen
12.04.2012 18:43, Ralf Gommers kirjoitti:
[clip]
> My current list of preferences is:
> 
> 1. Redmine (if admin overhead is not unreasonable)
> 2. Trac with performance issues solved
> 3. Github
> 4. YouTrack
> 5. Trac with current performance

Redmine seems pretty nice, apparently has all the features Trac has, and
more.

It's actually *easier* to administer than Trac, because you apparently
can do most configuration via the web interface. With Trac, you have to
drop down to command line and use trac-admin.

Just don't deploy it on CGI like the Tracs we currently have :)

Pauli

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] documentation bug: Matrix library page not populated

2012-04-18 Thread Pauli Virtanen
Hi,

18.04.2012 19:57, Alan G Isaac kirjoitti:
> http://docs.scipy.org/doc/numpy/reference/routines.matlib.html#module-numpy.matlib
> promises a list of functions that does not appear (at the moment, anyway).

This doesn't seem to be due to a technical reason, but rather than
because nobody has written a list of the functions in the docstring of
the module.

Pauli

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Casting rules - an awkward case

2012-04-18 Thread Matthew Brett
Oops, sorry, Keith Goodman kindly pointed out that I had missed out:

On Wed, Apr 18, 2012 at 11:03 AM, Matthew Brett  wrote:
> Hi,
>
> I just wanted to point out a situation where the scalar casting rules
> can be a little confusing:

In [110]: a = np.array([-128, 127], dtype=np.int8)

> In [113]: a - np.int16(128)
> Out[113]: array([-256,   -1], dtype=int16)
>
> In [114]: a + np.int16(-128)
> Out[114]: array([ 0, -1], dtype=int8)
>
> This is predictable from the nice docs here:
>
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.result_type.html
>
> but I offer it only as a speedbump I hit.
>
> On the other hand I didn't find it easy to predict what numpy 1.5.1
> was going to do:
>
> In [31]: a - np.int16(1)
> Out[31]: array([127, 126], dtype=int8)
>
> In [32]: a + np.int16(-1)
> Out[32]: array([-129,  126], dtype=int16)
>
> As a matter of interest, what was the rule for 1.5.1?

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] Casting rules - an awkward case

2012-04-18 Thread Matthew Brett
Hi,

I just wanted to point out a situation where the scalar casting rules
can be a little confusing:

In [113]: a - np.int16(128)
Out[113]: array([-256,   -1], dtype=int16)

In [114]: a + np.int16(-128)
Out[114]: array([ 0, -1], dtype=int8)

This is predictable from the nice docs here:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.result_type.html

but I offer it only as a speedbump I hit.

On the other hand I didn't find it easy to predict what numpy 1.5.1
was going to do:

In [31]: a - np.int16(1)
Out[31]: array([127, 126], dtype=int8)

In [32]: a + np.int16(-1)
Out[32]: array([-129,  126], dtype=int16)

As a matter of interest, what was the rule for 1.5.1?

See you,

Matthew
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] documentation bug: Matrix library page not populated

2012-04-18 Thread Alan G Isaac
http://docs.scipy.org/doc/numpy/reference/routines.matlib.html#module-numpy.matlib
promises a list of functions that does not appear (at the moment, anyway).

Alan Isaac
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] f2py with int8

2012-04-18 Thread Paul Anton Letnes
Hi,

1, 2, 3 are integer literals.
1.0, 3.0e2, -42.0 are real (float) literals
'hello world' is a string literal.
As far as I remember, f2py requires a literal variable for the kind.

The solution I have landed on is to write a pure fortran module (using int8, or 
whatever), and then wrap this module either with an f2py compatible fortran 
module or an interface file.

If you want to know what int8 corresponds to, run the following (pure fortran) 
program through your compiler of choice:
program kind_values
use iso_fortran_env
implicit none
print *, 'int8 kind value:', int8
print *, 'int16 kind value:', int16
end program kind_values

Paul

On 17. apr. 2012, at 19:47, John Mitchell wrote:

> Thanks Paul.
> 
> I suppose this is now going slightly out of bounds for f2py.   What I am 
> looking for is the fortran kind type for a byte.  I thought that this was 
> int8.  I guess the question is how to identify the kind type.  Although I 
> have verified that integer(1) seems to work for me, I would  really like to 
> know why and your answer alludes to that.
> 
> Please excuse my ignorance on this topic.  Can you perhaps educate me a 
> little on 'literal kind values'?  I take you to mean that 
> 'int8' is not a literal kind value while 1 and 8 are examples of literal kind 
> values.
> 
> Thanks,
> John
> 
> 
> 
> On Tue, Apr 17, 2012 at 10:12 AM, Paul Anton Letnes 
>  wrote:
> Ah, come to think of it, I think that f2py only supports literal kind values. 
> Maybe that's your problem.
> 
> Paul
> 
> On 17. apr. 2012, at 07:58, Sameer Grover wrote:
> 
> > On Tuesday 17 April 2012 11:02 AM, John Mitchell wrote:
> >> Hi,
> >>
> >> I am using f2py to pass a numpy array of type numpy.int8 to fortran.  It 
> >> seems like I am misunderstanding something because I just can't make it 
> >> work.
> >>
> >> Here is what I am doing.
> >>
> >> PYTHON
> >> b=numpy.array(numpy.zeros(shape=(10,),dtype=numpy.int8),order='F')
> >> b[0]=1
> >> b[2]=1
> >> b[3]=1
> >> b
> >> array([1, 0, 1, 1, 0, 0, 0, 0, 0, 0], dtype=int8)
> >>
> >>
> >>
> >> FORTRAN
> >> subroutine print_bit_array(bits,n)
> >>use iso_fortran_env
> >>integer,intent(in)::n
> >>integer(kind=int8),intent(in),dimension(n)::bits
> >>print*,'bits = ',bits
> >> end subroutine print_bit_array
> >>
> >>
> >> RESULT when calling fortran from python
> >> bits = 1000000010
> >>
> >> Any Ideas?
> >> thanks,
> >> John
> >>
> >>
> >>
> >>
> >> ___
> >> NumPy-Discussion mailing list
> >>
> >> NumPy-Discussion@scipy.org
> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> > It seems to work if "integer(kind=int8)" is replaced with "integer(8)" or 
> > "integer(1)".  Don't know why, though.
> >
> > Sameer
> > ___
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion