Skip to content

Bug in BicubicInterpolator setup #30

@jamiescottie1

Description

@jamiescottie1

There seems to be a copy-paste error in the setupInterpolator() function of the BicubicInterpolator class.
The code snippet computing the finite difference approximations of $f_y(0, 1)$ and $f_y(1, 1)$ currently reads

jm = std::max(j, 0);
jp = std::min(j + 2, jN - 1);

dy = ((*Y)(jp) - (*Y)(jm)) / yL;

fp = (*Z)(i, jp);
fm = (*Z)(i, jm);
fy01 = (fp - fm) / dx;  // <<<<<< This is wrong

fp = (*Z)(i + 1, jp);
fm = (*Z)(i + 1, jm);
fy11 = (fp - fm) / dx;  // <<<<<< This is wrong

The two expressions assigning the final values, fy01 = (fp - fm) / dx and fy11 = (fp - fm) / dx, are using the wrong denominator dx. Since they are expressions for the derivative in y direction, the correct denominator should be dy (as correctly used in the computation of $f_y(0, 0)$ and $f_y(1, 0)$ ).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions