Добавление квалификатора 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);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex)
|
||||
inline void bgc_fp32_complex_reset(BGC_FP32_Complex* const complex)
|
||||
{
|
||||
complex->real = 0.0f;
|
||||
complex->imaginary = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
|
||||
inline void bgc_fp64_complex_reset(BGC_FP64_Complex* const complex)
|
||||
{
|
||||
complex->real = 0.0;
|
||||
complex->imaginary = 0.0;
|
||||
|
|
@ -23,13 +23,13 @@ inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
|
|||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_make(BGC_FP32_Complex* complex, const float real, const float imaginary)
|
||||
inline void bgc_fp32_complex_make(BGC_FP32_Complex* const complex, const float real, const float imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real, const double imaginary)
|
||||
inline void bgc_fp64_complex_make(BGC_FP64_Complex* const complex, const double real, const double imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
|
|
@ -37,57 +37,57 @@ inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real,
|
|||
|
||||
// ================== Modulus =================== //
|
||||
|
||||
inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* number)
|
||||
inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* const number)
|
||||
{
|
||||
return number->real * number->real + number->imaginary * number->imaginary;
|
||||
}
|
||||
|
||||
inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* number)
|
||||
inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* const number)
|
||||
{
|
||||
return number->real * number->real + number->imaginary * number->imaginary;
|
||||
}
|
||||
|
||||
inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* number)
|
||||
inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* const number)
|
||||
{
|
||||
return sqrtf(bgc_fp32_complex_get_square_modulus(number));
|
||||
}
|
||||
|
||||
inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number)
|
||||
inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* const number)
|
||||
{
|
||||
return sqrt(bgc_fp64_complex_get_square_modulus(number));
|
||||
}
|
||||
|
||||
// ================= Comparison ================= //
|
||||
|
||||
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* const number)
|
||||
{
|
||||
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* const number)
|
||||
{
|
||||
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* const number)
|
||||
{
|
||||
return bgc_fp32_is_square_unit(bgc_fp32_complex_get_square_modulus(number));
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* const number)
|
||||
{
|
||||
return bgc_fp64_is_square_unit(bgc_fp64_complex_get_square_modulus(number));
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_complex_copy(BGC_FP32_Complex* destination, const BGC_FP32_Complex* source)
|
||||
inline void bgc_fp32_complex_copy(BGC_FP32_Complex* const destination, const BGC_FP32_Complex* const source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* source)
|
||||
inline void bgc_fp64_complex_copy(BGC_FP64_Complex* const destination, const BGC_FP64_Complex* const source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -95,7 +95,7 @@ inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* number2)
|
||||
inline void bgc_fp32_complex_swap(BGC_FP32_Complex* const number1, BGC_FP32_Complex* const number2)
|
||||
{
|
||||
const float real = number2->real;
|
||||
const float imaginary = number2->imaginary;
|
||||
|
|
@ -107,7 +107,7 @@ inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* n
|
|||
number1->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* number2)
|
||||
inline void bgc_fp64_complex_swap(BGC_FP64_Complex* const number1, BGC_FP64_Complex* const number2)
|
||||
{
|
||||
const double real = number2->real;
|
||||
const double imaginary = number2->imaginary;
|
||||
|
|
@ -121,13 +121,13 @@ inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* n
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* destination, const BGC_FP64_Complex* source)
|
||||
inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* const destination, const BGC_FP64_Complex* const source)
|
||||
{
|
||||
destination->real = (float)source->real;
|
||||
destination->imaginary = (float)source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, const BGC_FP32_Complex* source)
|
||||
inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* const destination, const BGC_FP32_Complex* const source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -135,25 +135,25 @@ inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, cons
|
|||
|
||||
// ================== Negative ================== //
|
||||
|
||||
inline void bgc_fp32_complex_revert(BGC_FP32_Complex* number)
|
||||
inline void bgc_fp32_complex_revert(BGC_FP32_Complex* const number)
|
||||
{
|
||||
number->real = -number->real;
|
||||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number)
|
||||
inline void bgc_fp64_complex_revert(BGC_FP64_Complex* const number)
|
||||
{
|
||||
number->real = -number->real;
|
||||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* reverse, const BGC_FP32_Complex* number)
|
||||
inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* const reverse, const BGC_FP32_Complex* const number)
|
||||
{
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP64_Complex* number)
|
||||
inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* const reverse, const BGC_FP64_Complex* const number)
|
||||
{
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
|
|
@ -161,7 +161,7 @@ inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP
|
|||
|
||||
// ================= Normalize ================== //
|
||||
|
||||
inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* const number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* const number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* const normalized, const BGC_FP32_Complex* const number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const B
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* const normalized, const BGC_FP64_Complex* const number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -251,23 +251,23 @@ inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const B
|
|||
|
||||
// ================= Conjugate ================== //
|
||||
|
||||
inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* number)
|
||||
inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* const number)
|
||||
{
|
||||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number)
|
||||
inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* const number)
|
||||
{
|
||||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* conjugate, const BGC_FP32_Complex* number)
|
||||
inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* const conjugate, const BGC_FP32_Complex* const number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BGC_FP64_Complex* number)
|
||||
inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* const conjugate, const BGC_FP64_Complex* const number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
|
|
@ -275,7 +275,7 @@ inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BG
|
|||
|
||||
// =================== Invert =================== //
|
||||
|
||||
inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* const inverse, const BGC_FP32_Complex* const number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP3
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* const inverse, const BGC_FP64_Complex* const number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -307,31 +307,31 @@ inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP6
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_complex_invert(BGC_FP32_Complex* number)
|
||||
inline int bgc_fp32_complex_invert(BGC_FP32_Complex* const number)
|
||||
{
|
||||
return bgc_fp32_complex_get_inverse(number, number);
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number)
|
||||
inline int bgc_fp64_complex_invert(BGC_FP64_Complex* const number)
|
||||
{
|
||||
return bgc_fp64_complex_get_inverse(number, number);
|
||||
}
|
||||
|
||||
// ================= Get Power ================== //
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
// ==================== Add ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_add(BGC_FP32_Complex* sum, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
inline void bgc_fp32_complex_add(BGC_FP32_Complex* const sum, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
inline void bgc_fp64_complex_add(BGC_FP64_Complex* const sum, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
|
|
@ -339,13 +339,13 @@ inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex*
|
|||
|
||||
// ================= Add Scaled ================= //
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
|
|
@ -353,13 +353,13 @@ inline void bgc_fp64_complex_add_scaled(BGC_FP64_Complex* sum, const BGC_FP64_Co
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend)
|
||||
inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* const difference, const BGC_FP32_Complex* const minuend, const BGC_FP32_Complex* const subtrahend)
|
||||
{
|
||||
difference->real = minuend->real - subtrahend->real;
|
||||
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend)
|
||||
inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* const difference, const BGC_FP64_Complex* const minuend, const BGC_FP64_Complex* const subtrahend)
|
||||
{
|
||||
difference->real = minuend->real - subtrahend->real;
|
||||
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
|
||||
|
|
@ -367,13 +367,13 @@ inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP
|
|||
|
||||
// ============== Subtract Scaled =============== //
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
difference->real = basic_number->real - scalable_number->real * scale;
|
||||
difference->imaginary = basic_number->imaginary - scalable_number->imaginary * scale;
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
difference->real = basic_number->real - scalable_number->real * scale;
|
||||
difference->imaginary = basic_number->imaginary - scalable_number->imaginary * scale;
|
||||
|
|
@ -381,13 +381,13 @@ inline void bgc_fp64_complex_subtract_scaled(BGC_FP64_Complex* difference, const
|
|||
|
||||
// ========== Multiply By Real Number =========== //
|
||||
|
||||
inline void bgc_fp32_complex_multiply_by_real(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier)
|
||||
inline void bgc_fp32_complex_multiply_by_real(BGC_FP32_Complex* const product, const BGC_FP32_Complex* const multiplicand, const float multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier)
|
||||
inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* const product, const BGC_FP64_Complex* const multiplicand, const double multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
|
|
@ -395,7 +395,7 @@ inline void bgc_fp64_complex_multiply_by_real(BGC_FP64_Complex* product, const B
|
|||
|
||||
// ========= Multiply By Complex Number ========= //
|
||||
|
||||
inline void bgc_fp32_complex_multiply_by_complex(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const BGC_FP32_Complex* multiplier)
|
||||
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)
|
||||
{
|
||||
const float real = multiplicand->real * multiplier->real - multiplicand->imaginary * multiplier->imaginary;
|
||||
const float imaginary = multiplicand->real * multiplier->imaginary + multiplicand->imaginary * multiplier->real;
|
||||
|
|
@ -404,7 +404,7 @@ inline void bgc_fp32_complex_multiply_by_complex(BGC_FP32_Complex* product, cons
|
|||
product->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_multiply_by_complex(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* multiplier)
|
||||
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)
|
||||
{
|
||||
const double real = multiplicand->real * multiplier->real - multiplicand->imaginary * multiplier->imaginary;
|
||||
const double imaginary = multiplicand->real * multiplier->imaginary + multiplicand->imaginary * multiplier->real;
|
||||
|
|
@ -415,7 +415,7 @@ inline void bgc_fp64_complex_multiply_by_complex(BGC_FP64_Complex* product, cons
|
|||
|
||||
// ======== Multiply By Conjugate Number ======== //
|
||||
|
||||
inline void bgc_fp32_complex_multiply_by_conjugate(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const BGC_FP32_Complex* multiplier_to_conjugate)
|
||||
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)
|
||||
{
|
||||
const float real = multiplicand->real * multiplier_to_conjugate->real + multiplicand->imaginary * multiplier_to_conjugate->imaginary;
|
||||
const float imaginary = multiplicand->imaginary * multiplier_to_conjugate->real - multiplicand->real * multiplier_to_conjugate->imaginary;
|
||||
|
|
@ -424,7 +424,7 @@ inline void bgc_fp32_complex_multiply_by_conjugate(BGC_FP32_Complex* product, co
|
|||
product->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_multiply_by_conjugate(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* multiplier_to_conjugate)
|
||||
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)
|
||||
{
|
||||
const double real = multiplicand->real * multiplier_to_conjugate->real + multiplicand->imaginary * multiplier_to_conjugate->imaginary;
|
||||
const double imaginary = multiplicand->imaginary * multiplier_to_conjugate->real - multiplicand->real * multiplier_to_conjugate->imaginary;
|
||||
|
|
@ -435,7 +435,7 @@ inline void bgc_fp64_complex_multiply_by_conjugate(BGC_FP64_Complex* product, co
|
|||
|
||||
// =========== Divide by Real Number ============ //
|
||||
|
||||
inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* dividend, const float divisor)
|
||||
inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* const quotient, const BGC_FP32_Complex* const dividend, const float divisor)
|
||||
{
|
||||
if (bgc_fp32_is_zero(divisor) || isnan(divisor)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -446,7 +446,7 @@ inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* quotient, const BGC
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_divide_by_real(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* dividend, const double divisor)
|
||||
inline int bgc_fp64_complex_divide_by_real(BGC_FP64_Complex* const quotient, const BGC_FP64_Complex* const dividend, const double divisor)
|
||||
{
|
||||
if (bgc_fp64_is_zero(divisor) || isnan(divisor)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -459,7 +459,7 @@ inline int bgc_fp64_complex_divide_by_real(BGC_FP64_Complex* quotient, const BGC
|
|||
|
||||
// ========== Divide by Complex Number ========== //
|
||||
|
||||
inline int bgc_fp32_complex_divide_by_complex(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor)
|
||||
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)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ inline int bgc_fp32_complex_divide_by_complex(BGC_FP32_Complex* quotient, const
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_divide_by_complex(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor)
|
||||
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)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ inline int bgc_fp64_complex_divide_by_complex(BGC_FP64_Complex* quotient, const
|
|||
|
||||
// ========= Divide By Conjugate Number ========= //
|
||||
|
||||
inline int bgc_fp32_complex_divide_by_conjugate(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor_to_conjugate)
|
||||
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)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor_to_conjugate);
|
||||
|
||||
|
|
@ -503,7 +503,7 @@ inline int bgc_fp32_complex_divide_by_conjugate(BGC_FP32_Complex* quotient, cons
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_divide_by_conjugate(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor_to_conjugate)
|
||||
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)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor_to_conjugate);
|
||||
|
||||
|
|
@ -519,13 +519,13 @@ inline int bgc_fp64_complex_divide_by_conjugate(BGC_FP64_Complex* quotient, cons
|
|||
|
||||
// ================== Average2 ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* const mean, const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5f;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* const mean, const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5;
|
||||
|
|
@ -533,13 +533,13 @@ inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Co
|
|||
|
||||
// ================== Average3 ================== //
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP32_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP32_ONE_THIRD;
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP64_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP64_ONE_THIRD;
|
||||
|
|
@ -547,7 +547,7 @@ inline void bgc_fp64_complex_get_mean3(BGC_FP64_Complex* mean, const BGC_FP64_Co
|
|||
|
||||
// =================== Linear =================== //
|
||||
|
||||
inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase)
|
||||
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)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const
|
|||
interpolation->imaginary = number1->imaginary * counter_phase + number2->imaginary * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase)
|
||||
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)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
|
|
@ -565,7 +565,7 @@ inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const
|
|||
|
||||
// ================== Are Close ================= //
|
||||
|
||||
inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* const number1, const BGC_FP32_Complex* const number2)
|
||||
{
|
||||
const float square_modulus1 = bgc_fp32_complex_get_square_modulus(number1);
|
||||
const float square_modulus2 = bgc_fp32_complex_get_square_modulus(number2);
|
||||
|
|
@ -582,7 +582,7 @@ inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC
|
|||
return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2)
|
||||
{
|
||||
const double square_modulus1 = bgc_fp64_complex_get_square_modulus(number1);
|
||||
const double square_modulus2 = bgc_fp64_complex_get_square_modulus(number2);
|
||||
|
|
|
|||
|
|
@ -1,73 +1,73 @@
|
|||
#include "./dual-number.h"
|
||||
|
||||
extern inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number);
|
||||
extern inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* const number);
|
||||
extern inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* number, const float real_part, const float dual_part);
|
||||
extern inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double real_part, const double dual_part);
|
||||
extern inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* const number, const float real_part, const float dual_part);
|
||||
extern inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* const number, const double real_part, const double dual_part);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* destination, const BGC_FP32_DualNumber* source);
|
||||
extern inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BGC_FP64_DualNumber* source);
|
||||
extern inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* const destination, const BGC_FP32_DualNumber* const source);
|
||||
extern inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* const destination, const BGC_FP64_DualNumber* const source);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* first, BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualNumber* second);
|
||||
extern inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* const first, BGC_FP32_DualNumber* const second);
|
||||
extern inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* const first, BGC_FP64_DualNumber* const second);
|
||||
|
||||
extern inline void bgc_fp64_dual_number_convert_to_fp32(BGC_FP32_DualNumber* first, BGC_FP64_DualNumber* second);
|
||||
extern inline void bgc_fp32_dual_number_convert_to_fp64(BGC_FP64_DualNumber* first, BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_convert_to_fp32(BGC_FP32_DualNumber* const destination, const BGC_FP64_DualNumber* const source);
|
||||
extern inline void bgc_fp32_dual_number_convert_to_fp64(BGC_FP64_DualNumber* const destination, const BGC_FP32_DualNumber* const source);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number);
|
||||
extern inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* const number);
|
||||
extern inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_reverse(BGC_FP32_DualNumber* reverse, const BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_get_reverse(BGC_FP64_DualNumber* reverse, const BGC_FP64_DualNumber* number);
|
||||
extern inline void bgc_fp32_dual_number_get_reverse(BGC_FP32_DualNumber* const reverse, const BGC_FP32_DualNumber* const number);
|
||||
extern inline void bgc_fp64_dual_number_get_reverse(BGC_FP64_DualNumber* const reverse, const BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* number);
|
||||
extern inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* number);
|
||||
extern inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* const number);
|
||||
extern inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline int bgc_fp32_dual_number_get_inverse(BGC_FP32_DualNumber* inverse, const BGC_FP32_DualNumber* number);
|
||||
extern inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* inverse, const BGC_FP64_DualNumber* number);
|
||||
extern inline int bgc_fp32_dual_number_get_inverse(BGC_FP32_DualNumber* const inverse, const BGC_FP32_DualNumber* const number);
|
||||
extern inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* const inverse, const BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_conjugate(BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_conjugate(BGC_FP64_DualNumber* number);
|
||||
extern inline void bgc_fp32_dual_number_conjugate(BGC_FP32_DualNumber* const number);
|
||||
extern inline void bgc_fp64_dual_number_conjugate(BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_conjugate(BGC_FP32_DualNumber* conjugate, const BGC_FP32_DualNumber* number);
|
||||
extern inline void bgc_fp64_dual_number_get_conjugate(BGC_FP64_DualNumber* conjugate, const BGC_FP64_DualNumber* number);
|
||||
extern inline void bgc_fp32_dual_number_get_conjugate(BGC_FP32_DualNumber* const conjugate, const BGC_FP32_DualNumber* const number);
|
||||
extern inline void bgc_fp64_dual_number_get_conjugate(BGC_FP64_DualNumber* const conjugate, const BGC_FP64_DualNumber* const number);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
extern inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* const sum, const BGC_FP32_DualNumber* const first, const BGC_FP32_DualNumber* const second);
|
||||
extern inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* const sum, const BGC_FP64_DualNumber* const first, const BGC_FP64_DualNumber* const second);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale);
|
||||
extern inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* const sum, const BGC_FP32_DualNumber* const base_number, const BGC_FP32_DualNumber* const scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* const sum, const BGC_FP64_DualNumber* const base_number, const BGC_FP64_DualNumber* const scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend);
|
||||
extern inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend);
|
||||
extern inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* const difference, const BGC_FP32_DualNumber* const minuend, const BGC_FP32_DualNumber* const subtrahend);
|
||||
extern inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* const difference, const BGC_FP64_DualNumber* const minuend, const BGC_FP64_DualNumber* const subtrahend);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_subtract_scaled(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_dual_number_subtract_scaled(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale);
|
||||
extern inline void bgc_fp32_dual_number_subtract_scaled(BGC_FP32_DualNumber* const difference, const BGC_FP32_DualNumber* const base_number, const BGC_FP32_DualNumber* const scalable_number, const float scale);
|
||||
extern inline void bgc_fp64_dual_number_subtract_scaled(BGC_FP64_DualNumber* const difference, const BGC_FP64_DualNumber* const base_number, const BGC_FP64_DualNumber* const scalable_number, const double scale);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_real(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_real(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier);
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_real(BGC_FP32_DualNumber* const product, const BGC_FP32_DualNumber* const multiplicand, const float multiplier);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_real(BGC_FP64_DualNumber* const product, const BGC_FP64_DualNumber* const multiplicand, const double multiplier);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_dual(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const BGC_FP32_DualNumber* multiplier);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_dual(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const BGC_FP64_DualNumber* multiplier);
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_dual(BGC_FP32_DualNumber* const product, const BGC_FP32_DualNumber* const multiplicand, const BGC_FP32_DualNumber* const multiplier);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_dual(BGC_FP64_DualNumber* const product, const BGC_FP64_DualNumber* const multiplicand, const BGC_FP64_DualNumber* const multiplier);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_conjugate(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const BGC_FP32_DualNumber* multiplier_to_conjugate);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_conjugate(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const BGC_FP64_DualNumber* multiplier_to_conjugate);
|
||||
extern inline void bgc_fp32_dual_number_multiply_by_conjugate(BGC_FP32_DualNumber* const product, const BGC_FP32_DualNumber* const multiplicand, const BGC_FP32_DualNumber* const multiplier_to_conjugate);
|
||||
extern inline void bgc_fp64_dual_number_multiply_by_conjugate(BGC_FP64_DualNumber* const product, const BGC_FP64_DualNumber* const multiplicand, const BGC_FP64_DualNumber* const multiplier_to_conjugate);
|
||||
|
||||
extern inline int bgc_fp32_dual_number_divide_by_real(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_real(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor);
|
||||
extern inline int bgc_fp32_dual_number_divide_by_real(BGC_FP32_DualNumber* const quotient, const BGC_FP32_DualNumber* const dividend, const float divisor);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_real(BGC_FP64_DualNumber* const quotient, const BGC_FP64_DualNumber* const dividend, const double divisor);
|
||||
|
||||
extern inline int bgc_fp32_dual_number_divide_by_dual(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const BGC_FP32_DualNumber* divisor);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_dual(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const BGC_FP64_DualNumber* divisor);
|
||||
extern inline int bgc_fp32_dual_number_divide_by_dual(BGC_FP32_DualNumber* const quotient, const BGC_FP32_DualNumber* const dividend, const BGC_FP32_DualNumber* const divisor);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_dual(BGC_FP64_DualNumber* const quotient, const BGC_FP64_DualNumber* const dividend, const BGC_FP64_DualNumber* const divisor);
|
||||
|
||||
extern inline int bgc_fp32_dual_number_divide_by_conjugate(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const BGC_FP32_DualNumber* divisor_to_conjugate);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_conjugate(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const BGC_FP64_DualNumber* divisor_to_conjugate);
|
||||
extern inline int bgc_fp32_dual_number_divide_by_conjugate(BGC_FP32_DualNumber* const quotient, const BGC_FP32_DualNumber* const dividend, const BGC_FP32_DualNumber* const divisor_to_conjugate);
|
||||
extern inline int bgc_fp64_dual_number_divide_by_conjugate(BGC_FP64_DualNumber* const quotient, const BGC_FP64_DualNumber* const dividend, const BGC_FP64_DualNumber* const divisor_to_conjugate);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
|
||||
extern inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
|
||||
extern inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* const mean, const BGC_FP32_DualNumber* const first, const BGC_FP32_DualNumber* const second);
|
||||
extern inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* const mean, const BGC_FP64_DualNumber* const first, const BGC_FP64_DualNumber* const second);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const BGC_FP32_DualNumber* third);
|
||||
extern inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* third);
|
||||
extern inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* const mean, const BGC_FP32_DualNumber* const first, const BGC_FP32_DualNumber* const second, const BGC_FP32_DualNumber* const third);
|
||||
extern inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* const mean, const BGC_FP64_DualNumber* const first, const BGC_FP64_DualNumber* const second, const BGC_FP64_DualNumber* const third);
|
||||
|
||||
extern inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* interpolation, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const float phase);
|
||||
extern inline void bgc_fp64_dual_number_interpolate(BGC_FP64_DualNumber* interpolation, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const double phase);
|
||||
extern inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* const interpolation, const BGC_FP32_DualNumber* const first, const BGC_FP32_DualNumber* const second, const float phase);
|
||||
extern inline void bgc_fp64_dual_number_interpolate(BGC_FP64_DualNumber* const interpolation, const BGC_FP64_DualNumber* const first, const BGC_FP64_DualNumber* const second, const double phase);
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* number)
|
||||
inline void bgc_fp32_dual_number_reset(BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
number->real_part = 0.0f;
|
||||
number->dual_part = 0.0f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number)
|
||||
inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
number->real_part = 0.0;
|
||||
number->dual_part = 0.0;
|
||||
|
|
@ -22,13 +22,13 @@ inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number)
|
|||
|
||||
// ==================== Make ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* number, const float real_part, const float dual_part)
|
||||
inline void bgc_fp32_dual_number_make(BGC_FP32_DualNumber* const number, const float real_part, const float dual_part)
|
||||
{
|
||||
number->real_part = real_part;
|
||||
number->dual_part = dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double real_part, const double dual_part)
|
||||
inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* const number, const double real_part, const double dual_part)
|
||||
{
|
||||
number->real_part = real_part;
|
||||
number->dual_part = dual_part;
|
||||
|
|
@ -36,13 +36,13 @@ inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* destination, const BGC_FP32_DualNumber* source)
|
||||
inline void bgc_fp32_dual_number_copy(BGC_FP32_DualNumber* const destination, const BGC_FP32_DualNumber* const source)
|
||||
{
|
||||
destination->real_part = source->real_part;
|
||||
destination->dual_part = source->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BGC_FP64_DualNumber* source)
|
||||
inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* const destination, const BGC_FP64_DualNumber* const source)
|
||||
{
|
||||
destination->real_part = source->real_part;
|
||||
destination->dual_part = source->dual_part;
|
||||
|
|
@ -50,13 +50,13 @@ inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BG
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* first, BGC_FP32_DualNumber* second)
|
||||
inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* const first, BGC_FP32_DualNumber* const second)
|
||||
{
|
||||
first->real_part = second->real_part;
|
||||
first->dual_part = second->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualNumber* second)
|
||||
inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* const first, BGC_FP64_DualNumber* const second)
|
||||
{
|
||||
first->real_part = second->real_part;
|
||||
first->dual_part = second->dual_part;
|
||||
|
|
@ -64,39 +64,39 @@ inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualN
|
|||
|
||||
// ================== Modulus =================== //
|
||||
|
||||
inline double bgc_fp32_dual_number_get_modulus(const BGC_FP32_DualNumber* number)
|
||||
inline double bgc_fp32_dual_number_get_modulus(const BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
return fabsf(number->real_part);
|
||||
}
|
||||
|
||||
inline double bgc_fp64_dual_number_get_modulus(const BGC_FP64_DualNumber* number)
|
||||
inline double bgc_fp64_dual_number_get_modulus(const BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
return fabs(number->real_part);
|
||||
}
|
||||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_dual_number_convert_to_fp32(BGC_FP32_DualNumber* first, BGC_FP64_DualNumber* second)
|
||||
inline void bgc_fp64_dual_number_convert_to_fp32(BGC_FP32_DualNumber* const destination, const BGC_FP64_DualNumber* const source)
|
||||
{
|
||||
first->real_part = (float) second->real_part;
|
||||
first->dual_part = (float) second->dual_part;
|
||||
destination->real_part = (float) source->real_part;
|
||||
destination->dual_part = (float) source->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_dual_number_convert_to_fp64(BGC_FP64_DualNumber* first, BGC_FP32_DualNumber* second)
|
||||
inline void bgc_fp32_dual_number_convert_to_fp64(BGC_FP64_DualNumber* const destination, const BGC_FP32_DualNumber* const source)
|
||||
{
|
||||
first->real_part = second->real_part;
|
||||
first->dual_part = second->dual_part;
|
||||
destination->real_part = source->real_part;
|
||||
destination->dual_part = source->dual_part;
|
||||
}
|
||||
|
||||
// =================== Revert =================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* number)
|
||||
inline void bgc_fp32_dual_number_revert(BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
number->real_part = -number->real_part;
|
||||
number->dual_part = -number->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number)
|
||||
inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
number->real_part = -number->real_part;
|
||||
number->dual_part = -number->dual_part;
|
||||
|
|
@ -104,13 +104,13 @@ inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number)
|
|||
|
||||
// ================ Get Reverse ================= //
|
||||
|
||||
inline void bgc_fp32_dual_number_get_reverse(BGC_FP32_DualNumber* reverse, const BGC_FP32_DualNumber* number)
|
||||
inline void bgc_fp32_dual_number_get_reverse(BGC_FP32_DualNumber* const reverse, const BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
reverse->real_part = -number->real_part;
|
||||
reverse->dual_part = -number->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_get_reverse(BGC_FP64_DualNumber* reverse, const BGC_FP64_DualNumber* number)
|
||||
inline void bgc_fp64_dual_number_get_reverse(BGC_FP64_DualNumber* const reverse, const BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
reverse->real_part = -number->real_part;
|
||||
reverse->dual_part = -number->dual_part;
|
||||
|
|
@ -118,7 +118,7 @@ inline void bgc_fp64_dual_number_get_reverse(BGC_FP64_DualNumber* reverse, const
|
|||
|
||||
// =================== Invert =================== //
|
||||
|
||||
inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* number)
|
||||
inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
if (bgc_fp32_is_zero(number->real_part) || isnan(number->real_part)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -132,7 +132,7 @@ inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* number)
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* number)
|
||||
inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
if (bgc_fp64_is_zero(number->real_part) || isnan(number->real_part)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -148,7 +148,7 @@ inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* number)
|
|||
|
||||
// ================ Get Inverse ================= //
|
||||
|
||||
inline int bgc_fp32_dual_number_get_inverse(BGC_FP32_DualNumber* inverse, const BGC_FP32_DualNumber* number)
|
||||
inline int bgc_fp32_dual_number_get_inverse(BGC_FP32_DualNumber* const inverse, const BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
if (bgc_fp32_is_zero(number->real_part) || isnan(number->real_part)) {
|
||||
inverse->real_part = 0.0f;
|
||||
|
|
@ -164,7 +164,7 @@ inline int bgc_fp32_dual_number_get_inverse(BGC_FP32_DualNumber* inverse, const
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* inverse, const BGC_FP64_DualNumber* number)
|
||||
inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* const inverse, const BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
if (bgc_fp64_is_zero(number->real_part) || isnan(number->real_part)) {
|
||||
inverse->real_part = 0.0;
|
||||
|
|
@ -182,25 +182,25 @@ inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* inverse, const
|
|||
|
||||
// ================= Conjugate ================== //
|
||||
|
||||
inline void bgc_fp32_dual_number_conjugate(BGC_FP32_DualNumber* number)
|
||||
inline void bgc_fp32_dual_number_conjugate(BGC_FP32_DualNumber* const number)
|
||||
{
|
||||
number->dual_part = -number->dual_part;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_dual_number_conjugate(BGC_FP64_DualNumber* number)
|
||||
inline void bgc_fp64_dual_number_conjugate(BGC_FP64_DualNumber* const number)
|
||||
{
|
||||
number->dual_part = -number->dual_part;
|
||||
}
|
||||
|
||||
// =============== Get Conjugate ================ //
|
||||
|
||||