17#ifndef BELFEM_FN_SMITH_HPP
18#define BELFEM_FN_SMITH_HPP
30 for (
uint k = 0; k < n; k++)
33 aMat(i-1,k) = aMat(j-1,k);
47 for (
uint k = 0; k < m; k++)
50 aMat(k,i-1) = aMat(k,j-1);
62 for (
uint k = 0; k < n; k++)
75 for (
uint k = 0; k < m; k++)
88 for (
uint k = 0; k < n; k++)
90 aMat(i-1,k) +=
q*aMat(j-1,k) ;
101 for (
uint k = 0; k < m; k++)
103 aMat(k,j-1) +=
q*aMat(k,i-1) ;
180 for(
uint i = k+1; i < m+1; ++i)
182 const int q = aMat(i-1,l-1)/aMat(k-1,l-1);
194 for(
uint i = l+1; i < n+1; ++i)
196 const int q = aMat(k-1,i-1)/aMat(k-1,l-1);
204 std::pair<uint, uint>
209 while (
alpha == 0 && k < v.length())
212 alpha = std::abs(v(k-1));
215 for(
uint i = k; i < v.length(); ++i)
217 if (std::abs(v(i)) <
alpha && std::abs(v(i)) != 0)
219 alpha = std::abs(v(i));
223 return std::pair(
alpha,i0);
247 for (
uint i = k; i < m; ++i)
249 if (aMat(i,l-1) != 0)
262 for (
uint i = k; i < m; ++i)
264 if (aMat(i,l-1) != 0)
276 std::tuple< Matrix< T >, Matrix< T >,
uint >
283 for(
uint i = 0; i < m; ++i)
293 while (k < m and n > 0)
297 for (
uint i = k; i < m; ++i)
299 if (aMat(i,l-1) != 0)
314 for (
uint i = k; i < m; i++ )
316 if ( aMat( i, l-1 ) != 0 )
336 std::tuple< Matrix< T >, Matrix< T > >
342 tMatT =
trans(tMatT);
349 for(
uint i = k; i < n; ++i)
353 tKer(j,tCount) = tPT(j,i);
359 for(
uint i = 0; i < k; ++i)
363 tIm(j,i) = tMatT(j,i);
367 return std::tuple< Matrix< T >,
Matrix< T > > (tKer, tIm);
373 std::pair<uint, uint>
379 moveMinNonzero(Matrix< int > &aMat, Matrix< int > &aQ, Matrix< int > &aQ_, Matrix< int > &aR, Matrix< int > &aR_,
const uint k);
383 std::tuple< bool, uint, uint, int >
389 partSmithForm(Matrix< int > &aMat, Matrix< int > &aQ, Matrix< int > &aQ_, Matrix< int > &aR, Matrix< int > &aR_,
const uint k);
393 std::tuple< Matrix< int >, Matrix< int >,Matrix< int >,Matrix< int >,
uint,
uint >
399 SolveInt(Matrix< int > aMat, Matrix< int > &aVec);
Dense column-major matrix.
Definition cl_BZ_Matrix.hpp:28
auto col(const size_t aColIndex) -> decltype(mMatrix.col(aColIndex))
Definition cl_AR_Matrix.hpp:325
size_t n_rows() const
Definition cl_AR_Matrix.hpp:183
size_t n_cols() const
Definition cl_AR_Matrix.hpp:191
Column vector.
Definition cl_BZ_Vector.hpp:41
USER GUIDES:
Definition cl_Capacitor.cpp:16
void rowReduce(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint k, const uint l)
Definition fn_Smith.hpp:241
Matrix< int > SolveInt(Matrix< int > aMat, Matrix< int > &aVec)
Definition fn_Smith.cpp:224
void columnMultiplyOperation(Matrix< T > &aMat, Matrix< T > &aR, Matrix< T > &aR_, const uint i)
Definition fn_Smith.hpp:155
std::tuple< Matrix< T >, Matrix< T > > kernelImage(Matrix< T > &aMat)
Definition fn_Smith.hpp:337
std::tuple< bool, uint, uint, int > checkForDivisibility(Matrix< int > &aMat, const uint k)
Definition fn_Smith.cpp:61
void columnAdd(Matrix< T > &aMat, const uint i, const uint j, const int q)
Definition fn_Smith.hpp:98
void rowPrepare(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint k, const uint l)
Definition fn_Smith.hpp:230
void rowExchangeOperation(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint i, const uint j)
Definition fn_Smith.hpp:111
void rowAddOperation(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint i, const uint j, const int q)
Definition fn_Smith.hpp:133
std::pair< uint, uint > minNonzero(Matrix< int > &aMat, const uint k)
Definition fn_Smith.cpp:26
unsigned int uint
Definition typedefs.hpp:30
void rowExchange(Matrix< T > &aMat, const uint i, const uint j)
Definition fn_Smith.hpp:26
auto trans(Matrix< T > &aMatrix) -> decltype(trans(aMatrix.matrix_data()))
Definition fn_trans.hpp:74
void rowAdd(Matrix< T > &aMat, const uint i, const uint j, const int q)
Definition fn_Smith.hpp:85
std::tuple< Matrix< int >, Matrix< int >, Matrix< int >, Matrix< int >, uint, uint > smithForm(Matrix< int > &aMat)
Definition fn_Smith.cpp:143
void rowMultiply(Matrix< T > &aMat, const uint i)
Definition fn_Smith.hpp:59
void columnMultiply(Matrix< T > &aMat, const uint i)
Definition fn_Smith.hpp:72
std::tuple< Matrix< T >, Matrix< T >, uint > rowEchelon(Matrix< T > &aMat)
Definition fn_Smith.hpp:277
void partSmithForm(Matrix< int > &aMat, Matrix< int > &aQ, Matrix< int > &aQ_, Matrix< int > &aR, Matrix< int > &aR_, const uint k)
Definition fn_Smith.cpp:84
@ alpha
Definition cl_Material.hpp:161
@ q
Definition cl_Material.hpp:176
void columnExchange(Matrix< T > &aMat, const uint i, const uint j)
Definition fn_Smith.hpp:43
void rowMultiplyOperation(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint i)
Definition fn_Smith.hpp:122
void moveMinNonzero(Matrix< int > &aMat, Matrix< int > &aQ, Matrix< int > &aQ_, Matrix< int > &aR, Matrix< int > &aR_, const uint k)
Definition fn_Smith.cpp:50
void columnExchangeOperation(Matrix< T > &aMat, Matrix< T > &aR, Matrix< T > &aR_, const uint i, const uint j)
Definition fn_Smith.hpp:144
void columnAddOperation(Matrix< T > &aMat, Matrix< T > &aR, Matrix< T > &aR_, const uint i, const uint j, const int q)
Definition fn_Smith.hpp:166
void partColumnReduce(Matrix< T > &aMat, Matrix< T > &aR, Matrix< T > &aR_, const uint k, const uint l)
Definition fn_Smith.hpp:191
std::pair< uint, uint > smallestNonzero(Vector< T > &v, uint k)
Definition fn_Smith.hpp:205
void partRowReduce(Matrix< T > &aMat, Matrix< T > &aQ, Matrix< T > &aQ_, const uint k, const uint l)
Definition fn_Smith.hpp:177