Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #3663 > unrolled thread
| Started by | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| First post | 2011-04-20 17:47 +1000 |
| Last post | 2011-04-25 17:05 +1000 |
| Articles | 19 — 9 participants |
Back to article view | Back to comp.lang.python
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
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-20 17:47 +1000 |
| Subject | Vectors |
| Message-ID | <mailman.625.1303285644.9059.python-list@python.org> |
Hi, 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? platform - ubuntu 10.10 (Linux), Python 3.1 or higher. Thanks for your help to avoid re-invention of the wheel. OldAl. -- Algis http://akabaila.pcug.org.au/StructuralAnalysis.pdf
[toc] | [next] | [standalone]
| From | Anssi Saari <as@sci.fi> |
|---|---|
| Date | 2011-04-20 11:07 +0300 |
| Message-ID | <vg3r58xgxbf.fsf@pepper.modeemi.fi> |
| In reply to | #3663 |
Algis Kabaila <akabaila@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 at http://numpy.scipy.org/
[toc] | [prev] | [next] | [standalone]
| From | Andreas Tawn <andreas.tawn@ubisoft.com> |
|---|---|
| Date | 2011-04-20 15:43 +0200 |
| Message-ID | <mailman.646.1303307522.9059.python-list@python.org> |
| In reply to | #3666 |
> Algis Kabaila <akabaila@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 at http://numpy.scipy.org/ You might also want to consider http://code.google.com/p/pyeuclid/ Cheers, Drea
[toc] | [prev] | [next] | [standalone]
| From | RJB <rbotting@csusb.edu> |
|---|---|
| Date | 2011-04-20 08:34 -0700 |
| Message-ID | <053fd9a1-f829-4777-a6ad-32ea4b22789a@r4g2000prm.googlegroups.com> |
| In reply to | #3702 |
On Apr 20, 6:43 am, 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 Pyeuclid docs don't mention dot or cross products. RJB
[toc] | [prev] | [next] | [standalone]
| From | Andreas Tawn <andreas.tawn@ubisoft.com> |
|---|---|
| Date | 2011-04-20 17:49 +0200 |
| Message-ID | <mailman.651.1303314600.9059.python-list@python.org> |
| In reply to | #3721 |
> On Apr 20, 6:43 am, 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 > > Pyeuclid docs don't mention dot or cross products. > RJB http://partiallydisassembled.net/euclid/vector-classes.html#SECTION002220000000000000000 Bottom of the page. Cheers, Drea
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-21 17:25 +1000 |
| Message-ID | <mailman.686.1303370707.9059.python-list@python.org> |
| In reply to | #3721 |
On Thursday 21 April 2011 01:49:57 Andreas Tawn wrote: > > On Apr 20, 6:43 am, 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 > > > > Pyeuclid docs don't mention dot or cross products. > > RJB > > http://partiallydisassembled.net/euclid/vector-classes.html#S > ECTION002220000000000000000 > > Bottom of the page. > > Cheers, > > Drea Yes, pyeuclid had "cross" and "dot" product of vectors. I am impressed with it and curious how it works: the Vector3 class is available without any prefix euclid: import euclid v = Vector3(111.., 222.2, 333.3) works without requiring as in: v = euclid.Vector3( etc...) I am really intrigued by that. OTOH, I also am somewhat aprehensive about using something that affects the program writing after importing "euclid", without any need to explicitly refer to euclid. Looks rather risky to me. What does that do to the namespace? Thanks for bringing this to my attention. I confess that I would be hapier if euclid was accessible in a "standard" manner with prefix of module name for classes in the module. OldAl. -- Algis http://akabaila.pcug.org.au/StructuralAnalysis.pdf
[toc] | [prev] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2011-04-22 13:43 +1200 |
| Message-ID | <91c4q0Fnl4U1@mid.individual.net> |
| In reply to | #3771 |
Algis Kabaila wrote: > the Vector3 class > is available without any prefix euclid: > > import euclid > v = Vector3(111.., 222.2, 333.3) Doesn't work that way for me: Python 2.7 (r27:82500, Oct 15 2010, 21:14:33) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import euclid >>> Vector3 Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'Vector3' is not defined Are you sure you hadn't previously done 'from euclid import Vector3' or 'from euclid import *' in that session? -- Greg
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-22 20:58 +1000 |
| Message-ID | <mailman.743.1303469897.9059.python-list@python.org> |
| In reply to | #3834 |
On Friday 22 April 2011 11:43:26 Gregory Ewing wrote: > Algis Kabaila wrote: > > the Vector3 class > > is available without any prefix euclid: > > > > import euclid > > v = Vector3(111.., 222.2, 333.3) > > Doesn't work that way for me: > > Python 2.7 (r27:82500, Oct 15 2010, 21:14:33) > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin > Type "help", "copyright", "credits" or "license" for more > information. > > >>> import euclid > >>> Vector3 > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > NameError: name 'Vector3' is not defined > > Are you sure you hadn't previously done 'from euclid import > Vector3' or 'from euclid import *' in that session? I've tested it again and it does behave in a "standard" manner. I must have imported all as you suspected. Makes me much happier, though I do feel sheepish. As they say, sh... happens. BTW, I did modify the euclid very slightly to work with Python 3 - just change the syntax of messages with exception in line with syntax changes. Thanks for sharing your experience with that cute package! OldAl. -- Algis http://akabaila.pcug.org.au/StructuralAnalysis.pdf
[toc] | [prev] | [next] | [standalone]
| From | Anssi Saari <as@sci.fi> |
|---|---|
| Date | 2011-04-21 17:07 +0300 |
| Message-ID | <vg3d3kfg0ko.fsf@pepper.modeemi.fi> |
| In reply to | #3702 |
Andreas Tawn <andreas.tawn@ubisoft.com> writes: > You might also want to consider http://code.google.com/p/pyeuclid/ Thanks, I was studying quaternions recently and had to use two packages to get some stuff done. And of course one of them used ass-backwards declaration for a quaternion and one didn't...
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Hartley <tartley@tartley.com> |
|---|---|
| Date | 2011-04-25 03:49 -0700 |
| Message-ID | <62f7ffa9-8511-42e4-8a53-a11ce8636dbe@hd10g2000vbb.googlegroups.com> |
| In reply to | #3702 |
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
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-26 21:26 +1000 |
| Message-ID | <mailman.834.1303817205.9059.python-list@python.org> |
| In reply to | #3972 |
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
[toc] | [prev] | [next] | [standalone]
| From | sturlamolden <sturlamolden@yahoo.no> |
|---|---|
| Date | 2011-04-22 13:57 -0700 |
| Message-ID | <bea7e814-c208-4268-8ef6-e019be552dab@bl1g2000vbb.googlegroups.com> |
| In reply to | #3663 |
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
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-23 10:32 +1000 |
| Message-ID | <mailman.769.1303518759.9059.python-list@python.org> |
| In reply to | #3893 |
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
[toc] | [prev] | [next] | [standalone]
| From | sturlamolden <sturlamolden@yahoo.no> |
|---|---|
| Date | 2011-04-22 21:13 -0700 |
| Message-ID | <8d8942d4-372c-4bc8-a13d-3c496daf5c73@z37g2000vbl.googlegroups.com> |
| In reply to | #3899 |
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/numpy/files/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
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-23 22:26 +1000 |
| Message-ID | <mailman.775.1303561616.9059.python-list@python.org> |
| In reply to | #3902 |
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/numpy/files/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
[toc] | [prev] | [next] | [standalone]
| From | sturlamolden <sturlamolden@yahoo.no> |
|---|---|
| Date | 2011-04-23 07:02 -0700 |
| Message-ID | <2f7ad52e-b23b-4047-a7b3-557bce6a1c8f@z31g2000vbs.googlegroups.com> |
| In reply to | #3908 |
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
[toc] | [prev] | [next] | [standalone]
| From | Robert Kern <robert.kern@gmail.com> |
|---|---|
| Date | 2011-04-24 18:49 -0500 |
| Message-ID | <mailman.808.1303688996.9059.python-list@python.org> |
| In reply to | #3893 |
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
[toc] | [prev] | [next] | [standalone]
| From | rusi <rustompmody@gmail.com> |
|---|---|
| Date | 2011-04-24 19:59 -0700 |
| Message-ID | <7f574d15-02f5-4487-8436-99ee148efccc@j16g2000pro.googlegroups.com> |
| In reply to | #3966 |
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
[toc] | [prev] | [next] | [standalone]
| From | Algis Kabaila <akabaila@pcug.org.au> |
|---|---|
| Date | 2011-04-25 17:05 +1000 |
| Message-ID | <mailman.809.1303715151.9059.python-list@python.org> |
| In reply to | #3968 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web