LibSakura  5.2
sakura.h
Go to the documentation of this file.
1 /*
2  * @SAKURA_LICENSE_HEADER_START@
3  * Copyright (C) 2013-2022
4  * Inter-University Research Institute Corporation, National Institutes of Natural Sciences
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 
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[])
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*/])
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*/])
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*/])
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*/])
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*/])
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*/])
659 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(Uint32ToBool)(size_t num_data,
664  uint32_t const data[/*num_data*/], bool result[/*num_data*/])
666 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(InvertBool)(size_t num_data,
683  bool const data[/*num_data*/], bool result[/*num_data*/])
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*/])
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*/])
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*/])
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*/])
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*/])
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*/])
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*/])
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*/])
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[])
1230 
1248 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateConvolve1DContextFFTFloat)(
1249  size_t num_kernel, float const kernel[/*num_kernel*/],
1250  struct LIBSAKURA_SYMBOL(Convolve1DContextFloat) **context)
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)
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*/])
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*/])
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*/])
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*/])
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)(
1636 LIBSAKURA_SYMBOL(LSQFitType) const lsqfit_type, uint16_t order, size_t num_data,
1637  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1639 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateLSQFitContextCubicSplineFloat)(
1661  uint16_t npiece, size_t num_data,
1662  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1664 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateLSQFitContextSinusoidFloat)(
1687  uint16_t nwave, size_t num_data,
1688  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) **context)
1690 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(DestroyLSQFitContextFloat)(
1702  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) *context)
1704 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitPolynomialFloat)(
1774  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1775  uint16_t order, size_t num_data, float const data[/*num_data*/],
1776  bool const mask[/*num_data*/], float clip_threshold_sigma,
1777  uint16_t num_fitting_max, size_t num_coeff, double coeff[/*num_coeff*/],
1778  float best_fit[/*num_data*/], float residual[/*num_data*/],
1779  bool final_mask[/*num_data*/], float *rms,
1780  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1782 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitCubicSplineFloat)(
1860  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1861  size_t num_pieces, size_t num_data, float const data[/*num_data*/],
1862  bool const mask[/*num_data*/], float clip_threshold_sigma,
1863  uint16_t num_fitting_max, double coeff[/*num_pieces*/][4],
1864  float best_fit[/*num_data*/], float residual[/*num_data*/],
1865  bool final_mask[/*num_data*/], float *rms,
1866  size_t boundary[/*num_pieces+1*/],
1867  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1869 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(LSQFitSinusoidFloat)(
1948  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1949  size_t num_nwave, size_t const nwave[/*num_nwave*/], size_t num_data,
1950  float const data[/*num_data*/], bool const mask[/*num_data*/],
1951  float clip_threshold_sigma, uint16_t num_fitting_max, size_t num_coeff,
1952  double coeff[/*num_coeff*/], float best_fit[/*num_data*/],
1953  float residual[/*num_data*/], bool final_mask[/*num_data*/], float *rms,
1954  LIBSAKURA_SYMBOL(LSQFitStatus) *lsqfit_status)
1956 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractPolynomialFloat)(
1982  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
1983  size_t num_data, float const data[/*num_data*/], size_t num_coeff,
1984  double const coeff[/*num_coeff*/], float out[/*num_data*/])
1986 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractCubicSplineFloat)(
2019  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2020  size_t num_data, float const data[/*num_data*/], size_t num_pieces,
2021  double const coeff[/*num_pieces*/][4],
2022  size_t const boundary[/*num_pieces+1*/], float out[/*num_data*/])
2024 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(SubtractSinusoidFloat)(
2060  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2061  size_t num_data, float const data[/*num_data*/], size_t num_nwave,
2062  size_t const nwave[/*num_nwave*/], size_t num_coeff,
2063  double const coeff[/*num_coeff*/], float out[/*num_data*/])
2065 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(GetNumberOfCoefficientsFloat)(
2085  struct LIBSAKURA_SYMBOL(LSQFitContextFloat) const *context,
2086  uint16_t order, size_t *num_coeff)
2088 
2133 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayFloat)(
2134  bool inner_most_untouched, size_t dims, size_t const elements[],
2135  float const src[], float dst[]) LIBSAKURA_NOEXCEPT;
2136 
2173 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayFloat)(
2174  bool inner_most_untouched, size_t dims, size_t const elements[],
2175  float const src[], float dst[]) LIBSAKURA_NOEXCEPT;
2176 
2180 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayDouble)(
2181  bool inner_most_untouched, size_t dims, size_t const elements[],
2182  double const src[], double dst[]) LIBSAKURA_NOEXCEPT;
2183 
2187 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayDouble)(
2188  bool inner_most_untouched, size_t dims, size_t const elements[],
2189  double const src[], double dst[]) LIBSAKURA_NOEXCEPT;
2190 
2194 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(FlipArrayDouble2)(
2195  bool inner_most_untouched, size_t dims, size_t const elements[],
2196  double const src[][2], double dst[][2]) LIBSAKURA_NOEXCEPT;
2197 
2201 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(UnflipArrayDouble2)(
2202  bool inner_most_untouched, size_t dims, size_t const elements[],
2203  double const src[][2], double dst[][2]) LIBSAKURA_NOEXCEPT;
2204 
2293 LIBSAKURA_SYMBOL(Status) LIBSAKURA_SYMBOL(CreateMaskNearEdgeDouble)(
2294  float fraction, double pixel_size, size_t num_data, double const x[],
2295  double const y[], double const *blc_x, double const *blc_y,
2296  double const *trc_x, double const *trc_y, bool mask[]);
2297 
2298 #ifdef __cplusplus
2299 }
2300 /* extern "C" */
2301 #endif
2302 
2303 #endif /* LIBSAKURA_LIBSAKURA_SAKURA_H_ */
#define LIBSAKURA_SYMBOL(x)
Definition: config.h:34
#define LIBSAKURA_NOEXCEPT
Definition: sakura.h:49
#define LIBSAKURA_WARN_UNUSED_RESULT
Definition: sakura.h:46
size_t count
number of valid data
Definition: sakura.h:212
float min
min value of valid data.
Definition: sakura.h:224
double square_sum
sum of squared valid data
Definition: sakura.h:220
ssize_t index_of_min
index for one of min value.
Definition: sakura.h:232
double sum
sum of valid data
Definition: sakura.h:216
float max
max value of valid data.
Definition: sakura.h:228
ssize_t index_of_max
index for one of max value.
Definition: sakura.h:236