I do like the idea of dispatch.  I'm not sure that I understand the rest
though.  Maybe I need a more explicit example.  We'll probably have to
convert back at some point.

For me an example of shared functionality might be indexing.  Many matrix
expressions can be reduced to indexed expressions.  Operations like matrix
multiply could be written more generally as contractions.  These
contractions might mean something very different on a Matrix, a
MatrixExpression, or a Tensor* but we might be able to find simplifications
that are common to all.


On Fri, Mar 7, 2014 at 4:04 AM, F. B. <franz.bona...@gmail.com> wrote:

>
>
> On Thursday, March 6, 2014 1:41:21 PM UTC+1, F. B. wrote:
>>
>>
>>
>> On Thursday, March 6, 2014 6:10:10 AM UTC+1, Matthew wrote:
>>>
>>> I actually do believe that a core for expressions with indices is
>>> possible here.  But I don't have as much experience as Kasper, so I could
>>> be wrong.
>>>
>>>
>> What about using type conversion and promotion? A tensor core wouldn't
>> really be necessary if it were possible to use tensors indepedently of
>> their object representation.
>>
>> There could be a conversion rule table for all different tensor objects,
>> and functions requiring tensors as parameters could force conversions to
>> the right representation through multiple dispatch.
>>
>
> To be more clear, consider a hypothetical function
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *some_op_on_a_tensor( ... )convert_rules = {    TensorHead: {
> Matrix: lambda x: ... ,    },}def convert(a, b):   return
> convert_rules[a][type(b)](b)@dispatch(TensorHead)def
> some_op_on_a_tensor(a):    ...@dispatch(Matrix)def some_op_on_a_tensor(a):
>   some_op_on_a_tensor(convert(TensorHead, a)*In such a way a *Matrix*object 
> could be converted to a
> *TensorHead* object without any need for the end user to do that.
>
> What do you think of this approach?
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/b8cc811d-cde0-4acf-9e64-a99165225d2c%40googlegroups.com<https://groups.google.com/d/msgid/sympy/b8cc811d-cde0-4acf-9e64-a99165225d2c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAJ8oX-Es03p_QYjk1Ujj1LHZZefCEPsGd7pLX%2BpJXTkHk6skTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to