Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

50 linhas
1.5 KiB

  1. /*
  2. * aptdec - A lightweight FOSS (NOAA) APT decoder
  3. * Copyright (C) 2019-2023 Xerbo (xerbo@protonmail.com)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. #ifndef LIBAPTDEC_ALGEBRA_H_
  19. #define LIBAPTDEC_ALGEBRA_H_
  20. #include <stddef.h>
  21. #define M_PIf 3.14159265358979323846f
  22. #define M_TAUf (M_PIf * 2.0f)
  23. // A linear equation in the form of y(x) = ax + b
  24. typedef struct {
  25. float a, b;
  26. } linear_t;
  27. // A quadratic equation in the form of y(x) = ax^2 + bx + c
  28. typedef struct {
  29. float a, b, c;
  30. } quadratic_t;
  31. linear_t linear_regression(const float *independent, const float *dependent, size_t len);
  32. float standard_deviation(const float *data, size_t len);
  33. float sumf(const float *x, size_t len);
  34. float meanf(const float *x, size_t len);
  35. void normalizef(float *x, size_t len);
  36. // NOTE: Modifies input array
  37. float medianf(float *data, size_t len);
  38. float linear_calc(float x, linear_t line);
  39. float quadratic_calc(float x, quadratic_t quadratic);
  40. float sincf(float x);
  41. #endif