On Apr 5, 2011, at 10:54 AM, Brian Granger wrote:

> On Tue, Apr 5, 2011 at 9:26 AM, Aaron S. Meurer <asmeu...@gmail.com> wrote:
>> 
>> On Apr 4, 2011, at 11:30 PM, Brian Granger wrote:
>> 
>>> Hi,
>>> 
>>>> Could you give an example of how you construct large sparse matrices.
>>>> What sort of constructors would you like to see in the class ?
>>> 
>>> Our big sparse matrices are formed out of tensor products of 2x2
>>> matrices, such as Pauli and Hadamard matrices.  But these tensor
>>> products have *many* identity matrices as well, which makes them
>>> sparse.  Here is our matrix tensor product code:
>>> 
>>> https://github.com/sympy/sympy/blob/master/sympy/physics/quantum/matrixutils.py#L232
>>> 
>>> 
>>> Here is some specific examples:
>>> 
>>> In [1]: from sympy.physics.quantum import *
>>> 
>>> In [2]: from sympy.physics.quantum.gate import *
>>> 
>>> In [3]: g = X(2)
>>> 
>>> In [4]: represent(g, nqubits=4)
>>> 
>>> You could also look at what happens when you increase nqubits and also look 
>>> at:
>>> 
>>> g = Y(2)
>>> g = H(2)
>>> 
>>> 2 could also be any number < nqubits
>>> 
>>> In many ways one of the most useful things we could have would be a
>>> sparse tensor product.
>>> 
>>>> Are there any special class of sparse matrices that you guys use
>>>> often, like tridiagonal matrix or permutation matrix ?
>>> 
>>> Nope, in practice we get matrices that look quite different and have
>>> different sparsities.
>>> 
>>>>>> I should also mention that we are
>>>> pretty much only interested in matrix-vector multiplies, matrix-
>>>> scalar
>>>> mult. and matrix addition.
>>> 
>>>> Arent you also interested in solving A * x = B, or matrix-matrix
>>>> mult ?
>>> 
>>> Nope for this particular application, we don't need linear solves or
>>> matrix-matrix mul.
>> 
>> So what do you do with the matrices?
> 
> 90% of the time, we build them and them apply a sequence of them to a vector:
> 
> A*B*C*D*E*...(Y*(Z*v))
> 
> We could do the matrix-matrix muls first and then apply to the vector:
> 
> (A*B*C*D*E*...Y*Z)*v
> 
> But the product of all the matrices is usually dense, and we don't
> want to have to store the entire big dense matrix.
> 
> Brian

This reminds me.  Implementing symbolic matrices would allow us to optimize 
multiplication of several matrices of different sizes using the matrix chain 
multiplication algorithm.

Aaron Meurer

> 
> 
> 
> 
>> Aaron Meurer
>> 
>>> 
>>> Cheers,
>>> 
>>> Brian
>>> 
>>>> Thank you for your help,
>>>> Sherjil Ozair
>>>> 
>>>> --
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "sympy" group.
>>>> To post to this group, send email to sympy@googlegroups.com.
>>>> To unsubscribe from this group, send email to 
>>>> sympy+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at 
>>>> http://groups.google.com/group/sympy?hl=en.
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Brian E. Granger
>>> Cal Poly State University, San Luis Obispo
>>> bgran...@calpoly.edu and elliso...@gmail.com
>>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "sympy" group.
>>> To post to this group, send email to sympy@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> sympy+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/sympy?hl=en.
>>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sympy" group.
>> To post to this group, send email to sympy@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sympy+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/sympy?hl=en.
>> 
>> 
> 
> 
> 
> -- 
> Brian E. Granger
> Cal Poly State University, San Luis Obispo
> bgran...@calpoly.edu and elliso...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to