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 [email protected].
To post to this group, send email to [email protected].
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.
For more options, visit https://groups.google.com/d/optout.