Добавление квалификатора const, который запрещает изменение указателя

This commit is contained in:
Andrey Pokidov 2026-03-23 18:55:33 +07:00
parent 51fafe50c8
commit 610756ffed
14 changed files with 1019 additions and 1039 deletions

View file

@ -1,101 +1,101 @@
#include "./complex.h" #include "./complex.h"
extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex); extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* const complex);
extern inline void bgc_fp64_complex_reset(BGC_FP64_Complex* 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_fp32_complex_make(BGC_FP32_Complex* const 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_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 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* 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 float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* const number);
extern inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* 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_fp32_complex_is_zero(const BGC_FP32_Complex* const number);
extern inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* 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_fp32_complex_is_unit(const BGC_FP32_Complex* const number);
extern inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* 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_fp32_complex_copy(BGC_FP32_Complex* const destination, const BGC_FP32_Complex* const source);
extern inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* 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_fp32_complex_swap(BGC_FP32_Complex* const number1, BGC_FP32_Complex* const number2);
extern inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* 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_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* destination, const BGC_FP32_Complex* 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_fp32_complex_revert(BGC_FP32_Complex* const number);
extern inline void bgc_fp64_complex_revert(BGC_FP64_Complex* 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_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* reverse, const BGC_FP64_Complex* 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_fp32_complex_normalize(BGC_FP32_Complex* const number);
extern inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* 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_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* normalized, const BGC_FP64_Complex* 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_fp32_complex_conjugate(BGC_FP32_Complex* const number);
extern inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* 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_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* conjugate, const BGC_FP64_Complex* 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_fp32_complex_invert(BGC_FP32_Complex* const number);
extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* 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_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* inverse, const BGC_FP64_Complex* 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_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* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* 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_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* sum, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double 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_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* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* 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_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* difference, const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double 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_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* product, const BGC_FP64_Complex* multiplicand, const double 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_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* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* 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_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* product, const BGC_FP64_Complex* multiplicand, const BGC_FP64_Complex* 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_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* quotient, const BGC_FP64_Complex* dividend, const double 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_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* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* 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_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* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* 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_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* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* 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_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* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* 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_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* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double 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_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* number1, const BGC_FP64_Complex* number2); extern inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* const number1, const BGC_FP64_Complex* const number2);
// =============== Get Exponation =============== // // =============== 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); 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); 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); const double square_modulus = bgc_fp64_complex_get_square_modulus(base);

View file

@ -9,13 +9,13 @@
// =================== Reset ==================== // // =================== 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->real = 0.0f;
complex->imaginary = 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->real = 0.0;
complex->imaginary = 0.0; complex->imaginary = 0.0;
@ -23,13 +23,13 @@ inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
// ==================== Set ===================== // // ==================== 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->real = real;
complex->imaginary = imaginary; 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->real = real;
complex->imaginary = imaginary; complex->imaginary = imaginary;
@ -37,57 +37,57 @@ inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real,
// ================== Modulus =================== // // ================== 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; 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; 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)); 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)); return sqrt(bgc_fp64_complex_get_square_modulus(number));
} }
// ================= Comparison ================= // // ================= 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; 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; 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)); 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)); return bgc_fp64_is_square_unit(bgc_fp64_complex_get_square_modulus(number));
} }
// ==================== Copy ==================== // // ==================== 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->real = source->real;
destination->imaginary = source->imaginary; 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->real = source->real;
destination->imaginary = source->imaginary; destination->imaginary = source->imaginary;
@ -95,7 +95,7 @@ inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_
// ==================== Swap ==================== // // ==================== 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 real = number2->real;
const float imaginary = number2->imaginary; 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; 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 real = number2->real;
const double imaginary = number2->imaginary; const double imaginary = number2->imaginary;
@ -121,13 +121,13 @@ inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* n
// ================== Convert =================== // // ================== 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->real = (float)source->real;
destination->imaginary = (float)source->imaginary; 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->real = source->real;
destination->imaginary = source->imaginary; destination->imaginary = source->imaginary;
@ -135,25 +135,25 @@ inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, cons
// ================== Negative ================== // // ================== 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->real = -number->real;
number->imaginary = -number->imaginary; 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->real = -number->real;
number->imaginary = -number->imaginary; 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->real = -number->real;
reverse->imaginary = -number->imaginary; 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->real = -number->real;
reverse->imaginary = -number->imaginary; reverse->imaginary = -number->imaginary;
@ -161,7 +161,7 @@ inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP
// ================= Normalize ================== // // ================= 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); 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; 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); 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; 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); 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; 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); 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 ================== // // ================= 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; 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; 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->real = number->real;
conjugate->imaginary = -number->imaginary; 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->real = number->real;
conjugate->imaginary = -number->imaginary; conjugate->imaginary = -number->imaginary;
@ -275,7 +275,7 @@ inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BG
// =================== Invert =================== // // =================== 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); 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; 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); 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; 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); 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); return bgc_fp64_complex_get_inverse(number, number);
} }
// ================= Get Power ================== // // ================= 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 ===================== // // ==================== 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->real = number1->real + number2->real;
sum->imaginary = number1->imaginary + number2->imaginary; 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->real = number1->real + number2->real;
sum->imaginary = number1->imaginary + number2->imaginary; 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 ================= // // ================= 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->real = basic_number->real + scalable_number->real * scale;
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * 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->real = basic_number->real + scalable_number->real * scale;
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * 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 ================== // // ================== 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->real = minuend->real - subtrahend->real;
difference->imaginary = minuend->imaginary - subtrahend->imaginary; 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->real = minuend->real - subtrahend->real;
difference->imaginary = minuend->imaginary - subtrahend->imaginary; 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 =============== // // ============== 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->real = basic_number->real - scalable_number->real * scale;
difference->imaginary = basic_number->imaginary - scalable_number->imaginary * 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->real = basic_number->real - scalable_number->real * scale;
difference->imaginary = basic_number->imaginary - scalable_number->imaginary * 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 =========== // // ========== 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->real = multiplicand->real * multiplier;
product->imaginary = multiplicand->imaginary * 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->real = multiplicand->real * multiplier;
product->imaginary = multiplicand->imaginary * 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 ========= // // ========= 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 real = multiplicand->real * multiplier->real - multiplicand->imaginary * multiplier->imaginary;
const float imaginary = multiplicand->real * multiplier->imaginary + multiplicand->imaginary * multiplier->real; 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; 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 real = multiplicand->real * multiplier->real - multiplicand->imaginary * multiplier->imaginary;
const double imaginary = multiplicand->real * multiplier->imaginary + multiplicand->imaginary * multiplier->real; 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 ======== // // ======== 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 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; 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; 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 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; 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 ============ // // =========== 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)) { if (bgc_fp32_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -446,7 +446,7 @@ inline int bgc_fp32_complex_divide_by_real(BGC_FP32_Complex* quotient, const BGC
return BGC_SUCCESS; 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)) { if (bgc_fp64_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE; 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 ========== // // ========== 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); 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; 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); 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 ========= // // ========= 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); 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; 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); 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 ================== // // ================== 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->real = (number1->real + number2->real) * 0.5f;
mean->imaginary = (number1->imaginary + number2->imaginary) * 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->real = (number1->real + number2->real) * 0.5;
mean->imaginary = (number1->imaginary + number2->imaginary) * 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 ================== // // ================== 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->real = (number1->real + number2->real + number3->real) * BGC_FP32_ONE_THIRD;
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * 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->real = (number1->real + number2->real + number3->real) * BGC_FP64_ONE_THIRD;
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * 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 =================== // // =================== 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; 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; 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; const double counter_phase = 1.0 - phase;
@ -565,7 +565,7 @@ inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const
// ================== Are Close ================= // // ================== 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_modulus1 = bgc_fp32_complex_get_square_modulus(number1);
const float square_modulus2 = bgc_fp32_complex_get_square_modulus(number2); 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; 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_modulus1 = bgc_fp64_complex_get_square_modulus(number1);
const double square_modulus2 = bgc_fp64_complex_get_square_modulus(number2); const double square_modulus2 = bgc_fp64_complex_get_square_modulus(number2);

View file

@ -1,73 +1,73 @@
#include "./dual-number.h" #include "./dual-number.h"
extern inline void bgc_fp32_dual_number_reset(BGC_FP32_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* 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_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* number, const double real_part, const double 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_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* destination, const BGC_FP64_DualNumber* 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_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* first, BGC_FP64_DualNumber* 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_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* first, BGC_FP32_DualNumber* second); 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_fp32_dual_number_revert(BGC_FP32_DualNumber* const number);
extern inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* 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_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* reverse, const BGC_FP64_DualNumber* 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_fp32_dual_number_invert(BGC_FP32_DualNumber* const number);
extern inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* 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_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* inverse, const BGC_FP64_DualNumber* 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_fp32_dual_number_conjugate(BGC_FP32_DualNumber* const number);
extern inline void bgc_fp64_dual_number_conjugate(BGC_FP64_DualNumber* 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_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* conjugate, const BGC_FP64_DualNumber* 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_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* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* 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_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* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double 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_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* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* 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_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* difference, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double 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_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* product, const BGC_FP64_DualNumber* multiplicand, const double 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_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* product, const BGC_FP64_DualNumber* multiplicand, const BGC_FP64_DualNumber* 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_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* product, const BGC_FP64_DualNumber* multiplicand, const BGC_FP64_DualNumber* 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_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* quotient, const BGC_FP64_DualNumber* dividend, const double 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_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* quotient, const BGC_FP64_DualNumber* dividend, const BGC_FP64_DualNumber* 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_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* quotient, const BGC_FP64_DualNumber* dividend, const BGC_FP64_DualNumber* 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_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* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* 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_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* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* 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_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* interpolation, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const double 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);

View file

@ -8,13 +8,13 @@
// =================== Reset ==================== // // =================== 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->real_part = 0.0f;
number->dual_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->real_part = 0.0;
number->dual_part = 0.0; number->dual_part = 0.0;
@ -22,13 +22,13 @@ inline void bgc_fp64_dual_number_reset(BGC_FP64_DualNumber* number)
// ==================== Make ==================== // // ==================== 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->real_part = real_part;
number->dual_part = dual_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->real_part = real_part;
number->dual_part = dual_part; number->dual_part = dual_part;
@ -36,13 +36,13 @@ inline void bgc_fp64_dual_number_make(BGC_FP64_DualNumber* number, const double
// ==================== Copy ==================== // // ==================== 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->real_part = source->real_part;
destination->dual_part = source->dual_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->real_part = source->real_part;
destination->dual_part = source->dual_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 ==================== // // ==================== 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->real_part = second->real_part;
first->dual_part = second->dual_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->real_part = second->real_part;
first->dual_part = second->dual_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 =================== // // ================== 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); 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); return fabs(number->real_part);
} }
// ================== Convert =================== // // ================== 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; destination->real_part = (float) source->real_part;
first->dual_part = (float) second->dual_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; destination->real_part = source->real_part;
first->dual_part = second->dual_part; destination->dual_part = source->dual_part;
} }
// =================== Revert =================== // // =================== 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->real_part = -number->real_part;
number->dual_part = -number->dual_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->real_part = -number->real_part;
number->dual_part = -number->dual_part; number->dual_part = -number->dual_part;
@ -104,13 +104,13 @@ inline void bgc_fp64_dual_number_revert(BGC_FP64_DualNumber* number)
// ================ Get Reverse ================= // // ================ 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->real_part = -number->real_part;
reverse->dual_part = -number->dual_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->real_part = -number->real_part;
reverse->dual_part = -number->dual_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 =================== // // =================== 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)) { if (bgc_fp32_is_zero(number->real_part) || isnan(number->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -132,7 +132,7 @@ inline int bgc_fp32_dual_number_invert(BGC_FP32_DualNumber* number)
return BGC_SUCCESS; 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)) { if (bgc_fp64_is_zero(number->real_part) || isnan(number->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -148,7 +148,7 @@ inline int bgc_fp64_dual_number_invert(BGC_FP64_DualNumber* number)
// ================ Get Inverse ================= // // ================ 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)) { if (bgc_fp32_is_zero(number->real_part) || isnan(number->real_part)) {
inverse->real_part = 0.0f; 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; 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)) { if (bgc_fp64_is_zero(number->real_part) || isnan(number->real_part)) {
inverse->real_part = 0.0; inverse->real_part = 0.0;
@ -182,25 +182,25 @@ inline int bgc_fp64_dual_number_get_inverse(BGC_FP64_DualNumber* inverse, const
// ================= Conjugate ================== // // ================= 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; 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; number->dual_part = -number->dual_part;
} }
// =============== Get Conjugate ================ // // =============== Get Conjugate ================ //
inline void bgc_fp32_dual_number_get_conjugate(BGC_FP32_DualNumber* conjugate, const BGC_FP32_DualNumber* number) inline void bgc_fp32_dual_number_get_conjugate(BGC_FP32_DualNumber* const conjugate, const BGC_FP32_DualNumber* const number)
{ {
conjugate->real_part = number->real_part; conjugate->real_part = number->real_part;
conjugate->dual_part = -number->dual_part; conjugate->dual_part = -number->dual_part;
} }
inline void bgc_fp64_dual_number_get_conjugate(BGC_FP64_DualNumber* conjugate, const BGC_FP64_DualNumber* number) inline void bgc_fp64_dual_number_get_conjugate(BGC_FP64_DualNumber* const conjugate, const BGC_FP64_DualNumber* const number)
{ {
conjugate->real_part = number->real_part; conjugate->real_part = number->real_part;
conjugate->dual_part = -number->dual_part; conjugate->dual_part = -number->dual_part;
@ -208,13 +208,13 @@ inline void bgc_fp64_dual_number_get_conjugate(BGC_FP64_DualNumber* conjugate, c
// ==================== Add ===================== // // ==================== Add ===================== //
inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second) inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* const sum, const BGC_FP32_DualNumber* const first, const BGC_FP32_DualNumber* const second)
{ {
sum->real_part = first->real_part + second->real_part; sum->real_part = first->real_part + second->real_part;
sum->dual_part = first->dual_part + second->dual_part; sum->dual_part = first->dual_part + second->dual_part;
} }
inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second) inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* const sum, const BGC_FP64_DualNumber* const first, const BGC_FP64_DualNumber* const second)
{ {
sum->real_part = first->real_part + second->real_part; sum->real_part = first->real_part + second->real_part;
sum->dual_part = first->dual_part + second->dual_part; sum->dual_part = first->dual_part + second->dual_part;
@ -222,13 +222,13 @@ inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_Du
// ================= Add Scaled ================= // // ================= Add Scaled ================= //
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) 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)
{ {
sum->real_part = base_number->real_part + scalable_number->real_part * scale; sum->real_part = base_number->real_part + scalable_number->real_part * scale;
sum->dual_part = base_number->dual_part + scalable_number->dual_part * scale; sum->dual_part = base_number->dual_part + scalable_number->dual_part * scale;
} }
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) 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)
{ {
sum->real_part = base_number->real_part + scalable_number->real_part * scale; sum->real_part = base_number->real_part + scalable_number->real_part * scale;
sum->dual_part = base_number->dual_part + scalable_number->dual_part * scale; sum->dual_part = base_number->dual_part + scalable_number->dual_part * scale;
@ -236,13 +236,13 @@ inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_
// ================== Subtract ================== // // ================== Subtract ================== //
inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend) inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* const difference, const BGC_FP32_DualNumber* const minuend, const BGC_FP32_DualNumber* const subtrahend)
{ {
difference->real_part = minuend->real_part - subtrahend->real_part; difference->real_part = minuend->real_part - subtrahend->real_part;
difference->dual_part = minuend->dual_part - subtrahend->dual_part; difference->dual_part = minuend->dual_part - subtrahend->dual_part;
} }
inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend) inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* const difference, const BGC_FP64_DualNumber* const minuend, const BGC_FP64_DualNumber* const subtrahend)
{ {
difference->real_part = minuend->real_part - subtrahend->real_part; difference->real_part = minuend->real_part - subtrahend->real_part;
difference->dual_part = minuend->dual_part - subtrahend->dual_part; difference->dual_part = minuend->dual_part - subtrahend->dual_part;
@ -250,13 +250,13 @@ inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const
// ============== Subtract Scaled =============== // // ============== Subtract Scaled =============== //
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) 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)
{ {
difference->real_part = base_number->real_part - scalable_number->real_part * scale; difference->real_part = base_number->real_part - scalable_number->real_part * scale;
difference->dual_part = base_number->dual_part - scalable_number->dual_part * scale; difference->dual_part = base_number->dual_part - scalable_number->dual_part * scale;
} }
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) 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)
{ {
difference->real_part = base_number->real_part - scalable_number->real_part * scale; difference->real_part = base_number->real_part - scalable_number->real_part * scale;
difference->dual_part = base_number->dual_part - scalable_number->dual_part * scale; difference->dual_part = base_number->dual_part - scalable_number->dual_part * scale;
@ -264,19 +264,19 @@ inline void bgc_fp64_dual_number_subtract_scaled(BGC_FP64_DualNumber* difference
// ================== Multiply ================== // // ================== Multiply ================== //
inline void bgc_fp32_dual_number_multiply_by_real(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier) inline void bgc_fp32_dual_number_multiply_by_real(BGC_FP32_DualNumber* const product, const BGC_FP32_DualNumber* const multiplicand, const float multiplier)
{ {
product->real_part = multiplicand->real_part * multiplier; product->real_part = multiplicand->real_part * multiplier;
product->dual_part = multiplicand->dual_part * multiplier; product->dual_part = multiplicand->dual_part * multiplier;
} }
inline void bgc_fp64_dual_number_multiply_by_real(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier) inline void bgc_fp64_dual_number_multiply_by_real(BGC_FP64_DualNumber* const product, const BGC_FP64_DualNumber* const multiplicand, const double multiplier)
{ {
product->real_part = multiplicand->real_part * multiplier; product->real_part = multiplicand->real_part * multiplier;
product->dual_part = multiplicand->dual_part * multiplier; product->dual_part = multiplicand->dual_part * multiplier;
} }
inline void bgc_fp32_dual_number_multiply_by_dual(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const BGC_FP32_DualNumber* multiplier) 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)
{ {
const float real_part = multiplicand->real_part * multiplier->real_part; const float real_part = multiplicand->real_part * multiplier->real_part;
const float dual_part = multiplicand->dual_part * multiplier->real_part + multiplicand->real_part * multiplier->dual_part; const float dual_part = multiplicand->dual_part * multiplier->real_part + multiplicand->real_part * multiplier->dual_part;
@ -285,7 +285,7 @@ inline void bgc_fp32_dual_number_multiply_by_dual(BGC_FP32_DualNumber* product,
product->dual_part = dual_part; product->dual_part = dual_part;
} }
inline void bgc_fp64_dual_number_multiply_by_dual(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const BGC_FP64_DualNumber* multiplier) 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)
{ {
const double real_part = multiplicand->real_part * multiplier->real_part; const double real_part = multiplicand->real_part * multiplier->real_part;
const double dual_part = multiplicand->dual_part * multiplier->real_part + multiplicand->real_part * multiplier->dual_part; const double dual_part = multiplicand->dual_part * multiplier->real_part + multiplicand->real_part * multiplier->dual_part;
@ -294,7 +294,7 @@ inline void bgc_fp64_dual_number_multiply_by_dual(BGC_FP64_DualNumber* product,
product->dual_part = dual_part; product->dual_part = dual_part;
} }
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) 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)
{ {
const float real_part = multiplicand->real_part * multiplier_to_conjugate->real_part; const float real_part = multiplicand->real_part * multiplier_to_conjugate->real_part;
const float dual_part = multiplicand->dual_part * multiplier_to_conjugate->real_part - multiplicand->real_part * multiplier_to_conjugate->dual_part; const float dual_part = multiplicand->dual_part * multiplier_to_conjugate->real_part - multiplicand->real_part * multiplier_to_conjugate->dual_part;
@ -303,7 +303,7 @@ inline void bgc_fp32_dual_number_multiply_by_conjugate(BGC_FP32_DualNumber* prod
product->dual_part = dual_part; product->dual_part = dual_part;
} }
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) 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)
{ {
const double real_part = multiplicand->real_part * multiplier_to_conjugate->real_part; const double real_part = multiplicand->real_part * multiplier_to_conjugate->real_part;
const double dual_part = multiplicand->dual_part * multiplier_to_conjugate->real_part - multiplicand->real_part * multiplier_to_conjugate->dual_part; const double dual_part = multiplicand->dual_part * multiplier_to_conjugate->real_part - multiplicand->real_part * multiplier_to_conjugate->dual_part;
@ -313,7 +313,7 @@ inline void bgc_fp64_dual_number_multiply_by_conjugate(BGC_FP64_DualNumber* prod
} }
// =================== Divide =================== // // =================== Divide =================== //
inline int bgc_fp32_dual_number_divide_by_real(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor) inline int bgc_fp32_dual_number_divide_by_real(BGC_FP32_DualNumber* const quotient, const BGC_FP32_DualNumber* const dividend, const float divisor)
{ {
if (bgc_fp32_is_zero(divisor) || isnan(divisor)) { if (bgc_fp32_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -323,7 +323,7 @@ inline int bgc_fp32_dual_number_divide_by_real(BGC_FP32_DualNumber* quotient, co
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_number_divide_by_real(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor) inline int bgc_fp64_dual_number_divide_by_real(BGC_FP64_DualNumber* const quotient, const BGC_FP64_DualNumber* const dividend, const double divisor)
{ {
if (bgc_fp64_is_zero(divisor) || isnan(divisor)) { if (bgc_fp64_is_zero(divisor) || isnan(divisor)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -333,7 +333,7 @@ inline int bgc_fp64_dual_number_divide_by_real(BGC_FP64_DualNumber* quotient, co
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp32_dual_number_divide_by_dual(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const BGC_FP32_DualNumber* divisor) 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)
{ {
if (bgc_fp32_is_zero(divisor->real_part)) { if (bgc_fp32_is_zero(divisor->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -350,7 +350,7 @@ inline int bgc_fp32_dual_number_divide_by_dual(BGC_FP32_DualNumber* quotient, co
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_number_divide_by_dual(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const BGC_FP64_DualNumber* divisor) 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)
{ {
if (bgc_fp64_is_zero(divisor->real_part)) { if (bgc_fp64_is_zero(divisor->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -367,7 +367,7 @@ inline int bgc_fp64_dual_number_divide_by_dual(BGC_FP64_DualNumber* quotient, co
return BGC_SUCCESS; return BGC_SUCCESS;
} }
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) 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)
{ {
if (bgc_fp32_is_zero(divisor_to_conjugate->real_part)) { if (bgc_fp32_is_zero(divisor_to_conjugate->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -384,7 +384,7 @@ inline int bgc_fp32_dual_number_divide_by_conjugate(BGC_FP32_DualNumber* quotien
return BGC_SUCCESS; return BGC_SUCCESS;
} }
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) 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)
{ {
if (bgc_fp64_is_zero(divisor_to_conjugate->real_part)) { if (bgc_fp64_is_zero(divisor_to_conjugate->real_part)) {
return BGC_FAILURE; return BGC_FAILURE;
@ -403,13 +403,13 @@ inline int bgc_fp64_dual_number_divide_by_conjugate(BGC_FP64_DualNumber* quotien
// ================ Mean of Two ================= // // ================ Mean of Two ================= //
inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second) 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)
{ {
mean->real_part = (first->real_part + second->real_part) * 0.5f; mean->real_part = (first->real_part + second->real_part) * 0.5f;
mean->dual_part = (first->dual_part + second->dual_part) * 0.5f; mean->dual_part = (first->dual_part + second->dual_part) * 0.5f;
} }
inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second) 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)
{ {
mean->real_part = (first->real_part + second->real_part) * 0.5; mean->real_part = (first->real_part + second->real_part) * 0.5;
mean->dual_part = (first->dual_part + second->dual_part) * 0.5; mean->dual_part = (first->dual_part + second->dual_part) * 0.5;
@ -417,13 +417,13 @@ inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_
// =============== Mean of Three ================ // // =============== Mean of Three ================ //
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) 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)
{ {
mean->real_part = (first->real_part + second->real_part + third->real_part) * BGC_FP32_ONE_THIRD; mean->real_part = (first->real_part + second->real_part + third->real_part) * BGC_FP32_ONE_THIRD;
mean->dual_part = (first->dual_part + second->dual_part + third->dual_part) * BGC_FP32_ONE_THIRD; mean->dual_part = (first->dual_part + second->dual_part + third->dual_part) * BGC_FP32_ONE_THIRD;
} }
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) 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)
{ {
mean->real_part = (first->real_part + second->real_part + third->real_part) * BGC_FP64_ONE_THIRD; mean->real_part = (first->real_part + second->real_part + third->real_part) * BGC_FP64_ONE_THIRD;
mean->dual_part = (first->dual_part + second->dual_part + third->dual_part) * BGC_FP64_ONE_THIRD; mean->dual_part = (first->dual_part + second->dual_part + third->dual_part) * BGC_FP64_ONE_THIRD;
@ -431,7 +431,7 @@ inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_
// ============ Linear Interpolation ============ // // ============ Linear Interpolation ============ //
inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* interpolation, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const float phase) 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)
{ {
const float counter_phase = 1.0f - phase; const float counter_phase = 1.0f - phase;
@ -439,7 +439,7 @@ inline void bgc_fp32_dual_number_interpolate(BGC_FP32_DualNumber* interpolation,
interpolation->dual_part = first->dual_part * counter_phase + second->dual_part * phase; interpolation->dual_part = first->dual_part * counter_phase + second->dual_part * phase;
} }
inline void bgc_fp64_dual_number_interpolate(BGC_FP64_DualNumber* interpolation, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const double phase) 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)
{ {
const double counter_phase = 1.0 - phase; const double counter_phase = 1.0 - phase;

View file

@ -1,103 +1,103 @@
#include "./dual-quaternion.h" #include "./dual-quaternion.h"
extern inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source); extern inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* const destination, const BGC_FP32_DualQuaternion* const source);
extern inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source); extern inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* const destination, const BGC_FP64_DualQuaternion* const source);
extern inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* first, BGC_FP32_DualQuaternion* second); extern inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* const first, BGC_FP32_DualQuaternion* const second);
extern inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP64_DualQuaternion* second); extern inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* const first, BGC_FP64_DualQuaternion* const second);
extern inline void bgc_fp32_dual_quaternion_convert_to_fp64(BGC_FP64_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source); extern inline void bgc_fp32_dual_quaternion_convert_to_fp64(BGC_FP64_DualQuaternion* const destination, const BGC_FP32_DualQuaternion* const source);
extern inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source); extern inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuaternion* const destination, const BGC_FP64_DualQuaternion* const source);
extern inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* reverse, const BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* const reverse, const BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* reverse, const BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* const reverse, const BGC_FP64_DualQuaternion* const quaternion);
extern inline int bgc_fp32_dual_quaternion_invert(BGC_FP32_DualQuaternion* quaternion); extern inline int bgc_fp32_dual_quaternion_invert(BGC_FP32_DualQuaternion* const quaternion);
extern inline int bgc_fp64_dual_quaternion_invert(BGC_FP64_DualQuaternion* quaternion); extern inline int bgc_fp64_dual_quaternion_invert(BGC_FP64_DualQuaternion* const quaternion);
extern inline int bgc_fp32_dual_quaternion_get_inverse(BGC_FP32_DualQuaternion* inverse, const BGC_FP32_DualQuaternion* quaternion); extern inline int bgc_fp32_dual_quaternion_get_inverse(BGC_FP32_DualQuaternion* const inverse, const BGC_FP32_DualQuaternion* const quaternion);
extern inline int bgc_fp64_dual_quaternion_get_inverse(BGC_FP64_DualQuaternion* inverse, const BGC_FP64_DualQuaternion* quaternion); extern inline int bgc_fp64_dual_quaternion_get_inverse(BGC_FP64_DualQuaternion* const inverse, const BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_component_conjugate(BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_component_conjugate(BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_component_conjugate(BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_component_conjugate(BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_get_component_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_get_component_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_get_component_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_get_component_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_dual_conjugate(BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_dual_conjugate(BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_dual_conjugate(BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_dual_conjugate(BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_get_dual_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_get_dual_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_get_dual_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_get_dual_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_fully_conjugate(BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_fully_conjugate(BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_fully_conjugate(BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_fully_conjugate(BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_get_fully_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion); extern inline void bgc_fp32_dual_quaternion_get_fully_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion);
extern inline void bgc_fp64_dual_quaternion_get_fully_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion); extern inline void bgc_fp64_dual_quaternion_get_fully_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion);
extern inline int bgc_fp32_dual_quaternion_normalize(BGC_FP32_DualQuaternion* quaternion); extern inline int bgc_fp32_dual_quaternion_normalize(BGC_FP32_DualQuaternion* const quaternion);
extern inline int bgc_fp64_dual_quaternion_normalize(BGC_FP64_DualQuaternion* quaternion); extern inline int bgc_fp64_dual_quaternion_normalize(BGC_FP64_DualQuaternion* const quaternion);
extern inline int bgc_fp32_dual_quaternion_get_normalized(BGC_FP32_DualQuaternion* normalized, const BGC_FP32_DualQuaternion* quaternion); extern inline int bgc_fp32_dual_quaternion_get_normalized(BGC_FP32_DualQuaternion* const normalized, const BGC_FP32_DualQuaternion* const quaternion);
extern inline int bgc_fp64_dual_quaternion_get_normalized(BGC_FP64_DualQuaternion* normalized, const BGC_FP64_DualQuaternion* quaternion); extern inline int bgc_fp64_dual_quaternion_get_normalized(BGC_FP64_DualQuaternion* const normalized, const BGC_FP64_DualQuaternion* const quaternion);
extern inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second); extern inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* const sum, const BGC_FP32_DualQuaternion* const first, const BGC_FP32_DualQuaternion* const second);
extern inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second); extern inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* const sum, const BGC_FP64_DualQuaternion* const first, const BGC_FP64_DualQuaternion* const second);
extern inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale); extern inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* const sum, const BGC_FP32_DualQuaternion* const base_quaternion, const BGC_FP32_DualQuaternion* const scalable_quaternion, const float scale);
extern inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale); extern inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* const sum, const BGC_FP64_DualQuaternion* const base_quaternion, const BGC_FP64_DualQuaternion* const scalable_quaternion, const double scale);
extern inline void bgc_fp32_dual_quaternion_subtract(BGC_FP32_DualQuaternion* difference, const BGC_FP32_DualQuaternion* minuend, const BGC_FP32_DualQuaternion* subtrahend); extern inline void bgc_fp32_dual_quaternion_subtract(BGC_FP32_DualQuaternion* const difference, const BGC_FP32_DualQuaternion* const minuend, const BGC_FP32_DualQuaternion* const subtrahend);
extern inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* difference, const BGC_FP64_DualQuaternion* minuend, const BGC_FP64_DualQuaternion* subtrahend); extern inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* const difference, const BGC_FP64_DualQuaternion* const minuend, const BGC_FP64_DualQuaternion* const subtrahend);
extern inline void bgc_fp32_dual_quaternion_subtract_scaled(BGC_FP32_DualQuaternion* difference, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale); extern inline void bgc_fp32_dual_quaternion_subtract_scaled(BGC_FP32_DualQuaternion* const difference, const BGC_FP32_DualQuaternion* const base_quaternion, const BGC_FP32_DualQuaternion* const scalable_quaternion, const float scale);
extern inline void bgc_fp64_dual_quaternion_subtract_scaled(BGC_FP64_DualQuaternion* difference, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale); extern inline void bgc_fp64_dual_quaternion_subtract_scaled(BGC_FP64_DualQuaternion* const difference, const BGC_FP64_DualQuaternion* const base_quaternion, const BGC_FP64_DualQuaternion* const scalable_quaternion, const double scale);
extern inline void bgc_fp32_dual_quaternion_multiply_by_real_number(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const float multiplier); extern inline void bgc_fp32_dual_quaternion_multiply_by_real_number(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const float multiplier);
extern inline void bgc_fp64_dual_quaternion_multiply_by_real_number(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const double multiplier); extern inline void bgc_fp64_dual_quaternion_multiply_by_real_number(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const double multiplier);
extern inline void bgc_fp32_dual_quaternion_multiply_by_dual_number(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const BGC_FP32_DualNumber* multiplier); extern inline void bgc_fp32_dual_quaternion_multiply_by_dual_number(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const BGC_FP32_DualNumber* const multiplier);
extern inline void bgc_fp64_dual_quaternion_multiply_by_dual_number(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const BGC_FP64_DualNumber* multiplier); extern inline void bgc_fp64_dual_quaternion_multiply_by_dual_number(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const BGC_FP64_DualNumber* const multiplier);
extern inline void bgc_fp32_dual_quaternion_multiply_by_conjugate_dual_number(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const BGC_FP32_DualNumber* multiplier_to_conjugate); extern inline void bgc_fp32_dual_quaternion_multiply_by_conjugate_dual_number(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const BGC_FP32_DualNumber* const multiplier_to_conjugate);
extern inline void bgc_fp64_dual_quaternion_multiply_by_conjugate_dual_number(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const BGC_FP64_DualNumber* multiplier_to_conjugate); extern inline void bgc_fp64_dual_quaternion_multiply_by_conjugate_dual_number(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const BGC_FP64_DualNumber* const multiplier_to_conjugate);
extern inline void bgc_fp32_dual_quaternion_multiply_by_quaternion(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const BGC_FP32_Quaternion* multiplier); extern inline void bgc_fp32_dual_quaternion_multiply_by_quaternion(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const BGC_FP32_Quaternion* const multiplier);
extern inline void bgc_fp64_dual_quaternion_multiply_by_quaternion(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const BGC_FP64_Quaternion* multiplier); extern inline void bgc_fp64_dual_quaternion_multiply_by_quaternion(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const BGC_FP64_Quaternion* const multiplier);
extern inline void bgc_fp32_dual_quaternion_multiply_by_conjugate_quaternion(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const BGC_FP32_Quaternion* multiplier_to_conjugate); extern inline void bgc_fp32_dual_quaternion_multiply_by_conjugate_quaternion(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const BGC_FP32_Quaternion* const multiplier_to_conjugate);
extern inline void bgc_fp64_dual_quaternion_multiply_by_conjugate_quaternion(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const BGC_FP64_Quaternion* multiplier_to_conjugate); extern inline void bgc_fp64_dual_quaternion_multiply_by_conjugate_quaternion(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const BGC_FP64_Quaternion* const multiplier_to_conjugate);
extern inline void bgc_fp32_dual_quaternion_multiply_by_dual_quaternion(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* left, const BGC_FP32_DualQuaternion* right); extern inline void bgc_fp32_dual_quaternion_multiply_by_dual_quaternion(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const left, const BGC_FP32_DualQuaternion* const right);
extern inline void bgc_fp64_dual_quaternion_multiply_by_dual_quaternion(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* left, const BGC_FP64_DualQuaternion* right); extern inline void bgc_fp64_dual_quaternion_multiply_by_dual_quaternion(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const left, const BGC_FP64_DualQuaternion* const right);
extern inline int bgc_fp32_dual_quaternion_divide_by_real_number(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* divident, const float divisor); extern inline int bgc_fp32_dual_quaternion_divide_by_real_number(BGC_FP32_DualQuaternion* const quotient, const BGC_FP32_DualQuaternion* const divident, const float divisor);
extern inline int bgc_fp64_dual_quaternion_divide_by_real_number(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* divident, const double divisor); extern inline int bgc_fp64_dual_quaternion_divide_by_real_number(BGC_FP64_DualQuaternion* const quotient, const BGC_FP64_DualQuaternion* const divident, const double divisor);
extern inline int bgc_fp32_dual_quaternion_divide_by_dual_number(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* dividend, const BGC_FP32_DualNumber* divisor); extern inline int bgc_fp32_dual_quaternion_divide_by_dual_number(BGC_FP32_DualQuaternion* const quotient, const BGC_FP32_DualQuaternion* const dividend, const BGC_FP32_DualNumber* const divisor);
extern inline int bgc_fp64_dual_quaternion_divide_by_dual_number(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* dividend, const BGC_FP64_DualNumber* divisor); extern inline int bgc_fp64_dual_quaternion_divide_by_dual_number(BGC_FP64_DualQuaternion* const quotient, const BGC_FP64_DualQuaternion* const dividend, const BGC_FP64_DualNumber* const divisor);
extern inline int bgc_fp32_dual_quaternion_divide_by_conjugate_dual_number(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* dividend, const BGC_FP32_DualNumber* divisor_to_conjugate); extern inline int bgc_fp32_dual_quaternion_divide_by_conjugate_dual_number(BGC_FP32_DualQuaternion* const quotient, const BGC_FP32_DualQuaternion* const dividend, const BGC_FP32_DualNumber* const divisor_to_conjugate);
extern inline int bgc_fp64_dual_quaternion_divide_by_conjugate_dual_number(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* dividend, const BGC_FP64_DualNumber* divisor_to_conjugate); extern inline int bgc_fp64_dual_quaternion_divide_by_conjugate_dual_number(BGC_FP64_DualQuaternion* const quotient, const BGC_FP64_DualQuaternion* const dividend, const BGC_FP64_DualNumber* const divisor_to_conjugate);
extern inline int bgc_fp32_dual_quaternion_divide_by_quaternion(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* dividend, const BGC_FP32_Quaternion* divisor); extern inline int bgc_fp32_dual_quaternion_divide_by_quaternion(BGC_FP32_DualQuaternion* const quotient, const BGC_FP32_DualQuaternion* const dividend, const BGC_FP32_Quaternion* const divisor);
extern inline int bgc_fp64_dual_quaternion_divide_by_quaternion(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* dividend, const BGC_FP64_Quaternion* divisor); extern inline int bgc_fp64_dual_quaternion_divide_by_quaternion(BGC_FP64_DualQuaternion* const quotient, const BGC_FP64_DualQuaternion* const dividend, const BGC_FP64_Quaternion* const divisor);
extern inline int bgc_fp32_dual_quaternion_divide_by_conjugate_quaternion(BGC_FP32_DualQuaternion* quotient, const BGC_FP32_DualQuaternion* dividend, const BGC_FP32_Quaternion* divisor_to_conjugate); extern inline int bgc_fp32_dual_quaternion_divide_by_conjugate_quaternion(BGC_FP32_DualQuaternion* const quotient, const BGC_FP32_DualQuaternion* const dividend, const BGC_FP32_Quaternion* const divisor_to_conjugate);
extern inline int bgc_fp64_dual_quaternion_divide_by_conjugate_quaternion(BGC_FP64_DualQuaternion* quotient, const BGC_FP64_DualQuaternion* dividend, const BGC_FP64_Quaternion* divisor_to_conjugate); extern inline int bgc_fp64_dual_quaternion_divide_by_conjugate_quaternion(BGC_FP64_DualQuaternion* const quotient, const BGC_FP64_DualQuaternion* const dividend, const BGC_FP64_Quaternion* const divisor_to_conjugate);
extern inline void bgc_fp32_dual_quaternion_get_mean2(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2); extern inline void bgc_fp32_dual_quaternion_get_mean2(BGC_FP32_DualQuaternion* const mean, const BGC_FP32_DualQuaternion* const quaternion1, const BGC_FP32_DualQuaternion* const quaternion2);
extern inline void bgc_fp64_dual_quaternion_get_mean2(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2); extern inline void bgc_fp64_dual_quaternion_get_mean2(BGC_FP64_DualQuaternion* const mean, const BGC_FP64_DualQuaternion* const quaternion1, const BGC_FP64_DualQuaternion* const quaternion2);
extern inline void bgc_fp32_dual_quaternion_get_mean3(BGC_FP32_DualQuaternion* mean, const BGC_FP32_DualQuaternion* quaternion1, const BGC_FP32_DualQuaternion* quaternion2, const BGC_FP32_DualQuaternion* quaternion3); extern inline void bgc_fp32_dual_quaternion_get_mean3(BGC_FP32_DualQuaternion* const mean, const BGC_FP32_DualQuaternion* const quaternion1, const BGC_FP32_DualQuaternion* const quaternion2, const BGC_FP32_DualQuaternion* const quaternion3);
extern inline void bgc_fp64_dual_quaternion_get_mean3(BGC_FP64_DualQuaternion* mean, const BGC_FP64_DualQuaternion* quaternion1, const BGC_FP64_DualQuaternion* quaternion2, const BGC_FP64_DualQuaternion* quaternion3); extern inline void bgc_fp64_dual_quaternion_get_mean3(BGC_FP64_DualQuaternion* const mean, const BGC_FP64_DualQuaternion* const quaternion1, const BGC_FP64_DualQuaternion* const quaternion2, const BGC_FP64_DualQuaternion* const quaternion3);
extern inline void bgc_fp32_dual_quaternion_interpolate(BGC_FP32_DualQuaternion* interpolation, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second, const float phase); extern inline void bgc_fp32_dual_quaternion_interpolate(BGC_FP32_DualQuaternion* const interpolation, const BGC_FP32_DualQuaternion* const first, const BGC_FP32_DualQuaternion* const second, const float phase);
extern inline void bgc_fp64_dual_quaternion_interpolate(BGC_FP64_DualQuaternion* interpolation, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second, const double phase); extern inline void bgc_fp64_dual_quaternion_interpolate(BGC_FP64_DualQuaternion* const interpolation, const BGC_FP64_DualQuaternion* const first, const BGC_FP64_DualQuaternion* const second, const double phase);

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -6,13 +6,13 @@
// =================== Reset ==================== // // =================== Reset ==================== //
inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_reset(&quaternion->real_part); bgc_fp32_quaternion_reset(&quaternion->real_part);
bgc_fp32_quaternion_reset(&quaternion->dual_part); bgc_fp32_quaternion_reset(&quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_reset(&quaternion->real_part); bgc_fp64_quaternion_reset(&quaternion->real_part);
bgc_fp64_quaternion_reset(&quaternion->dual_part); bgc_fp64_quaternion_reset(&quaternion->dual_part);
@ -20,13 +20,13 @@ inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion)
// ==================== Copy ==================== // // ==================== Copy ==================== //
inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source) inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* const destination, const BGC_FP32_DualQuaternion* const source)
{ {
bgc_fp32_quaternion_copy(&destination->real_part, &source->real_part); bgc_fp32_quaternion_copy(&destination->real_part, &source->real_part);
bgc_fp32_quaternion_copy(&destination->dual_part, &source->dual_part); bgc_fp32_quaternion_copy(&destination->dual_part, &source->dual_part);
} }
inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source) inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* const destination, const BGC_FP64_DualQuaternion* const source)
{ {
bgc_fp64_quaternion_copy(&destination->real_part, &source->real_part); bgc_fp64_quaternion_copy(&destination->real_part, &source->real_part);
bgc_fp64_quaternion_copy(&destination->dual_part, &source->dual_part); bgc_fp64_quaternion_copy(&destination->dual_part, &source->dual_part);
@ -34,13 +34,13 @@ inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination,
// ==================== Swap ==================== // // ==================== Swap ==================== //
inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* first, BGC_FP32_DualQuaternion* second) inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* const first, BGC_FP32_DualQuaternion* const second)
{ {
bgc_fp32_quaternion_swap(&first->real_part, &second->real_part); bgc_fp32_quaternion_swap(&first->real_part, &second->real_part);
bgc_fp32_quaternion_swap(&first->dual_part, &second->dual_part); bgc_fp32_quaternion_swap(&first->dual_part, &second->dual_part);
} }
inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP64_DualQuaternion* second) inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* const first, BGC_FP64_DualQuaternion* const second)
{ {
bgc_fp64_quaternion_swap(&first->real_part, &second->real_part); bgc_fp64_quaternion_swap(&first->real_part, &second->real_part);
bgc_fp64_quaternion_swap(&first->dual_part, &second->dual_part); bgc_fp64_quaternion_swap(&first->dual_part, &second->dual_part);
@ -48,13 +48,13 @@ inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP
// ================== Convert =================== // // ================== Convert =================== //
inline void bgc_fp32_dual_quaternion_convert_to_fp64(BGC_FP64_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source) inline void bgc_fp32_dual_quaternion_convert_to_fp64(BGC_FP64_DualQuaternion* const destination, const BGC_FP32_DualQuaternion* const source)
{ {
bgc_fp32_quaternion_convert_to_fp64(&destination->real_part, &source->real_part); bgc_fp32_quaternion_convert_to_fp64(&destination->real_part, &source->real_part);
bgc_fp32_quaternion_convert_to_fp64(&destination->dual_part, &source->dual_part); bgc_fp32_quaternion_convert_to_fp64(&destination->dual_part, &source->dual_part);
} }
inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source) inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuaternion* const destination, const BGC_FP64_DualQuaternion* const source)
{ {
bgc_fp64_quaternion_convert_to_fp32(&destination->real_part, &source->real_part); bgc_fp64_quaternion_convert_to_fp32(&destination->real_part, &source->real_part);
bgc_fp64_quaternion_convert_to_fp32(&destination->dual_part, &source->dual_part); bgc_fp64_quaternion_convert_to_fp32(&destination->dual_part, &source->dual_part);
@ -62,13 +62,13 @@ inline void bgc_fp64_dual_quaternion_convert_to_fp32(BGC_FP32_DualQuaternion* de
// =================== Revert =================== // // =================== Revert =================== //
inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_revert(BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_revert(&quaternion->real_part); bgc_fp32_quaternion_revert(&quaternion->real_part);
bgc_fp32_quaternion_revert(&quaternion->dual_part); bgc_fp32_quaternion_revert(&quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_revert(&quaternion->real_part); bgc_fp64_quaternion_revert(&quaternion->real_part);
bgc_fp64_quaternion_revert(&quaternion->dual_part); bgc_fp64_quaternion_revert(&quaternion->dual_part);
@ -76,13 +76,13 @@ inline void bgc_fp64_dual_quaternion_revert(BGC_FP64_DualQuaternion* quaternion)
// ================ Get Reverse ================= // // ================ Get Reverse ================= //
inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* reverse, const BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_get_reverse(BGC_FP32_DualQuaternion* const reverse, const BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_get_reverse(&reverse->real_part, &quaternion->real_part); bgc_fp32_quaternion_get_reverse(&reverse->real_part, &quaternion->real_part);
bgc_fp32_quaternion_get_reverse(&reverse->dual_part, &quaternion->dual_part); bgc_fp32_quaternion_get_reverse(&reverse->dual_part, &quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* reverse, const BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* const reverse, const BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_get_reverse(&reverse->real_part, &quaternion->real_part); bgc_fp64_quaternion_get_reverse(&reverse->real_part, &quaternion->real_part);
bgc_fp64_quaternion_get_reverse(&reverse->dual_part, &quaternion->dual_part); bgc_fp64_quaternion_get_reverse(&reverse->dual_part, &quaternion->dual_part);
@ -90,7 +90,7 @@ inline void bgc_fp64_dual_quaternion_get_reverse(BGC_FP64_DualQuaternion* revers
// =================== Invert =================== // // =================== Invert =================== //
inline int bgc_fp32_dual_quaternion_invert(BGC_FP32_DualQuaternion* quaternion) inline int bgc_fp32_dual_quaternion_invert(BGC_FP32_DualQuaternion* const quaternion)
{ {
if (bgc_fp32_quaternion_get_inverse(&quaternion->real_part, &quaternion->real_part) != BGC_SUCCESS) { if (bgc_fp32_quaternion_get_inverse(&quaternion->real_part, &quaternion->real_part) != BGC_SUCCESS) {
return BGC_FAILURE; return BGC_FAILURE;
@ -106,7 +106,7 @@ inline int bgc_fp32_dual_quaternion_invert(BGC_FP32_DualQuaternion* quaternion)
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_quaternion_invert(BGC_FP64_DualQuaternion* quaternion) inline int bgc_fp64_dual_quaternion_invert(BGC_FP64_DualQuaternion* const quaternion)
{ {
if (bgc_fp64_quaternion_get_inverse(&quaternion->real_part, &quaternion->real_part) != BGC_SUCCESS) { if (bgc_fp64_quaternion_get_inverse(&quaternion->real_part, &quaternion->real_part) != BGC_SUCCESS) {
return BGC_FAILURE; return BGC_FAILURE;
@ -124,7 +124,7 @@ inline int bgc_fp64_dual_quaternion_invert(BGC_FP64_DualQuaternion* quaternion)
// ================ Get Inverse ================= // // ================ Get Inverse ================= //
inline int bgc_fp32_dual_quaternion_get_inverse(BGC_FP32_DualQuaternion* inverse, const BGC_FP32_DualQuaternion* quaternion) inline int bgc_fp32_dual_quaternion_get_inverse(BGC_FP32_DualQuaternion* const inverse, const BGC_FP32_DualQuaternion* const quaternion)
{ {
if (bgc_fp32_quaternion_get_inverse(&inverse->real_part, &quaternion->real_part) != BGC_SUCCESS) { if (bgc_fp32_quaternion_get_inverse(&inverse->real_part, &quaternion->real_part) != BGC_SUCCESS) {
return BGC_FAILURE; return BGC_FAILURE;
@ -140,7 +140,7 @@ inline int bgc_fp32_dual_quaternion_get_inverse(BGC_FP32_DualQuaternion* inverse
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_quaternion_get_inverse(BGC_FP64_DualQuaternion* inverse, const BGC_FP64_DualQuaternion* quaternion) inline int bgc_fp64_dual_quaternion_get_inverse(BGC_FP64_DualQuaternion* const inverse, const BGC_FP64_DualQuaternion* const quaternion)
{ {
if (bgc_fp64_quaternion_get_inverse(&inverse->real_part, &quaternion->real_part) != BGC_SUCCESS) { if (bgc_fp64_quaternion_get_inverse(&inverse->real_part, &quaternion->real_part) != BGC_SUCCESS) {
return BGC_FAILURE; return BGC_FAILURE;
@ -158,13 +158,13 @@ inline int bgc_fp64_dual_quaternion_get_inverse(BGC_FP64_DualQuaternion* inverse
// ============ Component Conjugate ============= // // ============ Component Conjugate ============= //
inline void bgc_fp32_dual_quaternion_component_conjugate(BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_component_conjugate(BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_conjugate(&quaternion->real_part); bgc_fp32_quaternion_conjugate(&quaternion->real_part);
bgc_fp32_quaternion_conjugate(&quaternion->dual_part); bgc_fp32_quaternion_conjugate(&quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_component_conjugate(BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_component_conjugate(BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_conjugate(&quaternion->real_part); bgc_fp64_quaternion_conjugate(&quaternion->real_part);
bgc_fp64_quaternion_conjugate(&quaternion->dual_part); bgc_fp64_quaternion_conjugate(&quaternion->dual_part);
@ -172,13 +172,13 @@ inline void bgc_fp64_dual_quaternion_component_conjugate(BGC_FP64_DualQuaternion
// ========== Get Component Conjugate =========== // // ========== Get Component Conjugate =========== //
inline void bgc_fp32_dual_quaternion_get_component_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_get_component_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_get_conjugate(&conjugate->real_part, &quaternion->real_part); bgc_fp32_quaternion_get_conjugate(&conjugate->real_part, &quaternion->real_part);
bgc_fp32_quaternion_get_conjugate(&conjugate->dual_part, &quaternion->dual_part); bgc_fp32_quaternion_get_conjugate(&conjugate->dual_part, &quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_get_component_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_get_component_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_get_conjugate(&conjugate->real_part, &quaternion->real_part); bgc_fp64_quaternion_get_conjugate(&conjugate->real_part, &quaternion->real_part);
bgc_fp64_quaternion_get_conjugate(&conjugate->dual_part, &quaternion->dual_part); bgc_fp64_quaternion_get_conjugate(&conjugate->dual_part, &quaternion->dual_part);
@ -186,25 +186,25 @@ inline void bgc_fp64_dual_quaternion_get_component_conjugate(BGC_FP64_DualQuater
// =============== Dual Conjugate =============== // // =============== Dual Conjugate =============== //
inline void bgc_fp32_dual_quaternion_dual_conjugate(BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_dual_conjugate(BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_revert(&quaternion->dual_part); bgc_fp32_quaternion_revert(&quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_dual_conjugate(BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_dual_conjugate(BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_revert(&quaternion->dual_part); bgc_fp64_quaternion_revert(&quaternion->dual_part);
} }
// ============= Get Dual Conjugate ============= // // ============= Get Dual Conjugate ============= //
inline void bgc_fp32_dual_quaternion_get_dual_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_get_dual_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion)
{ {
bgc_fp32_quaternion_copy(&conjugate->real_part, &quaternion->real_part); bgc_fp32_quaternion_copy(&conjugate->real_part, &quaternion->real_part);
bgc_fp32_quaternion_get_reverse(&conjugate->real_part, &quaternion->dual_part); bgc_fp32_quaternion_get_reverse(&conjugate->real_part, &quaternion->dual_part);
} }
inline void bgc_fp64_dual_quaternion_get_dual_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_get_dual_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion)
{ {
bgc_fp64_quaternion_copy(&conjugate->real_part, &quaternion->real_part); bgc_fp64_quaternion_copy(&conjugate->real_part, &quaternion->real_part);
bgc_fp64_quaternion_get_reverse(&conjugate->real_part, &quaternion->dual_part); bgc_fp64_quaternion_get_reverse(&conjugate->real_part, &quaternion->dual_part);
@ -212,7 +212,7 @@ inline void bgc_fp64_dual_quaternion_get_dual_conjugate(BGC_FP64_DualQuaternion*
// ============== Fully Conjugate =============== // // ============== Fully Conjugate =============== //
inline void bgc_fp32_dual_quaternion_fully_conjugate(BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_fully_conjugate(BGC_FP32_DualQuaternion* const quaternion)
{ {
quaternion->real_part.x1 = -quaternion->real_part.x1; quaternion->real_part.x1 = -quaternion->real_part.x1;
quaternion->real_part.x2 = -quaternion->real_part.x2; quaternion->real_part.x2 = -quaternion->real_part.x2;
@ -221,7 +221,7 @@ inline void bgc_fp32_dual_quaternion_fully_conjugate(BGC_FP32_DualQuaternion* qu
quaternion->dual_part.s0 = -quaternion->dual_part.s0; quaternion->dual_part.s0 = -quaternion->dual_part.s0;
} }
inline void bgc_fp64_dual_quaternion_fully_conjugate(BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_fully_conjugate(BGC_FP64_DualQuaternion* const quaternion)
{ {
quaternion->real_part.x1 = -quaternion->real_part.x1; quaternion->real_part.x1 = -quaternion->real_part.x1;
quaternion->real_part.x2 = -quaternion->real_part.x2; quaternion->real_part.x2 = -quaternion->real_part.x2;
@ -232,7 +232,7 @@ inline void bgc_fp64_dual_quaternion_fully_conjugate(BGC_FP64_DualQuaternion* qu
// ============ Get Fully Conjugate ============= // // ============ Get Fully Conjugate ============= //
inline void bgc_fp32_dual_quaternion_get_fully_conjugate(BGC_FP32_DualQuaternion* conjugate, const BGC_FP32_DualQuaternion* quaternion) inline void bgc_fp32_dual_quaternion_get_fully_conjugate(BGC_FP32_DualQuaternion* const conjugate, const BGC_FP32_DualQuaternion* const quaternion)
{ {
conjugate->real_part.s0 = quaternion->real_part.s0; conjugate->real_part.s0 = quaternion->real_part.s0;
conjugate->real_part.x1 = -quaternion->real_part.x1; conjugate->real_part.x1 = -quaternion->real_part.x1;
@ -245,7 +245,7 @@ inline void bgc_fp32_dual_quaternion_get_fully_conjugate(BGC_FP32_DualQuaternion
conjugate->dual_part.x3 = quaternion->dual_part.x3; conjugate->dual_part.x3 = quaternion->dual_part.x3;
} }
inline void bgc_fp64_dual_quaternion_get_fully_conjugate(BGC_FP64_DualQuaternion* conjugate, const BGC_FP64_DualQuaternion* quaternion) inline void bgc_fp64_dual_quaternion_get_fully_conjugate(BGC_FP64_DualQuaternion* const conjugate, const BGC_FP64_DualQuaternion* const quaternion)
{ {
conjugate->real_part.s0 = quaternion->real_part.s0; conjugate->real_part.s0 = quaternion->real_part.s0;
conjugate->real_part.x1 = -quaternion->real_part.x1; conjugate->real_part.x1 = -quaternion->real_part.x1;
@ -260,7 +260,7 @@ inline void bgc_fp64_dual_quaternion_get_fully_conjugate(BGC_FP64_DualQuaternion
// ================= Normalize ================== // // ================= Normalize ================== //
inline int bgc_fp32_dual_quaternion_normalize(BGC_FP32_DualQuaternion* quaternion) inline int bgc_fp32_dual_quaternion_normalize(BGC_FP32_DualQuaternion* const quaternion)
{ {
const float square_magnitude = bgc_fp32_quaternion_get_square_magnitude(&quaternion->real_part); const float square_magnitude = bgc_fp32_quaternion_get_square_magnitude(&quaternion->real_part);
@ -282,7 +282,7 @@ inline int bgc_fp32_dual_quaternion_normalize(BGC_FP32_DualQuaternion* quaternio
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_quaternion_normalize(BGC_FP64_DualQuaternion* quaternion) inline int bgc_fp64_dual_quaternion_normalize(BGC_FP64_DualQuaternion* const quaternion)
{ {
const double square_magnitude = bgc_fp64_quaternion_get_square_magnitude(&quaternion->real_part); const double square_magnitude = bgc_fp64_quaternion_get_square_magnitude(&quaternion->real_part);
@ -306,7 +306,7 @@ inline int bgc_fp64_dual_quaternion_normalize(BGC_FP64_DualQuaternion* quaternio
// =============== Get Normalized =============== // // =============== Get Normalized =============== //
inline int bgc_fp32_dual_quaternion_get_normalized(BGC_FP32_DualQuaternion* normalized, const BGC_FP32_DualQuaternion* quaternion) inline int bgc_fp32_dual_quaternion_get_normalized(BGC_FP32_DualQuaternion* const normalized, const BGC_FP32_DualQuaternion* const quaternion)
{ {
const float square_magnitude = bgc_fp32_quaternion_get_square_magnitude(&quaternion->real_part); const float square_magnitude = bgc_fp32_quaternion_get_square_magnitude(&quaternion->real_part);
@ -332,7 +332,7 @@ inline int bgc_fp32_dual_quaternion_get_normalized(BGC_FP32_DualQuaternion* norm
return BGC_SUCCESS; return BGC_SUCCESS;
} }
inline int bgc_fp64_dual_quaternion_get_normalized(BGC_FP64_DualQuaternion* normalized, const BGC_FP64_DualQuaternion* quaternion) inline int bgc_fp64_dual_quaternion_get_normalized(BGC_FP64_DualQuaternion* const normalized, const BGC_FP64_DualQuaternion* const quaternion)
{ {
const double square_magnitude = bgc_fp64_quaternion_get_square_magnitude(&quaternion->real_part); const double square_magnitude = bgc_fp64_quaternion_get_square_magnitude(&quaternion->real_part);
@ -360,13 +360,13 @@ inline int bgc_fp64_dual_quaternion_get_normalized(BGC_FP64_DualQuaternion* norm
// ==================== Add ===================== // // ==================== Add ===================== //
inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* first, const BGC_FP32_DualQuaternion* second) inline void bgc_fp32_dual_quaternion_add(BGC_FP32_DualQuaternion* const sum, const BGC_FP32_DualQuaternion* const first, const BGC_FP32_DualQuaternion* const second)
{ {
bgc_fp32_quaternion_add(&sum->real_part, &first->real_part, &second->real_part); bgc_fp32_quaternion_add(&sum->real_part, &first->real_part, &second->real_part);
bgc_fp32_quaternion_add(&sum->dual_part, &first->dual_part, &second->dual_part); bgc_fp32_quaternion_add(&sum->dual_part, &first->dual_part, &second->dual_part);
} }
inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* first, const BGC_FP64_DualQuaternion* second) inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* const sum, const BGC_FP64_DualQuaternion* const first, const BGC_FP64_DualQuaternion* const second)
{ {
bgc_fp64_quaternion_add(&sum->real_part, &first->real_part, &second->real_part); bgc_fp64_quaternion_add(&sum->real_part, &first->real_part, &second->real_part);
bgc_fp64_quaternion_add(&sum->dual_part, &first->dual_part, &second->dual_part); bgc_fp64_quaternion_add(&sum->dual_part, &first->dual_part, &second->dual_part);
@ -374,13 +374,13 @@ inline void bgc_fp64_dual_quaternion_add(BGC_FP64_DualQuaternion* sum, const BGC
// ================= Add Scaled ================= // // ================= Add Scaled ================= //
inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* sum, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale) inline void bgc_fp32_dual_quaternion_add_scaled(BGC_FP32_DualQuaternion* const sum, const BGC_FP32_DualQuaternion* const base_quaternion, const BGC_FP32_DualQuaternion* const scalable_quaternion, const float scale)
{ {
bgc_fp32_quaternion_add_scaled(&sum->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale); bgc_fp32_quaternion_add_scaled(&sum->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale);
bgc_fp32_quaternion_add_scaled(&sum->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale); bgc_fp32_quaternion_add_scaled(&sum->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale);
} }
inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* sum, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale) inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* const sum, const BGC_FP64_DualQuaternion* const base_quaternion, const BGC_FP64_DualQuaternion* const scalable_quaternion, const double scale)
{ {
bgc_fp64_quaternion_add_scaled(&sum->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale); bgc_fp64_quaternion_add_scaled(&sum->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale);
bgc_fp64_quaternion_add_scaled(&sum->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale); bgc_fp64_quaternion_add_scaled(&sum->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale);
@ -388,13 +388,13 @@ inline void bgc_fp64_dual_quaternion_add_scaled(BGC_FP64_DualQuaternion* sum, co
// ================== Subtract ================== // // ================== Subtract ================== //
inline void bgc_fp32_dual_quaternion_subtract(BGC_FP32_DualQuaternion* difference, const BGC_FP32_DualQuaternion* minuend, const BGC_FP32_DualQuaternion* subtrahend) inline void bgc_fp32_dual_quaternion_subtract(BGC_FP32_DualQuaternion* const difference, const BGC_FP32_DualQuaternion* const minuend, const BGC_FP32_DualQuaternion* const subtrahend)
{ {
bgc_fp32_quaternion_subtract(&difference->real_part, &minuend->real_part, &subtrahend->real_part); bgc_fp32_quaternion_subtract(&difference->real_part, &minuend->real_part, &subtrahend->real_part);
bgc_fp32_quaternion_subtract(&difference->dual_part, &minuend->dual_part, &subtrahend->dual_part); bgc_fp32_quaternion_subtract(&difference->dual_part, &minuend->dual_part, &subtrahend->dual_part);
} }
inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* difference, const BGC_FP64_DualQuaternion* minuend, const BGC_FP64_DualQuaternion* subtrahend) inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* const difference, const BGC_FP64_DualQuaternion* const minuend, const BGC_FP64_DualQuaternion* const subtrahend)
{ {
bgc_fp64_quaternion_subtract(&difference->real_part, &minuend->real_part, &subtrahend->real_part); bgc_fp64_quaternion_subtract(&difference->real_part, &minuend->real_part, &subtrahend->real_part);
bgc_fp64_quaternion_subtract(&difference->dual_part, &minuend->dual_part, &subtrahend->dual_part); bgc_fp64_quaternion_subtract(&difference->dual_part, &minuend->dual_part, &subtrahend->dual_part);
@ -402,13 +402,13 @@ inline void bgc_fp64_dual_quaternion_subtract(BGC_FP64_DualQuaternion* differenc
// ============== Subtract Scaled =============== // // ============== Subtract Scaled =============== //
inline void bgc_fp32_dual_quaternion_subtract_scaled(BGC_FP32_DualQuaternion* difference, const BGC_FP32_DualQuaternion* base_quaternion, const BGC_FP32_DualQuaternion* scalable_quaternion, const float scale) inline void bgc_fp32_dual_quaternion_subtract_scaled(BGC_FP32_DualQuaternion* const difference, const BGC_FP32_DualQuaternion* const base_quaternion, const BGC_FP32_DualQuaternion* const scalable_quaternion, const float scale)
{ {
bgc_fp32_quaternion_subtract_scaled(&difference->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale); bgc_fp32_quaternion_subtract_scaled(&difference->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale);
bgc_fp32_quaternion_subtract_scaled(&difference->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale); bgc_fp32_quaternion_subtract_scaled(&difference->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale);
} }
inline void bgc_fp64_dual_quaternion_subtract_scaled(BGC_FP64_DualQuaternion* difference, const BGC_FP64_DualQuaternion* base_quaternion, const BGC_FP64_DualQuaternion* scalable_quaternion, const double scale) inline void bgc_fp64_dual_quaternion_subtract_scaled(BGC_FP64_DualQuaternion* const difference, const BGC_FP64_DualQuaternion* const base_quaternion, const BGC_FP64_DualQuaternion* const scalable_quaternion, const double scale)
{ {
bgc_fp64_quaternion_subtract_scaled(&difference->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale); bgc_fp64_quaternion_subtract_scaled(&difference->real_part, &base_quaternion->real_part, &scalable_quaternion->real_part, scale);
bgc_fp64_quaternion_subtract_scaled(&difference->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale); bgc_fp64_quaternion_subtract_scaled(&difference->dual_part, &base_quaternion->dual_part, &scalable_quaternion->dual_part, scale);
@ -416,13 +416,13 @@ inline void bgc_fp64_dual_quaternion_subtract_scaled(BGC_FP64_DualQuaternion* di
// ================== Multiply ================== // // ================== Multiply ================== //
inline void bgc_fp32_dual_quaternion_multiply_by_real_number(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const float multiplier) inline void bgc_fp32_dual_quaternion_multiply_by_real_number(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const float multiplier)
{ {
bgc_fp32_quaternion_multiply_by_real_number(&product->real_part, &multiplicand->real_part, multiplier); bgc_fp32_quaternion_multiply_by_real_number(&product->real_part, &multiplicand->real_part, multiplier);
bgc_fp32_quaternion_multiply_by_real_number(&product->dual_part, &multiplicand->dual_part, multiplier); bgc_fp32_quaternion_multiply_by_real_number(&product->dual_part, &multiplicand->dual_part, multiplier);
} }
inline void bgc_fp64_dual_quaternion_multiply_by_real_number(BGC_FP64_DualQuaternion* product, const BGC_FP64_DualQuaternion* multiplicand, const double multiplier) inline void bgc_fp64_dual_quaternion_multiply_by_real_number(BGC_FP64_DualQuaternion* const product, const BGC_FP64_DualQuaternion* const multiplicand, const double multiplier)
{ {
bgc_fp64_quaternion_multiply_by_real_number(&product->real_part, &multiplicand->real_part, multiplier); bgc_fp64_quaternion_multiply_by_real_number(&product->real_part, &multiplicand->real_part, multiplier);
bgc_fp64_quaternion_multiply_by_real_number(&product->dual_part, &multiplicand->dual_part, multiplier); bgc_fp64_quaternion_multiply_by_real_number(&product->dual_part, &multiplicand->dual_part, multiplier);
@ -430,7 +430,7 @@ inline void bgc_fp64_dual_quaternion_multiply_by_real_number(BGC_FP64_DualQuater
// ========== Multiply by Dual Number =========== // // ========== Multiply by Dual Number =========== //
inline void bgc_fp32_dual_quaternion_multiply_by_dual_number(BGC_FP32_DualQuaternion* product, const BGC_FP32_DualQuaternion* multiplicand, const BGC_FP32_DualNumber* multiplier) inline void bgc_fp32_dual_quaternion_multiply_by_dual_number(BGC_FP32_DualQuaternion* const product, const BGC_FP32_DualQuaternion* const multiplicand, const BGC_FP32_DualNumber* const multiplier)
{ {
BGC_FP32_Quaternion dual_part; BGC_FP32_Quaternion dual_part;
@ -441,7 +441,7 @@ inline void bgc_fp32_dual_quaternion_multiply_by_dual_number(BGC_FP32_DualQuater
bgc_fp32_quaternion_copy(&product->dual_part, &dual_part); bgc_fp32_quaternion_copy(&product->dual_part, &dual_part);
} }