flatten 20260225
This commit is contained in:
56
tjp/core/math/HMatrix.cpp
Executable file
56
tjp/core/math/HMatrix.cpp
Executable file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Math.cpp
|
||||
// amoeba
|
||||
//
|
||||
// Created by Timothy Prepscius on 12/30/16.
|
||||
// Copyright © 2016 Timothy Prepscius. All rights reserved.
|
||||
//
|
||||
|
||||
#include "HMatrix.hpp"
|
||||
#include "HMatrix.inl"
|
||||
|
||||
namespace tjp {
|
||||
namespace core {
|
||||
namespace math {
|
||||
|
||||
// inline
|
||||
template<>
|
||||
HMatrix<double> operator *(const HMatrix<double> &lhs, const HMatrix<double> &rhs)
|
||||
{
|
||||
HMatrix<Real> result;
|
||||
|
||||
for (int r = 0; r < 4; ++r)
|
||||
{
|
||||
for (int c = 0; c < 4; ++c)
|
||||
{
|
||||
result[r][c] = 0;
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
result[r][c] += lhs[i][c] * rhs[r][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const HMatrix<double> HMatrix<double>::Zero {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
template<>
|
||||
const HMatrix<double> HMatrix<double>::Identity {
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user