28 using namespace gtsam;
37 auto model = noiseModel::Isotropic::Sigma(9, 1);
38 auto model2 = noiseModel::Isotropic::Sigma(3, 1);
49 if (
H) *
H = m_ * Matrix::Identity(X.rows() * X.cols(), X.rows() * X.cols());
61 H1->resize(x.size(), A.size());
62 *H1 << I_3x3, I_3x3, I_3x3;
74 double multiplier = 1.0;
86 double multiplier = 2.0;
87 Matrix X = Matrix::Identity(3, 3);
103 double multiplier = 2.0;
116 Matrix X = Matrix::Identity(3, 3);
119 double multiplier = 2.0;
134 Matrix X = Matrix::Identity(2, 2);
136 double multiplier = 2.0;
143 " noise model: unit (9) \n" 144 "FunctorizedFactor(X0)\n" 149 " noise model sigmas: 1 1 1 1 1 1 1 1 1\n";
157 double multiplier = 2.0;
158 Matrix X = Matrix::Identity(3, 3);
161 std::function<Matrix(Matrix, boost::optional<Matrix &>)> functional =
174 double multiplier = 2.0;
175 Matrix X = Matrix::Identity(3, 3);
182 Matrix::Identity(X.rows() * X.cols(), X.rows() * X.cols());
183 return multiplier *
X;
197 Matrix A = Matrix::Identity(3, 3);
202 MakeFunctorizedFactor2<Matrix, Vector>(
keyA,
keyx,
x,
model2, functor);
212 Matrix A = Matrix::Identity(3, 3);
214 Matrix actualH1, actualH2;
216 auto factor = MakeFunctorizedFactor2<Matrix, Vector>(
keyA,
keyx,
x,
model2,
230 Matrix A = Matrix::Identity(3, 3);
234 std::function<Matrix(Matrix, Matrix, boost::optional<Matrix &>,
235 boost::optional<Matrix &>)>
248 Matrix A = Matrix::Identity(3, 3);
254 OptionalJacobian<-1, -1> H2 = boost::none) {
256 H1->resize(x.size(), A.size());
257 *H1 << I_3x3, I_3x3, I_3x3;
Provides additional testing facilities for common data structures.
MultiplyFunctor(double m)
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
bool equals(const GaussianFactor &lf, double tol=1e-9) const override
bool assert_print_equal(const std::string &expected, const V &actual, const std::string &s="")
void insert(Key j, const Value &val)
Evaluate derivatives of a nonlinear factor numerically.
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 set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
Vector operator()(const Matrix &A, const Vector &x, OptionalJacobian<-1,-1 > H1=boost::none, OptionalJacobian<-1,-1 > H2=boost::none) const
#define EXPECT(condition)
double m_
simple multiplier
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Functor that performs Ax where A is a matrix and x is a vector.
Matrix operator()(const Matrix &X, OptionalJacobian<-1,-1 > H=boost::none) const
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
#define EXPECT_CORRECT_FACTOR_JACOBIANS(factor, values, numerical_derivative_step, tolerance)
Check the Jacobians produced by a factor against finite differences.
Functor that takes a matrix and multiplies every element by m.
JacobianFactor factor2(keyX, A21, keyY, A22, b2, noiseModel::Isotropic::Sigma(2, sigma2))
TEST(FunctorizedFactor, Identity)
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
std::uint64_t Key
Integer nonlinear key type.
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)
JacobianFactor factor1(keyX, A11, b1, noiseModel::Isotropic::Sigma(2, sigma1))