Go to the documentation of this file.
7 #ifndef UPPER_HESSENBERG_QR_H
8 #define UPPER_HESSENBERG_QR_H
42 template <
typename Scalar =
double>
157 throw std::invalid_argument(
"UpperHessenbergQR: matrix must be square");
199 ptr[0] =
c * tmp -
s * ptr[1];
200 ptr[1] =
s * tmp +
c * ptr[1];
223 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
238 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
260 Yi[
j] =
c * tmp -
s * Yi1[
j];
261 Yi1[
j] =
s * tmp +
c * Yi1[
j];
270 dest.diagonal().array() +=
m_shift;
285 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
295 Y[
i] =
c * tmp +
s *
Y[
i + 1];
296 Y[
i + 1] = -
s * tmp +
c *
Y[
i + 1];
312 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
323 Y[
i] =
c * tmp -
s *
Y[
i + 1];
324 Y[
i + 1] =
s * tmp +
c *
Y[
i + 1];
341 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
351 Yi.noalias() =
Y.row(
i);
352 Yi1.noalias() =
Y.row(
i + 1);
353 Y.row(
i) =
c * Yi +
s * Yi1;
354 Y.row(
i + 1) = -
s * Yi +
c * Yi1;
371 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
382 Yi.noalias() =
Y.row(
i);
383 Yi1.noalias() =
Y.row(
i + 1);
384 Y.row(
i) =
c * Yi -
s * Yi1;
385 Y.row(
i + 1) =
s * Yi +
c * Yi1;
402 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
416 Scalar *Y_col_i, *Y_col_i1;
418 const Index nrow =
Y.rows();
424 Y_col_i = &
Y.coeffRef(0,
i);
425 Y_col_i1 = &
Y.coeffRef(0,
i + 1);
429 Y_col_i[
j] =
c * tmp -
s * Y_col_i1[
j];
430 Y_col_i1[
j] =
s * tmp +
c * Y_col_i1[
j];
448 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
458 Yi.noalias() =
Y.col(
i);
459 Y.col(
i) =
c * Yi +
s *
Y.col(
i + 1);
460 Y.col(
i + 1) = -
s * Yi +
c *
Y.col(
i + 1);
474 template <
typename Scalar =
double>
528 this->m_n =
mat.rows();
529 if (this->m_n !=
mat.cols())
530 throw std::invalid_argument(
"TridiagQR: matrix must be square");
532 this->m_shift = shift;
537 this->m_rot_cos.
resize(this->m_n - 1);
538 this->m_rot_sin.
resize(this->m_n - 1);
541 m_T_lsub.noalias() =
mat.diagonal(-1);
546 *
s = this->m_rot_sin.
data(),
548 const Index n1 = this->m_n - 1;
593 this->m_computed =
true;
605 if (!this->m_computed)
606 throw std::logic_error(
"TridiagQR: need to call compute() first");
608 Matrix R = Matrix::Zero(this->m_n, this->m_n);
625 if (!this->m_computed)
626 throw std::logic_error(
"TridiagQR: need to call compute() first");
629 dest.
resize(this->m_n, this->m_n);
631 dest.diagonal().noalias() =
m_T_diag;
641 const Index n1 = this->m_n - 1;
657 dest.diagonal(1).noalias() = dest.diagonal(-1);
660 dest.diagonal().array() += this->
m_shift;
670 #endif // UPPER_HESSENBERG_QR_H
void matrix_QtHQ(Matrix &dest) const
void apply_QY(GenericMatrix Y) const
void compute(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
GaussianFactorGraphValuePair Y
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
virtual ~UpperHessenbergQR()
General-purpose arrays with easy API for coefficient-wise operations.
Eigen::Matrix< Scalar, 1, Eigen::Dynamic > RowVector
void apply_QtY(GenericMatrix Y) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
virtual void compute(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
void apply_YQ(GenericMatrix Y) const
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
static void compute_rotation(const Scalar &x, const Scalar &y, Scalar &r, Scalar &c, Scalar &s)
void apply_YQt(GenericMatrix Y) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar & coeff(Index rowId, Index colId) const
void apply_QtY(Vector &Y) const
UpperHessenbergQR(Index size)
A matrix or vector expression mapping an existing expression.
Eigen::Array< Scalar, Eigen::Dynamic, 1 > Array
const typedef Eigen::Ref< const Matrix > ConstGenericMatrix
TridiagQR(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
virtual Matrix matrix_R() const
Eigen::Ref< Matrix > GenericMatrix
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size ratio
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar & coeff(Index rowId, Index colId) const
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar * data() const
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
virtual void matrix_QtHQ(Matrix &dest) const
void apply_QY(Vector &Y) const
UpperHessenbergQR(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Jet< T, N > sqrt(const Jet< T, N > &f)
Rot2 R(Rot2::fromAngle(0.1))
const typedef Eigen::Ref< const Matrix > ConstGenericMatrix
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:40