Preliminary fix for the 'interpolate' function.
Interpolation of 1D vectors is o.k. now, multi-dimensional vectors are not (yet) supported.
This commit is contained in:
parent
1977128380
commit
4dbd8b7f9a
|
|
@ -161,6 +161,10 @@ cx_interpolate(void *data, short int type, int length, int *newlength, short int
|
||||||
if (grouping == 0)
|
if (grouping == 0)
|
||||||
grouping = length;
|
grouping = length;
|
||||||
|
|
||||||
|
if (grouping != length) {
|
||||||
|
fprintf(cp_err, "Error: interpolation of multi-dimensional vectors is currntly not supported\n");
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
/* First do some sanity checks. */
|
/* First do some sanity checks. */
|
||||||
if (!pl || !pl->pl_scale || !newpl || !newpl->pl_scale) {
|
if (!pl || !pl->pl_scale || !newpl || !newpl->pl_scale) {
|
||||||
fprintf(cp_err, "Internal error: cx_interpolate: bad scale\n");
|
fprintf(cp_err, "Internal error: cx_interpolate: bad scale\n");
|
||||||
|
|
@ -216,10 +220,12 @@ cx_interpolate(void *data, short int type, int length, int *newlength, short int
|
||||||
if (!cp_getvar("polydegree", CP_NUM, °ree, 0))
|
if (!cp_getvar("polydegree", CP_NUM, °ree, 0))
|
||||||
degree = 1;
|
degree = 1;
|
||||||
|
|
||||||
|
/* FIXME: this function is defect: ns data cannot have same base and grouping
|
||||||
|
as the original data. Will now do only if grouping == length. */
|
||||||
for (base = 0; base < length; base += grouping) {
|
for (base = 0; base < length; base += grouping) {
|
||||||
if (!ft_interpolate((double *) data + base, d + base,
|
if (!ft_interpolate((double *) data + base, d + base,
|
||||||
os->v_realdata + base, grouping,
|
os->v_realdata + base, grouping,
|
||||||
ns->v_realdata + base, grouping, degree))
|
ns->v_realdata + base, ns->v_length, degree))
|
||||||
{
|
{
|
||||||
tfree(d);
|
tfree(d);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue