diff --git a/fun/interpcubic.v b/fun/interpcubic.v index 9cc1c8197..cddbf31e7 100644 --- a/fun/interpcubic.v +++ b/fun/interpcubic.v @@ -67,7 +67,7 @@ pub fn (o InterpCubic) critical() (f64, f64, f64, bool, bool, bool) { // (x1, y1) -- second point // (x2, y2) -- third point // (x3, y3) -- fourth point -pub fn (mut o InterpCubic) fit_4points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64, x3 f64, y3 f64) ? { +pub fn (mut o InterpCubic) fit_4points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64, x3 f64, y3 f64) ! { z0, z1, z2, z3 := x0 * x0, x1 * x1, x2 * x2, x3 * x3 w0, w1, w2, w3 := z0 * x0, z1 * x1, z2 * x2, z3 * x3 den := w0 * ((x2 - x3) * z1 + x3 * z2 - x2 * z3 + x1 * (z3 - z2)) + w1 * (x2 * z3 - x3 * z2) + @@ -97,7 +97,7 @@ pub fn (mut o InterpCubic) fit_4points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y // (x1, y1) -- second point // (x2, y2) -- third point // (x3, d3) -- derivative @ x3 -pub fn (mut o InterpCubic) fit_3points_d(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64, x3 f64, d3 f64) ? { +pub fn (mut o InterpCubic) fit_3points_d(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64, x3 f64, d3 f64) ! { z0, z1, z2, z3 := x0 * x0, x1 * x1, x2 * x2, x3 * x3 w0, w1, w2 := z0 * x0, z1 * x1, z2 * x2 den := x0 * (2 * w1 * x3 - 2 * w2 * x3 - 3 * z1 * z3 + 3 * z2 * z3) + diff --git a/fun/interpcubic_test.v b/fun/interpcubic_test.v index 49edc1ba6..80f1e74f8 100644 --- a/fun/interpcubic_test.v +++ b/fun/interpcubic_test.v @@ -17,7 +17,7 @@ fn test_interp_cubic_01() { // intepolator mut interp := new_interp_cubic() - interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)? + interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] { @@ -50,7 +50,7 @@ fn test_interp_cubic_02() { // intepolator mut interp := new_interp_cubic() - interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)? + interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)! // check model and derivatives for x in [-10.0, 0.0, 5.0, 100.0] { @@ -81,7 +81,7 @@ fn test_interp_cubic_03() { // intepolator mut interp := new_interp_cubic() - interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)? + interp.fit_4points(x0, y0, x1, y1, x2, y2, x3, y3)! // check model and derivatives for x in [-10.0, 0.0, 5.0, 100.0] { @@ -113,7 +113,7 @@ fn test_interp_cubic_04() { // intepolator mut interp := new_interp_cubic() - interp.fit_3points_d(x0, y0, x1, y1, x2, y2, x3, d3)? + interp.fit_3points_d(x0, y0, x1, y1, x2, y2, x3, d3)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] { diff --git a/fun/interpquad.v b/fun/interpquad.v index 0e4eef646..958c89608 100644 --- a/fun/interpquad.v +++ b/fun/interpquad.v @@ -48,7 +48,7 @@ pub fn (o InterpQuad) optimum() (f64, f64) { // (x0, y0) -- first point // (x1, y1) -- second point // (x2, y2) -- third point -pub fn (mut o InterpQuad) fit_3points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64) ? { +pub fn (mut o InterpQuad) fit_3points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 f64) ! { z0, z1, z2 := x0 * x0, x1 * x1, x2 * x2 den := x0 * (z2 - z1) - x1 * z2 + x2 * z1 + (x1 - x2) * z0 if math.abs(den) < o.tol_den { @@ -64,7 +64,7 @@ pub fn (mut o InterpQuad) fit_3points(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, y2 // (x0, y0) -- first point // (x1, y1) -- second point // (x2, d2) -- derivate @ x2 -pub fn (mut o InterpQuad) fit_2points_d(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, d2 f64) ? { +pub fn (mut o InterpQuad) fit_2points_d(x0 f64, y0 f64, x1 f64, y1 f64, x2 f64, d2 f64) ! { z0, z1 := x0 * x0, x1 * x1 den := -z1 + z0 + 2 * x1 * x2 - 2 * x0 * x2 if math.abs(den) < o.tol_den { diff --git a/fun/interpquad_test.v b/fun/interpquad_test.v index da3afc84c..ca61d1051 100644 --- a/fun/interpquad_test.v +++ b/fun/interpquad_test.v @@ -16,7 +16,7 @@ fn test_interp_quad_01() { // intepolator mut interp := new_interp_quad() - interp.fit_3points(x0, y0, x1, y1, x2, y2)? + interp.fit_3points(x0, y0, x1, y1, x2, y2)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] { @@ -46,7 +46,7 @@ fn test_interp_quad_02() { // intepolator mut interp := new_interp_quad() - interp.fit_3points(x0, y0, x1, y1, x2, y2)? + interp.fit_3points(x0, y0, x1, y1, x2, y2)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] { @@ -76,7 +76,7 @@ fn test_interp_quad_03() { // intepolator mut interp := new_interp_quad() - interp.fit_2points_d(x0, y0, x1, y1, x2, d2)? + interp.fit_2points_d(x0, y0, x1, y1, x2, d2)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] { @@ -106,7 +106,7 @@ fn test_interp_quad_04() { // intepolator mut interp := new_interp_quad() - interp.fit_2points_d(x0, y0, x1, y1, x2, d2)? + interp.fit_2points_d(x0, y0, x1, y1, x2, d2)! // check model and derivatives for x in [-10.0, 0.0, 1.0, 8.0] {