Go to the documentation of this file.
42 bool fpEqual(
double a,
double b,
double tol,
bool check_relative_also) {
60 else if(
a == 0 ||
b == 0 || (
abs(
a) +
abs(
b)) < DOUBLE_MIN_NORMAL) {
61 return abs(
a-
b) <=
tol * DOUBLE_MIN_NORMAL;
69 else if (
abs(
a -
b) <=
71 check_relative_also) {
84 for(
size_t i=0;
i<
n;
i++) {
85 stream << setprecision(9) <<
v(
i) << (
i<
n-1 ?
"; " :
"");
105 if (
vec1.size() != vec2.size())
return false;
106 size_t m =
vec1.size();
107 for(
size_t i=0;
i<
m;
i++)
115 size_t m =
vec1.size();
116 for(
size_t i=0;
i<
m;
i++)
124 if (
vec1.size()!=vec2.size())
return false;
125 size_t m =
vec1.size();
126 for(
size_t i=0;
i<
m; ++
i) {
135 if (
vec1.size()!=vec2.size())
return false;
136 size_t m =
vec1.size();
137 for(
size_t i=0;
i<
m; ++
i) {
147 cout <<
"not equal:" << endl;
149 print(actual,
"actual");
156 cout <<
"Erroneously equal:" << endl;
158 print(actual,
"actual");
165 cout <<
"not equal:" << endl;
174 cout <<
"not equal:" << endl;
182 if (
vec1.size()!=vec2.size())
return false;
183 bool flag =
false;
double scale = 1.0;
184 size_t m =
vec1.size();
185 for(
size_t i=0;
i<
m;
i++) {
188 if(
vec1[
i] == 0 && vec2[
i] == 0)
continue;
201 assert (
b.size()==
a.size());
203 for(
size_t i = 0;
i <
n;
i++ ) {
204 const double &ai =
a(
i), &bi =
b(
i);
205 c(
i) = (bi==0.0 && ai==0.0) ? 0.0 : ai/bi;
213 const double x0 =
v(0);
214 const double x02 =
x0*
x0;
217 const double sigma =
v.squaredNorm() - x02;
230 const double v02 =
v(0)*
v(0);
232 return 2.0 * v02 / (
sigma + v02);
240 return make_pair(
beta,
v);
249 size_t m = weights.size();
250 static const double inf = std::numeric_limits<double>::infinity();
254 for (
size_t i = 0;
i <
m; ++
i) isZero.push_back(
std::abs(
a[
i]) < 1
e-9);
257 for (
size_t i = 0;
i <
m; ++
i) {
258 if (weights[
i] ==
inf && !isZero[
i]) {
262 pseudo = Vector::Unit(
m,
i)*(1.0/
a[
i]);
270 for (
size_t i = 0;
i <
m;
i++) {
278 for (
size_t i = 0;
i <
m;
i++)
283 for (
size_t i = 0;
i <
m;
i++)
284 pseudo[
i] = isZero[
i] ? 0 : variance * weights[
i] *
a[
i];
295 throw invalid_argument(
"a and weights have different sizes!");
309 for (
int d = 0;
d <
v.size();
d++)
A(
d + index) =
v(
d);
321 va_start(ap, nrVectors);
322 for(
size_t i = 0 ;
i < nrVectors ;
i++) {
bool assert_equal(const ConstSubVector &expected, const ConstSubVector &actual, double tol)
typedef and functions to augment Eigen's VectorXd
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static const double d[K][N]
Vector ediv_(const Vector &a, const Vector &b)
double houseInPlace(Vector &v)
bool assert_inequal(const Vector &expected, const Vector &actual, double tol)
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::vector< Vector3 > vs
double beta(double a, double b)
static const double sigma
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
bool equal_with_abs_tol(const SubVector &vec1, const SubVector &vec2, double tol)
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 scale
bool linear_dependent(const Vector &vec1, const Vector &vec2, double tol)
bool fpEqual(double a, double b, double tol, bool check_relative_also)
void save(const Vector &v, const string &s, const string &filename)
pair< Vector, double > weightedPseudoinverse(const Vector &a, const Vector &weights)
bool operator==(const Vector &vec1, const Vector &vec2)
std::ofstream out("Result.txt")
bool greaterThanOrEqual(const Vector &vec1, const Vector &vec2)
Vector concatVectors(size_t nrVectors,...)
ptrdiff_t DenseIndex
The index type for Eigen objects.
Expression of a fixed-size or dynamic-size sub-vector.
Array< int, Dynamic, 1 > v
pair< double, Vector > house(const Vector &x)
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
Jet< T, N > sqrt(const Jet< T, N > &f)
void print(const Vector &v, const string &s)
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:18:23