LibSakura  4.0
sakura.h
Go to the documentation of this file.
1 /*
2  * @SAKURA_LICENSE_HEADER_START@
3  * Copyright (C) 2013-2016
4  * National Astronomical Observatory of Japan
5  * 2-21-1, Osawa, Mitaka, Tokyo, 181-8588, Japan.
6  *
7  * This file is part of Sakura.
8  *
9  * Sakura is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or (at your
12  * option) any later version.
13  *
14  * Sakura is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with Sakura. If not, see <http://www.gnu.org/licenses/>.
21  * @SAKURA_LICENSE_HEADER_END@
22  */
33 #ifndef LIBSAKURA_LIBSAKURA_SAKURA_H_
34 #define LIBSAKURA_LIBSAKURA_SAKURA_H_
35 
36 #include <stddef.h>
37 #include <stdbool.h>
38 #include <stdint.h>
39 #include <sys/types.h>
40 
41 #include <libsakura/config.h>
42 
43 #if defined(__GNUC__) || defined(__GNUG__)
44 # define LIBSAKURA_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
45 #else
46 # define LIBSAKURA_WARN_UNUSED_RESULT /* Don't ignore result value */
47 #endif
48 
49 #define LIBSAKURA_NOEXCEPT /* noexcept */
50 
51 #ifdef __cplusplus
52 extern "C" {
53 
54 #if __cplusplus >= 201103L
55 # undef LIBSAKURA_NOEXCEPT
56 # define LIBSAKURA_NOEXCEPT noexcept
57 #endif
58 
59 #endif
60 
64 typedef enum {LIBSAKURA_SYMBOL(Status_kOK) = 0,LIBSAKURA_SYMBOL(Status_kNG) = 1,LIBSAKURA_SYMBOL(Status_kInvalidArgument) = 2,LIBSAKURA_SYMBOL(Status_kNoMemory) = 3,LIBSAKURA_SYMBOL(Status_kUnknownError) = 99
82 }LIBSAKURA_SYMBOL (Status);
83 
97 typedef void *(*LIBSAKURA_SYMBOL(UserAllocator))(size_t size);
98 
111 typedef void (*LIBSAKURA_SYMBOL(UserDeallocator))(void *pointer);
112 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Initialize)(
126 LIBSAKURA_SYMBOL(UserAllocator) allocator,
127 LIBSAKURA_SYMBOL(UserDeallocator) deallocator)
129 
137 void LIBSAKURA_SYMBOL(CleanUp)() LIBSAKURA_NOEXCEPT;
138 
139 /*
140  * memory alignment(for SIMD)
141  */
151 bool LIBSAKURA_SYMBOL(IsAligned)(void const *ptr) LIBSAKURA_NOEXCEPT;
152 
160 size_t LIBSAKURA_SYMBOL (GetAlignment)() LIBSAKURA_NOEXCEPT;
161 
175 void *LIBSAKURA_SYMBOL(AlignAny)(size_t size_of_arena, void *arena,
176  size_t size_required) LIBSAKURA_NOEXCEPT;
190 float *LIBSAKURA_SYMBOL(AlignFloat)(size_t elements_in_arena, float *arena,
191  size_t elements_required) LIBSAKURA_NOEXCEPT;
192 
196 double *LIBSAKURA_SYMBOL(AlignDouble)(size_t elements_in_arena, double *arena,
197  size_t elements_required) LIBSAKURA_NOEXCEPT;
198 
208 typedef struct {
212  size_t count;
216  double sum;
220  double square_sum;
224  float min;
228  float max;
232  ssize_t index_of_min;
236  ssize_t index_of_max;
237 }LIBSAKURA_SYMBOL(StatisticsResultFloat);
238 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(ComputeStatisticsFloat)(
255  size_t num_data, float const data[], bool const is_valid[],
256  LIBSAKURA_SYMBOL(StatisticsResultFloat) *result) LIBSAKURA_NOEXCEPT;
257 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(ComputeAccurateStatisticsFloat)(
265  size_t num_data, float const data[], bool const is_valid[],
266  LIBSAKURA_SYMBOL(StatisticsResultFloat) *result) LIBSAKURA_NOEXCEPT;
267 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SortValidValuesDenselyFloat)(
281  size_t num_data, bool const is_valid[], float data[],
282  size_t *new_num_data) LIBSAKURA_NOEXCEPT;
283 
306 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(ComputeMedianAbsoluteDeviationFloat)(
307  size_t num_data, float const data[], float new_data[])
308  LIBSAKURA_NOEXCEPT;
309 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(GridConvolvingFloat)(
367  size_t num_spectra, size_t start_spectrum, size_t end_spectrum,
368  bool const spectrum_mask[/*num_spectra*/],
369  double const x[/*num_spectra*/], double const y[/*num_spectra*/],
370  size_t support, size_t sampling, size_t num_polarizations,
371  uint32_t const polarization_map[/*num_polarizations*/],
372  size_t num_channels, uint32_t const channel_map[/*num_channels*/],
373  bool const mask/*[num_spectra][num_polarizations]*/[/*num_channels*/],
374  float const value/*[num_spectra][num_polarizations]*/[/*num_channels*/],
375  float const weight/*[num_spectra]*/[/*num_channels*/], bool weight_only,
376  size_t num_convolution_table/*= ceil(sqrt(2.)*(support+1)*sampling)*/,
377  float const convolution_table[/*num_convolution_table*/],
378  size_t num_polarizations_for_grid, size_t num_channels_for_grid,
379  size_t width, size_t height,
380  double weight_sum/*[num_polarizations_for_grid]*/[/*num_channels_for_grid*/],
381  float weight_of_grid/*[height][width][num_polarizations_for_grid]*/[/*num_channels_for_grid*/],
382  float grid/*[height][width][num_polarizations_for_grid]*/[/*num_channels_for_grid*/])
383  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
384 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfInRangesInclusiveFloat)(
419  size_t num_data, float const data[/*num_data*/], size_t num_condition,
420  float const lower_bounds[/*num_condition*/],
421  float const upper_bounds[/*num_condition*/], bool result[/*num_data*/])
422  LIBSAKURA_NOEXCEPT;
423 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfInRangesInclusiveInt)(
428  size_t num_data, int const data[/*num_data*/], size_t num_condition,
429  int const lower_bounds[/*num_condition*/],
430  int const upper_bounds[/*num_condition*/], bool result[/*num_data*/])
431  LIBSAKURA_NOEXCEPT;
432 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfInRangesExclusiveFloat)(
468  size_t num_data, float const data[/*num_data*/], size_t num_condition,
469  float const lower_bounds[/*num_condition*/],
470  float const upper_bounds[/*num_condition*/], bool result[/*num_data*/])
471  LIBSAKURA_NOEXCEPT;
472 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfInRangesExclusiveInt)(
477  size_t num_data, int const data[/*num_data*/], size_t num_condition,
478  int const lower_bounds[/*num_condition*/],
479  int const upper_bounds[/*num_condition*/], bool result[/*num_data*/])
480  LIBSAKURA_NOEXCEPT;
481 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfGreaterThanFloat)(
507  size_t num_data, float const data[/*num_data*/], float threshold,
508  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
509 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfGreaterThanInt)(
514  size_t num_data, int const data[/*num_data*/], int threshold,
515  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
516 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfGreaterThanOrEqualsFloat)(
542  size_t num_data, float const data[/*num_data*/], float threshold,
543  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
544 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfGreaterThanOrEqualsInt)(
549  size_t num_data, int const data[/*num_data*/], int threshold,
550  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
551 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfLessThanFloat)(
577  size_t num_data, float const data[/*num_data*/], float threshold,
578  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
579 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfLessThanInt)(
584  size_t num_data, int const data[/*num_data*/], int threshold,
585  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
586 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfLessThanOrEqualsFloat)(
612  size_t num_data, float const data[/*num_data*/], float threshold,
613  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
614 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetTrueIfLessThanOrEqualsInt)(
619  size_t num_data, int const data[/*num_data*/], int threshold,
620  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
621 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SetFalseIfNanOrInfFloat)(
639  size_t num_data, float const data[/*num_data*/],
640  bool result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
641 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint8ToBool)(size_t num_data,
657  uint8_t const data[/*num_data*/], bool result[/*num_data*/])
658  LIBSAKURA_NOEXCEPT;
659 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint32ToBool)(size_t num_data,
664  uint32_t const data[/*num_data*/], bool result[/*num_data*/])
665  LIBSAKURA_NOEXCEPT;
666 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(InvertBool)(size_t num_data,
683  bool const data[/*num_data*/], bool result[/*num_data*/])
684  LIBSAKURA_NOEXCEPT;
685 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseAndUint8)(
722  uint8_t bit_mask, size_t num_data, uint8_t const data[/*num_data*/],
723  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
724  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseAndUint32)(
729  uint32_t bit_mask, size_t num_data, uint32_t const data[/*num_data*/],
730  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
731  LIBSAKURA_NOEXCEPT;
732 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseConverseNonImplicationUint8)(
770  uint8_t bit_mask, size_t num_data, uint8_t const data[/*num_data*/],
771  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
772  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseConverseNonImplicationUint32)(
777  uint32_t bit_mask, size_t num_data, uint32_t const data[/*num_data*/],
778  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
779  LIBSAKURA_NOEXCEPT;
780 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseImplicationUint8)(
817  uint8_t bit_mask, size_t num_data, uint8_t const data[/*num_data*/],
818  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
819  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseImplicationUint32)(
824  uint32_t bit_mask, size_t num_data, uint32_t const data[/*num_data*/],
825  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
826  LIBSAKURA_NOEXCEPT;
827 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseNotUint8)(
856  size_t num_data, uint8_t const data[/*num_data*/],
857  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
858  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseNotUint32)(
863  size_t num_data, uint32_t const data[/*num_data*/],
864  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
865  LIBSAKURA_NOEXCEPT;
866 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseOrUint8)(
903  uint8_t bit_mask, size_t num_data, uint8_t const data[/*num_data*/],
904  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
905  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseOrUint32)(
910  uint32_t bit_mask, size_t num_data, uint32_t const data[/*num_data*/],
911  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
912  LIBSAKURA_NOEXCEPT;
913 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseXorUint8)(
950  uint8_t bit_mask, size_t num_data, uint8_t const data[/*num_data*/],
951  bool const edit_mask[/*num_data*/], uint8_t result[/*num_data*/])
952  LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(OperateBitwiseXorUint32)(
957  uint32_t bit_mask, size_t num_data, uint32_t const data[/*num_data*/],
958  bool const edit_mask[/*num_data*/], uint32_t result[/*num_data*/])
959  LIBSAKURA_NOEXCEPT;
960 
964 typedef enum {LIBSAKURA_SYMBOL(InterpolationMethod_kNearest),
968 LIBSAKURA_SYMBOL(InterpolationMethod_kLinear),
972 LIBSAKURA_SYMBOL(InterpolationMethod_kPolynomial),
976 LIBSAKURA_SYMBOL(InterpolationMethod_kSpline),
980 LIBSAKURA_SYMBOL(InterpolationMethod_kNumElements)
984 }LIBSAKURA_SYMBOL(InterpolationMethod);
985 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(InterpolateXAxisFloat)(
1074 LIBSAKURA_SYMBOL(InterpolationMethod) interpolation_method,
1075  uint8_t polynomial_order, size_t num_base,
1076  double const base_position[/*num_base*/], size_t num_array,
1077  float const base_data[/*num_base*num_array*/],
1078  bool const base_mask[/*num_base*num_array*/], size_t num_interpolated,
1079  double const interpolated_position[/*num_interpolated*/],
1080  float interpolated_data[/*num_interpolated*num_array*/],
1081  bool interpolated_mask[/*num_interpolated*num_array*/])
1083 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(InterpolateYAxisFloat)(
1088 LIBSAKURA_SYMBOL(InterpolationMethod) interpolation_method,
1089  uint8_t polynomial_order, size_t num_base,
1090  double const base_position[/*num_base*/], size_t num_array,
1091  float const base_data[/*num_base*num_array*/],
1092  bool const base_mask[/*num_base*num_array*/], size_t num_interpolated,
1093  double const interpolated_position[/*num_interpolated*/],
1094  float interpolated_data[/*num_interpolated*num_array*/],
1095  bool interpolated_mask[/*num_interpolated*num_array*/])
1096  LIBSAKURA_NOEXCEPT;
1097 
1137 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CalibrateDataWithArrayScalingFloat)(
1138  size_t num_data, float const scaling_factor[/*num_data*/],
1139  float const data[/*num_data*/], float const reference[/*num_data*/],
1140  float result[/*num_data*/]) LIBSAKURA_NOEXCEPT;
1141 
1178 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CalibrateDataWithConstScalingFloat)(
1179  float scaling_factor, size_t num_data, float const data[/*num_data*/],
1180  float const reference[/*num_data*/], float result[/*num_data*/])
1181  LIBSAKURA_NOEXCEPT;
1182 
1186 struct LIBSAKURA_SYMBOL(Convolve1DContextFloat);
1187 
1227 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateGaussianKernelFloat)(
1228  float peak_location, float kernel_width, size_t num_kernel, float kernel[])
1229  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1230 
1248 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateConvolve1DContextFFTFloat)(
1249  size_t num_kernel, float const kernel[/*num_kernel*/],
1250  struct LIBSAKURA_SYMBOL(Convolve1DContextFloat) **context)
1251  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1252 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Convolve1DFloat)(size_t num_kernel,
1294  float const kernel[/*num_kernel*/], size_t num_data,
1295  float const input_data[/*num_data*/],
1296  bool const input_mask[/*num_data*/], float output_data[/*num_data*/],
1297  float output_weight[/*num_data*/]) LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Convolve1DFFTFloat)(
1319  struct LIBSAKURA_SYMBOL(Convolve1DContextFloat) const *context,
1320  size_t num_data, float const input_data[/*num_data*/],
1321  float output_data[/*num_data*/]) LIBSAKURA_NOEXCEPT;LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(DestroyConvolve1DContextFloat)(
1332  struct LIBSAKURA_SYMBOL(Convolve1DContextFloat) *context)
1333  LIBSAKURA_NOEXCEPT;
1334 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(GetLSQCoefficientsDouble)(
1404  size_t const num_data, float const data[/*num_data*/],
1405  bool const mask[/*num_data*/], size_t const num_model_bases,
1406  double const basis_data[/*num_model_bases*num_data*/],
1407  size_t const num_lsq_bases,
1408  size_t const use_bases_idx[/*num_lsq_bases*/],
1409  double lsq_matrix[/*num_lsq_bases*num_lsq_bases*/],
1410  double lsq_vector[/*num_lsq_bases*/])
1411  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1412 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UpdateLSQCoefficientsDouble)(
1483  size_t const num_data, float const data[/*num_data*/],
1484  bool const mask[/*num_data*/], size_t const num_exclude_indices,
1485  size_t const exclude_indices[/*num_data*/],
1486  size_t const num_model_bases,
1487  double const basis_data[/*num_model_bases*num_data*/],
1488  size_t const num_lsq_bases,
1489  size_t const use_bases_idx[/*num_lsq_bases*/],
1490  double lsq_matrix[/*num_lsq_bases*num_lsq_bases*/],
1491  double lsq_vector[/*num_lsq_bases*/])
1492  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1493 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SolveSimultaneousEquationsByLUDouble)(
1521  size_t num_equations,
1522  double const in_matrix[/*num_equations*num_equations*/],
1523  double const in_vector[/*num_equations*/],
1524  double out[/*num_equations*/])
1525  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1526 
1527 //LM part----------------------------------------------------------------
1559 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LMFitGaussianFloat)(
1560  size_t const num_data, float const data[/*num_data*/],
1561  bool const mask[/*num_data*/], size_t const num_peaks,
1562  double height[/*num_peaks*/], double err_height[/*num_peaks*/],
1563  double center[/*num_peaks*/], double err_center[/*num_peaks*/],
1564  double sigma[/*num_peaks*/], double err_sigma[/*num_peaks*/])
1565  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1566 
1570 typedef enum {LIBSAKURA_SYMBOL(LSQFitStatus_kOK) = 0,
1574 LIBSAKURA_SYMBOL(LSQFitStatus_kNG) = 1,
1578 LIBSAKURA_SYMBOL(LSQFitStatus_kNotEnoughData) = 2,
1582 LIBSAKURA_SYMBOL(LSQFitStatus_kNumElements)
1586 }LIBSAKURA_SYMBOL(LSQFitStatus);
1587 
1591 typedef enum {LIBSAKURA_SYMBOL(LSQFitType_kPolynomial),
1595 LIBSAKURA_SYMBOL(LSQFitType_kChebyshev),
1599 LIBSAKURA_SYMBOL(LSQFitType_kNumElements)
1603 }LIBSAKURA_SYMBOL(LSQFitType);
1604 
1608 struct LIBSAKURA_SYMBOL(LSQFitContextFloat);
1609 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateLSQFitContextPolynomialFloat)(
1635 LIBSAKURA_SYMBOL(LSQFitType) const lsqfit_type, uint16_t order, size_t num_data,
1636  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1638 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateLSQFitContextCubicSplineFloat)(
1659  uint16_t npiece, size_t num_data,
1660  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1661  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1662 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateLSQFitContextSinusoidFloat)(
1684  uint16_t nwave, size_t num_data,
1685  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1686  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1687 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(DestroyLSQFitContextFloat)(
1699  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) *context)
1701 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitPolynomialFloat)(
1771  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1772  uint16_t order, size_t num_data, float const data[/*num_data*/],
1773  bool const mask[/*num_data*/], float clip_threshold_sigma,
1774  uint16_t num_fitting_max, size_t num_coeff, double coeff[/*num_coeff*/],
1775  float best_fit[/*num_data*/], float residual[/*num_data*/],
1776  bool final_mask[/*num_data*/], float *rms,
1777  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1778  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1779 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitCubicSplineFloat)(
1857  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1858  size_t num_pieces, size_t num_data, float const data[/*num_data*/],
1859  bool const mask[/*num_data*/], float clip_threshold_sigma,
1860  uint16_t num_fitting_max, double coeff[/*num_pieces*/][4],
1861  float best_fit[/*num_data*/], float residual[/*num_data*/],
1862  bool final_mask[/*num_data*/], float *rms,
1863  size_t boundary[/*num_pieces+1*/],
1864  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1865  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1866 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitSinusoidFloat)(
1945  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1946  size_t num_nwave, size_t const nwave[/*num_nwave*/], size_t num_data,
1947  float const data[/*num_data*/], bool const mask[/*num_data*/],
1948  float clip_threshold_sigma, uint16_t num_fitting_max, size_t num_coeff,
1949  double coeff[/*num_coeff*/], float best_fit[/*num_data*/],
1950  float residual[/*num_data*/], bool final_mask[/*num_data*/], float *rms,
1951  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1952  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1953 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractPolynomialFloat)(
1979  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1980  size_t num_data, float const data[/*num_data*/], size_t num_coeff,
1981  double const coeff[/*num_coeff*/], float out[/*num_data*/])
1982  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
1983 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractCubicSplineFloat)(
2016  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2017  size_t num_data, float const data[/*num_data*/], size_t num_pieces,
2018  double const coeff[/*num_pieces*/][4],
2019  size_t const boundary[/*num_pieces+1*/], float out[/*num_data*/])
2020  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
2021 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractSinusoidFloat)(
2057  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2058  size_t num_data, float const data[/*num_data*/], size_t num_nwave,
2059  size_t const nwave[/*num_nwave*/], size_t num_coeff,
2060  double const coeff[/*num_coeff*/], float out[/*num_data*/])
2061  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
2062 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(GetNumberOfCoefficientsFloat)(
2082  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2083  uint16_t order, size_t *num_coeff)
2084  LIBSAKURA_NOEXCEPT LIBSAKURA_WARN_UNUSED_RESULT;
2085 
2130 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayFloat)(
2131  bool inner_most_untouched, size_t dims, size_t const elements[],
2132  float const src[], float dst[]) LIBSAKURA_NOEXCEPT;
2133 
2170 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayFloat)(
2171  bool inner_most_untouched, size_t dims, size_t const elements[],
2172  float const src[], float dst[]) LIBSAKURA_NOEXCEPT;
2173 
2177 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayDouble)(
2178  bool inner_most_untouched, size_t dims, size_t const elements[],
2179  double const src[], double dst[]) LIBSAKURA_NOEXCEPT;
2180 
2184 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayDouble)(
2185  bool inner_most_untouched, size_t dims, size_t const elements[],
2186  double const src[], double dst[]) LIBSAKURA_NOEXCEPT;
2187 
2191 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayDouble2)(
2192  bool inner_most_untouched, size_t dims, size_t const elements[],
2193  double const src[][2], double dst[][2]) LIBSAKURA_NOEXCEPT;
2194 
2198 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayDouble2)(
2199  bool inner_most_untouched, size_t dims, size_t const elements[],
2200  double const src[][2], double dst[][2]) LIBSAKURA_NOEXCEPT;
2201 
2290 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateMaskNearEdgeDouble)(
2291  float fraction, double pixel_size, size_t num_data, double const x[],
2292  double const y[], double const *blc_x, double const *blc_y,
2293  double const *trc_x, double const *trc_y, bool mask[]);
2294 
2295 #ifdef __cplusplus
2296 }
2297 /* extern "C" */
2298 #endif
2299 
2300 #endif /* LIBSAKURA_LIBSAKURA_SAKURA_H_ */
size_t count
number of valid data
Definition: sakura.h:212
#define LIBSAKURA_SYMBOL(x)
Definition: config.h:34
ssize_t index_of_min
index for one of min value.
Definition: sakura.h:232
float min
min value of valid data.
Definition: sakura.h:224
#define LIBSAKURA_NOEXCEPT
Definition: sakura.h:49
double sum
sum of valid data
Definition: sakura.h:216
float max
max value of valid data.
Definition: sakura.h:228
#define LIBSAKURA_WARN_UNUSED_RESULT
Definition: sakura.h:46
double square_sum
sum of squared valid data
Definition: sakura.h:220
ssize_t index_of_max
index for one of max value.
Definition: sakura.h:236