On 03-24-2011, at 11:18 AM, SherjilOzair wrote: > Cool ideas, indeed. Very useful, I'm sure, and quite easy to > implement. > For the abstract Matrix part, A new constructor-less data-less class > AbstractMatrix which inherits class Matrix. This class' objects will > serve as pointers to Matrices. And the object would later be made to > point to a concrete class. We can also make the other concrete classes > sub-classes of this class, but that remains to be seen. Another slight > modification will need to be done to the solve function, to solve > simple eqns like Ax=B, where x is the abstract vector.
I'm not sure if this is the best idea. Working with these kind of matrices symbolically is quite different than regular matrices. They don't have any components, you're just working with the matrix as a whole ignoring the internal details. So, one won't have some of the functions of a regular matrix. For instance >>> 1/2*a.transpose()*N*N.transpose()*a where a and N are vectors. Then when you differentiate with respect to a, you'd get, >>> transpose((1/2*N*N.transpose().a)+(/2*a.transpose()*N*N.transpose() which then becomes, >>> 1/2*a.transpose()*transpose(N*N.transpose()) + >>> 1/2*a.transpose()*N*N.transpose() in this case, because of the N*N.transpose() will be symmetric, these can be added together to get, >>> a.transpose()*N*N.transpose() Note that this works even not knowing what the vectors are as long as they are of the right shape. The tricky part is working with the parts and taking transpose operations to rearrange things in the right order. I don't know how possible that is to do automatically. I've put a PDF of the Maple worksheet I have that does this at, http://db.tt/QBF5Eaz and for those with Maple, the actual worksheet is, http://db.tt/6jJoFdO > > The second idea is simpler, Just make the matrix class accept Matrices > as elements. We'll have to put in a flag though, a boolean > contains_matrices, which will tell particular methods to compute the > results with keeping this in mind, OR > > An alternate design : Another class BlockMatrix, which will accept > matrices as elements, but when any computation is needed, it will call > its BlockMatrix.expand() function, whose result will be feeded to the > regular matrices functions. The expansion will be stored in a local > cache in the object, to be re-used. The block matrix is a special kind of matrix, that has the "abstract" matrices as components. Basically, you're opening up an "abstract" matrix to provide some structure, but each of those parts is left as a black box. > > Thank you Tim. If you're interested to do the Linear Algebra module, > as Aaron says there is plenty of work to be done. We can discuss more > of it on IRC or mail. You're welcome. I tend to think of these as kind of parallel to the Linear Algebra module since these are only working with matrices as a whole or in large parts. Once as much can be done with these, you'd create the details of the individual matrices and then substitute for the abstract/block matrices to get the final result. Cheers, Tim. -- 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.