Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Vectors

Reply
Thread Tools

Vectors

 
 
Algis Kabaila
Guest
Posts: n/a
 
      04-23-2011
On Saturday 23 April 2011 06:57:23 sturlamolden wrote:
> On Apr 20, 9:47 am, Algis Kabaila <akaba...@pcug.org.au>

wrote:
> > Are there any modules for vector algebra (three dimensional
> > vectors, vector addition, subtraction, multiplication
> > [scalar and vector]. Could you give me a reference to such
> > module?

>
> NumPy
>
> Or one of these libraries (ctypes or Cython):
>
> BLAS (Intel MKL, ACML, ACML-GPU, GotoBLAS2, or ATLAS)
> Intel VML
> ACML-VM


Thanks for that. Last time I looked at numpy (for Python3) it
was available in source only. I know, real men do compile, but
I am an old man... I will compile if it is unavoidable, but in
case of numpy it does not seem a simple matter. Am I badly
mistaken?

euclid has another attraction - the source is readily available,
not too burdened by backward compatibility issues and relatively
easy to follow, though I "managed" to get lost in it

OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
 
Reply With Quote
 
 
 
 
sturlamolden
Guest
Posts: n/a
 
      04-23-2011
On Apr 23, 2:32*am, Algis Kabaila <akaba...@pcug.org.au> wrote:

> Thanks for that. *Last time I looked at numpy (for Python3) it
> was available in source only. *I know, real men do compile, but
> I am an old man... *I will compile if it is unavoidable, but in
> case of numpy it does not seem *a simple matter. Am I badly
> mistaken?



There is a Win32 binary for Python 3.1:

http://sourceforge.net/projects/nump...s/NumPy/1.5.1/

I have not tried to compile NumPy as I use Enthought to
avoid such headaches. I value my own time enough to pay
for a subscription

http://enthought.com/



Sturla

 
Reply With Quote
 
 
 
 
Algis Kabaila
Guest
Posts: n/a
 
      04-23-2011
On Saturday 23 April 2011 14:13:31 sturlamolden wrote:
> On Apr 23, 2:32 am, Algis Kabaila <akaba...@pcug.org.au>

wrote:
> > Thanks for that. Last time I looked at numpy (for Python3)
> > it was available in source only. I know, real men do
> > compile, but I am an old man... I will compile if it is
> > unavoidable, but in case of numpy it does not seem a
> > simple matter. Am I badly mistaken?

>
> There is a Win32 binary for Python 3.1:
>
> http://sourceforge.net/projects/nump...s/NumPy/1.5.1/
>
> I have not tried to compile NumPy as I use Enthought to
> avoid such headaches. I value my own time enough to pay
> for a subscription
>
> http://enthought.com/
>
>
>
> Sturla


Whilst I have Win32 officially paid for OS, never "fire it up".
I find nix systems much more interesting and convenient for
programming and consequently I use ubuntu for computing
activities. I do understand that many people prefer Win32 and
appreciate their right to use what they want. I just am at a
loss to understand *why* ...

I guess each to own taste,

OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
 
Reply With Quote
 
sturlamolden
Guest
Posts: n/a
 
      04-23-2011
On Apr 23, 2:26*pm, Algis Kabaila <akaba...@pcug.org.au> wrote:

> I do understand that many people prefer Win32 and
> appreciate their right to use what they want. *I just am at a
> loss to understand *why* ...


For the same reason some people prefered OS/2 or
DEC to SunOS or BSD.

For the same reason some people prefer Perl or Java
to Python.

Sturla


 
Reply With Quote
 
Robert Kern
Guest
Posts: n/a
 
      04-24-2011
On 4/22/11 7:32 PM, Algis Kabaila wrote:
> On Saturday 23 April 2011 06:57:23 sturlamolden wrote:
>> On Apr 20, 9:47 am, Algis Kabaila<akaba...@pcug.org.au>

> wrote:
>>> Are there any modules for vector algebra (three dimensional
>>> vectors, vector addition, subtraction, multiplication
>>> [scalar and vector]. Could you give me a reference to such
>>> module?

>>
>> NumPy
>>
>> Or one of these libraries (ctypes or Cython):
>>
>> BLAS (Intel MKL, ACML, ACML-GPU, GotoBLAS2, or ATLAS)
>> Intel VML
>> ACML-VM

>
> Thanks for that. Last time I looked at numpy (for Python3) it
> was available in source only. I know, real men do compile, but
> I am an old man... I will compile if it is unavoidable, but in
> case of numpy it does not seem a simple matter. Am I badly
> mistaken?


On UNIX machines with compilers and headers properly installed, it's really
pretty straightforward.

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

 
Reply With Quote
 
rusi
Guest
Posts: n/a
 
      04-25-2011
On Apr 25, 4:49*am, Robert Kern <robert.k...@gmail.com> wrote:
> On 4/22/11 7:32 PM, Algis Kabaila wrote:
>
>
>
> > On Saturday 23 April 2011 06:57:23 sturlamolden wrote:
> >> On Apr 20, 9:47 am, Algis Kabaila<akaba...@pcug.org.au>

> > wrote:
> >>> Are there any modules for vector algebra (three dimensional
> >>> vectors, vector addition, subtraction, multiplication
> >>> [scalar and vector]. Could you give me a reference to such
> >>> module?

>
> >> NumPy

>
> >> Or one of these libraries (ctypes or Cython):

>
> >> BLAS (Intel MKL, ACML, ACML-GPU, GotoBLAS2, or ATLAS)
> >> Intel VML
> >> ACML-VM

>
> > Thanks for that. *Last time I looked at numpy (for Python3) it
> > was available in source only. *I know, real men do compile, but
> > I am an old man... *I will compile if it is unavoidable, but in
> > case of numpy it does not seem *a simple matter. Am I badly
> > mistaken?

>
> On UNIX machines with compilers and headers properly installed, it's really
> pretty straightforward.


Mostly (on ubuntu/debian) that means do this [Untested]
$ aptitude build-dep python-numpy
Then you should be ready to build/compile numpy from source
 
Reply With Quote
 
Algis Kabaila
Guest
Posts: n/a
 
      04-25-2011
On Monday 25 April 2011 12:59:38 rusi wrote:
> On Apr 25, 4:49 am, Robert Kern <robert.k...@gmail.com> wrote:
> > On 4/22/11 7:32 PM, Algis Kabaila wrote:
> > > On Saturday 23 April 2011 06:57:23 sturlamolden wrote:
> > >> On Apr 20, 9:47 am, Algis Kabaila<akaba...@pcug.org.au>
> > >
> > > wrote:
> > >>> Are there any modules for vector algebra (three
> > >>> dimensional vectors, vector addition, subtraction,
> > >>> multiplication [scalar and vector]. Could you give me
> > >>> a reference to such module?
> > >>
> > >> NumPy
> > >>
> > >> Or one of these libraries (ctypes or Cython):
> > >>
> > >> BLAS (Intel MKL, ACML, ACML-GPU, GotoBLAS2, or ATLAS)
> > >> Intel VML
> > >> ACML-VM
> > >
> > > Thanks for that. Last time I looked at numpy (for
> > > Python3) it was available in source only. I know, real
> > > men do compile, but I am an old man... I will compile
> > > if it is unavoidable, but in case of numpy it does not
> > > seem a simple matter. Am I badly mistaken?

> >
> > On UNIX machines with compilers and headers properly
> > installed, it's really pretty straightforward.

>
> Mostly (on ubuntu/debian) that means do this [Untested]
> $ aptitude build-dep python-numpy
> Then you should be ready to build/compile numpy from source


Thank you, Robert and Rusi,

I will try it RSN, but first the latest version of ubuntu that
should become available this week (including today?!).

OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
 
Reply With Quote
 
Jonathan Hartley
Guest
Posts: n/a
 
      04-25-2011
On Apr 20, 2:43*pm, Andreas Tawn <andreas.t...@ubisoft.com> wrote:
> > Algis Kabaila <akaba...@pcug.org.au> writes:

>
> > > Are there any modules for vector algebra (three dimensional
> > > vectors, vector addition, subtraction, multiplication [scalar
> > > and vector]. Could you give me a reference to such module?

>
> > NumPy has array (and matrix) types with support for these basic
> > operations you mention. See the tutorial athttp://numpy.scipy.org/

>
> You might also want to considerhttp://code.google.com/p/pyeuclid/
>
> Cheers,
>
> Drea



Stealing this from Casey Duncan's recent post to the Grease users
list:


- (ab)use complex numbers for 2D vectors (only). Very fast arithmetic
and built-in to Python. Downside is lack of abstraction.

- Use pyeuclid (pure python) if ultimate speed isn't an issue, or if
compiled extensions are. It supports 3D and has a nice api

- vectypes is a more recent project from the same author as pyeuclid.
It offers a more consistent 'GLSL' like interface, including
swizzling, and internally seems to have more maintainable code because
it generates various sizes of vector and matrix from a single
template. This is done without performance penalty because the
generation is done at design time, not runtime.

- Use pyeigen if you want fast vectors, and don't mind compiling some
C/C++. I don't know how the Python api looks though

- Use numpy if you want fast batch operations

 
Reply With Quote
 
Algis Kabaila
Guest
Posts: n/a
 
      04-26-2011
On Monday 25 April 2011 20:49:34 Jonathan Hartley wrote:
> On Apr 20, 2:43 pm, Andreas Tawn <andreas.t...@ubisoft.com>

wrote:
> > > Algis Kabaila <akaba...@pcug.org.au> writes:
> > > > Are there any modules for vector algebra (three
> > > > dimensional vectors, vector addition, subtraction,
> > > > multiplication [scalar and vector]. Could you give me
> > > > a reference to such module?
> > >
> > > NumPy has array (and matrix) types with support for these
> > > basic operations you mention. See the tutorial
> > > athttp://numpy.scipy.org/

> >
> > You might also want to
> > considerhttp://code.google.com/p/pyeuclid/
> >
> > Cheers,
> >
> > Drea

>
> Stealing this from Casey Duncan's recent post to the Grease
> users list:
>
>
> - (ab)use complex numbers for 2D vectors (only). Very fast
> arithmetic and built-in to Python. Downside is lack of
> abstraction.
>
> - Use pyeuclid (pure python) if ultimate speed isn't an
> issue, or if compiled extensions are. It supports 3D and has
> a nice api
>
> - vectypes is a more recent project from the same author as
> pyeuclid. It offers a more consistent 'GLSL' like interface,
> including swizzling, and internally seems to have more
> maintainable code because it generates various sizes of
> vector and matrix from a single template. This is done
> without performance penalty because the generation is done
> at design time, not runtime.
>
> - Use pyeigen if you want fast vectors, and don't mind
> compiling some C/C++. I don't know how the Python api looks
> though
>
> - Use numpy if you want fast batch operations

Jonathan,

Thank you for a nice and extensive list of references. To
clarify my position - surprisingly, speed is not an issue- I've
programmed a matrix in pure python (3, but mainly iwth python 2
syntax) and found that inversion was quite fast enough for my
requirements.

Good vector algebra is necessary for 3 D frame analysis, so a
vector package is indicated. numpy is great, but it is a tool
like a sledge to drive a nail...

OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ primer statement about vectors containing vectors pauldepstein@att.net C++ 3 03-26-2008 06:22 PM
Ruby, SWIG and C++: how to properly wrap vector of vectors of doubles (2D vectors)? Ruby 0 09-14-2005 05:47 PM
Conditional Check on Vectors Analog Guy VHDL 3 10-07-2004 09:13 AM
millions combinations of test vectors for ALU Lily VHDL 16 05-10-2004 07:22 PM
Comparison of Bit Vectors in a Conditional Signal Assignment Statement Anand P Paralkar VHDL 2 08-04-2003 08:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57