Skip to content

veccat([]) -> Sparsity instead of MX #2549

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

Closed
jgillis opened this issue Jan 25, 2020 · 10 comments
Closed

veccat([]) -> Sparsity instead of MX #2549

jgillis opened this issue Jan 25, 2020 · 10 comments
Milestone

Comments

@jgillis
Copy link
Member

jgillis commented Jan 25, 2020

No description provided.

@jgillis jgillis added this to the Version 3.6 milestone Aug 24, 2020
@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

But what if we want SX?
Is DM a useful common ground?

@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

The following passes:

    f = Function('f',[DM(0,1)],[])
    print(f)
    f = Function('f',[DM(0,1),SX.sym("x")],[])
    print(f)
    f = Function('f',[DM(0,1),MX.sym("x")],[])
    print(f)

So DM makes sense

@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

Check if C++ variants match up

@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

veccat, vertcat, horzcat, diagcat should all fall back to DM when receiving empty arguments.

@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

Do we give shape (0,1) also to vertcat, (1,0) to horzcat and (0,0) to diagcat? Or just in the case of veccat?

@jgillis
Copy link
Member Author

jgillis commented Mar 4, 2023

Matlab?

@jaeandersson
Copy link
Member

Yeah, why would we want to cast [] to Sparsity?

@jaeandersson
Copy link
Member

Nevermind, I get it now. I think you can solve it by modifying the casting priorities in SWIG. They decide in which order checks are made. Sparsity should have lower priority than DM. MATLAB uses the same typemaps

@jgillis
Copy link
Member Author

jgillis commented Mar 5, 2023

Changing casting priorities is opening a can of worms. vertcat(spA,spB) would then return type DM because of (possibly dubious) upconversion in our SWIG.

@jaeandersson
Copy link
Member

I don't think we should cast Sparsity to DM. Isn't that constructor explicit?

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

2 participants