Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4033

Re: Vectors

From Algis Kabaila <akabaila@pcug.org.au>
Organization PCUG - Users Helping Users
Subject Re: Vectors
Date 2011-04-26 21:26 +1000
References <mailman.625.1303285644.9059.python-list@python.org> <mailman.646.1303307522.9059.python-list@python.org> <62f7ffa9-8511-42e4-8a53-a11ce8636dbe@hd10g2000vbb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.834.1303817205.9059.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-20 17:47 +1000
  Re: Vectors Anssi Saari <as@sci.fi> - 2011-04-20 11:07 +0300
    RE: Vectors Andreas Tawn <andreas.tawn@ubisoft.com> - 2011-04-20 15:43 +0200
      Re: Vectors RJB <rbotting@csusb.edu> - 2011-04-20 08:34 -0700
        RE: Vectors Andreas Tawn <andreas.tawn@ubisoft.com> - 2011-04-20 17:49 +0200
        Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-21 17:25 +1000
          Re: Vectors Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-04-22 13:43 +1200
            Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-22 20:58 +1000
      Re: Vectors Anssi Saari <as@sci.fi> - 2011-04-21 17:07 +0300
      Re: Vectors Jonathan Hartley <tartley@tartley.com> - 2011-04-25 03:49 -0700
        Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-26 21:26 +1000
  Re: Vectors sturlamolden <sturlamolden@yahoo.no> - 2011-04-22 13:57 -0700
    Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-23 10:32 +1000
      Re: Vectors sturlamolden <sturlamolden@yahoo.no> - 2011-04-22 21:13 -0700
        Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-23 22:26 +1000
          Re: Vectors sturlamolden <sturlamolden@yahoo.no> - 2011-04-23 07:02 -0700
    Re: Vectors Robert Kern <robert.kern@gmail.com> - 2011-04-24 18:49 -0500
      Re: Vectors rusi <rustompmody@gmail.com> - 2011-04-24 19:59 -0700
        Re: Vectors Algis Kabaila <akabaila@pcug.org.au> - 2011-04-25 17:05 +1000

csiph-web