Переход на версию 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

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

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -9,22 +9,22 @@
typedef struct
{
float real, imaginary;
} BgcComplexFP32;
} BGC_FP32_Complex;
typedef struct
{
double real, imaginary;
} BgcComplexFP64;
} BGC_FP64_Complex;
// =================== Reset ==================== //
inline void bgc_complex_reset_fp32(BgcComplexFP32* complex)
inline void bgc_fp32_complex_reset(BGC_FP32_Complex* complex)
{
complex->real = 0.0f;
complex->imaginary = 0.0f;
}
inline void bgc_complex_reset_fp64(BgcComplexFP64* complex)
inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
{
complex->real = 0.0;
complex->imaginary = 0.0;
@ -32,71 +32,71 @@ inline void bgc_complex_reset_fp64(BgcComplexFP64* complex)
// ==================== Set ===================== //
inline void bgc_complex_set_values_fp32(const float real, const float imaginary, BgcComplexFP32* destination)
inline void bgc_fp32_complex_make(const float real, const float imaginary, BGC_FP32_Complex* complex)
{
destination->real = real;
destination->imaginary = imaginary;
complex->real = real;
complex->imaginary = imaginary;
}
inline void bgc_complex_set_values_fp64(const double real, const double imaginary, BgcComplexFP64* destination)
inline void bgc_fp64_complex_make(const double real, const double imaginary, BGC_FP64_Complex* complex)
{
destination->real = real;
destination->imaginary = imaginary;
complex->real = real;
complex->imaginary = imaginary;
}
// ================== Modulus =================== //
inline float bgc_complex_get_square_modulus_fp32(const BgcComplexFP32* number)
inline float bgc_fp32_complex_get_square_modulus(const BGC_FP32_Complex* number)
{
return number->real * number->real + number->imaginary * number->imaginary;
}
inline double bgc_complex_get_square_modulus_fp64(const BgcComplexFP64* number)
inline double bgc_fp64_complex_get_square_modulus(const BGC_FP64_Complex* number)
{
return number->real * number->real + number->imaginary * number->imaginary;
}
inline float bgc_complex_get_modulus_fp32(const BgcComplexFP32* number)
inline float bgc_fp32_complex_get_modulus(const BGC_FP32_Complex* number)
{
return sqrtf(bgc_complex_get_square_modulus_fp32(number));
return sqrtf(bgc_fp32_complex_get_square_modulus(number));
}
inline double bgc_complex_get_modulus_fp64(const BgcComplexFP64* number)
inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number)
{
return sqrt(bgc_complex_get_square_modulus_fp64(number));
return sqrt(bgc_fp64_complex_get_square_modulus(number));
}
// ================= Comparison ================= //
inline int bgc_complex_is_zero_fp32(const BgcComplexFP32* number)
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number)
{
return bgc_complex_get_square_modulus_fp32(number) <= BGC_SQUARE_EPSYLON_FP32;
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSYLON;
}
inline int bgc_complex_is_zero_fp64(const BgcComplexFP64* number)
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number)
{
return bgc_complex_get_square_modulus_fp64(number) <= BGC_SQUARE_EPSYLON_FP64;
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSYLON;
}
inline int bgc_complex_is_unit_fp32(const BgcComplexFP32* number)
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number)
{
return bgc_is_sqare_unit_fp32(bgc_complex_get_square_modulus_fp32(number));
return bgc_fp32_is_square_unit(bgc_fp32_complex_get_square_modulus(number));
}
inline int bgc_complex_is_unit_fp64(const BgcComplexFP64* number)
inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number)
{
return bgc_is_sqare_unit_fp64(bgc_complex_get_square_modulus_fp64(number));
return bgc_fp64_is_square_unit(bgc_fp64_complex_get_square_modulus(number));
}
// ==================== Copy ==================== //
inline void bgc_complex_copy_fp32(const BgcComplexFP32* source, BgcComplexFP32* destination)
inline void bgc_fp32_complex_copy(const BGC_FP32_Complex* source, BGC_FP32_Complex* destination)
{
destination->real = source->real;
destination->imaginary = source->imaginary;
}
inline void bgc_complex_copy_fp64(const BgcComplexFP64* source, BgcComplexFP64* destination)
inline void bgc_fp64_complex_copy(const BGC_FP64_Complex* source, BGC_FP64_Complex* destination)
{
destination->real = source->real;
destination->imaginary = source->imaginary;
@ -104,7 +104,7 @@ inline void bgc_complex_copy_fp64(const BgcComplexFP64* source, BgcComplexFP64*
// ==================== Swap ==================== //
inline void bgc_complex_swap_fp32(BgcComplexFP32* number1, BgcComplexFP32* number2)
inline void bgc_fp32_complex_swap(BGC_FP32_Complex* number1, BGC_FP32_Complex* number2)
{
const float real = number2->real;
const float imaginary = number2->imaginary;
@ -116,7 +116,7 @@ inline void bgc_complex_swap_fp32(BgcComplexFP32* number1, BgcComplexFP32* numbe
number1->imaginary = imaginary;
}
inline void bgc_complex_swap_fp64(BgcComplexFP64* number1, BgcComplexFP64* number2)
inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* number2)
{
const double real = number2->real;
const double imaginary = number2->imaginary;
@ -130,13 +130,13 @@ inline void bgc_complex_swap_fp64(BgcComplexFP64* number1, BgcComplexFP64* numbe
// ================== Convert =================== //
inline void bgc_complex_convert_fp64_to_fp32(const BgcComplexFP64* source, BgcComplexFP32* destination)
inline void bgc_fp64_complex_convert_to_fp32(const BGC_FP64_Complex* source, BGC_FP32_Complex* destination)
{
destination->real = (float)source->real;
destination->imaginary = (float)source->imaginary;
}
inline void bgc_complex_convert_fp32_to_fp64(const BgcComplexFP32* source, BgcComplexFP64* destination)
inline void bgc_fp32_complex_convert_to_fp64(const BGC_FP32_Complex* source, BGC_FP64_Complex* destination)
{
destination->real = source->real;
destination->imaginary = source->imaginary;
@ -144,25 +144,25 @@ inline void bgc_complex_convert_fp32_to_fp64(const BgcComplexFP32* source, BgcCo
// ================== Negative ================== //
inline void bgc_complex_make_opposite_fp32(BgcComplexFP32* number)
inline void bgc_fp32_complex_revert(BGC_FP32_Complex* number)
{
number->real = -number->real;
number->imaginary = -number->imaginary;
}
inline void bgc_complex_make_opposite_fp64(BgcComplexFP64* number)
inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number)
{
number->real = -number->real;
number->imaginary = -number->imaginary;
}
inline void bgc_complex_get_opposite_fp32(const BgcComplexFP32* number, BgcComplexFP32* opposite)
inline void bgc_fp32_complex_get_reverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* opposite)
{
opposite->real = -number->real;
opposite->imaginary = -number->imaginary;
}
inline void bgc_complex_get_opposite_fp64(const BgcComplexFP64* number, BgcComplexFP64* opposite)
inline void bgc_fp64_complex_get_reverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* opposite)
{
opposite->real = -number->real;
opposite->imaginary = -number->imaginary;
@ -170,15 +170,15 @@ inline void bgc_complex_get_opposite_fp64(const BgcComplexFP64* number, BgcCompl
// ================= Normalize ================== //
inline int bgc_complex_normalize_fp32(BgcComplexFP32* number)
inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
{
const float square_modulus = bgc_complex_get_square_modulus_fp32(number);
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
if (bgc_is_sqare_unit_fp32(square_modulus)) {
if (bgc_fp32_is_square_unit(square_modulus)) {
return 1;
}
if (square_modulus <= BGC_SQUARE_EPSYLON_FP32 || square_modulus != square_modulus) {
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
return 0;
}
@ -190,15 +190,15 @@ inline int bgc_complex_normalize_fp32(BgcComplexFP32* number)
return 1;
}
inline int bgc_complex_normalize_fp64(BgcComplexFP64* number)
inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
{
const double square_modulus = bgc_complex_get_square_modulus_fp64(number);
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
if (bgc_is_sqare_unit_fp64(square_modulus)) {
if (bgc_fp64_is_square_unit(square_modulus)) {
return 1;
}
if (square_modulus <= BGC_SQUARE_EPSYLON_FP64 || square_modulus != square_modulus) {
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
return 0;
}
@ -210,17 +210,17 @@ inline int bgc_complex_normalize_fp64(BgcComplexFP64* number)
return 1;
}
inline int bgc_complex_get_normalized_fp32(const BgcComplexFP32* number, BgcComplexFP32* normalized)
inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_FP32_Complex* normalized)
{
const float square_modulus = bgc_complex_get_square_modulus_fp32(number);
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
if (bgc_is_sqare_unit_fp32(square_modulus)) {
if (bgc_fp32_is_square_unit(square_modulus)) {
normalized->real = number->real;
normalized->imaginary = number->imaginary;
return 1;
}
if (square_modulus <= BGC_SQUARE_EPSYLON_FP32 || square_modulus != square_modulus) {
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
normalized->real = 0.0f;
normalized->imaginary = 0.0f;
return 0;
@ -234,17 +234,17 @@ inline int bgc_complex_get_normalized_fp32(const BgcComplexFP32* number, BgcComp
return 1;
}
inline int bgc_complex_get_normalized_fp64(const BgcComplexFP64* number, BgcComplexFP64* normalized)
inline int bgc_fp64_complex_get_normalized(const BGC_FP64_Complex* number, BGC_FP64_Complex* normalized)
{
const double square_modulus = bgc_complex_get_square_modulus_fp64(number);
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
if (bgc_is_sqare_unit_fp64(square_modulus)) {
if (bgc_fp64_is_square_unit(square_modulus)) {
normalized->real = number->real;
normalized->imaginary = number->imaginary;
return 1;
}
if (square_modulus <= BGC_SQUARE_EPSYLON_FP64 || square_modulus != square_modulus) {
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
normalized->real = 0.0;
normalized->imaginary = 0.0;
return 0;
@ -260,23 +260,23 @@ inline int bgc_complex_get_normalized_fp64(const BgcComplexFP64* number, BgcComp
// ================= Conjugate ================== //
inline void bgc_complex_conjugate_fp32(BgcComplexFP32* number)
inline void bgc_fp32_complex_conjugate(BGC_FP32_Complex* number)
{
number->imaginary = -number->imaginary;
}
inline void bgc_complex_conjugate_fp64(BgcComplexFP64* number)
inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number)
{
number->imaginary = -number->imaginary;
}
inline void bgc_complex_get_conjugate_fp32(const BgcComplexFP32* number, BgcComplexFP32* conjugate)
inline void bgc_fp32_complex_get_conjugate(const BGC_FP32_Complex* number, BGC_FP32_Complex* conjugate)
{
conjugate->real = number->real;
conjugate->imaginary = -number->imaginary;
}
inline void bgc_complex_get_conjugate_fp64(const BgcComplexFP64* number, BgcComplexFP64* conjugate)
inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_FP64_Complex* conjugate)
{
conjugate->real = number->real;
conjugate->imaginary = -number->imaginary;
@ -284,11 +284,11 @@ inline void bgc_complex_get_conjugate_fp64(const BgcComplexFP64* number, BgcComp
// =================== Invert =================== //
inline int bgc_complex_get_inverse_fp32(const BgcComplexFP32* number, BgcComplexFP32* inverse)
inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* inverse)
{
const float square_modulus = bgc_complex_get_square_modulus_fp32(number);
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
if (square_modulus <= BGC_SQUARE_EPSYLON_FP32 || square_modulus != square_modulus) {
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
return 0;
}
@ -300,11 +300,11 @@ inline int bgc_complex_get_inverse_fp32(const BgcComplexFP32* number, BgcComplex
return 1;
}
inline int bgc_complex_get_inverse_fp64(const BgcComplexFP64* number, BgcComplexFP64* inverse)