function constructor
extends Modelica.Icons.Function;
input Boolean rectangular = false "set true if input data is on rectangular grid, otherwise assume scattered data";
input Real data[:, :] "data to be fitted (see doku)";
input Real s(min = 0) = 0 "smoothing factor (s>0)";
input Integer kx(min = 1, max = 5) = 3 "degree of X-dir spline (should be odd)";
input Integer ky(min = 1, max = 5) = 3 "degree of Y-dir spline (should be odd)";
input Real x_lim[2] = {if rectangular then ApproxSpline.Utilities.vmin(data[2:size(data, 1), 1]) else ApproxSpline.Utilities.vmin(data[:, 1]), if rectangular then ApproxSpline.Utilities.vmax(data[2:size(data, 1), 1]) else ApproxSpline.Utilities.vmax(data[:, 1])} "X-dir boundaries of interpolation interval";
input Real y_lim[2] = {if rectangular then ApproxSpline.Utilities.vmin(data[1, 2:size(data, 2)]) else ApproxSpline.Utilities.vmin(data[:, 2]), if rectangular then ApproxSpline.Utilities.vmax(data[1, 2:size(data, 2)]) else ApproxSpline.Utilities.vmax(data[:, 2])} "Y-dir boundaries of interpolation interval";
input Real tx[:] = fill(0, 0) "array of X-dir knot positions (if given together with ty, a least square spline is generated)";
input Real ty[:] = fill(0, 0) "array of Y-dir knot positions (if given together with ty, a least square spline is generated)";
output Type surf "2-D spline surface data structure";
end constructor;