Merge reviewed explicit constant-zero derivative seeds

This commit is contained in:
KOKO\Mimi
2026-10-14 22:35:15 +09:00
2 changed files with 57 additions and 4 deletions
+12 -4
View File
@@ -859,9 +859,17 @@ JetVector3 Cross(const JetVector3& left, const JetVector3& right) {
left[0U] * right[1U] - left[1U] * right[0U]};
}
/// @brief Seeds only explicitly zero matrix entries with constant provenance.
JetMatrix3 ConstantZeroMatrix() {
JetMatrix3 result{};
for (auto& row : result)
for (auto& entry : row) entry = Constant(0.0);
return result;
}
/// @brief Builds a Jet identity matrix.
JetMatrix3 Identity() {
JetMatrix3 result{};
JetMatrix3 result = ConstantZeroMatrix();
for (std::size_t index = 0U; index < 3U; ++index) {
result[index][index] = Constant(1.0);
}
@@ -870,7 +878,7 @@ JetMatrix3 Identity() {
/// @brief Forms a skew matrix from a Jet vector.
JetMatrix3 Skew(const JetVector3& value) {
JetMatrix3 result{};
JetMatrix3 result = ConstantZeroMatrix();
result[0U][1U] = -1.0 * value[2U];
result[0U][2U] = value[1U];
result[1U][0U] = value[2U];
@@ -882,7 +890,7 @@ JetMatrix3 Skew(const JetVector3& value) {
/// @brief Multiplies two three-by-three Jet matrices.
JetMatrix3 Multiply(const JetMatrix3& left, const JetMatrix3& right) {
JetMatrix3 result{};
JetMatrix3 result = ConstantZeroMatrix();
for (std::size_t row = 0U; row < 3U; ++row) {
for (std::size_t column = 0U; column < 3U; ++column) {
for (std::size_t index = 0U; index < 3U; ++index) {
@@ -896,7 +904,7 @@ JetMatrix3 Multiply(const JetMatrix3& left, const JetMatrix3& right) {
/// @brief Multiplies a Jet matrix by a Jet vector.
JetVector3 Multiply(const JetMatrix3& matrix, const JetVector3& vector) {
JetVector3 result{};
JetVector3 result{Constant(0.0), Constant(0.0), Constant(0.0)};
for (std::size_t row = 0U; row < 3U; ++row) {
for (std::size_t column = 0U; column < 3U; ++column) {
result[row] = result[row] + matrix[row][column] * vector[column];