Добавление квалификатора const, который запрещает изменение указателя
This commit is contained in:
parent
51fafe50c8
commit
610756ffed
14 changed files with 1019 additions and 1039 deletions
|
|
@ -1,101 +1,101 @@
|
|||
#include "./complex.h"
|
||||
|
||||
extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex);
|
||||
extern inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex);
|
||||
extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* const complex);
|
||||
extern inline void bgc_fp64_complex_reset(BGC_FP64_Complex* const complex);
|
||||
|
||||
extern inline void bgc_fp32_complex_make(BGC_FP32_Complex* complex, const float real, const float imaginary);
|
||||
extern inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real, const double imaginary);
|
||||
extern inline void bgc_fp32_complex_make(BGC_FP32_Complex* const complex, const float real, const float imaginary);
|
||||
extern inline void bgc_fp64_complex_make(BGC_FP64_Complex* const complex, const double real, const double imaginary);
|
||||
|
||||
extern inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* number);
|
||||
extern inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* number);
|
||||
extern inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* const number);
|
||||
extern inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* number);
|
||||
extern inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number);
|
||||
extern inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* const number);
|
||||
extern inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline void bgc_fp32_complex_copy(BGC_FP32_Complex* destination, const BGC_FP32_Complex* source);
|
||||
extern inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* source);
|
||||
extern inline void bgc_fp32_complex_copy(BGC_FP32_Complex* const destination, const BGC_FP32_Complex* const source);
|
||||
extern inline void bgc_fp64_complex_copy(BGC_FP64_Complex* const destination, const BGC_FP64_Complex* const source);
|
||||
|
||||
extern inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* number2);
|
||||
extern inline void bgc_fp32_complex_swap(BGC_FP32_Complex* const number1, BGC_FP32_Complex* const number2);
|
||||
extern inline void bgc_fp64_complex_swap(BGC_FP64_Complex* const number1, BGC_FP64_Complex* const number2);
|
||||
|
||||
extern inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* destination, const BGC_FP64_Complex* source);
|
||||
extern inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, const BGC_FP32_Complex* source);
|
||||
extern inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* const destination, const BGC_FP64_Complex* const source);
|
||||
extern inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* const destination, const BGC_FP32_Complex* const source);
|
||||
|
||||
extern inline void bgc_fp32_complex_revert(BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number);
|
||||
extern inline void bgc_fp32_complex_revert(BGC_FP32_Complex* const number);
|
||||
extern inline void bgc_fp64_complex_revert(BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* reverse, const BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP64_Complex* number);
|
||||
extern inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* const reverse, const BGC_FP32_Complex* const number);
|
||||
extern inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* const reverse, const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* const normalized, const BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* const normalized, const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number);
|
||||
extern inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* const number);
|
||||
extern inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* conjugate, const BGC_FP32_Complex* number);
|
||||
extern inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BGC_FP64_Complex* number);
|
||||
extern inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* const conjugate, const BGC_FP32_Complex* const number);
|
||||
extern inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* const conjugate, const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_invert(BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_invert(BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP32_Complex* number);
|
||||
extern inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP64_Complex* number);
|
||||
extern inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* const inverse, const BGC_FP32_Complex* const number);
|
||||
extern inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* const inverse, const BGC_FP64_Complex* const number);
|
||||
|
||||
extern inline void bgc_fp32_complex_add(BGC_FP32_Complex* sum, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
extern inline void bgc_fp32_complex_add(BGC_FP32_Complex* const sum, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2);
|
||||
extern inline void bgc_fp64_complex_add(BGC_FP64_Complex* const sum, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2);
|
||||
|
||||
extern inline void bgc_fp32_complex_add_scaled(BGC_FP32_Complex* sum, const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* sum, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale);
|
||||
extern inline void bgc_fp32_complex_add_scaled(BGC_FP32_Complex* const sum, const BGC_FP32_Complex* const basic_number, const BGC_FP32_Complex* const scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* const sum, const BGC_FP64_Complex* const basic_number, const BGC_FP64_Complex* const scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend);
|
||||
extern inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend);
|
||||
extern inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* const difference, const BGC_FP32_Complex* const minuend, const BGC_FP32_Complex* const subtrahend);
|
||||
extern inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* const difference, const BGC_FP64_Complex* const minuend, const BGC_FP64_Complex* const subtrahend);
|
||||
|
||||
extern inline void bgc_fp32_complex_subtract_scaled(BGC_FP32_Complex* difference, const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_complex_subtract_scaled(BGC_FP64_Complex* difference, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale);
|
||||
extern inline void bgc_fp32_complex_subtract_scaled(BGC_FP32_Complex* const difference, const BGC_FP32_Complex* const basic_number, const BGC_FP32_Complex* const scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_complex_subtract_scaled(BGC_FP64_Complex* const difference, const BGC_FP64_Complex* const basic_number, const BGC_FP64_Complex* const scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_complex_multiply_by_real(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier);
|
||||
extern inline void bgc_fp32_complex_multiply_by_real(BGC_FP32_Complex* const product, const BGC_FP32_Complex* const multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* const product, const BGC_FP64_Complex* const multiplicand, const double multiplier);
|
||||
|
||||
extern inline void bgc_fp32_complex_multiply_by_complex(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const BGC_FP32_Complex* multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply_by_complex(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* multiplier);
|
||||
extern inline void bgc_fp32_complex_multiply_by_complex(BGC_FP32_Complex* const product, const BGC_FP32_Complex* const multiplicand, const BGC_FP32_Complex* const multiplier);
|
||||
extern inline void bgc_fp64_complex_multiply_by_complex(BGC_FP64_Complex* const product, const BGC_FP64_Complex* const multiplicand, const BGC_FP64_Complex* const multiplier);
|
||||
|
||||
extern inline void bgc_fp32_complex_multiply_by_conjugate(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const BGC_FP32_Complex* multiplier_to_conjugate);
|
||||
extern inline void bgc_fp64_complex_multiply_by_conjugate(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* multiplier_to_conjugate);
|
||||
extern inline void bgc_fp32_complex_multiply_by_conjugate(BGC_FP32_Complex* const product, const BGC_FP32_Complex* const multiplicand, const BGC_FP32_Complex* const multiplier_to_conjugate);
|
||||
extern inline void bgc_fp64_complex_multiply_by_conjugate(BGC_FP64_Complex* const product, const BGC_FP64_Complex* const multiplicand, const BGC_FP64_Complex* const multiplier_to_conjugate);
|
||||
|
||||
extern inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* dividend, const float divisor);
|
||||
extern inline int bgc_fp64_complex_divide_by_real(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* dividend, const double divisor);
|
||||
extern inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* const quotient, const BGC_FP32_Complex* const dividend, const float divisor);
|
||||
extern inline int bgc_fp64_complex_divide_by_real(BGC_FP64_Complex* const quotient, const BGC_FP64_Complex* const dividend, const double divisor);
|
||||
|
||||
extern inline int bgc_fp32_complex_divide_by_complex(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor);
|
||||
extern inline int bgc_fp64_complex_divide_by_complex(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor);
|
||||
extern inline int bgc_fp32_complex_divide_by_complex(BGC_FP32_Complex* const quotient, const BGC_FP32_Complex* const divident, const BGC_FP32_Complex* const divisor);
|
||||
extern inline int bgc_fp64_complex_divide_by_complex(BGC_FP64_Complex* const quotient, const BGC_FP64_Complex* const divident, const BGC_FP64_Complex* const divisor);
|
||||
|
||||
extern inline int bgc_fp32_complex_divide_by_conjugate(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor_to_conjugate);
|
||||
extern inline int bgc_fp64_complex_divide_by_conjugate(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor_to_conjugate);
|
||||
extern inline int bgc_fp32_complex_divide_by_conjugate(BGC_FP32_Complex* const quotient, const BGC_FP32_Complex* const divident, const BGC_FP32_Complex* const divisor_to_conjugate);
|
||||
extern inline int bgc_fp64_complex_divide_by_conjugate(BGC_FP64_Complex* const quotient, const BGC_FP64_Complex* const divident, const BGC_FP64_Complex* const divisor_to_conjugate);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
extern inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* const mean, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2);
|
||||
extern inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* const mean, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2);
|
||||
|
||||
extern inline void bgc_fp32_complex_get_mean3(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3);
|
||||
extern inline void bgc_fp64_complex_get_mean3(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3);
|
||||
extern inline void bgc_fp32_complex_get_mean3(BGC_FP32_Complex* const mean, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2, const BGC_FP32_Complex* const number3);
|
||||
extern inline void bgc_fp64_complex_get_mean3(BGC_FP64_Complex* const mean, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2, const BGC_FP64_Complex* const number3);
|
||||
|
||||
extern inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase);
|
||||
extern inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase);
|
||||
extern inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* const interpolation, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2, const float phase);
|
||||
extern inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* const interpolation, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2, const double phase);
|
||||
|
||||
extern inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
|
||||
extern inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
|
||||
extern inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2);
|
||||
extern inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2);
|
||||
|
||||
// =============== Get Exponation =============== //
|
||||
|
||||
void bgc_fp32_complex_get_power(BGC_FP32_Complex* power, const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent)
|
||||
void bgc_fp32_complex_get_power(BGC_FP32_Complex* const power, const BGC_FP32_Complex* const base, const float real_exponent, const float imaginary_exponent)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(base);
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ void bgc_fp32_complex_get_power(BGC_FP32_Complex* power, const BGC_FP32_Complex*
|
|||
power->imaginary = power_modulus * sinf(power_angle);
|
||||
}
|
||||
|
||||
void bgc_fp64_complex_get_power(BGC_FP64_Complex* power, const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent)
|
||||
void bgc_fp64_complex_get_power(BGC_FP64_Complex* const power, const BGC_FP64_Complex* const base, const double real_exponent, const double imaginary_exponent)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(base);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue