Robert Bradshaw wrote:
> On Jul 9, 2009, at 3:36 AM, Robert Bradshaw wrote:
>
>> See http://trac.sagemath.org/sage_trac/ticket/5081 .
>>
>> sage: numpy.array([1, 10, 100]).dtype
>> dtype('int64')
>
> Following up on this, I've also posted http://trac.sagemath.org/
> sage_trac/ticket/6506 . This brings up an interface question, and I
> thought I'd bring it up here. With the latest patch, we have the
> following behavior:
>
> Integer -> long (if it fits), then int64 (if it fits) and object
> otherwise
> Real/Complex -> float64 (if it's less than 57 bits, which is the
> cuttoff for RealNumber(repr(float(x))), and object for greater prec
> Rational -> same as Integer for integral, float64 otherwise
>
> I figured this is mostly for numerical use (whenever I import numpy,
> that's the mode I'm in), and the real advantage of numpy is when
> using native types. If I want exact linear algebra then I'd be using
> Sage types anyways, not numpy. Does this seem reasonable?

Sounds reasonable to me.

I must say I disagree rather strongly with your view of NumPy though. The
real advantage of NumPy (for certain purposes) is the semantics, which is
not focused around doing linear algebra at all. (I've written about this
at length earlier though so won't repeat myself.)

The link between NumPy semantics and fixed-size types is mostly historical
and also because number crunching apps use the CPU they can get, but it's
no reason it has to be that way.

Being able to very easily experiment using higher-precision floats to see
if there were numerical and/or overflow problems without changing
calculation formulation has a certain appeal...

(I wouldn't really use it myself though, mainly because when passing data
into Fortran libs it must be of native type anyway. And I see that there's
some technical reasons why Sage types can't trivially be made NumPy
dtypes. So I'm not asking you to do anything differently, just disagreeing
with how you see NumPy.)

Dag Sverre


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to