Отказ от функций getWeightedSum в пользу appendScaled; оптимизация версоров / Replacing of getWeightedSum onto appendScaled; versor optimization
This commit is contained in:
parent
7bd9c07f17
commit
e354b2425c
13 changed files with 331 additions and 835 deletions
144
src/matrix2x2.h
144
src/matrix2x2.h
|
@ -345,6 +345,26 @@ static inline void dp_matrix2x2_set_column2(const double r1, const double r2, DP
|
||||||
matrix->r2c2 = r2;
|
matrix->r2c2 = r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================ Append scaled =============== //
|
||||||
|
|
||||||
|
static inline void sp_matrix2x2_append_scaled(SPMatrix2x2* basic_vector, const SPMatrix2x2* scalable_vector, const float scale)
|
||||||
|
{
|
||||||
|
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||||
|
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||||
|
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void dp_matrix2x2_append_scaled(DPMatrix2x2* basic_vector, const DPMatrix2x2* scalable_vector, const double scale)
|
||||||
|
{
|
||||||
|
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||||
|
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||||
|
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||||
|
}
|
||||||
|
|
||||||
// ================== Addition ================== //
|
// ================== Addition ================== //
|
||||||
|
|
||||||
static inline void sp_matrix2x2_add(const SPMatrix2x2* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x2* sum)
|
static inline void sp_matrix2x2_add(const SPMatrix2x2* matrix1, const SPMatrix2x2* matrix2, SPMatrix2x2* sum)
|
||||||
|
@ -425,130 +445,6 @@ static inline void dp_matrix2x2_divide(const DPMatrix2x2* dividend, const double
|
||||||
quotient->r2c2 = dividend->r2c2 / divisor;
|
quotient->r2c2 = dividend->r2c2 / divisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============= Weighed Sum of two ============= //
|
|
||||||
|
|
||||||
static inline void sp_matrix2x2_get_weighted_sum2(
|
|
||||||
const float weight1, const SPMatrix2x2* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x2* matrix2,
|
|
||||||
SPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dp_matrix2x2_get_weighted_sum2(
|
|
||||||
const double weight1, const DPMatrix2x2* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x2* matrix2,
|
|
||||||
DPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of three ============ //
|
|
||||||
|
|
||||||
static inline void sp_matrix2x2_get_weighted_sum3(
|
|
||||||
const float weight1, const SPMatrix2x2* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x2* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x2* matrix3,
|
|
||||||
SPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2 + matrix3->r1c1 * weight3;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2 + matrix3->r1c2 * weight3;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2 + matrix3->r2c1 * weight3;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2 + matrix3->r2c2 * weight3;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dp_matrix2x2_get_weighted_sum3(
|
|
||||||
const double weight1, const DPMatrix2x2* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x2* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x2* matrix3,
|
|
||||||
DPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2 + matrix3->r1c1 * weight3;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2 + matrix3->r1c2 * weight3;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2 + matrix3->r2c1 * weight3;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2 + matrix3->r2c2 * weight3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of four ============= //
|
|
||||||
|
|
||||||
static inline void sp_matrix2x2_get_weighted_sum4(
|
|
||||||
const float weight1, const SPMatrix2x2* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x2* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x2* matrix3,
|
|
||||||
const float weight4, const SPMatrix2x2* matrix4,
|
|
||||||
SPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4);
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4);
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4);
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dp_matrix2x2_get_weighted_sum4(
|
|
||||||
const double weight1, const DPMatrix2x2* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x2* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x2* matrix3,
|
|
||||||
const double weight4, const DPMatrix2x2* matrix4,
|
|
||||||
DPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4);
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4);
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4);
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of five ============= //
|
|
||||||
|
|
||||||
static inline void sp_matrix2x2_get_weighted_sum5(
|
|
||||||
const float weight1, const SPMatrix2x2* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x2* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x2* matrix3,
|
|
||||||
const float weight4, const SPMatrix2x2* matrix4,
|
|
||||||
const float weight5, const SPMatrix2x2* matrix5,
|
|
||||||
SPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4) + matrix5->r1c1 * weight5;
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4) + matrix5->r1c2 * weight5;
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4) + matrix5->r2c1 * weight5;
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4) + matrix5->r2c2 * weight5;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dp_matrix2x2_get_weighted_sum5(
|
|
||||||
const double weight1, const DPMatrix2x2* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x2* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x2* matrix3,
|
|
||||||
const double weight4, const DPMatrix2x2* matrix4,
|
|
||||||
const double weight5, const DPMatrix2x2* matrix5,
|
|
||||||
DPMatrix2x2* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4) + matrix5->r1c1 * weight5;
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4) + matrix5->r1c2 * weight5;
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4) + matrix5->r2c1 * weight5;
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4) + matrix5->r2c2 * weight5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Left Vector Product ============= //
|
// ============ Left Vector Product ============= //
|
||||||
|
|
||||||
static inline void sp_matrix2x2_left_product(const SPVector2* vector, const SPMatrix2x2* matrix, SPVector2* result)
|
static inline void sp_matrix2x2_left_product(const SPVector2* vector, const SPMatrix2x2* matrix, SPVector2* result)
|
||||||
|
|
147
src/matrix2x3.c
147
src/matrix2x3.c
|
@ -1,149 +1,2 @@
|
||||||
#include "matrix2x3.h"
|
#include "matrix2x3.h"
|
||||||
|
|
||||||
// ============= Weighed Sum of two ============= //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum2(
|
|
||||||
const float weight1, const SPMatrix2x3* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x3* matrix2,
|
|
||||||
SPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2;
|
|
||||||
|
|
||||||
sum->r3c1 = matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2;
|
|
||||||
sum->r3c2 = matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dp_matrix2x3_get_weighted_sum2(
|
|
||||||
const double weight1, const DPMatrix2x3* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x3* matrix2,
|
|
||||||
DPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2;
|
|
||||||
|
|
||||||
sum->r3c1 = matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2;
|
|
||||||
sum->r3c2 = matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of three ============ //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum3(
|
|
||||||
const float weight1, const SPMatrix2x3* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x3* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x3* matrix3,
|
|
||||||
SPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2 + matrix3->r1c1 * weight3;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2 + matrix3->r1c2 * weight3;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2 + matrix3->r2c1 * weight3;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2 + matrix3->r2c2 * weight3;
|
|
||||||
|
|
||||||
sum->r3c1 = matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2 + matrix3->r3c1 * weight3;
|
|
||||||
sum->r3c2 = matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2 + matrix3->r3c2 * weight3;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dp_matrix2x3_get_weighted_sum3(
|
|
||||||
const double weight1, const DPMatrix2x3* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x3* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x3* matrix3,
|
|
||||||
DPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2 + matrix3->r1c1 * weight3;
|
|
||||||
sum->r1c2 = matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2 + matrix3->r1c2 * weight3;
|
|
||||||
|
|
||||||
sum->r2c1 = matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2 + matrix3->r2c1 * weight3;
|
|
||||||
sum->r2c2 = matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2 + matrix3->r2c2 * weight3;
|
|
||||||
|
|
||||||
sum->r3c1 = matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2 + matrix3->r3c1 * weight3;
|
|
||||||
sum->r3c2 = matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2 + matrix3->r3c2 * weight3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of four ============= //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum4(
|
|
||||||
const float weight1, const SPMatrix2x3* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x3* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x3* matrix3,
|
|
||||||
const float weight4, const SPMatrix2x3* matrix4,
|
|
||||||
SPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4);
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4);
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4);
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4);
|
|
||||||
|
|
||||||
sum->r3c1 = (matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2) + (matrix3->r3c1 * weight3 + matrix4->r3c1 * weight4);
|
|
||||||
sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4);
|
|
||||||
}
|
|
||||||
|
|
||||||
void dp_matrix2x3_get_weighted_sum4(
|
|
||||||
const double weight1, const DPMatrix2x3* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x3* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x3* matrix3,
|
|
||||||
const double weight4, const DPMatrix2x3* matrix4,
|
|
||||||
DPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4);
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4);
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4);
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4);
|
|
||||||
|
|
||||||
sum->r3c1 = (matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2) + (matrix3->r3c1 * weight3 + matrix4->r3c1 * weight4);
|
|
||||||
sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ Weighed Sum of five ============= //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum5(
|
|
||||||
const float weight1, const SPMatrix2x3* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x3* matrix2,
|
|
||||||
const float weight3, const SPMatrix2x3* matrix3,
|
|
||||||
const float weight4, const SPMatrix2x3* matrix4,
|
|
||||||
const float weight5, const SPMatrix2x3* matrix5,
|
|
||||||
SPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4) + matrix5->r1c1 * weight5;
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4) + matrix5->r1c2 * weight5;
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4) + matrix5->r2c1 * weight5;
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4) + matrix5->r2c2 * weight5;
|
|
||||||
|
|
||||||
sum->r3c1 = (matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2) + (matrix3->r3c1 * weight3 + matrix4->r3c1 * weight4) + matrix5->r3c1 * weight5;
|
|
||||||
sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4) + matrix5->r3c2 * weight5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dp_matrix2x3_get_weighted_sum5(
|
|
||||||
const double weight1, const DPMatrix2x3* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x3* matrix2,
|
|
||||||
const double weight3, const DPMatrix2x3* matrix3,
|
|
||||||
const double weight4, const DPMatrix2x3* matrix4,
|
|
||||||
const double weight5, const DPMatrix2x3* matrix5,
|
|
||||||
DPMatrix2x3* sum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sum->r1c1 = (matrix1->r1c1 * weight1 + matrix2->r1c1 * weight2) + (matrix3->r1c1 * weight3 + matrix4->r1c1 * weight4) + matrix5->r1c1 * weight5;
|
|
||||||
sum->r1c2 = (matrix1->r1c2 * weight1 + matrix2->r1c2 * weight2) + (matrix3->r1c2 * weight3 + matrix4->r1c2 * weight4) + matrix5->r1c2 * weight5;
|
|
||||||
|
|
||||||
sum->r2c1 = (matrix1->r2c1 * weight1 + matrix2->r2c1 * weight2) + (matrix3->r2c1 * weight3 + matrix4->r2c1 * weight4) + matrix5->r2c1 * weight5;
|
|
||||||
sum->r2c2 = (matrix1->r2c2 * weight1 + matrix2->r2c2 * weight2) + (matrix3->r2c2 * weight3 + matrix4->r2c2 * weight4) + matrix5->r2c2 * weight5;
|
|
||||||
|
|
||||||
sum->r3c1 = (matrix1->r3c1 * weight1 + matrix2->r3c1 * weight2) + (matrix3->r3c1 * weight3 + matrix4->r3c1 * weight4) + matrix5->r3c1 * weight5;
|
|
||||||
sum->r3c2 = (matrix1->r3c2 * weight1 + matrix2->r3c2 * weight2) + (matrix3->r3c2 * weight3 + matrix4->r3c2 * weight4) + matrix5->r3c2 * weight5;
|
|
||||||
}
|
|
||||||
|
|
|
@ -209,6 +209,32 @@ static inline void dp_matrix2x3_set_column2(const double r1, const double r2, co
|
||||||
matrix->r3c2 = r3;
|
matrix->r3c2 = r3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================ Append scaled =============== //
|
||||||
|
|
||||||
|
static inline void sp_matrix2x3_append_scaled(SPMatrix2x3* basic_vector, const SPMatrix2x3* scalable_vector, const float scale)
|
||||||
|
{
|
||||||
|
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||||
|
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||||
|
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r3c1 += scalable_vector->r3c1 * scale;
|
||||||
|
basic_vector->r3c2 += scalable_vector->r3c2 * scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void dp_matrix2x3_append_scaled(DPMatrix2x3* basic_vector, const DPMatrix2x3* scalable_vector, const double scale)
|
||||||
|
{
|
||||||
|
basic_vector->r1c1 += scalable_vector->r1c1 * scale;
|
||||||
|
basic_vector->r1c2 += scalable_vector->r1c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r2c1 += scalable_vector->r2c1 * scale;
|
||||||
|
basic_vector->r2c2 += scalable_vector->r2c2 * scale;
|
||||||
|
|
||||||
|
basic_vector->r3c1 += scalable_vector->r3c1 * scale;
|
||||||
|
basic_vector->r3c2 += scalable_vector->r3c2 * scale;
|
||||||
|
}
|
||||||
|
|
||||||
// ================== Addition ================== //
|
// ================== Addition ================== //
|
||||||
|
|
||||||
static inline void sp_matrix2x3_add(const SPMatrix2x3* matrix1, const SPMatrix2x3* matrix2, SPMatrix2x3* sum)
|
static inline void sp_matrix2x3_add(const SPMatrix2x3* matrix1, const SPMatrix2x3* matrix2, SPMatrix2x3* sum)
|
||||||
|
@ -313,74 +339,6 @@ static inline void dp_matrix2x3_divide(const DPMatrix2x3* dividend, const double
|
||||||
quotient->r3c2 = dividend->r3c2 / divisor;
|
quotient->r3c2 = dividend->r3c2 / divisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============= Weighed Sum of two ============= //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum2(
|
|
||||||
const float weight1, const SPMatrix2x3* matrix1,
|
|
||||||
const float weight2, const SPMatrix2x3* matrix2,
|
|
||||||
SPMatrix2x3* sum
|
|
||||||
);
|
|
||||||
|
|
||||||
void dp_matrix2x3_get_weighted_sum2(
|
|
||||||
const double weight1, const DPMatrix2x3* matrix1,
|
|
||||||
const double weight2, const DPMatrix2x3* matrix2,
|
|
||||||
DPMatrix2x3* sum
|
|
||||||
);
|
|
||||||
|
|
||||||
// ============ Weighed Sum of three ============ //
|
|
||||||
|
|
||||||
void sp_matrix2x3_get_weighted_sum3(
|
|
||||||