IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42682


Ignore:
Timestamp:
Jun 1, 2024, 3:17:30 PM (2 years ago)
Author:
eugene
Message:

linear extrapolation at endpoints

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/Ohana/src/opihi/lib.data/spline.c

    r42332 r42682  
    113113  opihi_flt dx, a, b, value;
    114114 
    115   // saturate correction at high and low ends
    116   if (X < x[0]) return y[0];
    117   if (X > x[N-1]) return y[N-1];
     115  // linear extrapolation past endpoints
     116  if (X < x[0]) {
     117    hi = 1;
     118    lo = 0;
     119    goto evaluate;
     120    // alternative: saturate correction at high and low ends
     121    // return y[0];
     122  }
     123  if (X > x[N-1]) {
     124    hi = N - 1;
     125    lo = N - 2;
     126    goto evaluate;
     127    // alternative: saturate correction at high and low ends
     128    // return y[N-1];
     129  }
    118130
    119131  /* find correct element in array (x must be sorted) */
     
    128140    }
    129141  }
     142
     143evaluate:
    130144
    131145  /* error condition: duplicate abssisca */
Note: See TracChangeset for help on using the changeset viewer.