smile.math.rbf.MultiquadricRadialBasis Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2010 Haifeng Li
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package smile.math.rbf;
/**
* Multiquadric RBF. φ(r) = (r2 + r20)1/2
* where r0 is a scale factor. Multiquadrics are said to be less
* sensitive to the choice of r0 than som other functional forms.
*
* In general, r0 should be larger than the typical separation of
* points but smaller than the "outer scale" or feature size of the function
* to interplate. There can be several orders of magnitude difference between
* the interpolation accuracy with a good choice for r0, versus a
* poor choice, so it is definitely worth some experimentation. One way to
* experiment is to construct an RBF interpolator omitting one data point
* at a time and measuring the interpolation error at the omitted point.
*
* @author Haifeng Li
*/
public class MultiquadricRadialBasis implements RadialBasisFunction {
private double r02;
/**
* Constructor.
*/
public MultiquadricRadialBasis() {
this(1.0);
}
/**
* Constructor.
*/
public MultiquadricRadialBasis(double scale) {
r02 = scale * scale;
}
@Override
public double f(double r) {
return Math.sqrt(r * r + r02);
}
}