31 #ifndef TOON_INCLUDE_SL_H
32 #define TOON_INCLUDE_SL_H
42 template <
int N,
typename P>
class SL;
58 template <
int N,
typename Precision =
double>
60 friend std::istream &
operator>> <N,Precision>(std::istream &,
SL &);
63 static const int dim = N*N - 1;
69 template <
int S,
typename P,
typename B>
73 template <
int R,
int C,
typename P,
typename A>
88 template <
int S,
typename P,
typename B>
107 assert(
abs(det) > 0);
125 template <
int N,
typename Precision>
126 template <
int S,
typename P,
typename B>
130 for(
int i = 0; i < dim; ++i)
131 t += generator(i) * v[i];
137 template <
int N,
typename Precision>
139 assert( i > -1 && i < dim );
143 result(i+1,i+1) = -1;
144 }
else if(i < SYMM_LIMIT){
145 int row = 0, col = i - DIAG_LIMIT + 1;
146 while(col > (N - row - 1)){
147 col -= (N - row - 1);
151 result(row, col) = result(col, row) = 1;
153 int row = 0, col = i - SYMM_LIMIT + 1;
154 while(col > N - row - 1){
159 result(row, col) = -1;
160 result(col, row) = 1;
165 template <
int S,
typename PV,
typename B,
int N,
typename P>
170 template <
int S,
typename PV,
typename B,
int N,
typename P>
175 template<
int R,
int C,
typename PM,
typename A,
int N,
typename P>
inline
180 template<
int R,
int C,
typename PM,
typename A,
int N,
typename P>
inline
185 template <
int N,
typename P>
186 std::ostream & operator<<(std::ostream & out, const SL<N, P> & h){
187 out << h.get_matrix();
191 template <
int N,
typename P>
SL(const SL &from, struct Invert)
static Operator< Internal::Identity< Internal::One > > Identity
static const int COUNT_SYMM
P determinant(const Matrix< R, C, P, B > &A)
static SL exp(const Vector< S, P, B > &)
SL(const Vector< S, P, B > &v)
exp constructor, creates element through exponentiation of Lie algebra vector. see SL::exp...
Matrix< N, N, Precision > my_matrix
}
Everything lives inside this namespace.
static const int COUNT_DIAG
static void test(int s1, int s2)
SL(const Matrix< R, C, P, A > &M)
copy constructor from a matrix, coerces matrix to be of determinant = 1
static const int size
size of the matrices represented by SL
SL inverse() const
returns the inverse using LU
SL operator*(const SL &rhs) const
multiplies to SLs together by multiplying the underlying matrices
static Matrix< N, N, Precision > generator(int)
static const int DIAG_LIMIT
SL(const SL &a, const SL &b)
static const int SYMM_LIMIT
Matrix< R, C, P > exp(const Matrix< R, C, P, B > &m)
SL()
default constructor, creates identity element
static const int dim
dimension of the vector space represented by SL
Vector< N, Precision > gaussian_elimination(Matrix< N, N, Precision > A, Vector< N, Precision > b)
static const int COUNT_ASYMM
std::istream & operator>>(std::istream &is, Vector< Size, Precision, Base > &v)
SL operator*=(const SL &rhs)
right multiplies this SL with another one
Vector< Internal::Sizer< S1, S2 >::size, typename Internal::MultiplyType< P1, P2 >::type > operator*(const DiagonalMatrix< S1, P1, B1 > &d, const Vector< S2, P2, B2 > &v)
static Operator< Internal::Zero > Zeros
const Matrix< N, N, Precision > & get_matrix() const
returns the represented matrix