2011/3/18 Aaron S. Meurer <[email protected]>:
>
> On Mar 18, 2011, at 4:13 PM, Robert Kern wrote:
>
>> On Fri, Mar 18, 2011 at 17:04, Aaron S. Meurer <[email protected]> wrote:
>>>
>>> On Mar 18, 2011, at 11:53 AM, Alexey U. Gudchenko wrote:
>>>
>>>>
>>>> 18.03.2011 19:42, SherjilOzair пишет:
>>>>> Hi,
>>>>
>>>> Good evening.
>>>>
>>>>> I'm working on a small base implementation of numpy-style array for
>>>>> sympy.
>>>>> Currently I've added component-wise addition, subtraction,
>>>>> multiplication, mult by integer. I've uploaded the code on GitHub.
>>>>
>>>> Where is it?
>>>>
>>>>>
>>>>> Here are some points of discussion.
>>>>>
>>>>> 1) If unequal-sized arrays are added, should an error be raised or
>>>>> should they still be force-added taking the missing elements as zero ?
>>>>> 2) Multiplication of two linear arrays should give another linear
>>>>> array, with component-wise multiplication ? Or an array of 2-tuples,
>>>>> like one does with Sets ?
>>>>> 3) If using component-wise multiplication, for unequal arrays, should
>>>>> the missing elements be taken as one ? Or should an error be raised ?
>>>>> 4) Power will be done component-wise ? But this depends on the answer
>>>>> to point 2.
>>>>> 5) Any more features ?
>>>>>
>>>>> Thanks,
>>>>> Sherjil Ozair
>>>>>
>>>> Sorry, I can entangle you, but:
>>>>
>>>> May be it would be helpful for answering of your questions if the aims of 
>>>> 'numpy-style array' would be more clear (for me at least, I can't find 
>>>> issues, aims or description of  'numpy-style array').
>>>
>>> The purpose is to implement a basic version of numpy in sympy so that you 
>>> do not have to install numpy to use the basic array feature.  Since numpy 
>>> has to be compiled, this will be very useful, since, for example, you can't 
>>> install it on the Google App Engine.  Therefore, the implementation in 
>>> SymPy should match the numpy implementation.
>>
>> That's not very informative. numpy ndarrays have a *lot* of
>> functionality attached to them. It's a major project, beyond the
>> capabilities and resources of a single GSoC student, to match *all* of
>> their functionality. You need to clearly state exactly what features
>> of numpy ndarrays you want duplicated.
>>
>> --
>> 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
>
> Well, it was Ondrej's idea.  Probably he could explain what he wants to see 
> implemented better.

Indeed, Robert is right, that this project can become tricky if ill
specified. My aim is to have "some basic implementation of arrays",
that would behave exactly like numpy.array, so that we can simply use
them, for example on the app engine, and if the speed becomes an
issue, you just install numpy and use it on your own hardware.

I frequently use the numpy's array syntax for my own research, and I
think it should be part of the basic language of Python, e.g. there
should be some implementation, that always works (e.g. on the app
engine), so it must be pure python.

Now features, that I mainly use are the following:

* [1, 2, 3] ** 3 operates on the elements, not the "matrix
exponentiation", sin([1, 2, 3]) again operates on the elements.
* reading from a text file (numpy.loadtxt)
* indexing, e.g. a[:, 2], and so on
* min(), max(), average()
* a = array([1, 2, 3]); a < eps, so things like .all(), and .any()

So to be totally specific, here is my current patch from a month ago
(not yet in sympy):

https://github.com/certik/sympy/commit/00a77c35dd0d603826aa29fe1c9528e34d08142e

and we have a test, that tests numpy/sympy interoperability. This test
file now partly works with my pure python implementation. So a very
specific project is to make *all* the numpy/sympy tests work with the
pure Python implementation. That is definitely a doable project, in
fact, I wanted to finish this myself, before submitting the patch for
review.

The tests in sympy don't test much of the 2D/3D stuff, so possible
extensions to the above are possible, but I think just making the
basic stuff work is worthy, and doable.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to