27#include <Eigen/Eigenvalues>
31#include "../ui/error.hpp"
32#include "../../kernel.hpp"
81 size_t n = funcData.
nVal;
82 size_t m = funcData.
mVal;
105 size_t n = funcData.
nVal;
106 size_t m = funcData.
mVal;
134 for (
int i = 0; i < funcData.
nVal; i++)
136 _mIdentity(i, i) = 1.0;
161 Matrix _mReturn(1, 1, 0.0);
163 for (
unsigned int i = 0; i < funcData.
mat1.
rows(); i++)
165 _mReturn(0, 0) += funcData.
mat1(i, i);
185 if (_mMatrix.
rows() == 1)
186 return _mMatrix(0, 0);
188 if (_mMatrix.
rows() == 2)
189 return _mMatrix(0, 0) * _mMatrix(1, 1) - _mMatrix(1, 0)*_mMatrix(0, 1);
191 if (_mMatrix.
rows() == 3)
193 return _mMatrix(0, 0)*_mMatrix(1, 1)*_mMatrix(2, 2)
194 + _mMatrix(0, 1)*_mMatrix(1, 2)*_mMatrix(2, 0)
195 + _mMatrix(0, 2)*_mMatrix(1, 0)*_mMatrix(2, 1)
196 - _mMatrix(0, 2)*_mMatrix(1, 1)*_mMatrix(2, 0)
197 - _mMatrix(0, 1)*_mMatrix(1, 0)*_mMatrix(2, 2)
198 - _mMatrix(0, 0)*_mMatrix(1, 2)*_mMatrix(2, 1);
204 for (
unsigned int i = 0; i < _mMatrix.
rows(); i++)
207 if (!(vRemovedLines[i] & 1))
210 vRemovedLines[i] += 1;
212 for (
unsigned int j = 0; j < _mMatrix.
rows(); j++)
215 if (!(vRemovedLines[j] & 2))
217 if (_mMatrix(i, j) == 0.0)
223 vRemovedLines[j] += 2;
226 if (i+1 < _mMatrix.
rows())
227 dDet += (double)nSign * _mMatrix(i, j) *
calcDeterminant(_mMatrix, vRemovedLines);
229 dDet += (double)nSign * _mMatrix(i, j);
232 vRemovedLines[j] -= 2;
238 vRemovedLines[i] -= 1;
265 std::vector<int> vRemovedLines(funcData.
mat1.
rows(), 0);
285 std::vector<int> vRemovedLines(funcData.
mat1.
rows(), 0);
296 _mResult(0) = funcData.
mat1(0, 1);
297 _mResult(1) = -funcData.
mat1(0, 0);
303 _mResult(0) = funcData.
mat1(1, 0)*funcData.
mat1(2, 1) - funcData.
mat1(2, 0)*funcData.
mat1(1, 1);
304 _mResult(1) = funcData.
mat1(2, 0)*funcData.
mat1(0, 1) - funcData.
mat1(0, 0)*funcData.
mat1(2, 1);
305 _mResult(2) = funcData.
mat1(0, 0)*funcData.
mat1(1, 1) - funcData.
mat1(1, 0)*funcData.
mat1(0, 1);
311 #pragma omp parallel for
312 for (
unsigned int i = 0; i < funcData.
mat1.
rows(); i++)
314 for (
unsigned int j = 0; j < funcData.
mat1.
cols(); j++)
316 _mTemp(i, j+1) = funcData.
mat1(i, j);
323 for (
unsigned int i = 1; i < funcData.
mat1.
rows(); i++)
325 _mTemp(i-1, 0) = 0.0;
375 #pragma omp parallel for
376 for (
unsigned int i = 0; i < _mMatrix.
rows(); i++)
378 for (
unsigned int j = 0; j < _mMatrix.
rows(); j++)
392 Eigen::VectorXcd vEigenVals =
eSolver.eigenvalues();
395 for (
unsigned int i = 0; i <
_mEigenVals.rows(); i++)
402 Eigen::EigenSolver<Eigen::MatrixXcd>::EigenvectorsType mEigenVects =
eSolver.eigenvectors();
405 #pragma omp parallel for
416 Eigen::VectorXcd vEigenVals =
eSolver.eigenvalues();
490 unsigned int nShuffle = funcData.
nVal;
491 unsigned int nBase = funcData.
mVal;
493 if (!nBase && nShuffle)
501 if (nShuffle > nBase)
505 for (
size_t i = 0; i < nBase; i++)
510 for (
size_t i = 0; i < nShuffle; i++)
512 std::uniform_real_distribution<double> randDist(i, nBase-1);
516 _mBase(i) = _mBase(nIndex);
517 _mBase(nIndex) = dTemp;
521 _mBase.
resize(nShuffle, 1);
558 if (_mToInvert.
rows() == 1)
561 _mInverse(0) /= _mToInvert(0);
564 else if (_mToInvert.
rows() == 2)
566 _mInverse = _mToInvert;
567 _mInverse(0, 0) = _mToInvert(1, 1);
568 _mInverse(1, 1) = _mToInvert(0, 0);
569 _mInverse(1, 0) *= -1.0;
570 _mInverse(0, 1) *= -1.0;
572 for (
unsigned int i = 0; i < 2; i++)
574 _mInverse(i, 0) /= dDet;
575 _mInverse(i, 1) /= dDet;
580 else if (_mToInvert.
rows() == 3)
582 _mInverse(0, 0) = (_mToInvert(1, 1)*_mToInvert(2, 2) - _mToInvert(2, 1)*_mToInvert(1, 2)) / dDet;
583 _mInverse(1, 0) = -(_mToInvert(1, 0)*_mToInvert(2, 2) - _mToInvert(1, 2)*_mToInvert(2, 0)) / dDet;
584 _mInverse(2, 0) = (_mToInvert(1, 0)*_mToInvert(2, 1) - _mToInvert(1, 1)*_mToInvert(2, 0)) / dDet;
586 _mInverse(0, 1) = -(_mToInvert(0, 1)*_mToInvert(2, 2) - _mToInvert(0, 2)*_mToInvert(2, 1)) / dDet;
587 _mInverse(1, 1) = (_mToInvert(0, 0)*_mToInvert(2, 2) - _mToInvert(0, 2)*_mToInvert(2, 0)) / dDet;
588 _mInverse(2, 1) = -(_mToInvert(0, 0)*_mToInvert(2, 1) - _mToInvert(0, 1)*_mToInvert(2, 0)) / dDet;
590 _mInverse(0, 2) = (_mToInvert(0, 1)*_mToInvert(1, 2) - _mToInvert(0, 2)*_mToInvert(1, 1)) / dDet;
591 _mInverse(1, 2) = -(_mToInvert(0, 0)*_mToInvert(1, 2) - _mToInvert(0, 2)*_mToInvert(1, 0)) / dDet;
592 _mInverse(2, 2) = (_mToInvert(0, 0)*_mToInvert(1, 1) - _mToInvert(0, 1)*_mToInvert(1, 0)) / dDet;
598 for (
unsigned int j = 0; j < _mToInvert.
cols(); j++)
600 for (
unsigned int i = j; i < _mToInvert.
rows(); i++)
602 if (_mToInvert(i, j) != 0.0)
608 for (
unsigned int _j = 0; _j < _mToInvert.
cols(); _j++)
610 dElement = _mToInvert(i, _j);
611 _mToInvert(i, _j) = _mToInvert(j, _j);
612 _mToInvert(j, _j) = dElement;
613 dElement = _mInverse(i, _j);
614 _mInverse(i, _j) = _mInverse(j, _j);
615 _mInverse(j, _j) = dElement;
624 for (
unsigned int _j = 0; _j < _mToInvert.
cols(); _j++)
626 _mToInvert(i, _j) /= dPivot;
627 _mInverse(i, _j) /= dPivot;
630 for (
unsigned int _i = i+1; _i < _mToInvert.
rows(); _i++)
637 for (
unsigned int _j = 0; _j < _mToInvert.
cols(); _j++)
639 _mToInvert(_i, _j) -= _mToInvert(i, _j)*dFactor;
640 _mInverse(_i, _j) -= _mInverse(i, _j)*dFactor;
651 for (
int j = (
int)_mToInvert.
rows()-1; j >= 0; j--)
653 if (_mToInvert(j, j) == 0.0)
656 if (_mToInvert(j, j) != 1.0)
658 for (
unsigned int _j = 0; _j < _mInverse.
cols(); _j++)
659 _mInverse(j, _j) /= _mToInvert(j, j);
661 _mToInvert(j, j) = 1.0;
664 for (
int i = 0; i < j; i++)
666 for (
unsigned int _j = 0; _j < _mInverse.
cols(); _j++)
667 _mInverse(i, _j) -= _mToInvert(i, j)*_mInverse(j, _j);
669 _mToInvert(i, j) -= _mToInvert(i, j)*_mToInvert(j, j);
708 std::vector<double> vLines;
709 std::vector<double> vRows;
713 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
715 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
717 if (funcData.
mat1(i, j).real())
718 vLines.push_back(i + j + 1);
727 for (
size_t i = 0; i < vLines.size(); i++)
728 _mReturn(i) = vLines[i];
734 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
736 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
738 if (funcData.
mat1(i, j).real())
740 vLines.push_back(i+1);
741 vRows.push_back(j+1);
751 for (
size_t i = 0; i < vLines.size(); i++)
753 _mReturn(i, 0) = vLines[i];
754 _mReturn(i, 1) = vRows[i];
780 constexpr size_t MINTHREADCOUNT = 100;
781 constexpr size_t MINELEMENTPERCOL = 100;
783 std::vector<StatsLogic> operation(rowCount, logic);
787 if (rowCount >= MINTHREADCOUNT && colCount >= MINELEMENTPERCOL)
789 #pragma omp parallel for
790 for (
size_t i = 0; i < rowCount; i++)
792 if (rowStart + (
int)i < 0 || rowStart + i >= mat.
rows())
795 for (
size_t j = 0; j < colCount; j++)
797 if (colStart + (
int)j < 0 || colStart + j >= mat.
cols())
800 operation[i](mat(i+rowStart, j+colStart));
806 for (
size_t i = 0; i < rowCount; i++)
808 if (rowStart + (
int)i < 0 || rowStart + i >= mat.
rows())
811 for (
size_t j = 0; j < colCount; j++)
813 if (colStart + (
int)j < 0 || colStart + j >= mat.
cols())
816 operation[i](mat(i+rowStart, j+colStart));
821 for (
size_t i = 1; i < operation.size(); i++)
823 operation.front().combine(operation[i]);
826 return operation.front().m_val;
863 if (funcData.
nVal < 0 || funcData.
mVal < 0
869 #pragma omp parallel for
870 for (
int i = 0; i < (int)_mResult.
rows(); i++)
872 for (
int j = 0; j < (int)_mResult.
cols(); j++)
902 if (!_mMatrixMax(0).
real() || _mMatrixMax(0).
real() < 0)
907 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
909 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
911 if (funcData.
mat1(i, j).real() > 0)
912 _mReturn(funcData.
mat1(i, j).real()-1) = 1.0;
920 std::vector<double> vCol;
921 std::vector<double> vRow;
925 for (
size_t i = 0; i < funcData.
mat1.
cols(); i++)
927 vRow.push_back(funcData.
mat1(0, i).real());
928 vCol.push_back(funcData.
mat1(1, i).real());
933 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
935 vRow.push_back(funcData.
mat1(i, 0).real());
936 vCol.push_back(funcData.
mat1(i, 1).real());
945 for (
size_t i = 0; i < vRow.size(); i++)
947 if (nRowMax < (
int)vRow[i])
948 nRowMax = (int)vRow[i];
950 if (nColMax < (
int)vCol[i])
951 nColMax = (
int)vCol[i];
954 if (!nColMax || !nRowMax)
959 for (
size_t i = 0; i < vRow.size(); i++)
961 if (vRow[i] > 0 && vCol[i] > 0)
962 _mReturn(vRow[i]-1, vCol[i]-1) = 1.0;
1010 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
1012 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
1014 if (funcData.
mat1(i, j) == 0.0)
1037 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
1039 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
1041 if (funcData.
mat1(i, j) != 0.0)
1064 bool isTrue =
false;
1066 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
1068 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
1070 if (funcData.
mat1(i, j) != 0.0)
1120 if (funcData.
nVal < 0 || funcData.
mVal < 0
1126 #pragma omp parallel for
1127 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1129 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1174 if (funcData.
nVal < 0 || funcData.
mVal < 0
1180 #pragma omp parallel for
1181 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1183 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1230 if (funcData.
nVal < 0 || funcData.
mVal < 0
1236 #pragma omp parallel for
1237 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1239 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1247 i-funcData.
nVal, 2*funcData.
nVal+1, j-funcData.
mVal, 2*funcData.
mVal+1).real();
1250 _mResult(i, j) = sum / num;
1278 _mReturn(0) = std::sqrt(_mReturn(0)/(_mNum(0).
real()-1.0));
1297 if (funcData.
nVal < 0 || funcData.
mVal < 0
1303 #pragma omp parallel for
1304 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1306 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1314 i-funcData.
nVal, 2*funcData.
nVal+1, j-funcData.
mVal, 2*funcData.
mVal+1).real();
1320 _mResult(i, j) = std::sqrt(std / (num - 1.0));
1362 if (funcData.
nVal < 0 || funcData.
mVal < 0
1368 #pragma omp parallel for
1369 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1371 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1414 double thresHigh(NAN);
1415 double thresLow(NAN);
1418 double thresInput = funcData.
fVal.real();
1419 int mode = funcData.
nVal;
1445 thresLow = thresInput;
1451 thresHigh = thresInput;
1458 thresHigh = matMin + (matMax - matMin) * thresInput;
1466 thresLow = matMin + (matMax - matMin) * thresInput;
1472 thresHigh = matMin + (matMax - matMin) / 2 + (matMax - matMin) * thresInput / 2.0;
1473 thresLow = matMin + (matMax - matMin) / 2 - (matMax - matMin) * thresInput / 2.0;
1482 for (
size_t i = 0; i < cutMatrix.
rows(); i++)
1484 for (
size_t j = 0; j < cutMatrix.
cols(); j++)
1487 if(!
std::isnan(thresLow) && cutMatrix(i, j).real() < thresLow)
1488 cutMatrix(i, j) = thresLow;
1489 if(!
std::isnan(thresHigh) && cutMatrix(i, j).real() > thresHigh)
1490 cutMatrix(i, j) = thresHigh;
1515 _mReturn(0) = std::sqrt(_mReturn(0));
1534 if (funcData.
nVal < 0 || funcData.
mVal < 0
1540 #pragma omp parallel for
1541 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1543 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1588 if (funcData.
nVal < 0 || funcData.
mVal < 0
1594 #pragma omp parallel for
1595 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1597 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1628 int nType = funcData.
nVal;
1631 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
1633 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
1638 if (funcData.
mat1(i, j) == dValue)
1640 if (!nType ||
abs(nType) <= 1)
1647 _mReturn(0) = funcData.
mat1(i, j);
1651 else if (nType > 0 && funcData.
mat1(i, j).real() > dValue.real())
1653 if (_mCoords(0) == -1.0 || funcData.
mat1(i, j).real() < dKeep.real())
1655 dKeep = funcData.
mat1(i, j).real();
1662 else if (nType < 0 && funcData.
mat1(i, j).real() < dValue.real())
1664 if (_mCoords(0) == -1.0 || funcData.
mat1(i, j).real() > dKeep.real())
1666 dKeep = funcData.
mat1(i, j).real();
1676 if (_mCoords(0) == -1.0)
1678 else if (nType <= -2 || nType >= 2)
1679 _mReturn(0) = dKeep;
1740 size_t nElems = funcData.
mat1.
data().size();
1746 for (
size_t i = 0; i < nElems; i++)
1769 if (funcData.
nVal < 0 || funcData.
mVal < 0
1775 #pragma omp parallel for
1776 for (
int i = 0; i < (int)_mResult.
rows(); i++)
1778 for (
int j = 0; j < (int)_mResult.
cols(); j++)
1784 for (
int n = 0; n < 2*funcData.
nVal+1; n++)
1786 if (i+n-funcData.
nVal < 0 || i+n-funcData.
nVal >= (
int)funcData.
mat1.
rows())
1789 for (
int m = 0; m < 2*funcData.
mVal+1; m++)
1791 if (j+m-funcData.
mVal < 0 || j+m-funcData.
mVal >= (
int)funcData.
mat1.
cols())
1822 size_t nElems = funcData.
mat1.
data().size();
1828 for (
size_t i = 0; i < nElems; i++)
1849 size_t nLines = funcData.
fVal.real();
1850 size_t nCols = funcData.
nVal;
1856 return funcData.
mat1;
1859 _mReturn.
resize(nLines, nCols);
1902 #pragma omp parallel for
1903 for (
int i1 = 0; i1 < (int)mCorrelation.
rows(); i1++)
1905 for (
int j1 = 0; j1 < (int)mCorrelation.
cols(); j1++)
1908 for (
int i2 = 0; i2 < n +
std::min(i1-n+1, n-i1-1); i2++)
1910 for (
int j2 = 0; j2 < m +
std::min(j1-m+1, m-j1-1); j2++)
1914 mCorrelation(i1, j1) += mMatrix1(i2 +
std::max(0, i1-n+1), j2 +
std::max(0, j1-m+1))
1921 return mCorrelation;
1955 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
1957 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
1959 mCovariance(0) += (funcData.
mat1(i, j) - mAvg1(0)) * (funcData.
mat2(i, j) - mAvg2(0));
1991 double dMax =
std::max(fabs(_mMax(0)), fabs(_mMin(0)));
1993 #pragma omp parallel for
1994 for (
size_t i = 0; i < _mReturn.
rows(); i++)
1996 for (
size_t j = 0; j < _mReturn.
cols(); j++)
1998 _mReturn(i, j) /= dMax;
2020 size_t nLines = funcData.
fVal.real();
2021 size_t nCols = funcData.
nVal;
2033 for (
size_t i = 0; i < nLines*nCols; i++)
2035 _mReturn(i / nCols, i % nCols) = funcData.
mat1(i / funcData.
mat1.
cols(), i % funcData.
mat1.
cols());
2053 size_t n = funcData.
fVal.real();
2054 size_t m = funcData.
nVal;
2067 #pragma omp parallel for
2068 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
2070 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
2072 for (
size_t _n = 0; _n < n; _n++)
2074 for (
size_t _m = 0; _m < m; _m++)
2097 return isnan(value);
2113 return value1.real() < value2.real();
2126static std::vector<mu::value_type>
getUniqueList(std::list<mu::value_type>& _list)
2131 return std::vector<mu::value_type>(1, NAN);
2133 std::vector<mu::value_type> vReturn;
2135 for (
auto& val : _list)
2137 if (std::find(vReturn.begin(), vReturn.end(), val) == vReturn.end())
2138 vReturn.push_back(val);
2162 std::list<mu::value_type> dataList;
2172 _mReturn.
assign(1, uniqueList.size(), uniqueList);
2174 else if (funcData.
mat1.
cols() == 1)
2179 _mReturn.
assign(uniqueList.size(), 1, uniqueList);
2189 dataList.assign(retVal.
data().begin(), retVal.
data().end());
2191 _mReturn.
assign(uniqueList.size(), 1, uniqueList);
2193 else if (funcData.
nVal == 1)
2195 std::vector<std::vector<mu::value_type>> mBuffer;
2198 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
2202 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
2203 dataList.push_back(funcData.
mat1(i, j));
2208 _mReturn =
Matrix(mBuffer);
2212 std::vector<std::vector<mu::value_type>> mBuffer;
2215 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
2219 for (
size_t i = 0; i < funcData.
mat1.
rows(); i++)
2220 dataList.push_back(funcData.
mat1(i, j));
2225 _mReturn =
Matrix(mBuffer);
2255 _mReturn = funcData.
mat1;
2258 std::vector<mu::value_type>& dat = _mReturn.
data();
2260 for (
size_t i = 1; i < dat.size(); i++)
2274 std::vector<mu::value_type>& dat = _mReturn.
data();
2276 for (
size_t i = 1; i < dat.size(); i++)
2281 else if (funcData.
nVal == 1)
2283 _mReturn = funcData.
mat1;
2286 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2288 for (
size_t j = 1; j < _mReturn.
cols(); j++)
2289 _mReturn(i, j) += _mReturn(i, j-1);
2294 _mReturn = funcData.
mat1;
2297 for (
size_t j = 0; j < _mReturn.
cols(); j++)
2299 for (
size_t i = 1; i < _mReturn.
rows(); i++)
2300 _mReturn(i, j) += _mReturn(i-1, j);
2330 _mReturn = funcData.
mat1;
2333 std::vector<mu::value_type>& dat = _mReturn.
data();
2335 for (
size_t i = 1; i < dat.size(); i++)
2349 std::vector<mu::value_type>& dat = _mReturn.
data();
2351 for (
size_t i = 1; i < dat.size(); i++)
2356 else if (funcData.
nVal == 1)
2358 _mReturn = funcData.
mat1;
2361 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2363 for (
size_t j = 1; j < _mReturn.
cols(); j++)
2364 _mReturn(i, j) *= _mReturn(i, j-1);
2369 _mReturn = funcData.
mat1;
2372 for (
size_t j = 0; j < _mReturn.
cols(); j++)
2374 for (
size_t i = 1; i < _mReturn.
rows(); i++)
2375 _mReturn(i, j) *= _mReturn(i-1, j);
2398 std::string sSolution =
"sle(";
2399 std::vector<std::string> vResult(_mMatrix.
cols()-1,
"");
2400 bool bIsZeroesLine =
true;
2401 unsigned int nVarCount = 0;
2406 #pragma omp parallel for
2407 for (
unsigned int i = 0; i <
std::min(_mMatrix.
rows(), _mMatrix.
cols()-1); i++)
2409 for (
unsigned int j = 0; j < _mMatrix.
cols(); j++)
2411 _mToSolve(i, j) = _mMatrix(i, j);
2415 for (
int i = _mToSolve.
rows()-1; i >= 0; i--)
2417 bIsZeroesLine =
true;
2419 for (
unsigned int j = 0; j < _mToSolve.
cols(); j++)
2421 if (bIsZeroesLine && _mToSolve(i, j) == 0.0)
2423 bIsZeroesLine =
false;
2430 _mCoefficents(i, i) = 1.0;
2436 _mCoefficents(i, _mCoefficents.
cols()-1) = _mToSolve(i, _mToSolve.
cols()-1);
2438 for (
unsigned int j = i+1; j < _mToSolve.
cols()-1; j++)
2440 if (_mToSolve(i, j) != 0.0)
2443 _mCoefficents(i, _mCoefficents.
cols()-1) -= _mToSolve(i, j) * _mCoefficents(j, _mCoefficents.
cols()-1);
2446 for (
unsigned int n = i+1; n < _mCoefficents.
cols()-1; n++)
2448 _mCoefficents(i, n) -= _mToSolve(i, j) * _mCoefficents(j, n);
2455 for (
unsigned int i = 0; i < _mCoefficents.
rows(); i++)
2457 for (
unsigned int j = 0; j < _mCoefficents.
cols()-1; j++)
2459 if (_mCoefficents(i, j) != 0.0)
2461 if (fabs(_mCoefficents(i, j)) != 1.0)
2462 vResult[i] +=
toString(_mCoefficents(i, j), 5) +
"*";
2464 if (_mCoefficents(i, j) == -1.0)
2467 vResult[i] += (
'z'-vResult.size()+1+j);
2471 if (_mCoefficents(i, _mCoefficents.
cols()-1) != 0.0)
2472 vResult[i] +=
"+" +
toString(_mCoefficents(i, _mCoefficents.
cols()-1), 5);
2474 while (vResult[i].find(
"+-") != std::string::npos)
2475 vResult[i].erase(vResult[i].find(
"+-"),1);
2478 for (
unsigned int i = 0; i < nVarCount; i++)
2480 sSolution += (
'z'-nVarCount+i+1);
2483 sSolution +=
") := {";
2485 for (
unsigned int i = 0; i < vResult.size(); i++)
2487 sSolution += vResult[i];
2489 if (i < vResult.size()-1)
2496 sSolution +=
" "+
_lang.
get(
"MATOP_SOLVELGSSYMBOLIC_DEFINECOMMENT");
2498 bool bDefinitionSuccess =
false;
2504 bDefinitionSuccess = _functions.
defineFunc(sSolution);
2506 bDefinitionSuccess = _functions.
defineFunc(sSolution,
true);
2510 if (bDefinitionSuccess)
2537 if (_mToSolve.
rows() == 1)
2539 _mResult(0) = _mToSolve(0, 1)/_mToSolve(0);
2544 for (
unsigned int j = 0; j < _mToSolve.
cols()-1; j++)
2546 for (
unsigned int i = j; i < _mToSolve.
rows(); i++)
2548 if (_mToSolve(i, j) != 0.0)
2554 for (
unsigned int _j = 0; _j < _mToSolve.
cols(); _j++)
2556 dElement = _mToSolve(i, _j);
2557 _mToSolve(i, _j) = _mToSolve(j, _j);
2558 _mToSolve(j, _j) = dElement;
2567 for (
unsigned int _j = 0; _j < _mToSolve.
cols(); _j++)
2569 _mToSolve(i, _j) /= dPivot;
2572 #pragma omp parallel for
2573 for (
unsigned int _i = i+1; _i < _mToSolve.
rows(); _i++)
2580 for (
unsigned int _j = 0; _j < _mToSolve.
cols(); _j++)
2582 _mToSolve(_i, _j) -= _mToSolve(i, _j)*dFactor;
2594 if ((_mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-2) == 0.0 && _mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-1) == 0.0)
2595 || _mToSolve.
rows()+1 < _mToSolve.
cols())
2601 else if (_mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-2) == 0.0 && _mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-1) != 0.0)
2603 else if ((_mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-2) == 0.0 && _mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-1) == 0.0)
2604 || _mToSolve.
rows()+1 > _mToSolve.
cols())
2607 std::vector<bool> vIsZerosLine(_mToSolve.
rows(),
true);
2609 for (
unsigned int i = 0; i < _mToSolve.
rows(); i++)
2611 for (
unsigned int j = 0; j < _mToSolve.
cols(); j++)
2613 if (_mToSolve(i, j) != 0.0)
2615 vIsZerosLine[i] =
false;
2621 for (
unsigned int i = 0; i < vIsZerosLine.size(); i++)
2623 if (vIsZerosLine[i])
2625 for (
unsigned int _i = i+1; _i < vIsZerosLine.size(); _i++)
2627 if (!vIsZerosLine[_i])
2631 for (
unsigned int _j = 0; _j < _mToSolve.
cols(); _j++)
2633 dElement = _mToSolve(i, _j);
2634 _mToSolve(i, _j) = _mToSolve(_i, _j);
2635 _mToSolve(_i, _j) = dElement;
2638 vIsZerosLine[i] =
false;
2639 vIsZerosLine[_i] =
true;
2646 if (_mToSolve(_mToSolve.
cols()-2, _mToSolve.
cols()-2) == 0.0 && _mToSolve(_mToSolve.
cols()-2, _mToSolve.
cols()-1) == 0.0)
2653 _mResult(_mResult.
cols()-2, 0) = _mToSolve(_mToSolve.
cols()-2, _mToSolve.
cols()-1);
2656 _mResult(_mResult.
rows()-1, 0) = _mToSolve(_mToSolve.
rows()-1, _mToSolve.
cols()-1);
2658 for (
int i = _mToSolve.
cols()-3; i >= 0; i--)
2660 for (
unsigned int j = 0; j < _mToSolve.
cols()-1; j++)
2662 _mToSolve(i, _mToSolve.
cols()-1) -= _mToSolve(i, j)*_mResult(j, 0);
2664 if (_mToSolve(i, j)*_mResult(j, 0) != 0.0)
2665 _mToSolve(i, j) = 0.0;
2668 if (_mToSolve(i, i) == 0.0 && _mToSolve(i, _mToSolve.
cols()-1) == 0.0)
2675 if (_mToSolve(i, i) == 0.0 && _mToSolve(i, _mToSolve.
cols()-1) != 0.0)
2678 _mResult(i, 0) = _mToSolve(i, _mToSolve.
cols()-1);
2703 for (
size_t i = 0; i < _reshapedMat.
rows(); i++)
2705 _diagonalMat(i, i) = _reshapedMat(i);
2708 return _diagonalMat;
2732 #pragma omp parallel for
2733 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2766 #pragma omp parallel for
2767 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2769 _mReturn(i, 0) = std::sqrt(
intPower(funcData.
mat1(i, 0), 2)
2800 #pragma omp parallel for
2801 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2803 _mReturn(i, 0) = funcData.
mat1(i, 0) * cos(funcData.
mat1(i, 1));
2804 _mReturn(i, 1) = funcData.
mat1(i, 0) * sin(funcData.
mat1(i, 1));
2830 return funcData.
mat1;
2834 #pragma omp parallel for
2835 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2839 funcData.
mat1(i, 0) * sin(funcData.
mat1(i, 1)),
2840 funcData.
mat1(i, 2));
2870 #pragma omp parallel for
2871 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2873 _mReturn(i, 0) = funcData.
mat1(i, 0) * cos(funcData.
mat1(i, 1)) * sin(funcData.
mat1(i, 2));
2874 _mReturn(i, 1) = funcData.
mat1(i, 0) * sin(funcData.
mat1(i, 1)) * sin(funcData.
mat1(i, 2));
2875 _mReturn(i, 2) = funcData.
mat1(i, 0) * cos(funcData.
mat1(i, 2));
2902 #pragma omp parallel for
2903 for (
size_t i = 0; i < _mReturn.
rows(); i++)
2905 _mReturn(i, 0) = funcData.
mat1(i, 0) * sin(funcData.
mat1(i, 2));
2908 _mReturn(i, 2) = funcData.
mat1(i, 0) * cos(funcData.
mat1(i, 2));
2927 int sign = gaxes(0, axis).real() > gaxes(gaxes.
cols()-1, axis).real() ? -1 : 1;
2929 for (
size_t i = 0; i < gaxes.
rows(); i++)
2931 if (sign * gaxes(i, axis).
real() >= sign * axisval)
2940 return gaxes.
rows()-1;
2973 #pragma omp parallel for
2974 for (
size_t i = 0; i < gcoords.
rows(); i++)
2976 for (
size_t j = 0; j < gcoords.
cols(); j++)
2981 ? funcData.
mat1(pos+1, j) - funcData.
mat1(pos, j)
2982 : funcData.
mat1(pos, j) - funcData.
mat1(pos-1, j);
2984 gcoords(i, j) = pos + 1 + off.real() / interval.real();
3004 if (row < (
int)mat.
rows() && col < (
int)mat.
cols() && row >= 0 && col >= 0)
3005 return mat(row, col);
3027 int nBaseLine =
intCast(row) + (row < 0 ? -1 : 0);
3028 int nBaseCol =
intCast(col) + (col < 0 ? -1 : 0);
3031 double x = row - nBaseLine;
3032 double y = col - nBaseCol;
3045 f00 =
isnan(f00) ? 0.0 : f00;
3046 f10 =
isnan(f10) ? 0.0 : f10;
3047 f01 =
isnan(f01) ? 0.0 : f01;
3048 f11 =
isnan(f11) ? 0.0 : f11;
3051 return f00*(1-x)*(1-y) + f10*x*(1-y) + f01*(1-x)*y + f11*x*y;
3080 #pragma omp parallel for
3081 for (
size_t i = 0; i < funcData.
mat2.
rows(); i++)
3085 for (
size_t j = 1; j < funcData.
mat2.
cols(); j++)
3183 #pragma omp parallel for firstprivate(row,col)
3184 for (
size_t i = 0; i < selected.
rows(); i++)
3186 for (
size_t j = 0; j < selected.
cols(); j++)
3196 if (row >= 0 && row < (
int)funcData.
mat1.
rows()
3197 && col >= 0 && col < (
int)funcData.
mat1.
cols())
3198 selected(i, j) = funcData.
mat1(row, col);
3256 #pragma omp parallel for firstprivate(row,col)
3257 for (
size_t i = 0; i < funcData.
mat3.
rows(); i++)
3259 for (
size_t j = 0; j < funcData.
mat3.
cols(); j++)
3268 assembled(row, col) = funcData.
mat3(i, j);
3298 for (
size_t i = 0; i < funcData.
mat1.
rows()-1; i++)
3302 for (
size_t j = 0; j < funcData.
mat1.
cols(); j++)
3304 sum += ((funcData.
mat1(i+1, j) - funcData.
mat1(i, j)) * conj(funcData.
mat1(i+1, j) - funcData.
mat1(i, j))).real();
3307 mRes(0) += sqrt(sum);
3332 for (
size_t i = 0; i < kernel.
rows(); i++)
3334 for (
size_t j = 0; j < kernel.
cols(); j++)
3336 result += kernel(i, j) * inMatrix(rows[startRow + i], cols[startCol + j]);
3363 if (funcData.
nVal < 0 || funcData.
nVal > 1)
3365 std::string sMode = std::to_string(funcData.
nVal);
3374 size_t offsetRows = (funcData.
mat2.
rows() - 1) / 2;
3375 size_t offsetCols = (funcData.
mat2.
cols() - 1) / 2;
3382 switch (funcData.
nVal)
3385 rows.
prepend(std::vector<int>(offsetRows, 0));
3386 rows.
append(std::vector<int>(offsetRows, funcData.
mat2.
rows() - 1));
3387 cols.
prepend(std::vector<int>(offsetCols, 0));
3388 cols.
append(std::vector<int>(offsetCols, funcData.
mat2.
cols() - 1));
3402 #pragma omp parallel for
3403 for (
int i = 0; i < (int)_mResult.
rows(); i++)
3405 for (
int j = 0; j < (int)_mResult.
cols(); j++)
3440 std::map<std::string,MatFuncDef> mFunctions;
This class implements the function definition managing instance.
std::string getDefinitionString(size_t _i) const
Returns the definition string of the ith defined custom function.
bool defineFunc(const std::string &sExpr, bool bRedefine=false, bool bFallback=false)
This function defines a custom function, by passing it to a new FunctionDefinition class instance.
bool isDefined(const std::string &sFunc)
This method checks, whether the passed function is already defined.
size_t getFunctionIndex(const std::string &sFuncName)
Returns the numerical index of the selected custom defined functions.
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
This class defines a dynamic size 2D matrix with a single 1D internal buffer. If the internal buffer ...
std::string printDims() const
Convert the dimensions to a printable string.
Matrix vcat(const Matrix &mat) const
Vertically concatenate two matrices.
std::vector< mu::value_type > & data()
Get a reference to the internal data structure.
void resize(size_t r, size_t c)
Resize the matrix to another dimension. New elements will be zero-initialized.
bool isSquare() const
Simple function to identify square matrices.
bool isEmpty() const
Simple function to identify empty matrices.
size_t cols() const
The cols of this matrix.
void assign(const Matrix &mat)
Assign a matrix.
size_t rows() const
The rows of this matrix.
void transpose()
Transpose this matrix.
bool isScalar() const
Check, whether this matrix is actually a scalar.
Matrix hcat(const Matrix &mat) const
Horizontally concatenate two matrices.
bool containsInvalidValues() const
Returns true, if this matrix contains invalid values.
This class represents a single table in memory, or a - so to say - single memory page to be handled b...
void writeData(int _nLine, int _nCol, const mu::value_type &_dData)
This member function writes the passed value to the selected position. The table is automatically enl...
mu::value_type pct(const VectorIndex &_vLine, const VectorIndex &_vCol, mu::value_type dPct=0.5) const
Implementation for the PCT multi argument function.
void writeDataDirectUnsafe(int _nLine, int _nCol, const mu::value_type &_dData)
This member function provides an even more unsafe but direct way of writing data to the table....
mu::value_type med(const VectorIndex &_vLine, const VectorIndex &_vCol) const
Implementation for the MED multi argument function.
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
static void print(const std::string &__sLine, bool printingEnabled=true)
This member function appends the passed string as a new output line to the buffer and informs the ter...
FunctionDefinitionManager & getDefinitions()
static void issueWarning(std::string sWarningMessage)
This static function may be used to issue a warning to the user. The warning will be printed by the t...
This class manages the setting values of the internal (kernel) settings of this application.
bool systemPrints() const
Returns, whether system messages shall be printed to the terminal.
Common exception class for all exceptions thrown in NumeRe.
@ MATRIX_IS_NOT_INVERTIBLE
@ INVALID_STATS_WINDOW_SIZE
@ MATRIX_CONTAINS_INVALID_VALUES
@ MATRIX_CANNOT_HAVE_ZERO_SIZE
@ WRONG_MATRIX_DIMENSIONS_FOR_MATOP
@ LGS_HAS_NO_SOLUTION
INSERT HERE.
This class abstracts all the index logics, i.e. the logical differences between single indices and in...
void prepend(const std::vector< int > &vVector)
This function will prepend the passed vector before the beginning of the index vector....
void append(const std::vector< int > &vVector)
This function will append the passed vector to the end of the index vector. The internal storage is e...
std::string toSystemCodePage(std::string)
Converts an internal to an external string. Does nothing currently.
value_type parser_theta(const value_type &x, const value_type &y, const value_type &z)
This function calculates the angle of a vector and the z axis in any z-r plane (the polar angle theta...
value_type parser_phi(const value_type &x, const value_type &y)
This function calculates the angle of a vector and the x axis in the x-y plane (the azimuthal angle p...
static Matrix coordsToGrid(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function converts floating point coordinates to grid coordinates by using the grid axes a...
static Matrix polyLength(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Calculates the length of an open polygon. If the circumference of a closed polygon shall be calculate...
static mu::value_type calculateStats(const Matrix &mat, StatsLogic logic, int rowStart, size_t rowCount, int colStart, size_t colCount)
Driver code to calculate some statistics from a matrix while being able to use moving windows....
static Matrix cylToCart(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts cylindrical to cartesian coordinates.
static Matrix matrixMovNorm(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the norm() function.
static Matrix calcEigenVects(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Calculates the eigenvectors of the passed matrix.
static Matrix logToIndex(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function converts logical vectors into matrix indices.
static Matrix polarToCart(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts polar to cartesian coordinates.
static Matrix vcat(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static functions concatenates two matrices vertically. This is, the number of columns stays the ...
static Matrix matrixCmp(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the cmp() function on the matrix elements.
static Matrix matrixMovNum(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the num() function.
static Matrix cartToPolar(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts cartesian to polar coordinates.
static Matrix solveLGS(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function will solve the system of linear equations passed as matrix using the Gauss elimi...
static Matrix matrixMovMax(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the max() function.
static mu::value_type applyKernel(const Matrix &kernel, const Matrix &inMatrix, const VectorIndex &rows, const VectorIndex &cols, const size_t startRow, const size_t startCol)
This static helper function applies the kernel to the subset of a matrix using the provided indices.
static Matrix polarToCyl(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts polar to cylindrical coordinates.
static std::vector< mu::value_type > getUniqueList(std::list< mu::value_type > &_list)
This is a static helper function for the implementation of the unique() function.
static Matrix diagonalize(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Diagonalizes the passed matrix using its eigenvalues.
static Matrix matrixMin(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the min() function on the matrix elements.
static Matrix matrixMovMin(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the min() function.
static std::string printMatrixDim(const Matrix &mat)
Simple helper for printing the matrix dimensions to a string.
static Matrix interpolate(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function wraps the bilinear interpolation algorithm for interpolating the values of the f...
static Matrix matrixAnd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the and() function on the matrix elements.
static Matrix matrixOr(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the or() function on the matrix elements.
static Matrix indexToLog(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function converts matrix indices into logical vectors.
static Matrix selection(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Extracts a selection from a matrix iterating through two matrices simultaneously.
static Matrix cylToPolar(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts cylindrical to polar coordinates.
static Matrix matrixCutoff(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies a threshold to the complete matrix as specified by the arguments.
static bool is_nan(const mu::value_type &value)
Static helper function for std::list::remove_if() called in getUniqueList().
static Matrix matrixAvg(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the avg() function on the matrix elements.
static Matrix createShuffledMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function creates a shuffled vector of nShuffle elements created from a 1:nBase vector.
static size_t findNearestLowerGridAxisValue(const Matrix &gaxes, size_t axis, double axisval)
This static function finds the nearest lower grid axis value.
static Matrix diagonalMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the "diag()" function.
static Matrix matrixMovSum(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the sum() function.
static Matrix matrixSize(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function returns the size of the passed matrix.
static Matrix getDeterminant(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function calculates the determinant of the passed matrix.
static Matrix matrixPrd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the prd() function on the matrix elements.
Eigen::ComplexEigenSolver< Eigen::MatrixXcd > eSolver(mMatrix)
static Matrix createOnesMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function returns a matrix filled with ones of the defined size.
static Matrix matrixXor(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the xor() function on the matrix elements.
static Matrix matrixStd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the std() function on the matrix elements.
static Matrix hcat(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static functions concatenates two matrices horizontally. This is, the number of rows stays the s...
static Matrix matrixMaxPos(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the maxpos() function on the matrix elements.
static std::map< std::string, MatFuncDef > getMatrixFunctions()
Returns a map containing all declared and "standard" matrix functions.
static Matrix matrixMax(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the max() function on the matrix elements.
Eigen::MatrixXcd mMatrix(_mMatrix.rows(), _mMatrix.rows())
static Matrix transposeMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function transposes a matrix.
static Matrix matrixMinPos(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the minpos() function on the matrix elements.
static Matrix matrixSum(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the sum() function on the matrix elements.
static Matrix identityMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function returns an identity matrix of the defined size.
static Matrix createZeroesMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function returns a matrix filled with zeros of the defined size.
__attribute__((force_align_arg_pointer)) static Matrix calcEigenVectsAndValues(const Matrix &_mMatrix
This static function does the whole eigenvalues, eigenvectors and diagonalizing stuff.
static Matrix calcCrossProduct(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function calulates the n-dimensional cross product ("curl").
static Matrix calcTrace(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function calculates the trace of the passed matrix.
if(!_mMatrix.isSquare()) throw SyntaxError(SyntaxError if(_mMatrix.containsInvalidValues()) throw SyntaxError(SyntaxError Matrix _mEigenVals
static Matrix matrixUnique(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the unique(MAT,nDim) function.
static Matrix covariance(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the covariance calculation of the passed two matrices.
static Matrix matrixCumSum(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the cumsum(MAT,nDim) function.
static mu::value_type bilinearInterpolation(const Matrix &mat, double row, double col)
Performs the bilinear interpolation of the matrix value at the selected coordinates.
static Matrix matrixFilter(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Function that allows the user to apply a customer filter kernel to a matrix while applying different ...
static Matrix matrixMed(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the med() function on the matrix elements.
static Matrix cartToCyl(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Converts cartesian to cylindrical coordinates.
static mu::value_type readMat(const Matrix &mat, int row, int col)
Static helper function for bilinearInterpolation().
static Matrix calcEigenValues(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Calculates the eigenvalues of the passed matrix.
static Matrix matrixMovAvg(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the avg() function.
static Matrix matrixCumPrd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the cumprd(MAT,nDim) function.
static Matrix matrixPct(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the pct() function on the matrix elements.
static Matrix assemble(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Assembles a matrix from coordinates and values (a datagrid replacement without interpolation).
static Matrix matrixMovPrd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the prd() function.
static Matrix normalize(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the normalize function, which will normalize the (absolute) data rang...
static Matrix matrixRepMat(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function repeats the passed matrix n and m times.
std::mt19937 & getRandGenInstance()
Returns a reference to the central random number generator instance, which is globally accessible by ...
static bool isSmallerRealOnly(const mu::value_type &value1, const mu::value_type &value2)
Static helper function for std::sort() called in getUniqueList(). Determines a real-only order.
static Matrix matrixMovMed(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the med() function.
static void solveLGSSymbolic(const Matrix &_mMatrix, const MatFuncErrorInfo &errorInfo)
This static function solves the system of linear equations symbolically.
static mu::value_type calcDeterminant(const Matrix &_mMatrix, std::vector< int > vRemovedLines)
This static function calculates the determinant of the passed matrix using the LaPlace algorithm.
static Matrix matrixReshape(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function changes the number of rows and columns to fit the new shape.
static Matrix invalidMatrixFunction(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Static invalid matrix function, which will always throw an error.
static Matrix matrixNum(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the num() function on the matrix elements.
static Matrix matrixCnt(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the cnt() function on the matrix elements.
static Matrix matrixMovStd(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Moving window version of the std() function.
int const MatFuncErrorInfo & errorInfo
static Matrix createFilledMatrix(size_t n, size_t m, const mu::value_type &val)
This static function returns a matrix filled with the passed value of the defined size.
static Matrix invertMatrix(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
Calculates the inverse matrix and checks in advance, whether the matrix is invertible.
static Matrix matrixNorm(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function applies the norm() function on the matrix elements.
static Matrix correlation(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function implements the cross- and auto-correlation matrix calculation from the passed tw...
static Matrix matrixResize(const MatFuncData &funcData, const MatFuncErrorInfo &errorInfo)
This static function changes the size of the passed matrix to fit the new size.
std::complex< double > intPower(const std::complex< double > &, int)
This function calculates the power of a value with the specialization that the exponent is an integer...
CONSTCD11 std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
MUP_BASETYPE value_type
The numeric datatype used by the parser.
bool isnan(const value_type &v)
std::vector< double > real(const std::vector< value_type > &vVec)
bool isinf(const value_type &v)
value_type rint(value_type v)
Defines a matrix function itself by containing the signature, the pointer to the implementation and a...
Defines the needed information for displaying a reasonable error information.
const std::string & command
Simplify the creation of some statistics by externalizing the operation code and unifying the driver ...
long long int intCast(const std::complex< double > &)
Casts the real part of the complex number to an integer and avoids rounding errors.
std::string toString(int)
Converts an integer to a string without the Settings bloat.