35 #ifndef _BLAZE_MATH_DENSE_LU_H_
36 #define _BLAZE_MATH_DENSE_LU_H_
71 template<
typename MT1,
bool SO1,
typename MT2,
typename MT3,
typename MT4,
bool SO2 >
72 void lu(
const DenseMatrix<MT1,SO1>& A, DenseMatrix<MT2,SO1>& L,
73 DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P );
91 template<
typename MT1
95 void lu( DenseMatrix<MT1,SO1>& A, Matrix<MT2,SO2>& P )
103 const size_t m( (~A).
rows() );
104 const size_t n( (~A).
columns() );
105 const size_t mindim(
min( m, n ) );
106 const size_t size( SO1 ? m : n );
108 UniqueArray<int> helper(
new int[mindim +
size] );
109 int* ipiv ( helper.get() );
110 int* permut( ipiv + mindim );
114 for(
size_t i=0UL; i<
size; ++i ) {
118 for(
int i=0; i<mindim; ++i ) {
127 for(
size_t i=0UL; i<
size; ++i ) {
128 (~P)( ( SO1 ? permut[i] : i ), ( SO1 ? i : permut[i] ) ) = ET(1);
211 template<
typename MT1
236 const size_t m( (~A).
rows() );
237 const size_t n( (~A).
columns() );
238 const size_t mindim(
min( m, n ) );
239 const size_t size( SO1 ? m : n );
264 for(
size_t i=0UL; i<m; ++i )
266 for(
size_t j=0UL; j<i; ++j ) {
277 for(
size_t j=0UL; j<m; ++j )
281 for(
size_t i=j+1UL; i<m; ++i ) {
298 for(
size_t i=0UL; i<n; ++i )
302 for(
size_t j=i+1UL; j<n; ++j ) {
310 for(
size_t j=0UL; j<n; ++j )
312 for(
size_t i=0UL; i<j; ++i ) {
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Header file for mathematical functions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
Constraint on the data type.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ADAPTOR_TYPE(T)
Constraint on the data type.In case the given data type T is an adaptor type (as for instance LowerMa...
Definition: Adaptor.h:118
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Constraint on the data type.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
Header file for the DenseMatrix base class.
void lu(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO1 > &L, DenseMatrix< MT3, SO1 > &U, Matrix< MT4, SO2 > &P)
LU decomposition of the given dense matrix.
Definition: LU.h:217
Compile time check for square matrices.This type trait tests whether or not the given template parame...
Definition: IsSquare.h:87
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:118
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
void getrf(int m, int n, float *A, int lda, int *ipiv, int *info)
LAPACK kernel for the LU decomposition of the given dense general single precision column-major matri...
Definition: getrf.h:139
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:118
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BlasCompatible.h:79
Constraint on the data type.
Evaluation of the return type of the derestrict function.Via this type trait it is possible to evalua...
Definition: DerestrictTrait.h:74
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_STRICTLY_TRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a strictly lower or upper triangular mat...
Definition: StrictlyTriangular.h:118
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:116
Header file for exception macros.
Header file for the IsResizable type trait.
Header file for the LAPACK LU decomposition functions (getrf)