Re: How to construct matrix from vectors?

2015-06-21 Thread lanuradha
On Sunday, 21 June 2015 20:43:15 UTC+5:30, Dennis Lee Bieber wrote: On Sun, 21 Jun 2015 09:32:55 +0100, Mark Lawrence declaimed the following: On 21/06/2015 04:47, Nasser M. Abbasi wrote: But it is not as intuitive as with Matlab For those of us who don't know would you be kind

Re: How to construct matrix from vectors?

2015-06-21 Thread Dave Farrance
], [ 3, 6], [ 7, 10], [ 8, 11], [ 9, 12]]) Neat. And if the OP wants vectors in np array form to start with, and to stack them together without transposing at that point, he could do it like this: v1=np.vstack([1,2,3]) v2=np.vstack([4,5,6]) v3=np.vstack([7,8,9]) v4

Re: How to construct matrix from vectors?

2015-06-21 Thread Mark Lawrence
On 21/06/2015 04:47, Nasser M. Abbasi wrote: But it is not as intuitive as with Matlab For those of us who don't know would you be kind enough to do a cost comparison of Matlab vs Python licenses? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for

Re: How to construct matrix from vectors?

2015-06-21 Thread Fabien
On 06/21/2015 07:21 AM, Nasser M. Abbasi wrote: v1=np.array([(1,2,3)]).T v2=np.array([(4,5,6)]).T v3=np.array([(7,8,9)]).T v4=np.array([(10,11,12)]).T mat =np.hstack(( np.vstack((v1,v3)), np.vstack((v2,v4))) ) Out[236]: array([[ 1, 4], [ 2, 5], [ 3, 6], [ 7, 10],

How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
I just started to learn some python today for first time, so be easy on me. I am having some trouble figuring how do the problem shown in this link http://12000.org/my_notes/mma_matlab_control/KERNEL/KEse44.htm Given 4 column vectors, v1,v2,v3,v4, each is 3 rows. I want to use

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
On 6/20/2015 9:20 PM, MRAB wrote: Here's one way, one step at a time: r1 = np.concatenate([v1, v2]) r1 array([1, 2, 3, 4, 5, 6]) r2 = np.concatenate([v3, v4]) r2 array([ 7, 8, 9, 10, 11, 12]) m = np.array([r1, r2]) m array([[ 1, 2, 3, 4, 5, 6], [ 7, 8, 9, 10, 11, 12]])

Re: How to construct matrix from vectors?

2015-06-20 Thread MRAB
On 2015-06-21 02:57, Nasser M. Abbasi wrote: I just started to learn some python today for first time, so be easy on me. I am having some trouble figuring how do the problem shown in this link http://12000.org/my_notes/mma_matlab_control/KERNEL/KEse44.htm Given 4 column vectors, v1,v2,v3,v4

Re: How to construct matrix from vectors?

2015-06-20 Thread Nasser M. Abbasi
to Matlab's method: First make all the vectors column vectors v1=np.array([(1,2,3)]).T v2=np.array([(4,5,6)]).T v3=np.array([(7,8,9)]).T v4=np.array([(10,11,12)]).T mat =np.hstack(( np.vstack((v1,v3)), np.vstack((v2,v4))) ) Out[236]: array([[ 1, 4], [ 2, 5], [ 3, 6], [ 7, 10

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-24 Thread asandroq
On May 24, 12:27 am, Deeyana d.awlb...@hotmail.invalid wrote: Classic unsubstantiated and erroneous claim. Scheme does not come OOTB with any suitable libraries for host interop and though it can make calls to C libraries, doing so is awkward and involves difficulties with the impedance

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-24 Thread Chris Angelico
On Tue, May 24, 2011 at 8:27 AM, Deeyana d.awlberg@hotmail.invalid wrote: Classic unsubstantiated and erroneous claim. Scheme does not come OOTB with any suitable libraries for host interop and though it can make calls to C libraries, doing so is awkward and involves difficulties with the

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-24 Thread Deeyana
On Tue, 24 May 2011 13:39:15 -0700, asandroq wrote: On May 24, 12:27 am, Deeyana d.awlb...@hotmail.invalid wrote: Classic unsubstantiated and erroneous claim. Scheme does not come OOTB with any suitable libraries for host interop and though it can make calls to C libraries, doing so is

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-23 Thread asandroq
On May 23, 4:29 am, Deeyana d.awlb...@hotmail.invalid wrote: You might be interested in Clojure, then. Lists are more abstracted, like in Scheme, and vectors and also dictionaries/maps and sets are first class citizens along side lists. And unlike Scheme, Clojure has good library/host interop

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-23 Thread Pascal J. Bourguignon
torb...@diku.dk (Torben Ægidius Mogensen) writes: Xah Lee xah...@gmail.com writes: Functional Programing: stop using recursion, cons. Use map vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp/Guy_Steele_parallel_computing.html This is more or less what Backus said

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-23 Thread Antti J Ylikoski
On 23.5.2011 16:39, Pascal J. Bourguignon wrote: torb...@diku.dk (Torben Ægidius Mogensen) writes: Xah Leexah...@gmail.com writes: Functional Programing: stop using recursion, cons. Use map vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-23 Thread Deeyana
On Mon, 23 May 2011 00:52:07 -0700, asandroq wrote: On May 23, 4:29 am, Deeyana d.awlb...@hotmail.invalid wrote: You might be interested in Clojure, then. Lists are more abstracted, like in Scheme, and vectors and also dictionaries/maps and sets are first class citizens along side lists

Functional Programing: stop using recursion, cons. Use map vectors

2011-05-22 Thread Xah Lee
this is important but i think most lispers and functional programers still don't know it. Functional Programing: stop using recursion, cons. Use map vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp/Guy_Steele_parallel_computing.html btw, lists (as cons, car, cdr

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-22 Thread Deeyana
On Sun, 22 May 2011 15:47:53 -0700, Xah Lee wrote: this is important but i think most lispers and functional programers still don't know it. Functional Programing: stop using recursion, cons. Use map vectors. 〈Guy Steele on Parallel Programing〉 http://xahlee.org/comp

Re: Vectors

2011-04-26 Thread Algis Kabaila
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

Re: Vectors

2011-04-25 Thread Algis Kabaila
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

Re: Vectors

2011-04-25 Thread Jonathan Hartley
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

Re: Vectors

2011-04-24 Thread Robert Kern
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 Kabailaakaba...@pcug.org.au wrote: Are there any modules for vector algebra (three dimensional vectors, vector addition, subtraction, multiplication [scalar and vector

Re: Vectors

2011-04-24 Thread rusi
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

Re: Vectors

2011-04-23 Thread Algis Kabaila
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

Re: Vectors

2011-04-23 Thread sturlamolden
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

Re: Vectors

2011-04-22 Thread Algis Kabaila
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.

Re: Vectors

2011-04-22 Thread sturlamolden
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

Re: Vectors

2011-04-22 Thread Algis Kabaila
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

Re: Vectors

2011-04-22 Thread sturlamolden
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

Re: Vectors

2011-04-21 Thread Algis Kabaila
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

Re: Vectors

2011-04-21 Thread Anssi Saari
Andreas Tawn andreas.t...@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

Re: Vectors

2011-04-21 Thread Gregory Ewing
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

Vectors

2011-04-20 Thread Algis Kabaila
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

Re: Vectors

2011-04-20 Thread Chris Rebert
On Wed, Apr 20, 2011 at 12:47 AM, Algis Kabaila akaba...@pcug.org.au wrote: 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? Dunno if it has 3D-specific

Re: Vectors

2011-04-20 Thread Anssi Saari
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

RE: Vectors

2011-04-20 Thread Andreas Tawn
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

Re: Vectors

2011-04-20 Thread RJB
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

RE: Vectors

2011-04-20 Thread Andreas Tawn
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

Using vectors in single NLP constraint inside proc iml with call statement

2011-03-15 Thread ayaa
I have two variables that are stored in a data set and also are stored as matrices and vectors. I want to formulate only one constraint that is a function of all the data set's observations (or elements of these vectors) and a decision variable. Suppose the two stored variables (two vectors

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-17 Thread Iain Wade
Iain Wade iw...@optusnet.com.au added the comment: d'oh, I should have checked HEAD before submitting the bug. I am running 2.5.1 on OSX, the fix seems to be in 2.5.2 and above. Thanks, and sorry for wasting your time. -- status: open - closed ___

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-16 Thread Hagen Fürstenau
Hagen Fürstenau hfuerste...@gmx.net added the comment: Seems like this has already been fixed as issue 1385. -- nosy: +hagen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6473 ___

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-16 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Indeed, the provided test file passes on all python versions I have. Iain, does this script fail on some version? -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-13 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- priority: - critical stage: - needs patch versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6473

[issue6473] hmac sha384/sha512 fails test vectors

2009-07-12 Thread Iain Wade
New submission from Iain Wade iw...@optusnet.com.au: Test vectors are in the following draft rfc: http://tools.ietf.org/html/draft-nystrom-smime-hmac-sha The problem is that hmac.py has a hard-coded block size of 64, while SHA-384 and SHA-512 have a 128-byte block size. Suggested fix

adding vectors

2005-12-19 Thread Andy Leszczynski
Hi, Short question: why (1,abc,0.3)+(2,def,10.2) != (3,abcdef,10.5)? How to elegantly achieve (3,abcdef,10.5) as a result of addition ... Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: adding vectors

2005-12-19 Thread Paul Rubin
Andy Leszczynski [EMAIL PROTECTED] writes: Short question: why (1,abc,0.3)+(2,def,10.2) != (3,abcdef,10.5)? How to elegantly achieve (3,abcdef,10.5) as a result of addition ... tuple([(a+b) for a,b in zip((1,abc,0.3),(2,def,10.2))]) -- http://mail.python.org/mailman/listinfo/python-list

Re: adding vectors

2005-12-19 Thread Mike Meyer
Paul Rubin http://[EMAIL PROTECTED] writes: Andy Leszczynski [EMAIL PROTECTED] writes: Short question: why (1,abc,0.3)+(2,def,10.2) != (3,abcdef,10.5)? How to elegantly achieve (3,abcdef,10.5) as a result of addition ... tuple([(a+b) for a,b in zip((1,abc,0.3),(2,def,10.2))])

Re: adding vectors

2005-12-19 Thread Alex Martelli
Andy Leszczynski [EMAIL PROTECTED] wrote: Hi, Short question: why (1,abc,0.3)+(2,def,10.2) != (3,abcdef,10.5)? Because '+' applied to sequences means to concatenate them -- a more frequent need than element by element addition (which I notice you would NOT want to apply to strings, only to

Re: adding vectors

2005-12-19 Thread Paul Rubin
Mike Meyer [EMAIL PROTECTED] writes: map(operator.add, (1, abc, 0.3), (2, def, 10.2)) [3, 'abcdef', 10.5] Not having to do the zip is win. operator.add is a lose. I'm not sure either is what I'd call elegant. Yeah, I didn't bother checking whether you could pass dyadic functions to map.

Re: adding vectors

2005-12-19 Thread Terry Hancock
On Mon, 19 Dec 2005 22:06:31 -0500 Andy Leszczynski [EMAIL PROTECTED] wrote: Short question: why (1,abc,0.3)+(2,def,10.2) != (3,abcdef,10.5)? How to elegantly achieve (3,abcdef,10.5) as a result of addition ... (a,b,c) is a tuple, not a vector. IMHO, the elegant thing to do is to define a

Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread lugal
I'm new to C++, coming from a Python background. I wrote the following code in C++ based on the Python code found here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478 //beginning #include vector #include iostream.h using namespace std; void looper(vector vectorint nseq,

Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread MyHaz
I didn't look at the original code but i you should know that passing vectors directly (i.e by value) to functions is not a good idea (results in big copy), its better to use `const vector ` or `vector ` (i.e. by reference). In general you should try to reduce the number of vector coping

Re: Python to C++ conversion substituting vectors for lists in a recursive function

2005-03-23 Thread Peter Otten
lugal wrote: Your code has an undeclared int i in main(). gseq.erase(0); I think erase() takes a pointer, not the element index: gseq.erase(qseq.begin()); in the recursive function. Is my C++ translation accurate from the original Python? Coming from a Python background, you should have

Re: Vectors in Visual Python

2005-02-24 Thread FLChamp
Thanks for all your help everyone, if only it had addressed what I had asked I may have actually learned something about Python!! If anything was addressed to my problem then it has completely passed me by as most points were clearly made by a computer scientist and I am not one of those in the

Re: Vectors in Visual Python

2005-02-10 Thread Alex Martelli
Arthur [EMAIL PROTECTED] wrote: thinking that the visciousness with wihich you were attacking someone suggesting a proposal for an optional feature - even if an iill adivised proposal for and ill advised optional feature (I frankly don't care much about that part of the discussion one way or

Vectors in Visual Python

2005-02-09 Thread FLChamp
SOrry if this message is a little confused, it most probably reflects the state of the author! I have made a small program that plots the orbit of a planet in visual python using visual.vector for all values. If i run the program it is clear that the orbit is non-keplerian as the planets

Re: Vectors in Visual Python

2005-02-09 Thread Alex Martelli
Arthur [EMAIL PROTECTED] wrote: is that VPython vectors are in effect flat 3 element Numeric arrays, and Numeric ararys can be constructed with Float64 specified as the datatype. (wonder if that speciufication is a declaration, and if so whether that would indicate some conflict between

Re: Vectors in Visual Python

2005-02-09 Thread Alex Martelli
Terry Reedy [EMAIL PROTECTED] wrote: I (and I believe Alex) object to name declaration *statements* and/or the strong typing of *names*. I confirm that my key objection is to declarations in the strict sense: thingies that aren't executable, but rather billets doux to the compiler, for example

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
On Thu, 10 Feb 2005 00:16:05 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: Arthur [EMAIL PROTECTED] wrote: Please clarify if you were making a lame joke without smilies, are utterly confused about what declaration *MEANS*, or what other folly prompted you to this astounding remark, thanks.

Re: Vectors in Visual Python

2005-02-09 Thread Arthur
On Thu, 10 Feb 2005 00:16:05 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: Having found out how to build a lasting killfile, I'd like to see if using it liberally on people who appear to post here just to provoke flamewars, rather than to offer and receive help, and participate in interesting