Добавление функций среднего от 2 и от 3 для матриц, добавление функций альтернативного двойного векторного произведения векторов.

This commit is contained in:
Andrey Pokidov 2026-02-23 22:30:22 +07:00
parent 3b7aa5088b
commit bba8a65c1a
10 changed files with 258 additions and 1 deletions

View file

@ -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;
mean->r3c2 = (term1->r3c2 + term2->r3c2 + term3->r3c2) * BGC_FP32_ONE_THIRD;
}
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)
{
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;
mean->r3c1 = (term1->r3c1 + term2->r3c1 + term3->r3c1) * BGC_FP64_ONE_THIRD;
mean->r3c2 = (term1->r3c2 + term2->r3c2 + term3->r3c2) * BGC_FP64_ONE_THIRD;
}
// ================ Interpolate ================= //
inline void bgc_fp32_matrix2x3_interpolate(BGC_FP32_Matrix2x3* interpolation, const BGC_FP32_Matrix2x3* first, const BGC_FP32_Matrix2x3* second, const float phase)