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

@msspoly/subsasgn.m can not handle empty vectors as indizes #18

Open
tarquasso opened this issue Nov 4, 2016 · 1 comment
Open

@msspoly/subsasgn.m can not handle empty vectors as indizes #18

tarquasso opened this issue Nov 4, 2016 · 1 comment

Comments

@tarquasso
Copy link

tarquasso commented Nov 4, 2016

Affects @msspoly/subsasgn.m

Can not handle a index assignment using zeros(0,n) or zeros(n,0)
see this test script:

nq = 3;
q=msspoly('q',nq);
s=msspoly('s',nq);
c=msspoly('c',nq);
qt=TrigPoly(q,s,c);

J = zeros(3,3) * qt;

pos_row_indices = 1:3;

v_or_qdot_indices = zeros(0,1);

Jpos = zeros(3,0);

J(pos_row_indices, v_or_qdot_indices) = Jpos;

It fails with this error:

In an assignment  A(:) = B, the number of elements in A and B must be the same.

Error in msspoly/subsasgn (line 89)
            p1.dim(2) = max(max(js),p1.dim(2));

Error in TrigPoly/subsasgn (line 365)
        a.p=subsasgn(a.p,s,b);

Error in msspoly_subsasgn_test (line 15)
J(pos_row_indices, v_or_qdot_indices) = Jpos;
@tarquasso
Copy link
Author

Proposing to fix it by:

            if(numel(s.subs{1}) == 0 || numel(s.subs{2}) == 0)
              q = p1;
              return
            end

added after case 2

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