Go to the documentation of this file.
7 #ifndef SPECTRA_DOUBLE_SHIFT_QR_H
8 #define SPECTRA_DOUBLE_SHIFT_QR_H
17 #include "../Util/TypeTraits.h"
21 template <
typename Scalar =
double>
77 r = (
r2 >= cutoff ||
r3 >= cutoff) ?
129 const Scalar x1_new =
x1 - rho * x_norm, x1m =
abs(x1_new);
134 if (x1m >= x2m && x1m >= x3m)
138 else if (x2m >= x1m && x2m >= x3m)
157 const Index bsize = iu - il + 1;
199 for (
Index i = 1;
i < bsize - 2;
i++)
228 const Index nrow =
X.rows();
229 const Index ncol =
X.cols();
232 if (nr == 2 || nrow == 2)
234 for (
Index i = 0;
i < ncol;
i++, xptr += stride)
236 const Scalar tmp = u0_2 * xptr[0] + u1_2 * xptr[1];
245 for (
Index i = 0;
i < ncol;
i++, xptr += stride)
247 const Scalar tmp = u0_2 * xptr[0] + u1_2 * xptr[1] + u2_2 * xptr[2];
268 const bool nr_is_2 = (nr == 2);
286 const int nrow =
X.rows();
287 const int ncol =
X.cols();
288 Scalar *X0 =
X.data(), *
X1 = X0 + stride;
290 if (nr == 2 || ncol == 2)
297 const Scalar tmp = u0_2 * X0[
i] + u1_2 *
X1[
i];
309 const Scalar tmp = u0_2 * X0[
i] + u1_2 *
X1[
i] + u2_2 *
X2[
i];
341 throw std::invalid_argument(
"DoubleShiftQR: matrix must be square");
356 std::vector<int> zero_ind;
357 zero_ind.reserve(
m_n - 1);
358 zero_ind.push_back(0);
368 if (
h <= eps_abs ||
h <= eps_rel *
diag)
371 zero_ind.push_back(
i + 1);
377 zero_ind.push_back(
m_n);
379 const Index len = zero_ind.size() - 1;
382 const Index start = zero_ind[
i];
394 if (
h <= eps_abs ||
h <= eps_rel *
diag)
404 throw std::logic_error(
"DoubleShiftQR: need to call compute() first");
414 throw std::logic_error(
"DoubleShiftQR: need to call compute() first");
429 throw std::logic_error(
"DoubleShiftQR: need to call compute() first");
431 const Index nrow =
Y.rows();
443 #endif // SPECTRA_DOUBLE_SHIFT_QR_H
static Scalar stable_norm3(Scalar x1, Scalar x2, Scalar x3)
GaussianFactorGraphValuePair Y
void apply_XP(GenericMatrix X, Index stride, Index u_ind) const
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
void compute_reflector(const Scalar &x1, const Scalar &x2, const Scalar &x3, Index ind)
void compute(ConstGenericMatrix &mat, const Scalar &s, const Scalar &t)
DoubleShiftQR(Index size)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
void apply_YQ(GenericMatrix Y) const
Pose3 x3(Rot3::Ypr(M_PI/4.0, 0.0, 0.0), l2)
void matrix_QtHQ(Matrix &dest) const
void compute_reflector(const Scalar *x, Index ind)
static void stable_scaling(Scalar &x1, Scalar &x2, Scalar &x3)
void update_block(Index il, Index iu)
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
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
Jet< T, N > pow(const Jet< T, N > &f, double g)
void apply_PX(Scalar *x, Index u_ind) const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
A matrix or vector expression mapping an existing expression.
void apply_PX(GenericMatrix X, Index stride, Index u_ind) const
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar & coeff(Index rowId, Index colId) const
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE Scalar * data() const
DoubleShiftQR(ConstGenericMatrix &mat, const Scalar &s, const Scalar &t)
size_t len(handle h)
Get the length of a Python object.
static const EIGEN_DEPRECATED end_t end
void apply_QtY(Vector &y) const
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
Jet< T, N > sqrt(const Jet< T, N > &f)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sun Feb 16 2025 04:01:18