/source/intComplexLinear1D.c

https://github.com/EyNuel/cTraceo · C · 58 lines · 9 code · 3 blank · 46 comment · 0 complexity · 0b4e2f9127672a151c6fd334d1ad5b7f MD5 · raw file

  1. /****************************************************************************************
  2. * intComplexLinear1D.c *
  3. * (formerly "clin1d.for) *
  4. * Perform linear interpolation at 1D using imaginary numbers. *
  5. * *
  6. * ------------------------------------------------------------------------------------ *
  7. * Website: *
  8. * https://github.com/EyNuel/cTraceo/wiki *
  9. * *
  10. * License: This file is part of the cTraceo Raytracing Model and is released under the *
  11. * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License *
  12. * http://creativecommons.org/licenses/by-nc-sa/3.0/ *
  13. * *
  14. * NOTE: cTraceo is research code under active development. *
  15. * The code may contain bugs and updates are possible in the future. *
  16. * *
  17. * Written for project SENSOCEAN by: *
  18. * Emanuel Ey *
  19. * emanuel.ey@gmail.com *
  20. * Copyright (C) 2011 - 2013 *
  21. * Signal Processing Laboratory *
  22. * Universidade do Algarve *
  23. * *
  24. * cTraceo is the C port of the FORTRAN 77 TRACEO code written by: *
  25. * Orlando Camargo Rodriguez: *
  26. * Copyright (C) 2010 *
  27. * Orlando Camargo Rodriguez *
  28. * orodrig@ualg.pt *
  29. * Universidade do Algarve *
  30. * Physics Department *
  31. * Signal Processing Laboratory *
  32. * *
  33. * ------------------------------------------------------------------------------------ *
  34. * Inputs: *
  35. * x: vector containing x0, x1 *
  36. * f: vector containing f0, f1 *
  37. * xi: scalar (the interpolation point) *
  38. * *
  39. * Outputs: *
  40. * fi: interpolated value of f at xi *
  41. * fxi: derivative of f at xi *
  42. * *
  43. * Return Value: *
  44. * None *
  45. * *
  46. ****************************************************************************************/
  47. #pragma once
  48. #include <complex.h>
  49. void intComplexLinear1D(double*, complex double*, complex double, complex double*, complex double*);
  50. void intComplexLinear1D(double* x, complex double* f, complex double xi, complex double* fi, complex double* fxi){
  51. DEBUG(8,"in\n");
  52. *fxi = ( f[1] -f[0]) / ( x[1] -x[0]);
  53. *fi = f[0] +(xi -x[0]) *(*fxi);
  54. DEBUG(8,"out\n");
  55. }