mirror of
https://git.code.sf.net/p/ngspice/ngspice
synced 2026-08-22 05:47:42 +02:00
plotting/plotit.c, xtend(), #4/7 support vector of zero length
This commit is contained in:
@@ -97,21 +97,25 @@ xtend(struct dvec *v, int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isreal(v)) {
|
if (isreal(v)) {
|
||||||
|
double d = NAN;
|
||||||
od = v->v_realdata;
|
od = v->v_realdata;
|
||||||
v->v_realdata = TMALLOC(double, length);
|
v->v_realdata = TMALLOC(double, length);
|
||||||
for (i = 0; i < v->v_length; i++)
|
for (i = 0; i < v->v_length; i++)
|
||||||
v->v_realdata[i] = od[i];
|
v->v_realdata[i] = od[i];
|
||||||
d = od[i - 1];
|
if (i > 0)
|
||||||
|
d = od[i - 1];
|
||||||
tfree(od);
|
tfree(od);
|
||||||
while (i < length)
|
while (i < length)
|
||||||
v->v_realdata[i++] = d;
|
v->v_realdata[i++] = d;
|
||||||
} else {
|
} else {
|
||||||
|
ngcomplex_t c = {NAN, NAN};
|
||||||
oc = v->v_compdata;
|
oc = v->v_compdata;
|
||||||
v->v_compdata = TMALLOC(ngcomplex_t, length);
|
v->v_compdata = TMALLOC(ngcomplex_t, length);
|
||||||
for (i = 0; i < v->v_length; i++) {
|
for (i = 0; i < v->v_length; i++) {
|
||||||
v->v_compdata[i] = oc[i];
|
v->v_compdata[i] = oc[i];
|
||||||
}
|
}
|
||||||
c = oc[i - 1];
|
if (i > 0)
|
||||||
|
c = oc[i - 1];
|
||||||
tfree(oc);
|
tfree(oc);
|
||||||
while (i < length)
|
while (i < length)
|
||||||
v->v_compdata[i++] = c;
|
v->v_compdata[i++] = c;
|
||||||
|
|||||||
Reference in New Issue
Block a user