Skip to content

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

Closed

Description

@jgillis
No description provided.

Activity

  1. added this to the Version 3.6 milestone on Aug 24, 2020
  2. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

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

  3. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

    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

  4. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

    Check if C++ variants match up

  5. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

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

  6. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

    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?

  7. jgillis commented on Mar 4, 2023

    @jgillis
    MemberAuthor

    Matlab?

  8. jaeandersson commented on Mar 5, 2023

    @jaeandersson
    Member

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

  9. jaeandersson commented on Mar 5, 2023

    @jaeandersson
    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

  10. jgillis commented on Mar 5, 2023

    @jgillis
    MemberAuthor

    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.

  11. jaeandersson commented on Mar 5, 2023

    @jaeandersson
    Member

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

  12. added a commit that references this issue on Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions