On Tue, Feb 27, 2018 at 9:02 AM, Seb wrote:
> That's right. I just tried this manipulation by replacing the last
> block of code in my example, from the line above `for` loop with:
>
> ------
> # Alternative using `np.matmul`
>
gt;>>> If A is an nx3 matrix and B is a 3x3 matrix, then C = A @ B is an
>>>> nx3 matrix where C[i] = A[i] @ B.
>>>> (This is a property of matrix multiplication in general, nothing
>>>> special about numpy.)
>>> I think that's only true if B is
g each
>>>> row (1x3) of a matrix by another matrix (3x3), compared to looping
>>>> through the matrix row by row as shown in the code.
>>
>>> Just multiply the two matrices together.
>>
>>> If A is an nx3 matrix and B is a 3x3 matrix, then C = A
ough the matrix row by row as shown in the code.
>
>> Just multiply the two matrices together.
>
>> If A is an nx3 matrix and B is a 3x3 matrix, then C = A @ B is an nx3
>> matrix where C[i] = A[i] @ B.
>
>> (This is a property of matrix multiplication in general, nothing
&
.
> Just multiply the two matrices together.
> If A is an nx3 matrix and B is a 3x3 matrix, then C = A @ B is an nx3
> matrix where C[i] = A[i] @ B.
> (This is a property of matrix multiplication in general, nothing
> special about numpy.)
I think that's only true if B is the sam
hen
C = A @ B is an nx3 matrix where C[i] = A[i] @ B.
(This is a property of matrix multiplication in
general, nothing special about numpy.)
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Feb 26, 2018 at 3:12 PM, Dan Stromberg wrote:
> On Mon, Feb 26, 2018 at 2:07 PM, Ian Kelly wrote:
>> Taking LMGTFY to a whole new level of rudeness by obviously not even
>> bothering to read the entire paragraph before responding.
>
> Is LMGTFY rude? I think maybe it was back when it sai
On Mon, Feb 26, 2018 at 2:07 PM, Ian Kelly wrote:
> On Mon, Feb 26, 2018 at 2:40 PM, Dan Stromberg wrote:
>> On Mon, Feb 26, 2018 at 8:53 AM, Seb wrote:
>>> On Sun, 25 Feb 2018 18:52:14 -0500,
>>> Terry Reedy wrote:
>>>
>>> [...]
>>>
numpy has a matrix multiply function and now the '@' mat
On Mon, Feb 26, 2018 at 2:40 PM, Dan Stromberg wrote:
> On Mon, Feb 26, 2018 at 8:53 AM, Seb wrote:
>> On Sun, 25 Feb 2018 18:52:14 -0500,
>> Terry Reedy wrote:
>>
>> [...]
>>
>>> numpy has a matrix multiply function and now the '@' matrix multiply
>>> operator.
>>
>> Yes, but what I was wonderi
On Mon, Feb 26, 2018 at 8:53 AM, Seb wrote:
> On Sun, 25 Feb 2018 18:52:14 -0500,
> Terry Reedy wrote:
>
> [...]
>
>> numpy has a matrix multiply function and now the '@' matrix multiply
>> operator.
>
> Yes, but what I was wondering is whether there's a faster way of
> multiplying each row (1x3)
On Mon, Feb 26, 2018 at 9:53 AM, Seb wrote:
> On Sun, 25 Feb 2018 18:52:14 -0500,
> Terry Reedy wrote:
>
> [...]
>
>> numpy has a matrix multiply function and now the '@' matrix multiply
>> operator.
>
> Yes, but what I was wondering is whether there's a faster way of
> multiplying each row (1x3)
On Sun, 25 Feb 2018 18:52:14 -0500,
Terry Reedy wrote:
[...]
> numpy has a matrix multiply function and now the '@' matrix multiply
> operator.
Yes, but what I was wondering is whether there's a faster way of
multiplying each row (1x3) of a matrix by another matrix (3x3), compared
to looping th
On 2/25/2018 12:45 PM, Seb wrote:
Hello,
The following is an example of an Nx3 matrix (`uvw`) representing N
vectors that need to be multiplied by a 3x3 matrix (generated by
`randint_mat` function) and store the result in `uvw_rots`:
---
Hello,
The following is an example of an Nx3 matrix (`uvw`) representing N
vectors that need to be multiplied by a 3x3 matrix (generated by
`randint_mat` function) and store the result in `uvw_rots`:
------
import numpy as np
Dave Farrance wrote:
Yep, he's evidently used to the Matlab/Octave way of defining "vectors"
which is somewhat easier for a math-oriented interactive environment.
It's just a *bit* more laborious to append columns in numpy.
Yes, that's probably the main reason to do things that way.
A collecti
PythonDude wrote:
>On Thursday, 12 November 2015 22:57:21 UTC+1, Robert Kern wrote:
>> He simply instantiated the two vectors as row-vectors instead of
>> column-vectors,
>> which he could have easily done, so he had to flip the matrix expression.
>
>Thank you very much Robert - I just had to
On Thursday, 12 November 2015 22:57:21 UTC+1, Robert Kern wrote:
> On 2015-11-12 15:57, PythonDude wrote:
> > Hi all,
> >
> > I've come around a webpage with python-tutorial/description for obtaining
> > something and I'll solve this:
> >
> > R = p^T w
> >
> > where R is a vector and p^T is the t
6, 8],
> [ 0, 3, 6, 9, 12],
> [ 0, 4, 8, 12, 16]])
> py> m.T * m
> matrix([[30]])
>
> Yeah, I don't know what that person is talking about either. It looks
> correct to me.
Thank you very much, Ian - just had to be sure about this - I would also be
very disappointed in Python, if this author was right about this non-intuitive
interpretation of how to do matrix multiplication :-)
--
https://mail.python.org/mailman/listinfo/python-list
On 2015-11-12 15:57, PythonDude wrote:
Hi all,
I've come around a webpage with python-tutorial/description for obtaining
something and I'll solve this:
R = p^T w
where R is a vector and p^T is the transpose of another vector.
...
p is a Nx1 column vector, so p^T turns into a 1xN row vector w
On Thu, Nov 12, 2015 at 8:57 AM, PythonDude wrote:
> Hi all,
>
> I've come around a webpage with python-tutorial/description for obtaining
> something and I'll solve this:
>
> R = p^T w
>
> where R is a vector and p^T is the transpose of another vector.
>
> ...
> p is a Nx1 column vector, so p^T
Hi all,
I've come around a webpage with python-tutorial/description for obtaining
something and I'll solve this:
R = p^T w
where R is a vector and p^T is the transpose of another vector.
...
p is a Nx1 column vector, so p^T turns into a 1xN row vector which can be
multiplied with the
Nx1 weig
On Tue, Jan 4, 2011 at 11:31 PM, Tim Roberts wrote:
> Zdenko wrote:
>>
>>Please, can anybody write me a simple recursive matrix multiplication
>>using multiple threads in Python, or at least show me some guidelines
>>how to write it myself
>
> Matrix mul
Zdenko wrote:
>
>Please, can anybody write me a simple recursive matrix multiplication
>using multiple threads in Python, or at least show me some guidelines
>how to write it myself
Matrix multiplication is not generally done recursively. There's no
conceptual gain. It
On 1/4/2011 2:15 AM, Ulrich Eckhardt wrote:
Zdenko wrote:
Please, can anybody write me a simple recursive matrix multiplication
using multiple threads in Python, or at least show me some guidelines
how to write it myself
No problem, I just need your bank account data to withdraw the payment
On Tue, 04 Jan 2011 13:22:33 +0100, Zdenko wrote:
> I wrote these two codes for example:
>
> this one is naive way of matrix multiplication using one thread
[...]
> this one is using two threads, each one is multiplying half of matrix
[...]
> why is second one more than twice sl
On Tue, Jan 4, 2011 at 4:22 AM, Zdenko wrote:
> On 4.1.2011 11:15, Ulrich Eckhardt wrote:
>>
>> Zdenko wrote:
>>>
>>> Please, can anybody write me a simple recursive matrix multiplication
>>> using multiple threads in Python, or at least show me some guid
See section titled: "'array' or 'matrix'? Which should I use?"
at
http://www.scipy.org/NumPy_for_Matlab_Users
BTW
http://www.python.org/dev/peps/pep-0211/
--
http://mail.python.org/mailman/listinfo/python-list
BTW
http://www.python.org/dev/peps/pep-0211/
--
http://mail.python.org/mailman/listinfo/python-list
your matrix
multiplication WHILE you were doing other things on your computer
where matrix multiplication was a background process chugging away
when you are not taxing the computer doing other stuff.
Threading adds efficiency when you would have lots of "blocking"
operations like reading
On 4.1.2011 11:15, Ulrich Eckhardt wrote:
Zdenko wrote:
Please, can anybody write me a simple recursive matrix multiplication
using multiple threads in Python, or at least show me some guidelines
how to write it myself
No problem, I just need your bank account data to withdraw the payment and
On 4 jan, 11:15, Ulrich Eckhardt
wrote:
> Zdenko wrote:
> > Please, can anybody write me a simple recursive matrix multiplication
> > using multiple threads in Python, or at least show me some guidelines
> > how to write it myself
>
> No problem, I just need your bank a
Zdenko wrote:
> Please, can anybody write me a simple recursive matrix multiplication
> using multiple threads in Python, or at least show me some guidelines
> how to write it myself
No problem, I just need your bank account data to withdraw the payment and
the address of your teache
Please, can anybody write me a simple recursive matrix multiplication
using multiple threads in Python, or at least show me some guidelines
how to write it myself
Thank You
--
http://mail.python.org/mailman/listinfo/python-list
1,0] = e*g+f*i
x[1,1] = e*h+f*j
What is the simplest way to do this? I ended up doing the matrix
multiplication manually as above but this doesn't scale very nicely if a & b
become larger size.
Cheers,
Jonno.
--
"If a theory can't produce hypotheses, can't be tested, ca
sturlamolden wrote:
> That's what I wrote: "NumPy has a matrix type." It is called called
> numpy.matrix.
>
> I did not suggest using the array type numpy.array.
>
> Reading carefully is indeed important...
I know what you wrote and you are strictly correct. I was just clarifying it
for a reade
On Jun 18, 11:20 am, Jeremy Sanders wrote:
> > NumPy has a matrix type that overloads the * operator.
> Just a tiny followup, which may be important unless you carefully read the
> documentation. The "*" operator doesn't do matrix multiplication for normal
> nump
[EMAIL PROTECTED] wrote:
> Hi,
>
> Is there any direct function for matrix multiplication in Python or
> any of its packages? or do we have to multiply element by element?
If you want a pure Python module for 4x4 matrices, then you may want to
look at Game Objects
http://code.
sturlamolden wrote:
> Use numpy: www.scipy.org
>
> NumPy has a matrix type that overloads the * operator.
Just a tiny followup, which may be important unless you carefully read the
documentation. The "*" operator doesn't do matrix multiplication for normal
numpy arrays
On Jun 17, 10:52 pm, "[EMAIL PROTECTED]" wrote:
> Hi,
>
> Is there any direct function for matrix multiplication in Python or
> any of its packages? or do we have to multiply element by element?
Use numpy: www.scipy.org
NumPy has a matrix type that overloads the *
[EMAIL PROTECTED]:
> Is there any direct function for matrix multiplication in Python or
> any of its packages? or do we have to multiply element by element?
First hit on google for "python matrix":
http://matpy.sourceforge.net/
--
Thomas Wittek
http://gedankenkonstrukt.de
Hi,
Is there any direct function for matrix multiplication in Python or
any of its packages? or do we have to multiply element by element?
Thank you,
Amit
--
http://mail.python.org/mailman/listinfo/python-list
a package, but if you insist in using lists
> of lists:
>
> >>> b = [[1, 2, 3, 4],
> ... [4, 5, 6, 7],
> ... [7, 8, 9, 10]]
> >>>
> >>> a = [[1, 2, 3],
> ... [4, 5, 6]]
> >>>
> >>> ab = [[sum(i*j for i, j in z
David wrote:
> Il 18 Oct 2006 04:17:29 -0700, Sssasss ha scritto:
>
> > hi evrybody!
> >
> > I wan't to multiply two square matrixes, and i don't understand why it
> > doesn't work.
> Can I suggest a little bit less cumbersome algorithm?
>
> def multmat2(A,B):
> "A*B"
> if len(A)!=len(B):
... [7, 8, 9, 10]]
>>>
>>> a = [[1, 2, 3],
... [4, 5, 6]]
>>>
>>> ab = [[sum(i*j for i, j in zip(row, col)) for col in zip(*b)] for row in a]
>>> ab
[[30, 36, 42, 48], [66, 81, 96, 111]]
Straightforward from the definition of matrix multiplication.
--
Roberto Bonvallet
--
http://mail.python.org/mailman/listinfo/python-list
Il 18 Oct 2006 04:17:29 -0700, Sssasss ha scritto:
> hi evrybody!
>
> I wan't to multiply two square matrixes, and i don't understand why it
> doesn't work.
Can I suggest a little bit less cumbersome algorithm?
def multmat2(A,B):
"A*B"
if len(A)!=len(B): return "error" # this check is
On 2006-10-18 14:15:17 +0200, Sssasss wrote:
> Fredrik Lundh wrote:
> > "Sssasss" wrote:
> >
> > > I wan't to multiply two square matrixes, and i don't understand why it
> > > doesn't work.
> > >
> > > def multmat(A,B):
> > >"A*B"
> > >if len(A)!=len(B): return "error"
> > >D=[]
> > >
Fredrik Lundh wrote:
> "Sssasss" wrote:
>
> > I wan't to multiply two square matrixes, and i don't understand why it
> > doesn't work.
> >
> > def multmat(A,B):
> >"A*B"
> >if len(A)!=len(B): return "error"
> >D=[]
> >C=[]
> >for i in range(len(A)): D.append(0)
> >for i in
"Sssasss" wrote:
> I wan't to multiply two square matrixes, and i don't understand why it
> doesn't work.
>
> def multmat(A,B):
>"A*B"
>if len(A)!=len(B): return "error"
>D=[]
>C=[]
>for i in range(len(A)): D.append(0)
>for i in range(len(A)): C.append(D)
append doesn't co
hi evrybody!
I wan't to multiply two square matrixes, and i don't understand why it
doesn't work.
Could you explain me?
def multmat(A,B):
"A*B"
if len(A)!=len(B): return "error"
D=[]
C=[]
for i in range(len(A)): D.append(0)
for i in range(len(A)): C.append(D)
for i in
49 matches
Mail list logo