Go to the documentation of this file.
7 #ifndef SPECTRA_UPPER_HESSENBERG_QR_H
8 #define SPECTRA_UPPER_HESSENBERG_QR_H
15 #include "../Util/TypeTraits.h"
44 template <
typename Scalar =
double>
111 const Scalar tc = t2 * (
c2 - c38 * t2);
114 r =
a +
c2 *
b *
t * (
c1 - t2 * (c4 - c8 * t2));
227 throw std::invalid_argument(
"UpperHessenbergQR: matrix must be square");
268 const Scalar tmp = ptr[0];
269 ptr[0] =
c * tmp -
s * ptr[1];
270 ptr[1] =
s * tmp +
c * ptr[1];
293 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
308 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
330 Yi[
j] =
c * tmp -
s * Yi1[
j];
331 Yi1[
j] =
s * tmp +
c * Yi1[
j];
340 dest.diagonal().array() +=
m_shift;
355 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
365 Y[
i] =
c * tmp +
s *
Y[
i + 1];
366 Y[
i + 1] = -
s * tmp +
c *
Y[
i + 1];
382 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
393 Y[
i] =
c * tmp -
s *
Y[
i + 1];
394 Y[
i + 1] =
s * tmp +
c *
Y[
i + 1];
411 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
421 Yi.noalias() =
Y.row(
i);
422 Yi1.noalias() =
Y.row(
i + 1);
423 Y.row(
i) =
c * Yi +
s * Yi1;
424 Y.row(
i + 1) = -
s * Yi +
c * Yi1;
441 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
452 Yi.noalias() =
Y.row(
i);
453 Yi1.noalias() =
Y.row(
i + 1);
454 Y.row(
i) =
c * Yi -
s * Yi1;
455 Y.row(
i + 1) =
s * Yi +
c * Yi1;
472 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
486 Scalar *Y_col_i, *Y_col_i1;
488 const Index nrow =
Y.rows();
494 Y_col_i = &
Y.coeffRef(0,
i);
495 Y_col_i1 = &
Y.coeffRef(0,
i + 1);
499 Y_col_i[
j] =
c * tmp -
s * Y_col_i1[
j];
500 Y_col_i1[
j] =
s * tmp +
c * Y_col_i1[
j];
518 throw std::logic_error(
"UpperHessenbergQR: need to call compute() first");
528 Yi.noalias() =
Y.col(
i);
529 Y.col(
i) =
c * Yi +
s *
Y.col(
i + 1);
530 Y.col(
i + 1) = -
s * Yi +
c *
Y.col(
i + 1);
544 template <
typename Scalar =
double>
607 throw std::invalid_argument(
"TridiagQR: matrix must be square");
696 throw std::logic_error(
"TridiagQR: need to call compute() first");
718 throw std::logic_error(
"TridiagQR: need to call compute() first");
727 dest.diagonal().noalias() =
m_T_diag;
728 dest.diagonal(-1).noalias() =
m_T_subd;
750 const Scalar c2x =
c2 *
x, s2x = s2 *
x, c2z =
c2 *
z, s2z = s2 *
z;
756 dest.
coeffRef(
i + 1,
i + 1) = s2x + csy2 + c2z;
778 dest.diagonal(1).noalias() = dest.diagonal(-1);
793 dest.noalias() = dest_real.template cast<std::complex<Scalar>>();
803 #endif // SPECTRA_UPPER_HESSENBERG_QR_H
void apply_QY(GenericMatrix Y) const
void matrix_QtHQ(ComplexMatrix &dest) const
GaussianFactorGraphValuePair Y
Matrix diag(const std::vector< Matrix > &Hs)
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()
void apply_QtY(GenericMatrix Y) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
virtual void compute(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
void apply_YQ(GenericMatrix Y) const
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
Jet< T, N > pow(const Jet< T, N > &f, double g)
UpperHessenbergQR(Index size)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
A matrix or vector expression mapping an existing expression.
TridiagQR(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0))
virtual Matrix matrix_R() const
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar & coeff(Index rowId, Index colId) const
void compute(ConstGenericMatrix &mat, const Scalar &shift=Scalar(0)) override
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))
static void stable_scaling(const Scalar &a, const Scalar &b, Scalar &r, Scalar &c, Scalar &s)
Jet< T, N > sqrt(const Jet< T, N > &f)
Rot2 R(Rot2::fromAngle(0.1))
Matrix matrix_R() const override
void matrix_QtHQ(Matrix &dest) const override
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sun Feb 16 2025 04:08:29