[sage-support] Matrix multiplication by symbolic vector
Hello, usually I ask question by Ask sagemath but the server seems down since yesterday. I would like to define a matrix function with symbolic variables (Linear or quadratic) of the form x A x, B x... and also linear inequalities of the form C x <= b for any size of the A, B and C matrix. The final problem is to optimize or to manipulate equations or inequations. Whichever be my fails effort, and my reading comfort me, it seems not to be allowed in Sagemath which seems strange. But a recent reading seems to say that R = PolynomialRing(RR, 'c', 20) c = R.gens() could solve my problem. In fact, if I define a list of c[i] show([c[0],c[1],c[2]]) <-- this work [c[i] for i in range(0..2)] <-- this doesn't work I need to understand Thanks -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/0547b1aa-97e7-47d8-a2df-edaed05b3836n%40googlegroups.com.
Re: [sage-support] Matrix Multiplication
On Thu, Dec 13, 2018 at 3:59 PM Peter Luschny wrote: > > From Sage Quick Reference: Linear Algebra, Robert A. Beezer: > > Matrix Multiplication > u = vector(QQ, [1,2,3]), v = vector(QQ, [1,2]) > A = matrix(QQ, [[1,2,3],[4,5,6]]) > B = matrix(QQ, [[1,2],[3,4]]) > u*A, A*v, B*A, B^6, B^(-3) all possible > > > However u*A or A*v give: > TypeError: unsupported operand parent(s) for *: 'Vector space > of dimension 3 over Rational Field' and 'Full MatrixSpace of > 2 by 3 dense matrices over Rational Field' looks like a typo in Rob's Quick Reference to me. > > SageMath version 8.4, Release Date: 2018-10-17 > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Matrix Multiplication
>From Sage Quick Reference: Linear Algebra, Robert A. Beezer: Matrix Multiplication u = vector(QQ, [1,2,3]), v = vector(QQ, [1,2]) A = matrix(QQ, [[1,2,3],[4,5,6]]) B = matrix(QQ, [[1,2],[3,4]]) u*A, A*v, B*A, B^6, B^(-3) all possible However u*A or A*v give: TypeError: unsupported operand parent(s) for *: 'Vector space of dimension 3 over Rational Field' and 'Full MatrixSpace of 2 by 3 dense matrices over Rational Field' SageMath version 8.4, Release Date: 2018-10-17 -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Matrix multiplication over finite fields
Dear sage-support team, i'm trying to convince my boss about using modern linear algebra software (as part of a project on group cohomology rings). However, i need better arguments. Perhaps you have some? I wrote a toy dynamic module for Sage providing two test functions: 1. - Read a square matrix over a finite field from a MeatAxe file - convert it into a Sage matrix - multiply it n times with itself - return the result 2. - Read a square matrix over a finite field from a MeatAxe file - multiply it n times with itself by using MeatAxe - convert the result into a Sage matrix - return it I was not interested in the result (computing M^101 in sage needs almost no time), but i was interested in the time of a single matrix multiplication. Therefore i've put the multiplications into a loop, compiled using sage -cython. When i take a 4x4 matrix over GF(7) with n=101, test function 1 needs 92.50 s CPU time, but test function 2 only needs 1.49 s CPU time! Hence, in that case, MeatAxe (actually a very old version!!) appears to be faster than Sage built with Atlas, by a factor of 60! On the other hand, a single multiplication of very large (4000x4000) random matrices over GF(2) in Sage is faster than multiplication in MeatAxe, by a factor of about 5. Do you have an explanation of that phenomenon? I do think the two test functions are fair, as in both cases we have exactly one matrix conversion and the loop -- the only difference is whether one uses multiplication by Sage or by MeatAxe. Yours sincerely Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---