Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algebraically linking Shape attributes #119

Open
LMWafer opened this issue May 17, 2024 · 0 comments
Open

Algebraically linking Shape attributes #119

LMWafer opened this issue May 17, 2024 · 0 comments

Comments

@LMWafer
Copy link

LMWafer commented May 17, 2024

I have a function which takes as input a sequence of 3-vectors with N elements. My input hint is

from nptyping import NDArray, Shape, Float

def foo(input_seq: NDArray[Shape["3, N"], Float]):
    pass

The function returns another sequence of 3-vectors, BUT this time with N+1 elements. Hence, I would like the output hint to re-employ the N variable. I'm thinking of something like

def foo(input_seq: NDArray[Shape["3, N"], Float]) -> NDArray[Shape["3, N+1"], Float]:
    pass

When I execute the above syntax I get the following error :
nptyping.error.InvalidShapeError: "3, N+1" is not a valid shape expression.

In general, how can I specify that one Shape object is related to another Shape by an algebraic expression (using *, +, -, /, **, ...) ? I'm sorry if there is already a related issue/a feature that I did not notice.

I encounter this situation anytime I deal with temporal sequences (kinematic simulation, logs extraction, state estimation etc.) : the sequence is N+1 elements-long while the sequence of deltas is N elements-long.

@LMWafer LMWafer changed the title Algebraically linking Shape attirbutes Algebraically linking Shape attributes May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant