Добавление функций среднего от 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

@ -502,7 +502,7 @@ inline void bgc_fp64_matrix3x2_multiply_by_matrix2x3(BGC_FP64_Matrix2x2* product
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
}
// ========== Matrix Product 3x2 at 3x3 ========= //
// ========== Matrix Product 3x2 at 3x2 ========= //
inline void bgc_fp32_matrix3x2_multiply_by_matrix3x3(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2)
{
@ -564,6 +564,54 @@ inline int bgc_fp64_matrix3x2_divide_by_real(BGC_FP64_Matrix3x2* quotient, const
return BGC_SUCCESS;
}
// ================== Average2 ================== //
inline void bgc_fp32_matrix3x2_get_mean2(BGC_FP32_Matrix3x2* mean, const BGC_FP32_Matrix3x2* term1, const BGC_FP32_Matrix3x2* term2)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5f;
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5f;
mean->r1c3 = (term1->r1c3 + term2->r1c3) * 0.5f;
mean->r2c1 = (term1->r2c1 + term2->r2c1) * 0.5f;
mean->r2c2 = (term1->r2c2 + term2->r2c2) * 0.5f;
mean->r2c3 = (term1->r2c3 + term2->r2c3) * 0.5f;
}
inline void bgc_fp64_matrix3x2_get_mean2(BGC_FP64_Matrix3x2* mean, const BGC_FP64_Matrix3x2* term1, const BGC_FP64_Matrix3x2* term2)
{
mean->r1c1 = (term1->r1c1 + term2->r1c1) * 0.5;
mean->r1c2 = (term1->r1c2 + term2->r1c2) * 0.5;
mean->r1c3 = (term1->r1c3 + term2->r1c3) * 0.5;
mean->r2c1 = (term1->r2c1 + term2->r2c1) * 0.5;
mean->r2c2 = (term1->r2c2 + term2->r2c2) * 0.5;
mean->r2c3 = (term1->r2c3 + term2->r2c3) * 0.5;
}
// ================== Average3 ================== //
inline void bgc_fp32_matrix3x2_get_mean3(BGC_FP32_Matrix3x2* mean, const BGC_FP32_Matrix3x2* term1, const BGC_FP32_Matrix3x2* term2, const BGC_FP32_Matrix3x2* 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->r1c3 = (term1->r1c3 + term2->r1c3 + term3->r1c3) * 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->r2c3 = (term1->r2c3 + term2->r2c3 + term3->r2c3) * BGC_FP32_ONE_THIRD;
}
inline void bgc_fp64_matrix3x2_get_mean3(BGC_FP64_Matrix3x2* mean, const BGC_FP64_Matrix3x2* term1, const BGC_FP64_Matrix3x2* term2, const BGC_FP64_Matrix3x2* 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->r1c3 = (term1->r1c3 + term2->r1c3 + term3->r1c3) * 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->r2c3 = (term1->r2c3 + term2->r2c3 + term3->r2c3) * BGC_FP64_ONE_THIRD;
}
// ================ Interpolate ================= //
inline void bgc_fp32_matrix3x2_interpolate(BGC_FP32_Matrix3x2* interpolation, const BGC_FP32_Matrix3x2* first, const BGC_FP32_Matrix3x2* second, const float phase)