Record Class Interpolation.SplineCoefficients

java.lang.Object
java.lang.Record
cloud.opencode.base.math.interpolation.Interpolation.SplineCoefficients
Record Components:
x - the x-coordinates / x 坐标
h - the interval widths / 区间宽度
a - coefficient a (y values) / 系数 a(y 值)
b - coefficient b / 系数 b
c - coefficient c / 系数 c
d - coefficient d / 系数 d
Enclosing class:
Interpolation

public static record Interpolation.SplineCoefficients(double[] x, double[] h, double[] a, double[] b, double[] c, double[] d) extends Record
Precomputed cubic spline coefficients for efficient multi-point evaluation. 预计算的三次样条系数,用于高效多点求值。
Since:
JDK 25, opencode-base-math V1.0.3
Author:
Leon Soo www.LeonSoo.com
  • Constructor Summary

    Constructors
    Constructor
    Description
    SplineCoefficients(double[] x, double[] h, double[] a, double[] b, double[] c, double[] d)
    Creates an instance of a SplineCoefficients record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    a()
    Returns the value of the a record component.
    double[]
    b()
    Returns the value of the b record component.
    double[]
    c()
    Returns the value of the c record component.
    double[]
    d()
    Returns the value of the d record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    evaluate(double xi)
    Evaluates the precomputed spline at the given x value.
    double[]
    h()
    Returns the value of the h record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    double[]
    x()
    Returns the value of the x record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SplineCoefficients

      public SplineCoefficients(double[] x, double[] h, double[] a, double[] b, double[] c, double[] d)
      Creates an instance of a SplineCoefficients record class.
      Parameters:
      x - the value for the x record component
      h - the value for the h record component
      a - the value for the a record component
      b - the value for the b record component
      c - the value for the c record component
      d - the value for the d record component
  • Method Details

    • evaluate

      public double evaluate(double xi)
      Evaluates the precomputed spline at the given x value. 在给定 x 值处求值预计算的样条。
      Parameters:
      xi - the x value at which to evaluate — 待求值的 x 值
      Returns:
      the interpolated y value — 插值后的 y 值
      Throws:
      MathException - if xi is out of range — xi 超出范围时抛出
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • x

      public double[] x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component
    • h

      public double[] h()
      Returns the value of the h record component.
      Returns:
      the value of the h record component
    • a

      public double[] a()
      Returns the value of the a record component.
      Returns:
      the value of the a record component
    • b

      public double[] b()
      Returns the value of the b record component.
      Returns:
      the value of the b record component
    • c

      public double[] c()
      Returns the value of the c record component.
      Returns:
      the value of the c record component
    • d

      public double[] d()
      Returns the value of the d record component.
      Returns:
      the value of the d record component