Re: [sage-support] Re: Does sagemath support something similar to numpy's einsum for symbolic arrays?

2024-05-29 Thread Anton Todorov
After a long search I found something that meets what I need:
https://docs.sympy.org/latest/modules/tensor/array.html

It allows for tensors to be used as they are in ML and lets you use
symbolic and numerical expressions with all the usual mathematical
manipulations built on top.

It's not sagemath per se, but I did get it working within sagemath quite
easily.

On Sun, Apr 21, 2024 at 12:12 AM Anton Todorov 
wrote:

> Looks close but not quite.
>
> I'm interested in what's described here:
> https://stats.stackexchange.com/a/198395
>
> Basically a dumb as bricks extension to matrices to higher dimensions with
> a contraction along selectable axes, with no notion of co and
> contravariance, and ability to have any number of elements in each
> dimension, e.g. a (8,1,512) shaped tensor (or n-way-array) should be
> possible.
>
> From what I've seen of tensors with indices are forced to be n-dimensional
> cubes (along with having the co and contravariant limitations to
> contractions).
>
> On Tue, Apr 16, 2024 at 12:19 PM Matthias Koeppe 
> wrote:
>
>> You might be looking for
>> https://doc.sagemath.org/html/en/reference/tensor_free_modules/sage/tensor/modules/tensor_with_indices.html
>>
>> On Tuesday, April 9, 2024 at 6:59:27 AM UTC-7 Anton Todorov wrote:
>>
>>> Einsum:
>>> https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
>>>
>>> It is a way to define multiple operations on arrays of arbitrary shape.
>>> I've not seen anything that suggests this is implemented in sagemath, but I
>>> was hoping there might be something hidden.
>>>
>>> What I need this for is to calculate symbolic results of array
>>> operations which are too cumbersome to represent as matrix operations.
>>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-support" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-support/Jg64P1k2YfI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sage-support+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-support/9acdf077-64a3-4034-8835-e1d806e0e049n%40googlegroups.com
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAG%2Bkvu%3DP_CMhGwTL_B3XG%2B_AwF8rzqiSeHTH5Z8uJmaWYwixdg%40mail.gmail.com.


Re: [sage-support] Re: Does sagemath support something similar to numpy's einsum for symbolic arrays?

2024-04-20 Thread Anton Todorov
Looks close but not quite.

I'm interested in what's described here:
https://stats.stackexchange.com/a/198395

Basically a dumb as bricks extension to matrices to higher dimensions with
a contraction along selectable axes, with no notion of co and
contravariance, and ability to have any number of elements in each
dimension, e.g. a (8,1,512) shaped tensor (or n-way-array) should be
possible.

>From what I've seen of tensors with indices are forced to be n-dimensional
cubes (along with having the co and contravariant limitations to
contractions).

On Tue, Apr 16, 2024 at 12:19 PM Matthias Koeppe 
wrote:

> You might be looking for
> https://doc.sagemath.org/html/en/reference/tensor_free_modules/sage/tensor/modules/tensor_with_indices.html
>
> On Tuesday, April 9, 2024 at 6:59:27 AM UTC-7 Anton Todorov wrote:
>
>> Einsum:
>> https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
>>
>> It is a way to define multiple operations on arrays of arbitrary shape.
>> I've not seen anything that suggests this is implemented in sagemath, but I
>> was hoping there might be something hidden.
>>
>> What I need this for is to calculate symbolic results of array operations
>> which are too cumbersome to represent as matrix operations.
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/Jg64P1k2YfI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/9acdf077-64a3-4034-8835-e1d806e0e049n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAG%2Bkvu%3DXGrRsX1eNVc6wvmXd6L43h1AvF2AZZLOeRyHexKNGuA%40mail.gmail.com.


[sage-support] Re: Does sagemath support something similar to numpy's einsum for symbolic arrays?

2024-04-15 Thread Matthias Koeppe
You might be looking 
for 
https://doc.sagemath.org/html/en/reference/tensor_free_modules/sage/tensor/modules/tensor_with_indices.html

On Tuesday, April 9, 2024 at 6:59:27 AM UTC-7 Anton Todorov wrote:

> Einsum: https://numpy.org/doc/stable/reference/generated/numpy.einsum.html
>
> It is a way to define multiple operations on arrays of arbitrary shape. 
> I've not seen anything that suggests this is implemented in sagemath, but I 
> was hoping there might be something hidden.
>
> What I need this for is to calculate symbolic results of array operations 
> which are too cumbersome to represent as matrix operations.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/9acdf077-64a3-4034-8835-e1d806e0e049n%40googlegroups.com.