Добавление функций среднего от 2 и от 3 для матриц, добавление функций альтернативного двойного векторного произведения векторов.
This commit is contained in:
parent
3b7aa5088b
commit
bba8a65c1a
10 changed files with 258 additions and 1 deletions
|
|
@ -84,5 +84,11 @@ extern inline void bgc_fp64_matrix2x2_multiply_by_matrix3x2(BGC_FP64_Matrix3x2*
|
||||||
extern inline int bgc_fp32_matrix2x2_divide_by_real(BGC_FP32_Matrix2x2* quotient, const BGC_FP32_Matrix2x2* dividend, const float divisor);
|
extern inline int bgc_fp32_matrix2x2_divide_by_real(BGC_FP32_Matrix2x2* quotient, const BGC_FP32_Matrix2x2* dividend, const float divisor);
|
||||||
extern inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* quotient, const BGC_FP64_Matrix2x2* dividend, const double divisor);
|
extern inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* quotient, const BGC_FP64_Matrix2x2* dividend, const double divisor);
|
||||||
|
|
||||||
|
extern inline void bgc_fp32_matrix2x2_get_mean2(BGC_FP32_Matrix2x2* mean, const BGC_FP32_Matrix2x2* term1, const BGC_FP32_Matrix2x2* term2);
|
||||||
|
extern inline void bgc_fp64_matrix2x2_get_mean2(BGC_FP64_Matrix2x2* mean, const BGC_FP64_Matrix2x2* term1, const BGC_FP64_Matrix2x2* term2);
|
||||||
|
|
||||||
|
extern inline void bgc_fp32_matrix2x2_get_mean3(BGC_FP32_Matrix2x2* mean, const BGC_FP32_Matrix2x2* term1, const BGC_FP32_Matrix2x2* term2, const BGC_FP32_Matrix2x2* term3);
|
||||||
|
extern inline void bgc_fp64_matrix2x2_get_mean3(BGC_FP64_Matrix2x2* mean, const BGC_FP64_Matrix2x2* term1, const BGC_FP64_Matrix2x2* term2, const BGC_FP64_Matrix2x2* term3);
|
||||||
|
|
||||||
extern inline void bgc_fp32_matrix2x2_interpolate(BGC_FP32_Matrix2x2* interpolation, const BGC_FP32_Matrix2x2* first, const BGC_FP32_Matrix2x2* second, const float phase);
|
extern inline void bgc_fp32_matrix2x2_interpolate(BGC_FP32_Matrix2x2* interpolation, const BGC_FP32_Matrix2x2* first, const BGC_FP32_Matrix2x2* second, const float phase);
|
||||||
extern inline void bgc_fp64_matrix2x2_interpolate(BGC_FP64_Matrix2x2* interpolation, const BGC_FP64_Matrix2x2* first, const BGC_FP64_Matrix2x2* second, const double phase);
|
extern inline void bgc_fp64_matrix2x2_interpolate(BGC_FP64_Matrix2x2* interpolation, const BGC_FP64_Matrix2x2* first, const BGC_FP64_Matrix2x2* second, const double phase);
|
||||||
|
|
|
||||||
|
|
@ -691,6 +691,46 @@ inline int bgc_fp64_matrix2x2_divide_by_real(BGC_FP64_Matrix2x2* quotient, const
|
||||||
return BGC_SUCCESS;
|
return BGC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================== Average2 ================== //
|
||||||
|
|
||||||
|
inline void bgc_fp32_matrix2x2_get_mean2(BGC_FP32_Matrix2x2* mean, const BGC_FP32_Matrix2x2* term1, const BGC_FP32_Matrix2x2* term2)
|
||||||
|
{
|
||||||
|
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5f;
|
||||||
|
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5f;
|
||||||
|
|
||||||
|
mean->r2c1 = (term1->r2c1 + term2->r2c1) * 0.5f;
|
||||||
|
mean->r2c2 = (term1->r2c2 + term2->r2c2) * 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void bgc_fp64_matrix2x2_get_mean2(BGC_FP64_Matrix2x2* mean, const BGC_FP64_Matrix2x2* term1, const BGC_FP64_Matrix2x2* term2)
|
||||||
|
{
|
||||||
|
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5;
|
||||||
|
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5;
|
||||||
|
|
||||||
|
mean->r2c1 = (term1->r2c1 + term2->r2c1) * 0.5;
|
||||||
|
mean->r2c2 = (term1->r2c2 + term2->r2c2) * 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================== Average3 ================== //
|
||||||
|
|
||||||
|
inline void bgc_fp32_matrix2x2_get_mean3(BGC_FP32_Matrix2x2* mean, const BGC_FP32_Matrix2x2* term1, const BGC_FP32_Matrix2x2* term2, const BGC_FP32_Matrix2x2* term3)
|
||||||
|
{
|
||||||
|
mean->r1c1 = (term1->r1c1 + term2->r1c1 + term3->r1c1) * BGC_FP32_ONE_THIRD;
|
||||||
|
mean->r1c2 = (term1->r1c2 + term2->r1c2 + term3->r1c2) * BGC_FP32_ONE_THIRD;
|
||||||
|
|
||||||
|
mean->r2c1 = (term1->r2c1 + term2->r2c1 + term3->r2c1) * BGC_FP32_ONE_THIRD;
|
||||||