Переход на парадигму Destination first в порядке параметров функий
This commit is contained in:
parent
f7e41645fe
commit
03627f4401
41 changed files with 1570 additions and 1978 deletions
|
|
@ -32,13 +32,13 @@ inline void bgc_fp64_complex_reset(BGC_FP64_Complex* complex)
|
|||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_make(const float real, const float imaginary, BGC_FP32_Complex* complex)
|
||||
inline void bgc_fp32_complex_make(BGC_FP32_Complex* complex, const float real, const float imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_make(const double real, const double imaginary, BGC_FP64_Complex* complex)
|
||||
inline void bgc_fp64_complex_make(BGC_FP64_Complex* complex, const double real, const double imaginary)
|
||||
{
|
||||
complex->real = real;
|
||||
complex->imaginary = imaginary;
|
||||
|
|
@ -90,13 +90,13 @@ inline int bgc_fp64_complex_is_unit(const BGC_FP64_Complex* number)
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void bgc_fp32_complex_copy(const BGC_FP32_Complex* source, BGC_FP32_Complex* destination)
|
||||
inline void bgc_fp32_complex_copy(BGC_FP32_Complex* destination, const BGC_FP32_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_copy(const BGC_FP64_Complex* source, BGC_FP64_Complex* destination)
|
||||
inline void bgc_fp64_complex_copy(BGC_FP64_Complex* destination, const BGC_FP64_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -130,13 +130,13 @@ inline void bgc_fp64_complex_swap(BGC_FP64_Complex* number1, BGC_FP64_Complex* n
|
|||
|
||||
// ================== Convert =================== //
|
||||
|
||||
inline void bgc_fp64_complex_convert_to_fp32(const BGC_FP64_Complex* source, BGC_FP32_Complex* destination)
|
||||
inline void bgc_fp64_complex_convert_to_fp32(BGC_FP32_Complex* destination, const BGC_FP64_Complex* source)
|
||||
{
|
||||
destination->real = (float)source->real;
|
||||
destination->imaginary = (float)source->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_convert_to_fp64(const BGC_FP32_Complex* source, BGC_FP64_Complex* destination)
|
||||
inline void bgc_fp32_complex_convert_to_fp64(BGC_FP64_Complex* destination, const BGC_FP32_Complex* source)
|
||||
{
|
||||
destination->real = source->real;
|
||||
destination->imaginary = source->imaginary;
|
||||
|
|
@ -156,16 +156,16 @@ inline void bgc_fp64_complex_revert(BGC_FP64_Complex* number)
|
|||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_reverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* opposite)
|
||||
inline void bgc_fp32_complex_get_reverse(BGC_FP32_Complex* reverse, const BGC_FP32_Complex* number)
|
||||
{
|
||||
opposite->real = -number->real;
|
||||
opposite->imaginary = -number->imaginary;
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_reverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* opposite)
|
||||
inline void bgc_fp64_complex_get_reverse(BGC_FP64_Complex* reverse, const BGC_FP64_Complex* number)
|
||||
{
|
||||
opposite->real = -number->real;
|
||||
opposite->imaginary = -number->imaginary;
|
||||
reverse->real = -number->real;
|
||||
reverse->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
// ================= Normalize ================== //
|
||||
|
|
@ -210,7 +210,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_FP32_Complex* normalized)
|
||||
inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const BGC_FP32_Complex* number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ inline int bgc_fp32_complex_get_normalized(const BGC_FP32_Complex* number, BGC_F
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_normalized(const BGC_FP64_Complex* number, BGC_FP64_Complex* normalized)
|
||||
inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const BGC_FP64_Complex* number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -270,13 +270,13 @@ inline void bgc_fp64_complex_conjugate(BGC_FP64_Complex* number)
|
|||
number->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp32_complex_get_conjugate(const BGC_FP32_Complex* number, BGC_FP32_Complex* conjugate)
|
||||
inline void bgc_fp32_complex_get_conjugate(BGC_FP32_Complex* conjugate, const BGC_FP32_Complex* number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_FP64_Complex* conjugate)
|
||||
inline void bgc_fp64_complex_get_conjugate(BGC_FP64_Complex* conjugate, const BGC_FP64_Complex* number)
|
||||
{
|
||||
conjugate->real = number->real;
|
||||
conjugate->imaginary = -number->imaginary;
|
||||
|
|
@ -284,7 +284,7 @@ inline void bgc_fp64_complex_get_conjugate(const BGC_FP64_Complex* number, BGC_F
|
|||
|
||||
// =================== Invert =================== //
|
||||
|
||||
inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32_Complex* inverse)
|
||||
inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP32_Complex* number)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ inline int bgc_fp32_complex_get_inverse(const BGC_FP32_Complex* number, BGC_FP32
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_inverse(const BGC_FP64_Complex* number, BGC_FP64_Complex* inverse)
|
||||
inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP64_Complex* number)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
|
||||
|
||||
|
|
@ -328,19 +328,19 @@ inline int bgc_fp64_complex_invert(BGC_FP64_Complex* number)
|
|||
|
||||
// =============== Get Exponation =============== //
|
||||
|
||||
void bgc_fp32_complex_get_exponation(const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent, BGC_FP32_Complex* power);
|
||||
void bgc_fp32_complex_get_exponation(BGC_FP32_Complex* power, const BGC_FP32_Complex* base, const float real_exponent, const float imaginary_exponent);
|
||||
|
||||
void bgc_fp64_complex_get_exponation(const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent, BGC_FP64_Complex* power);
|
||||
void bgc_fp64_complex_get_exponation(BGC_FP64_Complex* power, const BGC_FP64_Complex* base, const double real_exponent, const double imaginary_exponent);
|
||||
|
||||
// ==================== Add ===================== //
|
||||
|
||||
inline void bgc_fp32_complex_add(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* sum)
|
||||
inline void bgc_fp32_complex_add(BGC_FP32_Complex* sum, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* sum)
|
||||
inline void bgc_fp64_complex_add(BGC_FP64_Complex* sum, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
sum->real = number1->real + number2->real;
|
||||
sum->imaginary = number1->imaginary + number2->imaginary;
|
||||
|
|
@ -348,13 +348,13 @@ inline void bgc_fp64_complex_add(const BGC_FP64_Complex* number1, const BGC_FP64
|
|||
|
||||
// ================= Add scaled ================= //
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, const BGC_FP64_Complex* scalable_number, const double scale, BGC_FP64_Complex* sum)
|
||||
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)
|
||||
{
|
||||
sum->real = basic_number->real + scalable_number->real * scale;
|
||||
sum->imaginary = basic_number->imaginary + scalable_number->imaginary * scale;
|
||||
|
|
@ -362,7 +362,7 @@ inline void bgc_fp64_complex_add_scaled(const BGC_FP64_Complex* basic_number, co
|
|||
|
||||
// ================== Subtract ================== //
|
||||
|
||||
inline void bgc_fp32_complex_subtract(const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend, BGC_FP32_Complex* difference)
|
||||
inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP32_Complex* minuend, const BGC_FP32_Complex* subtrahend)
|
||||
{
|
||||
difference->real = minuend->real - subtrahend->real;
|
||||
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
|
||||
|
|
@ -376,7 +376,7 @@ inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC
|
|||
|
||||
// ================== Multiply ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* product)
|
||||
inline void bgc_fp32_complex_get_product(BGC_FP32_Complex* product, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
const float real = number1->real * number2->real - number1->imaginary * number2->imaginary;
|
||||
const float imaginary = number1->real * number2->imaginary + number1->imaginary * number2->real;
|
||||
|
|
@ -385,7 +385,7 @@ inline void bgc_fp32_complex_get_product(const BGC_FP32_Complex* number1, const
|
|||
product->imaginary = imaginary;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* product)
|
||||
inline void bgc_fp64_complex_get_product(BGC_FP64_Complex* product, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
const double real = number1->real * number2->real - number1->imaginary * number2->imaginary;
|
||||
const double imaginary = number1->real * number2->imaginary + number1->imaginary * number2->real;
|
||||
|
|
@ -396,13 +396,13 @@ inline void bgc_fp64_complex_get_product(const BGC_FP64_Complex* number1, const
|
|||
|
||||
// ============= Multiply By Number ============= //
|
||||
|
||||
inline void bgc_fp32_complex_multiply(const BGC_FP32_Complex* multiplicand, const float multiplier, BGC_FP32_Complex* product)
|
||||
inline void bgc_fp32_complex_multiply(BGC_FP32_Complex* product, const BGC_FP32_Complex* multiplicand, const float multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, const double multiplier, BGC_FP64_Complex* product)
|
||||
inline void bgc_fp64_complex_multiply(BGC_FP64_Complex* product, const BGC_FP64_Complex* multiplicand, const double multiplier)
|
||||
{
|
||||
product->real = multiplicand->real * multiplier;
|
||||
product->imaginary = multiplicand->imaginary * multiplier;
|
||||
|
|
@ -410,7 +410,7 @@ inline void bgc_fp64_complex_multiply(const BGC_FP64_Complex* multiplicand, cons
|
|||
|
||||
// =================== Divide =================== //
|
||||
|
||||
inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor, BGC_FP32_Complex* quotient)
|
||||
inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* divident, const BGC_FP32_Complex* divisor)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ inline int bgc_fp32_complex_get_ratio(const BGC_FP32_Complex* divident, const BG
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor, BGC_FP64_Complex* quotient)
|
||||
inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* divident, const BGC_FP64_Complex* divisor)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
|
||||
|
||||
|
|
@ -450,25 +450,25 @@ inline int bgc_fp64_complex_get_ratio(const BGC_FP64_Complex* divident, const BG
|
|||
|
||||
// ============== Divide By Number ============== //
|
||||
|
||||
inline void bgc_fp32_complex_divide(const BGC_FP32_Complex* dividend, const float divisor, BGC_FP32_Complex* quotient)
|
||||
inline void bgc_fp32_complex_divide(BGC_FP32_Complex* quotient, const BGC_FP32_Complex* dividend, const float divisor)
|
||||
{
|
||||
bgc_fp32_complex_multiply(dividend, 1.0f / divisor, quotient);
|
||||
bgc_fp32_complex_multiply(quotient, dividend, 1.0f / divisor);
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_divide(const BGC_FP64_Complex* dividend, const double divisor, BGC_FP64_Complex* quotient)
|
||||
inline void bgc_fp64_complex_divide(BGC_FP64_Complex* quotient, const BGC_FP64_Complex* dividend, const double divisor)
|
||||
{
|
||||
bgc_fp64_complex_multiply(dividend, 1.0 / divisor, quotient);
|
||||
bgc_fp64_complex_multiply(quotient, dividend, 1.0 / divisor);
|
||||
}
|
||||
|
||||
// ================== Average2 ================== //
|
||||
|
||||
inline void bgc_fp32_complex_get_mean2(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, BGC_FP32_Complex* mean)
|
||||
inline void bgc_fp32_complex_get_mean2(BGC_FP32_Complex* mean, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5f;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, BGC_FP64_Complex* mean)
|
||||
inline void bgc_fp64_complex_get_mean2(BGC_FP64_Complex* mean, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
|
||||
{
|
||||
mean->real = (number1->real + number2->real) * 0.5;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary) * 0.5;
|
||||
|
|
@ -476,13 +476,13 @@ inline void bgc_fp64_complex_get_mean2(const BGC_FP64_Complex* number1, const BG
|
|||
|
||||
// ================== Average3 ================== //
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP32_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP32_ONE_THIRD;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const BGC_FP64_Complex* number3, BGC_FP64_Complex* mean)
|
||||
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)
|
||||
{
|
||||
mean->real = (number1->real + number2->real + number3->real) * BGC_FP64_ONE_THIRD;
|
||||
mean->imaginary = (number1->imaginary + number2->imaginary + number3->imaginary) * BGC_FP64_ONE_THIRD;
|
||||
|
|
@ -490,7 +490,7 @@ inline void bgc_fp64_complex_get_mean3(const BGC_FP64_Complex* number1, const BG
|
|||
|
||||
// =================== Linear =================== //
|
||||
|
||||
inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase, BGC_FP32_Complex* interpolation)
|
||||
inline void bgc_fp32_complex_interpolate(BGC_FP32_Complex* interpolation, const BGC_FP32_Complex* number1, const BGC_FP32_Complex* number2, const float phase)
|
||||
{
|
||||
const float counter_phase = 1.0f - phase;
|
||||
|
||||
|
|
@ -498,7 +498,7 @@ inline void bgc_fp32_complex_interpolate(const BGC_FP32_Complex* number1, const
|
|||
interpolation->imaginary = number1->imaginary * counter_phase + number2->imaginary * phase;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_complex_interpolate(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase, BGC_FP64_Complex* interpolation)
|
||||
inline void bgc_fp64_complex_interpolate(BGC_FP64_Complex* interpolation, const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2, const double phase)
|
||||
{
|
||||
const double counter_phase = 1.0 - phase;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue