systemSolver->runBasicKinematic();
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "SparseVector.h"
|
||||
#include "FullRow.h"
|
||||
|
||||
namespace MbD {
|
||||
template <typename T>
|
||||
@@ -10,16 +11,19 @@ namespace MbD {
|
||||
{
|
||||
public:
|
||||
SparseRow(){}
|
||||
SparseRow(size_t n) : SparseVector<T>(n) {}
|
||||
SparseRow(std::initializer_list<std::pair<const size_t, T>> list) : SparseVector<T>{ list } {}
|
||||
SparseRow(int n) : SparseVector<T>(n) {}
|
||||
SparseRow(std::initializer_list<std::pair<const int, T>> list) : SparseVector<T>{ list } {}
|
||||
SparseRow(std::initializer_list<std::initializer_list<T>> list) : SparseVector<T>{ list } {}
|
||||
std::shared_ptr<SparseRow<double>> timesconditionedWithTol(double scaling, double tol);
|
||||
std::shared_ptr<SparseRow<double>> conditionedWithTol(double tol);
|
||||
void atiplusFullRow(int j, std::shared_ptr<FullRow<T>> fullRow);
|
||||
void atiplusFullRowtimes(int j, std::shared_ptr<FullRow<T>> fullRow, double factor);
|
||||
};
|
||||
using SpRowDsptr = std::shared_ptr<SparseRow<double>>;
|
||||
template<>
|
||||
inline std::shared_ptr<SparseRow<double>> SparseRow<double>::timesconditionedWithTol(double scaling, double tol)
|
||||
{
|
||||
auto answer = std::make_shared<SparseRow<double>>(this->size());
|
||||
auto answer = std::make_shared<SparseRow<double>>(this->numberOfElements());
|
||||
for (auto const& keyValue : *this)
|
||||
{
|
||||
auto val = keyValue.second * scaling;
|
||||
@@ -27,5 +31,32 @@ namespace MbD {
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
template<>
|
||||
inline std::shared_ptr<SparseRow<double>> SparseRow<double>::conditionedWithTol(double tol)
|
||||
{
|
||||
auto answer = std::make_shared<SparseRow<double>>(this->numberOfElements());
|
||||
for (auto const& keyValue : *this)
|
||||
{
|
||||
auto val = keyValue.second;
|
||||
if (std::abs(val) >= tol) (*answer)[keyValue.first] = val;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
template<typename T>
|
||||
inline void SparseRow<T>::atiplusFullRow(int j, std::shared_ptr<FullRow<T>> fullRow)
|
||||
{
|
||||
for (int jj = 0; jj < fullRow->size(); jj++)
|
||||
{
|
||||
(*this)[j + jj] += fullRow->at(jj);
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
inline void SparseRow<T>::atiplusFullRowtimes(int j, std::shared_ptr<FullRow<T>> fullRow, double factor)
|
||||
{
|
||||
for (int jj = 0; jj < fullRow->size(); jj++)
|
||||
{
|
||||
(*this)[j + jj] += fullRow->at(jj) * factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user