Небольшие исправления, а также добавление гомогенного трёхмерного вектора

This commit is contained in:
Andrey Pokidov 2026-02-02 20:44:10 +07:00
parent 03627f4401
commit 043cc72c81
25 changed files with 1686 additions and 1644 deletions

View file

@ -70,12 +70,12 @@ inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number)
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number)
{
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSYLON;
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number)
{
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSYLON;
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number)
@ -178,7 +178,7 @@ inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
return 1;
}
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -198,7 +198,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
return 1;
}
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -220,7 +220,7 @@ inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const B
return 1;
}
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0f;
normalized->imaginary = 0.0f;
return 0;
@ -244,7 +244,7 @@ inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const B
return 1;
}
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0;
normalized->imaginary = 0.0;
return 0;
@ -288,7 +288,7 @@ inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP3
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -304,7 +304,7 @@ inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP6
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -368,7 +368,7 @@ inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
}
inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend, BGC_FP64_Complex* difference)
inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend)
{
difference->real = minuend->real - subtrahend->real;
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
@ -414,7 +414,7 @@ inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
return 0;
}
@ -433,7 +433,7 @@ inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
return 0;
}
@ -518,11 +518,11 @@ inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC
const float square_distance = d_real * d_real + d_imaginary * d_imaginary;
if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP32_SQUARE_EPSYLON;
if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * 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)
@ -535,11 +535,11 @@ inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC
const double square_distance = d_real * d_real + d_imaginary * d_imaginary;
if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP64_SQUARE_EPSYLON;
if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
#endif