Переход на версию 0.3: изменение подхода к именованию сущностей, добавление, изменение и удаление ряда функций

This commit is contained in:
Andrey Pokidov 2026-01-30 19:37:49 +07:00
parent d33daf4e2d
commit f7e41645fe
87 changed files with 4580 additions and 4051 deletions

View file

@ -1,96 +1,96 @@
#include "./complex.h"
extern inline void bgc_complex_reset_fp32(BgcComplexFP32* complex);
extern inline void bgc_complex_reset_fp64(BgcComplexFP64* complex);
extern inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex);
extern inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex);
extern inline void bgc_complex_set_values_fp32(const float real, const float imaginary, BgcComplexFP32* destination);
extern inline void bgc_complex_set_values_fp64(const double real, const double imaginary, BgcComplexFP64* destination);
extern inline void bgc_fp32_complex_make(const float real, const float imaginary, BGC_FP32_Complex* complex);
extern inline void bgc_fp64_complex_make(const double real, const double imaginary, BGC_FP64_Complex* complex);
extern inline float bgc_complex_get_square_modulus_fp32(const BgcComplexFP32* number);
extern inline double bgc_complex_get_square_modulus_fp64(const BgcComplexFP64* number);
extern inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* number);
extern inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* number);
extern inline float bgc_complex_get_modulus_fp32(const BgcComplexFP32* number);
extern inline double bgc_complex_get_modulus_fp64(const BgcComplexFP64* number);
extern inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* number);
extern inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number);
extern inline int bgc_complex_is_zero_fp32(const BgcComplexFP32* number);
extern inline int bgc_complex_is_zero_fp64(const BgcComplexFP64* number);
extern inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number);
extern inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number);
extern inline int bgc_complex_is_unit_fp32(const BgcComplexFP32* number);
extern inline int bgc_complex_is_unit_fp64(const BgcComplexFP64* number);
extern inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number);
extern inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number);
extern inline void bgc_complex_copy_fp32(const BgcComplexFP32* source, BgcComplexFP32* destination);
extern inline void bgc_complex_copy_fp64(const BgcComplexFP64* source, BgcComplexFP64* destination);
extern inline void bgc_fp32_complex_copy(const BGC_FP32_Complex* source, BGC_FP32_Complex* destination);
extern inline void bgc_fp64_complex_copy(const BGC_FP64_Complex* source, BGC_FP64_Complex* destination);
extern inline void bgc_complex_swap_fp32(BgcComplexFP32* number1, BgcComplexFP32* number2);
extern inline void bgc_complex_swap_fp64(BgcComplexFP64* number1, BgcComplexFP64* number2);
extern inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* number2);
extern inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* number2);
extern inline void bgc_complex_convert_fp64_to_fp32(const BgcComplexFP64* source, BgcComplexFP32* destination);
extern inline void bgc_complex_convert_fp32_to_fp64(const BgcComplexFP32* source, BgcComplexFP64* destination);
extern inline void bgc_fp64_complex_convert_to_fp32(const BGC_FP64_Complex* source, BGC_FP32_Complex* destination);
extern inline void bgc_fp32_complex_convert_to_fp64(const BGC_FP32_Complex* source, BGC_FP64_Complex* destination);
extern inline void bgc_complex_make_opposite_fp32(BgcComplexFP32* number);
extern inline void bgc_complex_make_opposite_fp64(BgcComplexFP64* number);
extern inline void bgc_fp32_complex_revert(BGC_FP32_Complex* number);
extern inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number);
extern inline void bgc_complex_get_opposite_fp32(const BgcComplexFP32* number, BgcComplexFP32* opposite);
extern inline void bgc_complex_get_opposite_fp64(const BgcComplexFP64* number, BgcComplexFP64* opposite);
extern inline void bgc_fp32_complex_get_reverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* opposite);
extern inline void bgc_fp64_complex_get_reverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* opposite);
extern inline int bgc_complex_normalize_fp32(BgcComplexFP32* number);
extern inline int bgc_complex_normalize_fp64(BgcComplexFP64* number);
extern inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number);
extern inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number);
extern inline int bgc_complex_get_normalized_fp32(const BgcComplexFP32* number, BgcComplexFP32* normalized);
extern inline int bgc_complex_get_normalized_fp64(const BgcComplexFP64* number, BgcComplexFP64* normalized);
extern inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_FP32_Complex* normalized);
extern inline int bgc_fp64_complex_get_normalized(const BGC_FP64_Complex* number, BGC_FP64_Complex* normalized);
extern inline void bgc_complex_conjugate_fp32(BgcComplexFP32* number);
extern inline void bgc_complex_conjugate_fp64(BgcComplexFP64* number);
extern inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* number);
extern inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number);
extern inline void bgc_complex_get_conjugate_fp32(const BgcComplexFP32* number, BgcComplexFP32* conjugate);
extern inline void bgc_complex_get_conjugate_fp64(const BgcComplexFP64* number, BgcComplexFP64* conjugate);
extern inline void bgc_fp32_complex_get_conjugate(const BGC_FP32_Complex* number, BGC_FP32_Complex* conjugate);
extern inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_FP64_Complex* conjugate);
extern inline int bgc_complex_invert_fp32(BgcComplexFP32* number);
extern inline int bgc_complex_invert_fp64(BgcComplexFP64* number);
extern inline int bgc_fp32_complex_invert(BGC_FP32_Complex* number);
extern inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number);
extern inline int bgc_complex_get_inverse_fp32(const BgcComplexFP32* number, BgcComplexFP32* inverse);
extern inline int bgc_complex_get_inverse_fp64(const BgcComplexFP64* number, BgcComplexFP64* inverse);
extern inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* inverse);
extern inline int bgc_fp64_complex_get_inverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* inverse);
extern inline void bgc_complex_multiply_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2, BgcComplexFP32* result);
extern inline void bgc_complex_multiply_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2, BgcComplexFP64* result);
extern inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* product);
extern inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* product);
extern inline int bgc_complex_devide_fp32(const BgcComplexFP32* divident, const BgcComplexFP32* divisor, BgcComplexFP32* quotient);
extern inline int bgc_complex_devide_fp64(const BgcComplexFP64* divident, const BgcComplexFP64* divisor, BgcComplexFP64* quotient);
extern inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor, BGC_FP32_Complex* quotient);
extern inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor, BGC_FP64_Complex* quotient);
extern inline void bgc_complex_add_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2, BgcComplexFP32* sum);
extern inline void bgc_complex_add_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2, BgcComplexFP64* sum);
extern inline void bgc_fp32_complex_add(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* sum);
extern inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* sum);
extern inline void bgc_complex_add_scaled_fp32(const BgcComplexFP32* basic_number, const BgcComplexFP32* scalable_number, const float scale, BgcComplexFP32* sum);
extern inline void bgc_complex_add_scaled_fp64(const BgcComplexFP64* basic_number, const BgcComplexFP64* scalable_number, const double scale, BgcComplexFP64* sum);
extern inline void bgc_fp32_complex_add_scaled(const BGC_FP32_Complex* basic_number, const BGC_FP32_Complex* scalable_number, const float scale, BGC_FP32_Complex* sum);
extern inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale, BGC_FP64_Complex* sum);
extern inline void bgc_complex_subtract_fp32(const BgcComplexFP32* minuend, const BgcComplexFP32* subtrahend, BgcComplexFP32* difference);
extern inline void bgc_complex_subtract_fp64(const BgcComplexFP64* minuend, const BgcComplexFP64* subtrahend, BgcComplexFP64* difference);
extern inline void bgc_fp32_complex_subtract(const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend, BGC_FP32_Complex* difference);
extern inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend, BGC_FP64_Complex* difference);
extern inline void bgc_complex_multiply_by_number_fp32(const BgcComplexFP32* multiplicand, const float multiplier, BgcComplexFP32* product);
extern inline void bgc_complex_multiply_by_number_fp64(const BgcComplexFP64* multiplicand, const double multiplier, BgcComplexFP64* product);
extern inline void bgc_fp32_complex_multiply(const BGC_FP32_Complex* multiplicand, const float multiplier, BGC_FP32_Complex* product);
extern inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, const double multiplier, BGC_FP64_Complex* product);
extern inline void bgc_complex_divide_by_number_fp32(const BgcComplexFP32* dividend, const float divisor, BgcComplexFP32* quotient);
extern inline void bgc_complex_divide_by_number_fp64(const BgcComplexFP64* dividend, const double divisor, BgcComplexFP64* quotient);
extern inline void bgc_fp32_complex_divide(const BGC_FP32_Complex* dividend, const float divisor, BGC_FP32_Complex* quotient);
extern inline void bgc_fp64_complex_divide(const BGC_FP64_Complex* dividend, const double divisor, BGC_FP64_Complex* quotient);
extern inline void bgc_complex_get_mean_of_two_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2, BgcComplexFP32* mean);
extern inline void bgc_complex_get_mean_of_two_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2, BgcComplexFP64* mean);
extern inline void bgc_fp32_complex_get_mean2(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* mean);
extern inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* mean);
extern inline void bgc_complex_get_mean_of_three_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2, const BgcComplexFP32* number3, BgcComplexFP32* mean);
extern inline void bgc_complex_get_mean_of_three_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2, const BgcComplexFP64* number3, BgcComplexFP64* mean);
extern inline void bgc_fp32_complex_get_mean3(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const BGC_FP32_Complex* number3, BGC_FP32_Complex* mean);
extern inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3, BGC_FP64_Complex* mean);
extern inline void bgc_complex_interpolate_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2, const float phase, BgcComplexFP32* interpolation);
extern inline void bgc_complex_interpolate_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2, const double phase, BgcComplexFP64* interpolation);
extern inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase, BGC_FP32_Complex* interpolation);
extern inline void bgc_fp64_complex_interpolate(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase, BGC_FP64_Complex* interpolation);
extern inline int bgc_complex_are_close_fp32(const BgcComplexFP32* number1, const BgcComplexFP32* number2);
extern inline int bgc_complex_are_close_fp64(const BgcComplexFP64* number1, const BgcComplexFP64* number2);
extern inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2);
extern inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2);
// =============== Get Exponation =============== //
void bgc_complex_get_exponation_fp32(const BgcComplexFP32* base, const float real_exponent, const float imaginary_exponent, BgcComplexFP32* power)
void bgc_fp32_complex_get_exponation(const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent, BGC_FP32_Complex* power)
{
const float square_modulus = bgc_complex_get_square_modulus_fp32(base);
const float square_modulus = bgc_fp32_complex_get_square_modulus(base);
if (square_modulus <= BGC_SQUARE_EPSYLON_FP32) {
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
power->real = 0.0f;
power->imaginary = 0.0f;
return;
@ -106,11 +106,11 @@ void bgc_complex_get_exponation_fp32(const BgcComplexFP32* base, const float rea
power->imaginary = power_modulus * sinf(power_angle);
}
void bgc_complex_get_exponation_fp64(const BgcComplexFP64* base, const double real_exponent, const double imaginary_exponent, BgcComplexFP64* power)
void bgc_fp64_complex_get_exponation(const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent, BGC_FP64_Complex* power)
{
const double square_modulus = bgc_complex_get_square_modulus_fp64(base);
const double square_modulus = bgc_fp64_complex_get_square_modulus(base);
if (square_modulus <= BGC_SQUARE_EPSYLON_FP64) {
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
power->real = 0.0;
power->imaginary = 0.0;
return;