Добавление функций среднего от 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_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_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;
|
||||
}
|
||||
|
||||
// ================== 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;
|
||||
mean->r2c2 = (term1->r2c2 + term2->r2c2 + term3->r2c2) * BGC_FP32_ONE_THIRD;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
mean->r1c1 = (term1->r1c1 + term2->r1c1 + term3->r1c1) * BGC_FP64_ONE_THIRD;
|
||||
mean->r1c2 = (term1->r1c2 + term2->r1c2 + term3->r1c2) * BGC_FP64_ONE_THIRD;
|
||||
|
||||
mean->r2c1 = (term1->r2c1 + term2->r2c1 + term3->r2c1) * BGC_FP64_ONE_THIRD;
|
||||
mean->r2c2 = (term1->r2c2 + term2->r2c2 + term3->r2c2) * BGC_FP64_ONE_THIRD;
|
||||
}
|
||||
|
||||
// ================ Interpolate ================= //
|
||||
|
||||
inline void bgc_fp32_matrix2x2_interpolate(BGC_FP32_Matrix2x2* interpolation, const BGC_FP32_Matrix2x2* first, const BGC_FP32_Matrix2x2* second, const float phase)
|
||||
|
|
|
|||
|
|
@ -54,5 +54,11 @@ extern inline void bgc_fp64_matrix2x3_multiply_by_matrix3x2(BGC_FP64_Matrix3x3*
|
|||
extern inline int bgc_fp32_matrix2x3_divide_by_real(BGC_FP32_Matrix2x3* quotient, const BGC_FP32_Matrix2x3* dividend, const float divisor);
|
||||
extern inline int bgc_fp64_matrix2x3_divide_by_real(BGC_FP64_Matrix2x3* quotient, const BGC_FP64_Matrix2x3* dividend, const double divisor);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x3_get_mean2(BGC_FP32_Matrix2x3* mean, const BGC_FP32_Matrix2x3* term1, const BGC_FP32_Matrix2x3* term2);
|
||||
extern inline void bgc_fp64_matrix2x3_get_mean2(BGC_FP64_Matrix2x3* mean, const BGC_FP64_Matrix2x3* term1, const BGC_FP64_Matrix2x3* term2);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x3_get_mean3(BGC_FP32_Matrix2x3* mean, const BGC_FP32_Matrix2x3* term1, const BGC_FP32_Matrix2x3* term2, const BGC_FP32_Matrix2x3* term3);
|
||||
extern inline void bgc_fp64_matrix2x3_get_mean3(BGC_FP64_Matrix2x3* mean, const BGC_FP64_Matrix2x3* term1, const BGC_FP64_Matrix2x3* term2, const BGC_FP64_Matrix2x3* term3);
|
||||
|
||||
extern inline void bgc_fp32_matrix2x3_interpolate(BGC_FP32_Matrix2x3* interpolation, const BGC_FP32_Matrix2x3* first, const BGC_FP32_Matrix2x3* second, const float phase);
|
||||
extern inline void bgc_fp64_matrix2x3_interpolate(BGC_FP64_Matrix2x3* interpolation, const BGC_FP64_Matrix2x3* first, const BGC_FP64_Matrix2x3* second, const double phase);
|
||||
|
|
|
|||
|
|
@ -577,6 +577,58 @@ inline int bgc_fp64_matrix2x3_divide_by_real(BGC_FP64_Matrix2x3* quotient, const
|
|||
return BGC_SUCCESS;
|
||||
}
|
||||
|
||||
// ================== Average2 ================== //
|
||||
|
||||
inline void bgc_fp32_matrix2x3_get_mean2(BGC_FP32_Matrix2x3* mean, const BGC_FP32_Matrix2x3* term1, const BGC_FP32_Matrix2x3* 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;
|
||||
|
||||
mean->r3c1 = (term1->r3c1 + term2->r3c1) * 0.5f;
|
||||
mean->r3c2 = (term1->r3c2 + term2->r3c2) * 0.5f;
|
||||
}
|
||||
|
||||
inline void bgc_fp64_matrix2x3_get_mean2(BGC_FP64_Matrix2x3* mean, const BGC_FP64_Matrix2x3* term1, const BGC_FP64_Matrix2x3* 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;
|
||||
|
||||
mean->r3c1 = (term1->r3c1 + term2->r3c1) * 0.5;
|
||||
mean->r3c2 = (term1->r3c2 + term2->r3c2) * 0.5;
|
||||
}
|
||||
|
||||
// ================== Average3 ================== //
|
||||
|
||||
inline void bgc_fp32_matrix2x3_get_mean3(BGC_FP32_Matrix2x3* mean, const BGC_FP32_Matrix2x3* term1, const BGC_FP32_Matrix2x3* term2, const BGC_FP32_Matrix2x3* 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;
|
||||
mean->r2c2 = (term1->r2c2 + term2->r2c2 + term3->r2c2) * BGC_FP32_ONE_THIRD;
|
||||
|
||||
mean->r3c1 = (term1->r3c1 + term2->r3c1 + term3->r3c1) * BGC_FP32_ONE_THIRD;
|
||||