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

Inconsitency in counting input signals #70

Open
jviereck opened this issue Dec 13, 2018 · 3 comments
Open

Inconsitency in counting input signals #70

jviereck opened this issue Dec 13, 2018 · 3 comments

Comments

@jviereck
Copy link
Contributor

Hi folks,

for some operations in operator.cpp, the input signals count from 1 (sin1). However, sometimes they also count from 0 (sin0). There is also the possibility to get both versions after calling op.setSignalNumber(2):

>>> op = score.Add_of_double('')
>>> op.getSignalNumber()
2
>>> op.displaySignals()
--- <::719885386> signal list: 
    |-- <Sig:Add_of_double()::input(double)::sin1 (Type Cst) UNPLUGGED
    |-- <Sig:Add_of_double()::input(double)::sin2 (Type Cst) UNPLUGGED
    `-- <Sig:Add_of_double()::output(double)::sout (Type Fun)
>>> op.setSignalNumber(2)
>>> op.displaySignals()
--- <::719885386> signal list: 
    |-- <Sig:Add_of_double()::input(double)::sin0 (Type Cst) UNPLUGGED
    |-- <Sig:Add_of_double()::input(double)::sin1 (Type Cst) UNPLUGGED
    `-- <Sig:Add_of_double()::output(double)::sout (Type Fun)

Note how the signal names count from zero in the last case.

My proposal is to agree on a value for the first index and then make sure all operator.cpp uses the same convention.

Happy to send a PR once you let me know which counting to use.

Best,
julian

@olivier-stasse
Copy link
Member

Dear Julian,
Thanks for raising this issue. As for my self I would be in favor of starting from 0.
But more opinions might be interesting.

Best,
Olivier.

@jmirabel
Copy link
Contributor

I am responsible from this choice. I would be in favor of starting from 0 in all cases. The rationale behind this choice is the following.

At the beginning, there was entity like addition of two vectors, matrices... which were taking 2 entries, with input signals sin1 and sin2. I replaced them so that they take N entries. To keep backward, the new entities are initialized at construction with 2 input signals with the same name as before.
Then, in setSignalNumber, there was no reason to keep the old convention since this command is part of the new API. Maybe I should have kept the old convention.

@jmirabel
Copy link
Contributor

jmirabel commented Dec 5, 2019

I think the best is to remove the 2 default signals created before the call to setSignalNumber. If anyone feels like doing it...

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

3 participants