Развитие дуальный чисел, векторов и кватернионов, а также гомогенных векторов и матриц

This commit is contained in:
Andrey Pokidov 2026-02-03 19:56:56 +07:00
parent 3f96b661a9
commit b87518cd3f
21 changed files with 1787 additions and 1511 deletions

View file

@ -64,6 +64,22 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="cotes-number.h" />
<Unit filename="dual-number.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="dual-number.h" />
<Unit filename="dual-quaternion.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="dual-quaternion.h" />
<Unit filename="dual-vector3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="dual-vector3.h" />
<Unit filename="hg-matrix3x3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="hg-matrix3x3.h" />
<Unit filename="hg-vector3.c">
<Option compilerVar="CC" />
</Unit>

View file

@ -250,36 +250,36 @@ inline void bgc_fp64_cotes_number_exclude(BGC_FP64_CotesNumber* difference, cons
inline void bgc_fp32_cotes_number_get_rotation_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
{
matrix->row1_col1 = number->_cos;
matrix->row1_col2 = -number->_sin;
matrix->row2_col1 = number->_sin;
matrix->row2_col2 = number->_cos;
matrix->r1c1 = number->_cos;
matrix->r1c2 = -number->_sin;
matrix->r2c1 = number->_sin;
matrix->r2c2 = number->_cos;
}
inline void bgc_fp64_cotes_number_get_rotation_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
{
matrix->row1_col1 = number->_cos;
matrix->row1_col2 = -number->_sin;
matrix->row2_col1 = number->_sin;
matrix->row2_col2 = number->_cos;
matrix->r1c1 = number->_cos;
matrix->r1c2 = -number->_sin;
matrix->r2c1 = number->_sin;
matrix->r2c2 = number->_cos;
}
// ============== Reverse Matrix ================ //
inline void bgc_fp32_cotes_number_get_reverse_matrix(BGC_FP32_Matrix2x2* matrix, const BGC_FP32_CotesNumber* number)
{
matrix->row1_col1 = number->_cos;
matrix->row1_col2 = number->_sin;
matrix->row2_col1 = -number->_sin;
matrix->row2_col2 = number->_cos;
matrix->r1c1 = number->_cos;
matrix->r1c2 = number->_sin;
matrix->r2c1 = -number->_sin;
matrix->r2c2 = number->_cos;
}
inline void bgc_fp64_cotes_number_get_reverse_matrix(BGC_FP64_Matrix2x2* matrix, const BGC_FP64_CotesNumber* number)
{
matrix->row1_col1 = number->_cos;
matrix->row1_col2 = number->_sin;
matrix->row2_col1 = -number->_sin;
matrix->row2_col2 = number->_cos;
matrix->r1c1 = number->_cos;
matrix->r1c2 = number->_sin;
matrix->r2c1 = -number->_sin;
matrix->r2c2 = number->_cos;
}
// ================ Turn Vector ================= //

View file

@ -11,3 +11,24 @@ inline void bgc_fp64_dual_number_copy(BGC_FP64_DualNumber* destination, const BG
inline void bgc_fp32_dual_number_swap(BGC_FP32_DualNumber* first, BGC_FP32_DualNumber* second);
inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualNumber* second);
inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale);
inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale);
inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend);
inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend);
inline void bgc_fp32_dual_number_multiply(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier);
inline void bgc_fp64_dual_number_multiply(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier);
inline void bgc_fp32_dual_number_divide(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor);
inline void bgc_fp64_dual_number_divide(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor);
inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second);
inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second);
inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const BGC_FP32_DualNumber* third);
inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* third);

View file

@ -1,6 +1,8 @@
#ifndef _BGC_DUAL_NUMBER_H_
#define _BGC_DUAL_NUMBER_H_
#include "utilities.h"
// =================== Types ==================== //
typedef struct {
@ -67,4 +69,100 @@ inline void bgc_fp64_dual_number_swap(BGC_FP64_DualNumber* first, BGC_FP64_DualN
first->dual = second->dual;
}
// ==================== Add ===================== //
inline void bgc_fp32_dual_number_add(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second)
{
sum->real = first->real + second->real;
sum->dual = first->dual + second->dual;
}
inline void bgc_fp64_dual_number_add(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second)
{
sum->real = first->real + second->real;
sum->dual = first->dual + second->dual;
}
// ================= Add Scaled ================= //
inline void bgc_fp32_dual_number_add_scaled(BGC_FP32_DualNumber* sum, const BGC_FP32_DualNumber* base_number, const BGC_FP32_DualNumber* scalable_number, const float scale)
{
sum->real = base_number->real + scalable_number->real * scale;
sum->dual = base_number->dual + scalable_number->dual * scale;
}
inline void bgc_fp64_dual_number_add_scaled(BGC_FP64_DualNumber* sum, const BGC_FP64_DualNumber* base_number, const BGC_FP64_DualNumber* scalable_number, const double scale)
{
sum->real = base_number->real + scalable_number->real * scale;
sum->dual = base_number->dual + scalable_number->dual * scale;
}
// ================== Subtract ================== //
inline void bgc_fp32_dual_number_subtract(BGC_FP32_DualNumber* difference, const BGC_FP32_DualNumber* minuend, const BGC_FP32_DualNumber* subtrahend)
{
difference->real = minuend->real - subtrahend->real;
difference->dual = minuend->dual - subtrahend->dual;
}
inline void bgc_fp64_dual_number_subtract(BGC_FP64_DualNumber* difference, const BGC_FP64_DualNumber* minuend, const BGC_FP64_DualNumber* subtrahend)
{
difference->real = minuend->real - subtrahend->real;
difference->dual = minuend->dual - subtrahend->dual;
}
// ================== Multiply ================== //
inline void bgc_fp32_dual_number_multiply(BGC_FP32_DualNumber* product, const BGC_FP32_DualNumber* multiplicand, const float multiplier)
{
product->real = multiplicand->real * multiplier;
product->dual = multiplicand->dual * multiplier;
}
inline void bgc_fp64_dual_number_multiply(BGC_FP64_DualNumber* product, const BGC_FP64_DualNumber* multiplicand, const double multiplier)
{
product->real = multiplicand->real * multiplier;
product->dual = multiplicand->dual * multiplier;
}
// =================== Divide =================== //
inline void bgc_fp32_dual_number_divide(BGC_FP32_DualNumber* quotient, const BGC_FP32_DualNumber* dividend, const float divisor)
{
bgc_fp32_dual_number_multiply(quotient, dividend, 1.0f / divisor);
}
inline void bgc_fp64_dual_number_divide(BGC_FP64_DualNumber* quotient, const BGC_FP64_DualNumber* dividend, const double divisor)
{
bgc_fp64_dual_number_multiply(quotient, dividend, 1.0 / divisor);
}
// ================ Mean of Two ================= //
inline void bgc_fp32_dual_number_get_mean2(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second)
{
mean->real = (first->real + second->real) * 0.5f;
mean->dual = (first->dual + second->dual) * 0.5f;
}
inline void bgc_fp64_dual_number_get_mean2(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second)
{
mean->real = (first->real + second->real) * 0.5;
mean->dual = (first->dual + second->dual) * 0.5;
}
// =============== Mean of Three ================ //
inline void bgc_fp32_dual_number_get_mean3(BGC_FP32_DualNumber* mean, const BGC_FP32_DualNumber* first, const BGC_FP32_DualNumber* second, const BGC_FP32_DualNumber* third)
{
mean->real = (first->real + second->real + third->real) * BGC_FP32_ONE_THIRD;
mean->dual = (first->dual + second->dual + third->dual) * BGC_FP32_ONE_THIRD;
}
inline void bgc_fp64_dual_number_get_mean3(BGC_FP64_DualNumber* mean, const BGC_FP64_DualNumber* first, const BGC_FP64_DualNumber* second, const BGC_FP64_DualNumber* third)
{
mean->real = (first->real + second->real + third->real) * BGC_FP64_ONE_THIRD;
mean->dual = (first->dual + second->dual + third->dual) * BGC_FP64_ONE_THIRD;
}
#endif

View file

@ -0,0 +1,10 @@
#include "dual-quaternion.h"
extern inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* quaternion);
extern inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion);
extern inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source);
extern inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source);
extern inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* first, BGC_FP32_DualQuaternion* second);
extern inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP64_DualQuaternion* second);

View file

@ -0,0 +1,58 @@
#ifndef _BGC_DUAL_QUATERNION_H_
#define _BGC_DUAL_QUATERNION_H_
#include "quaternion.h"
// =================== Types ==================== //
typedef struct {
BGC_FP32_Quaternion real, dual;
} BGC_FP32_DualQuaternion;
typedef struct {
BGC_FP64_Quaternion real, dual;
} BGC_FP64_DualQuaternion;
// =================== Reset ==================== //
inline void bgc_fp32_dual_quaternion_reset(BGC_FP32_DualQuaternion* quaternion)
{
bgc_fp32_quaternion_reset(&quaternion->real);
bgc_fp32_quaternion_reset(&quaternion->dual);
}
inline void bgc_fp64_dual_quaternion_reset(BGC_FP64_DualQuaternion* quaternion)
{
bgc_fp64_quaternion_reset(&quaternion->real);
bgc_fp64_quaternion_reset(&quaternion->dual);
}
// ==================== Copy ==================== //
inline void bgc_fp32_dual_quaternion_copy(BGC_FP32_DualQuaternion* destination, const BGC_FP32_DualQuaternion* source)
{
bgc_fp32_quaternion_copy(&destination->real, &source->real);
bgc_fp32_quaternion_copy(&destination->dual, &source->dual);
}
inline void bgc_fp64_dual_quaternion_copy(BGC_FP64_DualQuaternion* destination, const BGC_FP64_DualQuaternion* source)
{
bgc_fp64_quaternion_copy(&destination->real, &source->real);
bgc_fp64_quaternion_copy(&destination->dual, &source->dual);
}
// ==================== Swap ==================== //
inline void bgc_fp32_dual_quaternion_swap(BGC_FP32_DualQuaternion* first, BGC_FP32_DualQuaternion* second)
{
bgc_fp32_quaternion_swap(&first->real, &second->real);
bgc_fp32_quaternion_swap(&first->dual, &second->dual);
}
inline void bgc_fp64_dual_quaternion_swap(BGC_FP64_DualQuaternion* first, BGC_FP64_DualQuaternion* second)
{
bgc_fp64_quaternion_swap(&first->real, &second->real);
bgc_fp64_quaternion_swap(&first->dual, &second->dual);
}
#endif

View file

@ -1,22 +1,34 @@
#include "./dual-vector3.h"
inline void bgc_fp32_dual_vector3_reset(BGC_FP32_DualVector3* vector);
inline void bgc_fp64_dual_vector3_reset(BGC_FP64_DualVector3* vector);
extern inline void bgc_fp32_dual_vector3_reset(BGC_FP32_DualVector3* vector);
extern inline void bgc_fp64_dual_vector3_reset(BGC_FP64_DualVector3* vector);
inline void bgc_fp32_dual_vector3_make(BGC_FP32_DualVector3* vector, const BGC_FP32_Vector3* real, const BGC_FP32_Vector3* dual);
inline void bgc_fp64_dual_vector3_make(BGC_FP64_DualVector3* vector, const BGC_FP64_Vector3* real, const BGC_FP64_Vector3* dual);
extern inline void bgc_fp32_dual_vector3_make(BGC_FP32_DualVector3* vector, const BGC_FP32_Vector3* real, const BGC_FP32_Vector3* dual);
extern inline void bgc_fp64_dual_vector3_make(BGC_FP64_DualVector3* vector, const BGC_FP64_Vector3* real, const BGC_FP64_Vector3* dual);
inline void bgc_fp32_dual_vector3_set_real_values(BGC_FP32_DualVector3* vector, const float x1, const float x2, const float x3);
inline void bgc_fp64_dual_vector3_set_real_values(BGC_FP64_DualVector3* vector, const double x1, const double x2, const double x3);
extern inline void bgc_fp32_dual_vector3_copy(BGC_FP32_DualVector3* destination, const BGC_FP32_DualVector3* source);
extern inline void bgc_fp64_dual_vector3_copy(BGC_FP64_DualVector3* destination, const BGC_FP64_DualVector3* source);
inline void bgc_fp32_dual_vector3_set_dual_values(BGC_FP32_DualVector3* vector, const float x1, const float x2, const float x3);
inline void bgc_fp64_dual_vector3_set_dual_values(BGC_FP64_DualVector3* vector, const double x1, const double x2, const double x3);
extern inline void bgc_fp32_dual_vector3_swap(BGC_FP32_DualVector3* first, BGC_FP32_DualVector3* second);
extern inline void bgc_fp64_dual_vector3_swap(BGC_FP64_DualVector3* first, BGC_FP64_DualVector3* second);
inline void bgc_fp32_dual_vector3_add(BGC_FP32_DualVector3* sum, const BGC_FP32_DualVector3* first, const BGC_FP32_DualVector3* second);
inline void bgc_fp64_dual_vector3_add(BGC_FP64_DualVector3* sum, const BGC_FP64_DualVector3* first, const BGC_FP64_DualVector3* second);
extern inline void bgc_fp32_dual_vector3_set_real_values(BGC_FP32_DualVector3* vector, const float x1, const float x2, const float x3);
extern inline void bgc_fp64_dual_vector3_set_real_values(BGC_FP64_DualVector3* vector, const double x1, const double x2, const double x3);
inline void bgc_fp32_dual_vector3_add_scaled(BGC_FP32_DualVector3* sum, const BGC_FP32_DualVector3* base_vector, const BGC_FP32_DualVector3* scalable_vector, const float scale);
inline void bgc_fp64_dual_vector3_add_scaled(BGC_FP64_DualVector3* sum, const BGC_FP64_DualVector3* base_vector, const BGC_FP64_DualVector3* scalable_vector, const double scale);
extern inline void bgc_fp32_dual_vector3_set_dual_values(BGC_FP32_DualVector3* vector, const float x1, const float x2, const float x3);
extern inline void bgc_fp64_dual_vector3_set_dual_values(BGC_FP64_DualVector3* vector, const double x1, const double x2, const double x3);
inline void bgc_fp32_dual_vector3_subtract(BGC_FP32_DualVector3* difference, const BGC_FP32_DualVector3* minuend, const BGC_FP32_DualVector3* subtrahend);
inline void bgc_fp64_dual_vector3_subtract(BGC_FP64_DualVector3* difference, const BGC_FP64_DualVector3* minuend, const BGC_FP64_DualVector3* subtrahend);
extern inline void bgc_fp32_dual_vector3_add(BGC_FP32_DualVector3* sum, const BGC_FP32_DualVector3* first, const BGC_FP32_DualVector3* second);
extern inline void bgc_fp64_dual_vector3_add(BGC_FP64_DualVector3* sum, const BGC_FP64_DualVector3* first, const BGC_FP64_DualVector3* second);
extern inline void bgc_fp32_dual_vector3_add_scaled(BGC_FP32_DualVector3* sum, const BGC_FP32_DualVector3* base_vector, const BGC_FP32_DualVector3* scalable_vector, const float scale);
extern inline void bgc_fp64_dual_vector3_add_scaled(BGC_FP64_DualVector3* sum, const BGC_FP64_DualVector3* base_vector, const BGC_FP64_DualVector3* scalable_vector, const double scale);
extern inline void bgc_fp32_dual_vector3_subtract(BGC_FP32_DualVector3* difference, const BGC_FP32_DualVector3* minuend, const BGC_FP32_DualVector3* subtrahend);
extern inline void bgc_fp64_dual_vector3_subtract(BGC_FP64_DualVector3* difference, const BGC_FP64_DualVector3* minuend, const BGC_FP64_DualVector3* subtrahend);
extern inline void bgc_fp32_dual_vector3_multiply(BGC_FP32_DualVector3* product, const BGC_FP32_DualVector3* multiplicand, const float multiplier);
extern inline void bgc_fp64_dual_vector3_multiply(BGC_FP64_DualVector3* product, const BGC_FP64_DualVector3* multiplicand, const double multiplier);
extern inline void bgc_fp32_dual_vector3_divide(BGC_FP32_DualVector3* quotient, const BGC_FP32_DualVector3* dividend, const float divisor);
extern inline void bgc_fp64_dual_vector3_divide(BGC_FP64_DualVector3* quotient, const BGC_FP64_DualVector3* dividend, const double divisor);

View file

@ -41,6 +41,34 @@ inline void bgc_fp64_dual_vector3_make(BGC_FP64_DualVector3* vector, const BGC_F
bgc_fp64_vector3_copy(&vector->dual, dual);
}
// ==================== Copy ==================== //
inline void bgc_fp32_dual_vector3_copy(BGC_FP32_DualVector3* destination, const BGC_FP32_DualVector3* source)
{
bgc_fp32_vector3_copy(&destination->real, &source->real);
bgc_fp32_vector3_copy(&destination->dual, &source->dual);
}
inline void bgc_fp64_dual_vector3_copy(BGC_FP64_DualVector3* destination, const BGC_FP64_DualVector3* source)
{
bgc_fp64_vector3_copy(&destination->real, &source->real);
bgc_fp64_vector3_copy(&destination->dual, &source->dual);
}
// ==================== Swap ==================== //
inline void bgc_fp32_dual_vector3_swap(BGC_FP32_DualVector3* first, BGC_FP32_DualVector3* second)
{
bgc_fp32_vector3_swap(&first->real, &second->real);
bgc_fp32_vector3_swap(&first->dual, &second->dual);
}
inline void bgc_fp64_dual_vector3_swap(BGC_FP64_DualVector3* first, BGC_FP64_DualVector3* second)
{
bgc_fp64_vector3_swap(&first->real, &second->real);
bgc_fp64_vector3_swap(&first->dual, &second->dual);
}
// ================== Set Real ================== //
inline void bgc_fp32_dual_vector3_set_real_values(BGC_FP32_DualVector3* vector, const float x1, const float x2, const float x3)
@ -115,6 +143,32 @@ inline void bgc_fp64_dual_vector3_subtract(BGC_FP64_DualVector3* difference, con
bgc_fp64_vector3_subtract(&difference->dual, &minuend->dual, &subtrahend->dual);
}
// ================== Multiply ================== //
inline void bgc_fp32_dual_vector3_multiply(BGC_FP32_DualVector3* product, const BGC_FP32_DualVector3* multiplicand, const float multiplier)
{
bgc_fp32_vector3_multiply(&product->real, &multiplicand->real, multiplier);
bgc_fp32_vector3_multiply(&product->dual, &multiplicand->dual, multiplier);
}
inline void bgc_fp64_dual_vector3_multiply(BGC_FP64_DualVector3* product, const BGC_FP64_DualVector3* multiplicand, const double multiplier)
{
bgc_fp64_vector3_multiply(&product->real, &multiplicand->real, multiplier);
bgc_fp64_vector3_multiply(&product->dual, &multiplicand->dual, multiplier);
}
// =================== Divide =================== //
inline void bgc_fp32_dual_vector3_divide(BGC_FP32_DualVector3* quotient, const BGC_FP32_DualVector3* dividend, const float divisor)
{
bgc_fp32_dual_vector3_multiply(quotient, dividend, 1.0f / divisor);
}
inline void bgc_fp64_dual_vector3_divide(BGC_FP64_DualVector3* quotient, const BGC_FP64_DualVector3* dividend, const double divisor)
{
bgc_fp64_dual_vector3_multiply(quotient, dividend, 1.0 / divisor);
}
// ================== Average2 ================== //
inline void bgc_fp32_dual_vector3_get_mean2(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2)
@ -133,14 +187,14 @@ inline void bgc_fp64_dual_vector3_get_mean2(BGC_FP64_DualVector3* mean, const BG
inline void bgc_fp32_dual_vector3_get_mean3(BGC_FP32_DualVector3* mean, const BGC_FP32_DualVector3* vector1, const BGC_FP32_DualVector3* vector2, const BGC_FP32_DualVector3* vector3)
{
bgc_fp32_vector3_get_mean2(&mean->real, &vector1->real, &vector2->real, &vector3->real);
bgc_fp32_vector3_get_mean2(&mean->dual, &vector1->dual, &vector2->dual, &vector3->dual);
bgc_fp32_vector3_get_mean3(&mean->real, &vector1->real, &vector2->real, &vector3->real);
bgc_fp32_vector3_get_mean3(&mean->dual, &vector1->dual, &vector2->dual, &vector3->dual);
}
inline void bgc_fp64_dual_vector3_get_mean3(BGC_FP64_DualVector3* mean, const BGC_FP64_DualVector3* vector1, const BGC_FP64_DualVector3* vector2, const BGC_FP64_DualVector3* vector3)
{
bgc_fp64_vector3_get_mean2(&mean->real, &vector1->real, &vector2->real, &vector3->real);
bgc_fp64_vector3_get_mean2(&mean->dual, &vector1->dual, &vector2->dual, &vector3->dual);
bgc_fp64_vector3_get_mean3(&mean->real, &vector1->real, &vector2->real, &vector3->real);
bgc_fp64_vector3_get_mean3(&mean->dual, &vector1->dual, &vector2->dual, &vector3->dual);
}
#endif

View file

@ -1,10 +0,0 @@
#include "dual-versor.h"
extern inline void bgc_fp32_dual_versor_reset(BGC_FP32_DualVersor* number);
extern inline void bgc_fp64_dual_versor_reset(BGC_FP64_DualVersor* number);
extern inline void bgc_fp32_dual_versor_copy(BGC_FP32_DualVersor* destination, const BGC_FP32_DualVersor* source);
extern inline void bgc_fp64_dual_versor_copy(BGC_FP64_DualVersor* destination, const BGC_FP64_DualVersor* source);
extern inline void bgc_fp32_dual_versor_swap(BGC_FP32_DualVersor* first, BGC_FP32_DualVersor* second);
extern inline void bgc_fp64_dual_versor_swap(BGC_FP64_DualVersor* first, BGC_FP64_DualVersor* second);

View file

@ -1,147 +0,0 @@
#ifndef _BGC_DUAL_VERSOR_H_
#define _BGC_DUAL_VERSOR_H_
// =================== Types ==================== //
typedef struct {
struct {
float s0, x1, x2, x3;
} _real, _dual;
} BGC_FP32_DualVersor;
typedef struct {
struct {
double s0, x1, x2, x3;
} _real, _dual;
} BGC_FP64_DualVersor;
// =================== Reset ==================== //
inline void bgc_fp32_dual_versor_reset(BGC_FP32_DualVersor* number)
{
number->_real.s0 = 1.0f;
number->_real.x1 = 0.0f;
number->_real.x2 = 0.0f;
number->_real.x3 = 0.0f;
number->_dual.s0 = 0.0f;
number->_dual.x1 = 0.0f;
number->_dual.x2 = 0.0f;
number->_dual.x3 = 0.0f;
}
inline void bgc_fp64_dual_versor_reset(BGC_FP64_DualVersor* number)
{
number->_real.s0 = 1.0f;
number->_real.x1 = 0.0f;
number->_real.x2 = 0.0f;
number->_real.x3 = 0.0f;
number->_dual.s0 = 0.0f;
number->_dual.x1 = 0.0f;
number->_dual.x2 = 0.0f;
number->_dual.x3 = 0.0f;
}
// ==================== Copy ==================== //
inline void bgc_fp32_dual_versor_copy(BGC_FP32_DualVersor* destination, const BGC_FP32_DualVersor* source)
{
destination->_real.s0 = source->_real.s0;
destination->_real.x1 = source->_real.x1;
destination->_real.x2 = source->_real.x2;
destination->_real.x3 = source->_real.x3;
destination->_dual.s0 = source->_dual.s0;
destination->_dual.x1 = source->_dual.x1;
destination->_dual.x2 = source->_dual.x2;
destination->_dual.x3 = source->_dual.x3;
}
inline void bgc_fp64_dual_versor_copy(BGC_FP64_DualVersor* destination, const BGC_FP64_DualVersor* source)
{
destination->_real.s0 = source->_real.s0;
destination->_real.x1 = source->_real.x1;
destination->_real.x2 = source->_real.x2;
destination->_real.x3 = source->_real.x3;
destination->_dual.s0 = source->_dual.s0;
destination->_dual.x1 = source->_dual.x1;
destination->_dual.x2 = source->_dual.x2;
destination->_dual.x3 = source->_dual.x3;
}
// ==================== Swap ==================== //
inline void bgc_fp32_dual_versor_swap(BGC_FP32_DualVersor* first, BGC_FP32_DualVersor* second)
{
// Real
float s0 = second->_real.s0;
float x1 = second->_real.x1;
float x2 = second->_real.x2;
float x3 = second->_real.x3;
second->_real.s0 = first->_real.s0;
second->_real.x1 = first->_real.x1;
second->_real.x2 = first->_real.x2;
second->_real.x3 = first->_real.x3;
first->_real.s0 = s0;
first->_real.x1 = x1;
first->_real.x2 = x2;
first->_real.x3 = x3;
// Dual
s0 = second->_dual.s0;
x1 = second->_dual.x1;
x2 = second->_dual.x2;
x3 = second->_dual.x3;
second->_dual.s0 = first->_dual.s0;
second->_dual.x1 = first->_dual.x1;
second->_dual.x2 = first->_dual.x2;
second->_dual.x3 = first->_dual.x3;
first->_dual.s0 = s0;
first->_dual.x1 = x1;
first->_dual.x2 = x2;
first->_dual.x3 = x3;
}
inline void bgc_fp64_dual_versor_swap(BGC_FP64_DualVersor* first, BGC_FP64_DualVersor* second)
{
// Real
double s0 = second->_real.s0;
double x1 = second->_real.x1;
double x2 = second->_real.x2;
double x3 = second->_real.x3;
second->_real.s0 = first->_real.s0;
second->_real.x1 = first->_real.x1;
second->_real.x2 = first->_real.x2;
second->_real.x3 = first->_real.x3;
first->_real.s0 = s0;
first->_real.x1 = x1;
first->_real.x2 = x2;
first->_real.x3 = x3;
// Dual
s0 = second->_dual.s0;
x1 = second->_dual.x1;
x2 = second->_dual.x2;
x3 = second->_dual.x3;
second->_dual.s0 = first->_dual.s0;
second->_dual.x1 = first->_dual.x1;
second->_dual.x2 = first->_dual.x2;
second->_dual.x3 = first->_dual.x3;
first->_dual.s0 = s0;
first->_dual.x1 = x1;
first->_dual.x2 = x2;
first->_dual.x3 = x3;
}
#endif

View file

@ -0,0 +1,7 @@
#include "hg-matrix3x3.h"
inline void bgc_fp32_hg_matrix3x3_reset(BGC_FP32_HgMatrix3x3* homogeneous_matrix);
inline void bgc_fp64_hg_matrix3x3_reset(BGC_FP64_HgMatrix3x3* homogeneous_matrix);
inline void bgc_fp32_hg_matrix3x3_make(BGC_FP32_HgMatrix3x3* homogeneous_matrix, const BGC_FP32_Matrix3x3* linear_matrix, const BGC_FP32_Vector3* shift);
inline void bgc_fp64_hg_matrix3x3_make(BGC_FP64_HgMatrix3x3* homogeneous_matrix, const BGC_FP64_Matrix3x3* linear_matrix, const BGC_FP64_Vector3* shift);

View file

@ -0,0 +1,123 @@
#ifndef _BGC_HG_MATRIX3X3_H_INCLUDED_
#define _BGC_HG_MATRIX3X3_H_INCLUDED_
#include "vector3.h"
#include "matrices.h"
#include "hg-vector3.h"
// =================== Types ==================== //
typedef struct
{
float r1c1, r1c2, r1c3, r1d0;
float r2c1, r2c2, r2c3, r2d0;
float r3c1, r3c2, r3c3, r3d0;
float d0c1, d0c2, d0c3, d0d0;
} BGC_FP32_HgMatrix3x3;
typedef struct
{
double r1c1, r1c2, r1c3, r1d0;
double r2c1, r2c2, r2c3, r2d0;
double r3c1, r3c2, r3c3, r3d0;
double d0c1, d0c2, d0c3, d0d0;
} BGC_FP64_HgMatrix3x3;
// =================== Reset ==================== //
inline void bgc_fp32_hg_matrix3x3_reset(BGC_FP32_HgMatrix3x3* homogeneous_matrix)
{
homogeneous_matrix->r1c1 = 1.0f;
homogeneous_matrix->r1c2 = 0.0f;
homogeneous_matrix->r1c2 = 0.0f;
homogeneous_matrix->r1d0 = 0.0f;
homogeneous_matrix->r2c1 = 0.0f;
homogeneous_matrix->r2c2 = 1.0f;
homogeneous_matrix->r2c2 = 0.0f;
homogeneous_matrix->r2d0 = 0.0f;
homogeneous_matrix->r3c1 = 0.0f;
homogeneous_matrix->r3c2 = 0.0f;
homogeneous_matrix->r3c2 = 1.0f;
homogeneous_matrix->r3d0 = 0.0f;
homogeneous_matrix->d0c1 = 0.0f;
homogeneous_matrix->d0c2 = 0.0f;
homogeneous_matrix->d0c2 = 0.0f;
homogeneous_matrix->d0d0 = 1.0f;
}
inline void bgc_fp64_hg_matrix3x3_reset(BGC_FP64_HgMatrix3x3* homogeneous_matrix)
{
homogeneous_matrix->r1c1 = 1.0;
homogeneous_matrix->r1c2 = 0.0;
homogeneous_matrix->r1c2 = 0.0;
homogeneous_matrix->r1d0 = 0.0;
homogeneous_matrix->r2c1 = 0.0;
homogeneous_matrix->r2c2 = 1.0;
homogeneous_matrix->r2c2 = 0.0;
homogeneous_matrix->r2d0 = 0.0;
homogeneous_matrix->r3c1 = 0.0;
homogeneous_matrix->r3c2 = 0.0;
homogeneous_matrix->r3c2 = 1.0;
homogeneous_matrix->r3d0 = 0.0;
homogeneous_matrix->d0c1 = 0.0;
homogeneous_matrix->d0c2 = 0.0;
homogeneous_matrix->d0c2 = 0.0;
homogeneous_matrix->d0d0 = 1.0;
}
// ==================== Make ==================== //
inline void bgc_fp32_hg_matrix3x3_make(BGC_FP32_HgMatrix3x3* homogeneous_matrix, const BGC_FP32_Matrix3x3* linear_matrix, const BGC_FP32_Vector3* shift)
{
homogeneous_matrix->r1c1 = linear_matrix->r1c1;
homogeneous_matrix->r1c2 = linear_matrix->r1c2;
homogeneous_matrix->r1c2 = linear_matrix->r1c3;
homogeneous_matrix->r1d0 = shift->x1;
homogeneous_matrix->r2c1 = linear_matrix->r2c1;
homogeneous_matrix->r2c2 = linear_matrix->r2c2;
homogeneous_matrix->r2c2 = linear_matrix->r2c3;
homogeneous_matrix->r2d0 = shift->x2;
homogeneous_matrix->r3c1 = linear_matrix->r3c1;
homogeneous_matrix->r3c2 = linear_matrix->r3c2;
homogeneous_matrix->r3c2 = linear_matrix->r3c3;
homogeneous_matrix->r3d0 = shift->x3;
homogeneous_matrix->d0c1 = 0.0f;
homogeneous_matrix->d0c2 = 0.0f;
homogeneous_matrix->d0c2 = 0.0f;
homogeneous_matrix->d0d0 = 1.0f;
}
inline void bgc_fp64_hg_matrix3x3_make(BGC_FP64_HgMatrix3x3* homogeneous_matrix, const BGC_FP64_Matrix3x3* linear_matrix, const BGC_FP64_Vector3* shift)
{
homogeneous_matrix->r1c1 = linear_matrix->r1c1;
homogeneous_matrix->r1c2 = linear_matrix->r1c2;
homogeneous_matrix->r1c2 = linear_matrix->r1c3;
homogeneous_matrix->r1d0 = shift->x1;
homogeneous_matrix->r2c1 = linear_matrix->r2c1;
homogeneous_matrix->r2c2 = linear_matrix->r2c2;
homogeneous_matrix->r2c2 = linear_matrix->r2c3;
homogeneous_matrix->r2d0 = shift->x2;
homogeneous_matrix->r3c1 = linear_matrix->r3c1;
homogeneous_matrix->r3c2 = linear_matrix->r3c2;
homogeneous_matrix->r3c2 = linear_matrix->r3c3;
homogeneous_matrix->r3d0 = shift->x3;
homogeneous_matrix->d0c1 = 0.0;
homogeneous_matrix->d0c2 = 0.0;
homogeneous_matrix->d0c2 = 0.0;
homogeneous_matrix->d0d0 = 1.0;
}
#endif

View file

@ -8,13 +8,13 @@
// Homogeneous 3D Vector
typedef struct
{
float x1, x2, x3, ratio;
float x1, x2, x3, d0;
} BGC_FP32_HgVector3;
// Homogeneous 3D Vector
typedef struct
{
double x1, x2, x3, ratio;
double x1, x2, x3, d0;
} BGC_FP64_HgVector3;
// ================ Reset Point ================= //
@ -24,7 +24,7 @@ inline void bgc_fp32_hg_vector3_reset_point(BGC_FP32_HgVector3* homogeneous_vect
homogeneous_vector->x1 = 0.0f;
homogeneous_vector->x2 = 0.0f;
homogeneous_vector->x3 = 0.0f;
homogeneous_vector->ratio = 1.0f;
homogeneous_vector->d0 = 1.0f;
}
inline void bgc_fp64_hg_vector3_reset_point(BGC_FP64_HgVector3* homogeneous_vector)
@ -32,7 +32,7 @@ inline void bgc_fp64_hg_vector3_reset_point(BGC_FP64_HgVector3* homogeneous_vect
homogeneous_vector->x1 = 0.0;
homogeneous_vector->x2 = 0.0;
homogeneous_vector->x3 = 0.0;
homogeneous_vector->ratio = 1.0;
homogeneous_vector->d0 = 1.0;
}
// ================ Reset Point ================= //
@ -42,7 +42,7 @@ inline void bgc_fp32_hg_vector3_reset_vector(BGC_FP32_HgVector3* homogeneous_vec
homogeneous_vector->x1 = 0.0f;
homogeneous_vector->x2 = 0.0f;
homogeneous_vector->x3 = 0.0f;
homogeneous_vector->ratio = 0.0f;
homogeneous_vector->d0 = 0.0f;
}
inline void bgc_fp64_hg_vector3_reset_vector(BGC_FP64_HgVector3* homogeneous_vector)
@ -50,25 +50,25 @@ inline void bgc_fp64_hg_vector3_reset_vector(BGC_FP64_HgVector3* homogeneous_vec
homogeneous_vector->x1 = 0.0;
homogeneous_vector->x2 = 0.0;
homogeneous_vector->x3 = 0.0;
homogeneous_vector->ratio = 0.0;
homogeneous_vector->d0 = 0.0;
}
// ==================== Make ==================== //
inline void bgc_fp32_hg_vector3_make(BGC_FP32_HgVector3* homogeneous_vector, const float x1, const float x2, const float x3, const float ratio)
inline void bgc_fp32_hg_vector3_make(BGC_FP32_HgVector3* homogeneous_vector, const float x1, const float x2, const float x3, const float d0)
{
homogeneous_vector->x1 = x1;
homogeneous_vector->x2 = x2;
homogeneous_vector->x3 = x3;
homogeneous_vector->ratio = ratio;
homogeneous_vector->d0 = d0;
}
inline void bgc_fp64_hg_vector3_make(BGC_FP64_HgVector3* homogeneous_vector, const double x1, const double x2, const double x3, const double ratio)
inline void bgc_fp64_hg_vector3_make(BGC_FP64_HgVector3* homogeneous_vector, const double x1, const double x2, const double x3, const double d0)
{
homogeneous_vector->x1 = x1;
homogeneous_vector->x2 = x2;
homogeneous_vector->x3 = x3;
homogeneous_vector->ratio = ratio;
homogeneous_vector->d0 = d0;
}
// ================= Make Point ================= //
@ -78,7 +78,7 @@ inline void bgc_fp32_hg_vector3_make_point(BGC_FP32_HgVector3* homogeneous_vecto
homogeneous_vector->x1 = regular_vector->x1;
homogeneous_vector->x2 = regular_vector->x2;
homogeneous_vector->x3 = regular_vector->x3;
homogeneous_vector->ratio = 1.0f;
homogeneous_vector->d0 = 1.0f;
}
inline void bgc_fp64_hg_vector3_make_point(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector)
@ -86,7 +86,7 @@ inline void bgc_fp64_hg_vector3_make_point(BGC_FP64_HgVector3* homogeneous_vecto
homogeneous_vector->x1 = regular_vector->x1;
homogeneous_vector->x2 = regular_vector->x2;
homogeneous_vector->x3 = regular_vector->x3;
homogeneous_vector->ratio = 1.0;
homogeneous_vector->d0 = 1.0;
}
// ================ Make Vector ================= //
@ -96,7 +96,7 @@ inline void bgc_fp32_hg_vector3_make_vector(BGC_FP32_HgVector3* homogeneous_vect
homogeneous_vector->x1 = regular_vector->x1;
homogeneous_vector->x2 = regular_vector->x2;
homogeneous_vector->x3 = regular_vector->x3;
homogeneous_vector->ratio = 0.0f;
homogeneous_vector->d0 = 0.0f;
}
inline void bgc_fp64_hg_vector3_make_vector(BGC_FP64_HgVector3* homogeneous_vector, const BGC_FP64_Vector3* regular_vector)
@ -104,31 +104,31 @@ inline void bgc_fp64_hg_vector3_make_vector(BGC_FP64_HgVector3* homogeneous_vect
homogeneous_vector->x1 = regular_vector->x1;
homogeneous_vector->x2 = regular_vector->x2;
homogeneous_vector->x3 = regular_vector->x3;
homogeneous_vector->ratio = 0.0;
homogeneous_vector->d0 = 0.0;
}
// ================== Is Point ================== //
inline int bgc_fp32_hg_vector3_is_point(const BGC_FP32_HgVector3* homogeneous_vector)
{
return !bgc_fp32_is_zero(homogeneous_vector->ratio);
return !bgc_fp32_is_zero(homogeneous_vector->d0);
}
inline int bgc_fp64_hg_vector3_is_point(const BGC_FP64_HgVector3* homogeneous_vector)
{
return !bgc_fp64_is_zero(homogeneous_vector->ratio);
return !bgc_fp64_is_zero(homogeneous_vector->d0);
}
// ================= Is Vector ================== //
inline int bgc_fp32_hg_vector3_is_vector(const BGC_FP32_HgVector3* homogeneous_vector)
{
return bgc_fp32_is_zero(homogeneous_vector->ratio);
return bgc_fp32_is_zero(homogeneous_vector->d0);
}
inline int bgc_fp64_hg_vector3_is_vector(const BGC_FP64_HgVector3* homogeneous_vector)
{
return bgc_fp64_is_zero(homogeneous_vector->ratio);
return bgc_fp64_is_zero(homogeneous_vector->d0);
}
// ==================== Copy ==================== //
@ -138,7 +138,7 @@ inline void bgc_fp32_hg_vector3_copy(BGC_FP32_HgVector3* destination, const BGC_
destination->x1 = source->x1;
destination->x2 = source->x2;
destination->x3 = source->x3;
destination->ratio = source->ratio;
destination->d0 = source->d0;
}
inline void bgc_fp64_hg_vector3_copy(BGC_FP64_HgVector3* destination, const BGC_FP64_HgVector3* source)
@ -146,7 +146,7 @@ inline void bgc_fp64_hg_vector3_copy(BGC_FP64_HgVector3* destination, const BGC_
destination->x1 = source->x1;
destination->x2 = source->x2;
destination->x3 = source->x3;
destination->ratio = source->ratio;
destination->d0 = source->d0;
}
// ==================== Swap ==================== //
@ -156,17 +156,17 @@ inline void bgc_fp32_hg_vector3_swap(BGC_FP32_HgVector3* first, BGC_FP32_HgVecto
const float x1 = first->x1;
const float x2 = first->x2;
const float x3 = first->x3;
const float ratio = first->ratio;
const float d0 = first->d0;
first->x1 = second->x1;
first->x2 = second->x2;
first->x3 = second->x3;
first->ratio = second->ratio;
first->d0 = second->d0;
second->x1 = x1;
second->x2 = x2;
second->x3 = x3;
second->ratio = ratio;
second->d0 = d0;
}
inline void bgc_fp64_hg_vector3_swap(BGC_FP64_HgVector3* first, BGC_FP64_HgVector3* second)
@ -174,17 +174,51 @@ inline void bgc_fp64_hg_vector3_swap(BGC_FP64_HgVector3* first, BGC_FP64_HgVecto
const double x1 = first->x1;
const double x2 = first->x2;
const double x3 = first->x3;
const double ratio = first->ratio;
const double d0 = first->d0;
first->x1 = second->x1;
first->x2 = second->x2;
first->x3 = second->x3;
first->ratio = second->ratio;
first->d0 = second->d0;
second->x1 = x1;
second->x2 = x2;
second->x3 = x3;
second->ratio = ratio;
second->d0 = d0;
}
// ================== Rescale =================== //
inline int bgc_fp32_hg_vector3_rescale(BGC_FP32_HgVector3* homogeneous_vector, const float new_ratio)
{
if (bgc_fp32_is_zero(homogeneous_vector->d0)) {
return 0;
}
const float multiplier = new_ratio / homogeneous_vector->d0;
homogeneous_vector->x1 *= multiplier;
homogeneous_vector->x2 *= multiplier;
homogeneous_vector->x3 *= multiplier;
homogeneous_vector->d0 = new_ratio;
return 1;
}
inline int bgc_fp64_hg_vector3_rescale(BGC_FP64_HgVector3* homogeneous_vector, const double new_ratio)
{
if (bgc_fp64_is_zero(homogeneous_vector->d0)) {
return 0;
}
const double multiplier = new_ratio / homogeneous_vector->d0;
homogeneous_vector->x1 *= multiplier;
homogeneous_vector->x2 *= multiplier;
homogeneous_vector->x3 *= multiplier;
homogeneous_vector->d0 = new_ratio;
return 1;
}
#endif

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -4,361 +4,361 @@
// ================== Matrix2x2 ================= //
typedef struct {
float row1_col1, row1_col2;
float row2_col1, row2_col2;
float r1c1, r1c2;
float r2c1, r2c2;
} BGC_FP32_Matrix2x2;
typedef struct {
double row1_col1, row1_col2;
double row2_col1, row2_col2;
double r1c1, r1c2;
double r2c1, r2c2;
} BGC_FP64_Matrix2x2;
// ================== Matrix2x3 ================= //
typedef struct {
float row1_col1, row1_col2;
float row2_col1, row2_col2;
float row3_col1, row3_col2;
float r1c1, r1c2;
float r2c1, r2c2;
float r3c1, r3c2;
} BGC_FP32_Matrix2x3;
typedef struct {
double row1_col1, row1_col2;
double row2_col1, row2_col2;
double row3_col1, row3_col2;
double r1c1, r1c2;
double r2c1, r2c2;
double r3c1, r3c2;
} BGC_FP64_Matrix2x3;
// ================== Matrix3x2 ================= //
typedef struct {
float row1_col1, row1_col2, row1_col3;
float row2_col1, row2_col2, row2_col3;
float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3;
} BGC_FP32_Matrix3x2;
typedef struct {
double row1_col1, row1_col2, row1_col3;
double row2_col1, row2_col2, row2_col3;
double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3;
} BGC_FP64_Matrix3x2;
// ================== Matrix3x3 ================= //
typedef struct {
float row1_col1, row1_col2, row1_col3;
float row2_col1, row2_col2, row2_col3;
float row3_col1, row3_col2, row3_col3;
float r1c1, r1c2, r1c3;
float r2c1, r2c2, r2c3;
float r3c1, r3c2, r3c3;
} BGC_FP32_Matrix3x3;
typedef struct {
double row1_col1, row1_col2, row1_col3;
double row2_col1, row2_col2, row2_col3;
double row3_col1, row3_col2, row3_col3;
double r1c1, r1c2, r1c3;
double r2c1, r2c2, r2c3;
double r3c1, r3c2, r3c3;
} BGC_FP64_Matrix3x3;
// ========== Matrix Product 2x2 at 2x2 ========= //
inline void bgc_fp32_multiply_matrix2x2_by_matrix2x2(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix2x2* matrix2)
{
const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
}
inline void bgc_fp64_multiply_matrix2x2_by_matrix2x2(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix2x2* matrix2)
{
const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
}
// ========== Matrix Product 2x2 at 3x2 ========= //
inline void bgc_fp32_multiply_matrix2x2_by_matrix3x2(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix2x2* matrix1, const BGC_FP32_Matrix3x2* matrix2)
{
const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const float row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const float row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->row1_col3 = row1_col3;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->r1c3 = r1c3;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->row2_col3 = row2_col3;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->r2c3 = r2c3;
}
inline void bgc_fp64_multiply_matrix2x2_by_matrix3x2(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix2x2* matrix1, const BGC_FP64_Matrix3x2* matrix2)
{
const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const double row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const double row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->row1_col3 = row1_col3;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->r1c3 = r1c3;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->row2_col3 = row2_col3;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->r2c3 = r2c3;
}
// ========== Matrix Product 2x3 at 2x2 ========= //
inline void bgc_fp32_multiply_matrix2x3_by_matrix2x2(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix2x2* matrix2)
{
const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const float row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
const float row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->row3_col1 = row3_col1;
product->row3_col2 = row3_col2;
product->r3c1 = r3c1;
product->r3c2 = r3c2;
}
inline void bgc_fp64_multiply_matrix2x3_by_matrix2x2(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix2x2* matrix2)
{
const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
const double row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
const double row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
const double r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
const double r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->row3_col1 = row3_col1;
product->row3_col2 = row3_col2;
product->r3c1 = r3c1;
product->r3c2 = r3c2;
}
// ========== Matrix Product 2x3 at 3x2 ========= //
inline void bgc_fp32_multiply_matrix2x3_by_matrix3x2(BGC_FP32_Matrix3x3* product, const BGC_FP32_Matrix2x3* matrix1, const BGC_FP32_Matrix3x2* matrix2)
{
product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
product->row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
product->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
product->row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
product->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
product->row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
product->row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
product->row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3;
product->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
product->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
product->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
}
inline void bgc_fp64_multiply_matrix2x3_by_matrix3x2(BGC_FP64_Matrix3x3* product, const BGC_FP64_Matrix2x3* matrix1, const BGC_FP64_Matrix3x2* matrix2)
{
product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1;
product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2;
product->row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3;
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1;
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2;
product->r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3;
product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1;
product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2;
product->row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3;
product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1;
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2;
product->r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3;
product->row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1;
product->row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2;
product->row3_col3 = matrix1->row3_col1 * matrix2->row1_col3 + matrix1->row3_col2 * matrix2->row2_col3;
product->r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1;
product->r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2;
product->r3c3 = matrix1->r3c1 * matrix2->r1c3 + matrix1->r3c2 * matrix2->r2c3;
}
// ========== Matrix Product 3x2 at 2x3 ========= //
inline void bgc_fp32_multiply_matrix3x2_by_matrix2x3(BGC_FP32_Matrix2x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix2x3* matrix2)
{
product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
}
inline void bgc_fp64_multiply_matrix3x2_by_matrix2x3(BGC_FP64_Matrix2x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix2x3* matrix2)
{
product->row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
product->row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
product->r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
product->r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
product->row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
product->row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
product->r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
product->r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
}
// ========== Matrix Product 3x2 at 3x3 ========= //
inline void bgc_fp32_multiply_matrix3x2_by_matrix3x3(BGC_FP32_Matrix3x2* product, const BGC_FP32_Matrix3x2* matrix1, const BGC_FP32_Matrix3x3* matrix2)
{
const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
const float row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
const float row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->row1_col3 = row1_col3;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->r1c3 = r1c3;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->row2_col3 = row2_col3;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->r2c3 = r2c3;
}
inline void bgc_fp64_multiply_matrix3x2_by_matrix3x3(BGC_FP64_Matrix3x2* product, const BGC_FP64_Matrix3x2* matrix1, const BGC_FP64_Matrix3x3* matrix2)
{
const double row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
const double row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
const double row1_col3 = matrix1->row1_col1 * matrix2->row1_col3 + matrix1->row1_col2 * matrix2->row2_col3 + matrix1->row1_col3 * matrix2->row3_col3;
const double r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const double r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const double r1c3 = matrix1->r1c1 * matrix2->r1c3 + matrix1->r1c2 * matrix2->r2c3 + matrix1->r1c3 * matrix2->r3c3;
const double row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
const double row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
const double row2_col3 = matrix1->row2_col1 * matrix2->row1_col3 + matrix1->row2_col2 * matrix2->row2_col3 + matrix1->row2_col3 * matrix2->row3_col3;
const double r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const double r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const double r2c3 = matrix1->r2c1 * matrix2->r1c3 + matrix1->r2c2 * matrix2->r2c3 + matrix1->r2c3 * matrix2->r3c3;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->row1_col3 = row1_col3;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->r1c3 = r1c3;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->row2_col3 = row2_col3;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->r2c3 = r2c3;
}
// ========== Matrix Product 3x3 at 2x3 ========= //
inline void bgc_fp32_multiply_matrix3x3_by_matrix2x3(BGC_FP32_Matrix2x3* product, const BGC_FP32_Matrix3x3* matrix1, const BGC_FP32_Matrix2x3* matrix2)
{
const float row1_col1 = matrix1->row1_col1 * matrix2->row1_col1 + matrix1->row1_col2 * matrix2->row2_col1 + matrix1->row1_col3 * matrix2->row3_col1;
const float row1_col2 = matrix1->row1_col1 * matrix2->row1_col2 + matrix1->row1_col2 * matrix2->row2_col2 + matrix1->row1_col3 * matrix2->row3_col2;
const float r1c1 = matrix1->r1c1 * matrix2->r1c1 + matrix1->r1c2 * matrix2->r2c1 + matrix1->r1c3 * matrix2->r3c1;
const float r1c2 = matrix1->r1c1 * matrix2->r1c2 + matrix1->r1c2 * matrix2->r2c2 + matrix1->r1c3 * matrix2->r3c2;
const float row2_col1 = matrix1->row2_col1 * matrix2->row1_col1 + matrix1->row2_col2 * matrix2->row2_col1 + matrix1->row2_col3 * matrix2->row3_col1;
const float row2_col2 = matrix1->row2_col1 * matrix2->row1_col2 + matrix1->row2_col2 * matrix2->row2_col2 + matrix1->row2_col3 * matrix2->row3_col2;
const float r2c1 = matrix1->r2c1 * matrix2->r1c1 + matrix1->r2c2 * matrix2->r2c1 + matrix1->r2c3 * matrix2->r3c1;
const float r2c2 = matrix1->r2c1 * matrix2->r1c2 + matrix1->r2c2 * matrix2->r2c2 + matrix1->r2c3 * matrix2->r3c2;
const float row3_col1 = matrix1->row3_col1 * matrix2->row1_col1 + matrix1->row3_col2 * matrix2->row2_col1 + matrix1->row3_col3 * matrix2->row3_col1;
const float row3_col2 = matrix1->row3_col1 * matrix2->row1_col2 + matrix1->row3_col2 * matrix2->row2_col2 + matrix1->row3_col3 * matrix2->row3_col2;
const float r3c1 = matrix1->r3c1 * matrix2->r1c1 + matrix1->r3c2 * matrix2->r2c1 + matrix1->r3c3 * matrix2->r3c1;
const float r3c2 = matrix1->r3c1 * matrix2->r1c2 + matrix1->r3c2 * matrix2->r2c2 + matrix1->r3c3 * matrix2->r3c2;
product->row1_col1 = row1_col1;
product->row1_col2 = row1_col2;
product->r1c1 = r1c1;
product->r1c2 = r1c2;
product->row2_col1 = row2_col1;
product->row2_col2 = row2_col2;
product->r2c1 = r2c1;
product->r2c2 = r2c2;
product->row3_col1 = row3_col1;
product->row3_col2 = row3_col2;
product->r3c1 = r3c1;
product->r3c2 = r3c2;
}
inline void bgc_fp64_multiply_matrix3x3_by_matrix2x3(BGC_FP64_Matrix2x3* product, const BGC_FP64_Matrix3x3* matrix1, const BGC_FP64_Matrix2x3* matrix2)
{