1 #ifndef TOON_INCLUDE_QR_LAPACK_H
2 #define TOON_INCLUDE_QR_LAPACK_H
30 template<
int Rows=Dynamic,
int Cols=Rows,
class Precision=
double>
41 template<
int R,
int C,
class P,
class B>
74 int M =
copy.num_rows();
75 int N =
copy.num_cols();
87 for(
int i=0; i <
pivot.size(); i++)
92 geqp3_(&M, &N,
copy.get_data_ptr(), &lda,
pivot.get_data_ptr(),
tau.get_data_ptr(), &size, &LWORK, &INFO);
96 Precision* work =
new Precision[LWORK];
98 geqp3_(&M, &N,
copy.get_data_ptr(), &lda,
pivot.get_data_ptr(),
tau.get_data_ptr(), work, &LWORK, &INFO);
102 std::cerr <<
"error in QR, INFO was " << INFO << std::endl;
114 orgqr_(&M, &N, &K,
Q.get_data_ptr(), &lda,
tau.get_data_ptr(), work, &LWORK, &INFO);
117 std::cerr <<
"error in QR, INFO was " << INFO << std::endl;
123 for(
int c=0; c<r; c++)
128 for(
int i=0; i <
pivot.size(); i++)
141 return std::min(copy.num_rows(), copy.num_cols());
Vector< Cols, int > pivot
static const int square_Size
Everything lives inside this namespace.
void orgqr_(int *M, int *N, int *K, float *A, int *LDA, float *TAU, float *WORK, int *LWORK, int *INFO)
static const int Dynamic
Template size value used to indicate dynamically sized vectors and matrices.
Matrix< square_Size, square_Size, Precision, ColMajor > Q
Matrix< Rows, Cols, Precision, ColMajor > copy
const Matrix< square_Size, square_Size, Precision, ColMajor > & get_Q()
Return Q.
QR_Lapack(const Matrix< R, C, P, B > &m, bool p=0)
const Vector< Cols, int > & get_P()
const Matrix< Rows, Cols, Precision, ColMajor > & get_R()
Return R.
static Operator< Internal::Zero > Zeros
Vector< square_Size, Precision > tau
void geqp3_(int *M, int *N, float *A, int *LDA, int *JPVT, float *TAU, float *WORK, int *LWORK, int *INFO)