Angel Yanguas-Gil | 1 Jul 02:29
Picon

problems with scipy in gentoo

Hi,

the scipy package in gentoo is currently masked and cannot be
installed. The problem is not in scipy but in one of the dependencies
which, at least in my case, is blas. Does anybody know if it is
possible to install scipy with an alternative library?

thanks

anglyan
dmitrey | 1 Jul 13:16
Favicon

once again about zeros() and ones()

Hi all,
There already was some discussion about zeros() and ones() usage, but I 
still can't understand some things.
1) currently ones(4,5, **kwargs) just yields error. Why it can't be 
translated to ones((4,5), **kwargs) ?
See my example of Ones() below.
##############################
from numpy import ones
def Ones(*args, **kwargs):
    if type(args[0]) in (type(()), type([])):
        return ones(*args, **kwargs)
    else: return ones(tuple(args), **kwargs)
#############################
if __name__ == '__main__':
    print Ones((2,2))
    print 2*Ones([2,2])
    print 3*Ones(2,2)   
    print 4*Ones(2,2,2, dtype=float)
    print 5*Ones((2,2,2), dtype='float')
    print 6*Ones([2,2,2], dtype='int')
    print 7*Ones(3,3, dtype=int, order = 'C')
    print 8*Ones((3,3), dtype='int')
    print 9*Ones(3, dtype='int')
    print 10*Ones((3,), dtype='int')
#############################

As one of the former MATLAB users, I'm very disappointed in using 
zeros((...)) instead of zeros(...), because I'm one of big number of 
those who should type the zeros() many times per day.
Also, same to ones(), tile(), reshape().
(Continue reading)

fred | 1 Jul 13:36
Picon

Re: once again about zeros() and ones()

dmitrey a écrit :
> 2) what does "order" param means? (in 
> zeros((d1,...,dn),dtype=float,order='C') )
>   
I guess it is related to how data are stored : 'C order' or 'Fortran order'
which are not the same, IIRC.

Try with order='C' and order='F'.

My 2 cts.

--

-- 
http://scipy.org/FredericPetit
Matthieu Brucher | 1 Jul 14:45
Picon

Re: once again about zeros() and ones()



2007/7/1, dmitrey <openopt <at> ukr.net>:
Hi all,
There already was some discussion about zeros() and ones() usage, but I
still can't understand some things.
1) currently ones(4,5, **kwargs) just yields error. Why it can't be
translated to ones((4,5), **kwargs) ?
See my example of Ones() below.
##############################
from numpy import ones
def Ones(*args, **kwargs):
    if type(args[0]) in (type(()), type([])):
        return ones(*args, **kwargs)
    else: return ones(tuple(args), **kwargs)
#############################
if __name__ == '__main__':
    print Ones((2,2))
    print 2*Ones([2,2])
    print 3*Ones(2,2)
    print 4*Ones(2,2,2, dtype=float)
    print 5*Ones((2,2,2), dtype='float')
    print 6*Ones([2,2,2], dtype='int')
    print 7*Ones(3,3, dtype=int, order = 'C')
    print 8*Ones((3,3), dtype='int')
    print 9*Ones(3, dtype='int')
    print 10*Ones((3,), dtype='int')
#############################

The first argument is a shape, the second is the type of the data. Python has no way of knowing that the second argument is part of the shape and not the type. This way, the arguments are defined correctly, although you could make a wrapper *args, **kwargs and forcing people to use explicitely dtype=float, which they won't do, thus leading to a lot of trouble and errors.

Matthieu

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
dmitrey | 1 Jul 15:10
Favicon

Re: once again about zeros() and ones()

I can't understand, which example of calling current numpy.zeros(...) is 
incompatible with mine, i.e. which one will yield other results?
D.

Matthieu Brucher wrote:
>
>
> 2007/7/1, dmitrey <openopt <at> ukr.net <mailto:openopt <at> ukr.net>>:
>
>     Hi all,
>     There already was some discussion about zeros() and ones() usage,
>     but I
>     still can't understand some things.
>     1) currently ones(4,5, **kwargs) just yields error. Why it can't be
>     translated to ones((4,5), **kwargs) ?
>     See my example of Ones() below.
>     ##############################
>     from numpy import ones
>     def Ones(*args, **kwargs):
>         if type(args[0]) in (type(()), type([])):
>             return ones(*args, **kwargs)
>         else: return ones(tuple(args), **kwargs)
>     #############################
>     if __name__ == '__main__':
>         print Ones((2,2))
>         print 2*Ones([2,2])
>         print 3*Ones(2,2)
>         print 4*Ones(2,2,2, dtype=float)
>         print 5*Ones((2,2,2), dtype='float')
>         print 6*Ones([2,2,2], dtype='int')
>         print 7*Ones(3,3, dtype=int, order = 'C')
>         print 8*Ones((3,3), dtype='int')
>         print 9*Ones(3, dtype='int')
>         print 10*Ones((3,), dtype='int')
>     #############################
>
>
> The first argument is a shape, the second is the type of the data. 
> Python has no way of knowing that the second argument is part of the 
> shape and not the type. This way, the arguments are defined correctly, 
> although you could make a wrapper *args, **kwargs and forcing people 
> to use explicitely dtype=float, which they won't do, thus leading to a 
> lot of trouble and errors.
>
> Matthieu
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user <at> scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   
Bill Dandreta | 1 Jul 15:22
Picon
Favicon

Re: problems with scipy in gentoo

Angel Yanguas-Gil wrote:
> the scipy package in gentoo is currently masked and cannot be
> installed. The problem is not in scipy but in one of the dependencies
> which, at least in my case, is blas. Does anybody know if it is
> possible to install scipy with an alternative library?
>   
Below are notes I wrote to myself to get scipy and matplotlib to install 
on gentoo:

Put these lines in /etc/portage/package.keywords

app-admin/eselect-blas ~amd64
app-admin/eselect-lapack ~amd64
dev-python/matplotlib ~amd64
dev-python/numpy ~amd64
dev-python/python-dateutil ~amd64
dev-python/pytz ~amd64
sci-libs/scipy amd64
---

emerge -av blas-reference eselect eselect-blas virtual/blas

#scipy requires lapack and numpy, matplotlib requires numpy.
#numpy does not require lapack but can use it.
#lapack-reference requires a fortran 77 compiler.
#gcc-4.X has gfortran, a fortran 95 compiler.
#Need to use gcc-3.x

emerge -av =sys-devel/gcc-3*

#switch compilers:
gcc-config -l
gcc-config x86_64-pc-linux-gnu-3.4.6
source /etc/profile

emerge -av virtual/lapack lapack-reference eselect-lapack

#switch compilers back:
gcc-config x86_64-pc-linux-gnu-4.1.2
source /etc/profile

emerge -av numpy matplotlib scipy

I have not gotten eselect-blas or eselect-lapack to work yet (maybe 
that's why they are masked <g>) but with blas-reference virtual/blas 
lapack-reference and virtual/lapack installed, portage is smart enough 
to use them when installing scipy. I've used blas-atlas and lapack-atlas 
in the past but since they take so long to compile and I don't do much 
linear algebra, the reference ones are OK for me.

Bill
--

-- 

Bill

wjdandreta <at> att.net

Gentoo Linux 2.6.20-gentoo-r8

Reclaim Your Inbox with http://www.mozilla.org/products/thunderbird/

All things cometh to he who waiteth as long as he who waiteth worketh like hell while he waiteth.
dmitrey | 1 Jul 15:46
Favicon

sparse stuff in numpy/scipy

Hi all,
I had heard there are some sparse matrix abilities in scipy (btw don't 
you think it's better to store those one in numpy?).
However, neither dir(scipy), nor dir(numpy), nor 
http://www.scipy.org/Topical_Software doesn't tell me what should I use.
Can scipy team just decide, which way sparse stuff will be implemented? 
Either it will be own numpy/scipy package, or some 3rd-party package 
will be connected, or maybe one of well-known Fortran/C sparse libraries 
will be connected? I didn't demand any excellent benchmark results, I 
need just something working + having status of common scipy/numpy users 
standard (like matplotlib has), that will be maintained - may be not 
very intensively, but at least somehow.
And, of course, it's highly preferable to have OSI-approved license 
without copyleft.

Regards, D.
Matthieu Brucher | 1 Jul 17:13
Picon

Re: once again about zeros() and ones()

numpy.zeros((2, 3, 4), float) for instance.

Matthieu

2007/7/1, dmitrey <openopt <at> ukr.net>:
I can't understand, which example of calling current numpy.zeros(...) is
incompatible with mine, i.e. which one will yield other results?
D.

Matthieu Brucher wrote:
>
>
> 2007/7/1, dmitrey < openopt <at> ukr.net <mailto:openopt <at> ukr.net>>:
>
>     Hi all,
>     There already was some discussion about zeros() and ones() usage,
>     but I
>     still can't understand some things.
>     1) currently ones(4,5, **kwargs) just yields error. Why it can't be
>     translated to ones((4,5), **kwargs) ?
>     See my example of Ones() below.
>     ##############################
>     from numpy import ones
>     def Ones(*args, **kwargs):
>         if type(args[0]) in (type(()), type([])):
>             return ones(*args, **kwargs)
>         else: return ones(tuple(args), **kwargs)
>     #############################
>     if __name__ == '__main__':
>         print Ones((2,2))
>         print 2*Ones([2,2])
>         print 3*Ones(2,2)
>         print 4*Ones(2,2,2, dtype=float)
>         print 5*Ones((2,2,2), dtype='float')
>         print 6*Ones([2,2,2], dtype='int')
>         print 7*Ones(3,3, dtype=int, order = 'C')
>         print 8*Ones((3,3), dtype='int')
>         print 9*Ones(3, dtype='int')
>         print 10*Ones((3,), dtype='int')
>     #############################
>
>
> The first argument is a shape, the second is the type of the data.
> Python has no way of knowing that the second argument is part of the
> shape and not the type. This way, the arguments are defined correctly,
> although you could make a wrapper *args, **kwargs and forcing people
> to use explicitely dtype=float, which they won't do, thus leading to a
> lot of trouble and errors.
>
> Matthieu
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user <at> scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
dmitrey | 1 Jul 19:12
Favicon

Re: once again about zeros() and ones()


Matthieu Brucher wrote:
> numpy.zeros((2, 3, 4), float) for instance.
>
> Matthieu
Ok, please try the updated file.
Maybe, it could be simplified.
D.

from numpy import ones
def Ones(*args, **kwargs):
    if type(args[0]) in (type(()), type([])):
        return ones(*args, **kwargs)
    else:
        i, args2 = 1, [args[0]]
        while i<len(args) and type(args[i])==type(15):  
args2.append(args[i]);  i+=1
        if len(args[i:]) ==0: return ones(args2, **kwargs)
        elif len(args[i:]) ==1: return ones(args2, args[i], **kwargs)
        elif len(args[i:]) ==2: return ones(args2, args[i], args[i+1], 
**kwargs)
        else: print 'ERROR!'

if __name__ == '__main__':
    print Ones((2,2))
    print 2*Ones([2,2])
    print 3*Ones(2,2)   
    print 4*Ones(2,2,2, dtype=float)
    print 5*Ones((2,2,2), dtype='float')
    print 6*Ones([2,2,2], dtype='int')
    print 7*Ones(3,3, dtype=int, order = 'C')
    print 8*Ones((3,3), dtype='int')
    print 9*Ones(3, dtype='int')
    print 10*Ones((3,), dtype='int')

    print 11*ones((2, 3, 4), float)
    print 12*Ones([2, 3, 4], 'float')
    print 13*Ones(2, 3, 4, float)
    print 14*Ones(2, 3, 4, int, order = 'C')
    print 15*Ones(2, 3, 4, float, 'F')
Picon

Re: sparse stuff in numpy/scipy

2007/7/1, dmitrey <openopt <at> ukr.net>:
> Hi all,
> I had heard there are some sparse matrix abilities in scipy (btw don't
> you think it's better to store those one in numpy?).
> However, neither dir(scipy), nor dir(numpy), nor
> http://www.scipy.org/Topical_Software doesn't tell me what should I use.

Have you tried "import scipy.sparse"?

Maybe one have to know something before beginning to make requests ;)

Best Regards,

    ~ Antonio

Gmane