Go to the documentation of this file.
41 bool fpEqual(
double a,
double b,
double tol,
bool check_relative_also) {
59 else if(
a == 0 ||
b == 0 || (
abs(
a) +
abs(
b)) < DOUBLE_MIN_NORMAL) {
60 return abs(
a-
b) <=
tol * DOUBLE_MIN_NORMAL;
68 else if (
abs(
a -
b) <=
70 check_relative_also) {
83 for(
size_t i=0;
i<
n;
i++) {
84 stream << setprecision(9) <<
v(
i) << (
i<
n-1 ?
"; " :
"");
104 if (
vec1.size() != vec2.size())
return false;
105 size_t m =
vec1.size();
106 for(
size_t i=0;
i<
m;
i++)
114 size_t m =
vec1.size();
115 for(
size_t i=0;
i<
m;
i++)
123 if (
vec1.size()!=vec2.size())
return false;
124 size_t m =
vec1.size();
125 for(
size_t i=0;
i<
m; ++
i) {
134 if (
vec1.size()!=vec2.size())
return false;
135 size_t m =
vec1.size();
136 for(
size_t i=0;
i<
m; ++
i) {
146 cout <<
"not equal:" << endl;
148 print(actual,
"actual");
155 cout <<
"Erroneously equal:" << endl;
157 print(actual,
"actual");
164 cout <<
"not equal:" << endl;
173 cout <<
"not equal:" << endl;
181 if (
vec1.size()!=vec2.size())
return false;
182 bool flag =
false;
double scale = 1.0;
183 size_t m =
vec1.size();
184 for(
size_t i=0;
i<
m;
i++) {
187 if(
vec1[
i] == 0 && vec2[
i] == 0)
continue;
200 assert (
b.size()==
a.size());
202 for(
size_t i = 0;
i <
n;
i++ ) {
203 const double &ai =
a(
i), &bi =
b(
i);
204 c(
i) = (bi==0.0 && ai==0.0) ? 0.0 : ai/bi;
212 const double x0 =
v(0);
213 const double x02 =
x0*
x0;
216 const double sigma =
v.squaredNorm() - x02;
229 const double v02 =
v(0)*
v(0);
231 return 2.0 * v02 / (
sigma + v02);
239 return make_pair(
beta,
v);
248 size_t m = weights.size();
249 static const double inf = std::numeric_limits<double>::infinity();
253 for (
size_t i = 0;
i <
m; ++
i) isZero.push_back(
std::abs(
a[
i]) < 1
e-9);
256 for (
size_t i = 0;
i <
m; ++
i) {
257 if (weights[
i] ==
inf && !isZero[
i]) {
261 pseudo = Vector::Unit(
m,
i)*(1.0/
a[
i]);
269 for (
size_t i = 0;
i <
m;
i++) {
277 for (
size_t i = 0;
i <
m;
i++)
282 for (
size_t i = 0;
i <
m;
i++)
283 pseudo[
i] = isZero[
i] ? 0 : variance * weights[
i] *
a[
i];
294 throw invalid_argument(
"a and weights have different sizes!");
303 for (
const Vector&
v : vs) dim +=
v.size();
308 for (
int d = 0;
d <
v.size();
d++)
A(
d + index) =
v(
d);
320 va_start(ap, nrVectors);
321 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
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 Sat Nov 16 2024 04:09:41