Well, you could make that syntax work by defining __iter__, so that L, U = LUDecomposition(X)
would be the same as LU = LUDecomposition(X) L, U = LU.L, LU.U Wouldn't the type just be MatrixExpr? But I see what you mean now. L, U, and X are somehow "linked" together. So I guess you might need to have a separate subclass for L and for U, like LowerTriangular, and UpperTrangular (except with some better names that suggest that the objects always have a corresponding dual). Those classes would then have some properties that point to the corresponding class, and also back to X. It may actually be overkill to also create LUDecomposition as a third class (depending again on what you want to do). But honestly, the best way to see what the class structure should look like is to write down all the functionality you want, and then see what you can factor out into common superclasses. From there, the names of the classes should be clear by what kind of common functionality they define. Trying to do this in the other order (figure out what the common type "names" are and then ask what kind of functionality they should provide) has never worked for me. I think it's one of the failures in education about OO design that this way is what's taught (or at least that's how I first learned it). Aaron Meurer On Tue, Oct 9, 2012 at 6:04 PM, Matthew Rocklin <[email protected]> wrote: > I might want to include in in queries to some sort of assumptions system > (not yet built). > > L, U = LUDecomposition(X) > > ask(Q.full_rank(L), Q.full_rank(X)) > > How would this work if L and U were properties? What is type(L) in this > case? > > > On Tue, Oct 9, 2012 at 6:50 PM, Aaron Meurer <[email protected]> wrote: >> >> Is it not enough to just have two properties, L and U, of the object? >> What kinds of things would you want to do with the object? >> >> Aaron Meurer >> >> On Tue, Oct 9, 2012 at 4:54 PM, Matthew Rocklin <[email protected]> >> wrote: >> > What is the best way to represent a symbolic operation in SymPy that has >> > multiple outputs? In particular I would like an LUDecomposition object. >> > >> > L, U = LUDecomposition((X*X.T).I*X) >> > >> > It's a bit strange because I want to separately refer to two halves of >> > one >> > lazily evaluated object. Do we have any solution for this kind of issue >> > in >> > SymPy? >> > >> > Best, >> > -Matt >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
