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

Fix scalar @system by converting arguments to matrices #175

Merged
merged 8 commits into from
Feb 21, 2020

Conversation

ueliwechsler
Copy link
Collaborator

Thinking about other solutions to handle scalar system in @system.

The problems with the constructor for scalar systems could be fixed by converting the argument with hcat and vcat to a matrix respectively a vector.

Basically, the same we did in the constructor for Number arguments.
Which means, that from the point of the @system macro, the scalar constructor would not be needed.

@mforets
Copy link
Member

mforets commented Feb 18, 2020

I like the idea in this PR 👍

My impression is that handling scalars in@system was more problematic than we thought.. I hope we can get to grips with that feature.. or throw it out of the window 😆

NB: I just fixed the conflicts wrt master for the test script, so you may have to git pull on your local branch.

@ueliwechsler
Copy link
Collaborator Author

My impression is that handling scalars in@system was more problematic than we thought

Yes! We did not consider that as a result of having both scalar and matrices there occur corner cases. Therefore, it simplifies if we convert everything to an Array before calling the constructor.
AFAIK, the only place where we don not convert the scalar is

push!(rhs_params, (array, :A))

@ueliwechsler
Copy link
Collaborator Author

On a different topic. Can I get some help with the doctest? 🙈
doctest(MathematicalSystems, fix=true) does not work for me.

@schillic
Copy link
Member

On a different topic. Can I get some help with the doctest? see_no_evil
doctest(MathematicalSystems, fix=true) does not work for me.

Oh yes, I also noticed that at some point. I think the reason is that we do not always write using MathematicalSystems in the doctests.
In conclusion, I think you need to fix them manually (or add this command to the top of each doctest; it can be hidden with # hide I think).

Here is an example from the doctest errors:

extract_sum([:(A1*x)], :x, :u, :w)
│ 
│ Evaluated output:
│ 
│ 1-element Array{Tuple{Any,Symbol},1}:
│  (:(hcat(A1)), :A)
│ 
│ Expected output:
│ 
│ 1-element Array{Tuple{Any,Symbol},1}:
│  (:(hcat(:A1)), :A)

Here there is a colon (:) that apparently got removed.

Also notice that when @mforets merged the latest changes here, other tests started breaking.

@ueliwechsler
Copy link
Collaborator Author

Here there is a colon (:) that apparently got removed.

Also notice that when @mforets merged the latest changes here, other tests started breaking.

Thanks a lot. I did not notice it!

@mforets mforets requested a review from blegat February 20, 2020 03:06
@mforets mforets changed the title Fix scalar @system by converting arguments to matrices (proposal) Fix scalar @system by converting arguments to matrices Feb 21, 2020
@mforets mforets merged commit b7342e3 into master Feb 21, 2020
@mforets mforets deleted the ueliwechsler/fixscalarcase branch February 21, 2020 14:55
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

Successfully merging this pull request may close these issues.

3 participants