plotting/plotit.c, xtend(), #3/7 complex assignment

This commit is contained in:
rlar 2015-12-26 19:44:33 +01:00
parent 13e649209c
commit 7c6fc1343b
1 changed files with 4 additions and 8 deletions

View File

@ -109,16 +109,12 @@ xtend(struct dvec *v, int length)
oc = v->v_compdata;
v->v_compdata = TMALLOC(ngcomplex_t, length);
for (i = 0; i < v->v_length; i++) {
realpart(v->v_compdata[i]) = realpart(oc[i]);
imagpart(v->v_compdata[i]) = imagpart(oc[i]);
v->v_compdata[i] = oc[i];
}
realpart(c) = realpart(oc[i - 1]);
imagpart(c) = imagpart(oc[i - 1]);
c = oc[i - 1];
tfree(oc);
while (i < length) {
realpart(v->v_compdata[i]) = realpart(c);
imagpart(v->v_compdata[i++]) = imagpart(c);
}
while (i < length)
v->v_compdata[i++] = c;
}
v->v_length = length;