DGtal 2.1.0
Loading...
Searching...
No Matches
IntegerMatrixFunctions.h
1
17#pragma once
18
32#if defined(IntegerMatrixFunctions_RECURSES)
33#error Recursive header files inclusion detected in IntegerMatrixFunctions.h
34#else // defined(IntegerMatrixFunctions_RECURSES)
36#define IntegerMatrixFunctions_RECURSES
37
38#if !defined IntegerMatrixFunctions_h
40#define IntegerMatrixFunctions_h
41
43// Inclusions
44#include "DGtal/base/Common.h"
45#include "DGtal/kernel/ArithmeticConversionTraits.h"
46#include "DGtal/arithmetic/IntegerComputer.h"
47#include "DGtal/math/linalg/SimpleMatrix.h"
49
50namespace DGtal
51{
52
53 namespace functions {
54
59 template <typename TComponent>
60 void
61 negate( std::vector<TComponent> &V );
62
71 template <typename TComponent>
72 bool
73 equals( const std::vector<TComponent> &a, const std::vector<TComponent> &b );
74
85 template <typename T, typename U >
87 dotProduct( const std::vector<T>& a, const std::vector<U>& b );
88
96 double
97 dotProduct( const std::vector<BigInteger>& a, const std::vector<double>& b );
98
106 double
107 dotProduct( const std::vector<double>& a, const std::vector<BigInteger>& b );
108
118 template <typename T, typename U >
119 std::vector< typename DGtal::ArithmeticConversionTraits<T,U>::type >
120 crossProduct( const std::vector<T>& a, const std::vector<U>& b );
121
135 template <typename T, typename U, typename Op2 >
136 std::vector< typename DGtal::ArithmeticConversionTraits<T,U>::type >
137 apply( const std::vector<T>& a, const std::vector<U>& b,
138 Op2 op2 );
139
149 template <typename T>
150 T
151 squaredNormL2( const std::vector<T>& a );
152
160 template <typename T>
161 T
162 normL1( const std::vector<T>& a );
163
171 template <typename T>
172 T
173 normLoo( const std::vector<T>& a );
174
183 template <typename TOutput, typename T>
184 void
185 getSquaredNormL2( TOutput& n, const std::vector<T>& a );
186
213 template <typename TOutput,
215 typename TEuclideanRing,
216 typename TContainer>
217 void
218 getSquaredNormL2( TOutput& n,
220
237 template <typename TComponent, DGtal::Dimension TN,
238 typename TInternalNumber>
239 void
240 getDeterminantBareiss( TInternalNumber& result,
241 const SimpleMatrix<TComponent, TN, TN>& matrix );
242
258 template <typename TComponent, typename TInternalNumber>
259 void
260 getDeterminantBareiss( TInternalNumber& result,
261 const std::vector< std::vector< TComponent > >& matrix );
262
273 template <typename TComponent>
274 std::vector< std::vector< TComponent > >
275 matrixAsVectorVector( std::size_t m, std::size_t n,
276 const std::vector< TComponent >& c );
277
288 template <typename TComponent, DGtal::Dimension TM, DGtal::Dimension TN>
289 std::vector< std::vector< TComponent > >
291
322 template <typename TComponent, typename TDouble = long double >
323 std::vector< std::vector< TComponent > >
324 computeLLLBasis( const std::vector< std::vector< TComponent > >& B,
325 TDouble delta = 0.75 );
326
357 template <typename TComponent, typename TDouble = long double >
358 void
359 reduceBasisWithLLL( std::vector< std::vector< TComponent > >& B,
360 TDouble delta = 0.75 );
361
370 template <typename TComponent>
371 TComponent
372 makePrimitive( std::vector< TComponent >& N );
373
383 template <typename TComponent>
384 TComponent
385 extendedGcd( TComponent& x, TComponent& y, TComponent a,TComponent b );
386
398 template <typename TComponent>
399 TComponent
400 extendedGcd( std::vector<TComponent> &C, const std::vector<TComponent> &A );
401
402
422 template <typename TComponent>
423 std::vector< std::vector< TComponent > >
424 computeOrthogonalLattice( std::vector< TComponent > N );
425
435 template <typename TComponent>
436 bool
437 shortenVectors( std::vector< TComponent >& u,
438 std::vector< TComponent >& v );
439
451 template <typename TComponent>
452 std::size_t
453 shortenBasis( std::vector< std::vector< TComponent > >& B );
454
455 } // namespace functions
456
457} // namespace DGtal
458
459
461// Includes inline functions.
462#include "DGtal/math/linalg/IntegerMatrixFunctions.ih"
463
464// //
466
467#endif // !defined IntegerMatrixFunctions_h
468
469#undef IntegerMatrixFunctions_RECURSES
470#endif // else defined(IntegerMatrixFunctions_RECURSES)
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: implements basic MxN Matrix services (M,N>=1).
std::vector< std::vector< TComponent > > matrixAsVectorVector(std::size_t m, std::size_t n, const std::vector< TComponent > &c)
bool shortenVectors(std::vector< TComponent > &u, std::vector< TComponent > &v)
std::vector< typename DGtal::ArithmeticConversionTraits< T, U >::type > apply(const std::vector< T > &a, const std::vector< U > &b, Op2 op2)
void getSquaredNormL2(TOutput &n, const std::vector< T > &a)
void reduceBasisWithLLL(std::vector< std::vector< TComponent > > &B, TDouble delta=0.75)
T normLoo(const std::vector< T > &a)
std::size_t shortenBasis(std::vector< std::vector< TComponent > > &B)
T squaredNormL2(const std::vector< T > &a)
bool equals(const std::vector< TComponent > &a, const std::vector< TComponent > &b)
std::vector< typename DGtal::ArithmeticConversionTraits< T, U >::type > crossProduct(const std::vector< T > &a, const std::vector< U > &b)
DGtal::ArithmeticConversionTraits< T, U >::type dotProduct(const std::vector< T > &a, const std::vector< U > &b)
std::vector< std::vector< TComponent > > computeLLLBasis(const std::vector< std::vector< TComponent > > &B, TDouble delta=0.75)
TComponent makePrimitive(std::vector< TComponent > &N)
std::vector< std::vector< TComponent > > computeOrthogonalLattice(std::vector< TComponent > N)
void negate(std::vector< TComponent > &V)
void getDeterminantBareiss(TInternalNumber &result, const SimpleMatrix< TComponent, TN, TN > &matrix)
TComponent extendedGcd(TComponent &x, TComponent &y, TComponent a, TComponent b)
T normL1(const std::vector< T > &a)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition Common.h:119
Aim: Trait class to get result type of arithmetic binary operators between two given types.