Package geometry :: Package manifolds :: Module matrix_lie_algebra
[hide private]
[frames] | no frames]

Source Code for Module geometry.manifolds.matrix_lie_algebra

 1  from . import MatrixLinearSpace, contract 
 2  from abc import abstractmethod 
3 4 5 -class MatrixLieAlgebra(MatrixLinearSpace):
6 ''' This is the base class for Matrix Lie Algebra. 7 8 It is understood that it is composed by square matrices. 9 10 The only function that *has* to be implemented is the 11 :py:func:`project` function that projects a square matrix 12 onto the algebra. This function is used both for checking 13 that a vector is in the algebra (see :py:func:`belongs`) 14 and to mitigate the numerical errors. 15 16 You probably also want to implement :py:func:`norm` if 17 the default is not what you want. 18 ''' 19
20 - def __init__(self, n, dimension):
21 MatrixLinearSpace.__init__(self, dimension=dimension, 22 shape=(n, n)) 23 self.n = n
24 25 @abstractmethod 26 @contract(a='belongs', returns='array[K]')
27 - def vector_from_algebra(self, a):
28 ''' Isomorphism from elements of the algebra to vectors. 29 (For example, so(3) <==> R^3). 30 '''
31 #raise ValueError('Not implemented for %s.' % self) 32 33 @abstractmethod 34 @contract(returns='belongs', v='array[K]')
35 - def algebra_from_vector(self, v):
36 ''' Isomorphism from elements of the algebra to vectors. 37 (For example, so(3) <==> R^3). 38 '''
39 #raise ValueError('Not implemented for %s.' % self) 40 41 # TODO: bracket 42