Fixed some warnings
parent
c1250f4509
commit
2e3520e0dd
|
@ -527,7 +527,7 @@ Matrix stack(size_t nrMatrices, ...)
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
Matrix stack(const std::vector<Matrix>& blocks) {
|
Matrix stack(const std::vector<Matrix>& blocks) {
|
||||||
if (blocks.size() == 1) return blocks.at(0);
|
if (blocks.size() == 1) return blocks.at(0);
|
||||||
int nrows = 0, ncols = blocks.at(0).cols();
|
DenseIndex nrows = 0, ncols = blocks.at(0).cols();
|
||||||
BOOST_FOREACH(const Matrix& mat, blocks) {
|
BOOST_FOREACH(const Matrix& mat, blocks) {
|
||||||
nrows += mat.rows();
|
nrows += mat.rows();
|
||||||
if (ncols != mat.cols())
|
if (ncols != mat.cols())
|
||||||
|
@ -535,7 +535,7 @@ Matrix stack(const std::vector<Matrix>& blocks) {
|
||||||
}
|
}
|
||||||
Matrix result(nrows, ncols);
|
Matrix result(nrows, ncols);
|
||||||
|
|
||||||
int cur_row = 0;
|
DenseIndex cur_row = 0;
|
||||||
BOOST_FOREACH(const Matrix& mat, blocks) {
|
BOOST_FOREACH(const Matrix& mat, blocks) {
|
||||||
result.middleRows(cur_row, mat.rows()) = mat;
|
result.middleRows(cur_row, mat.rows()) = mat;
|
||||||
cur_row += mat.rows();
|
cur_row += mat.rows();
|
||||||
|
@ -584,16 +584,16 @@ Matrix collect(size_t nrMatrices, ...)
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
// row scaling, in-place
|
// row scaling, in-place
|
||||||
void vector_scale_inplace(const Vector& v, Matrix& A, bool inf_mask) {
|
void vector_scale_inplace(const Vector& v, Matrix& A, bool inf_mask) {
|
||||||
const size_t m = A.rows();
|
const DenseIndex m = A.rows();
|
||||||
if (inf_mask) {
|
if (inf_mask) {
|
||||||
// only scale the first v.size() rows of A to support augmented Matrix
|
// only scale the first v.size() rows of A to support augmented Matrix
|
||||||
for (size_t i=0; i<v.size(); ++i) {
|
for (DenseIndex i=0; i<v.size(); ++i) {
|
||||||
const double& vi = v(i);
|
const double& vi = v(i);
|
||||||
if (std::isfinite(vi))
|
if (std::isfinite(vi))
|
||||||
A.row(i) *= vi;
|
A.row(i) *= vi;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (size_t i=0; i<m; ++i)
|
for (DenseIndex i=0; i<m; ++i)
|
||||||
A.row(i) *= v(i);
|
A.row(i) *= v(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,12 +270,12 @@ Vector Constrained::whiten(const Vector& v) const {
|
||||||
// a hard constraint, we don't do anything.
|
// a hard constraint, we don't do anything.
|
||||||
const Vector& a = v;
|
const Vector& a = v;
|
||||||
const Vector& b = sigmas_;
|
const Vector& b = sigmas_;
|
||||||
size_t n = a.size();
|
DenseIndex n = a.size();
|
||||||
// Now allow for whiten augmented vector with a new additional part coming
|
// Now allow for whiten augmented vector with a new additional part coming
|
||||||
// from the Lagrange multiplier. So a.size() >= b.size()
|
// from the Lagrange multiplier. So a.size() >= b.size()
|
||||||
// assert (b.size()==a.size());
|
// assert (b.size()==a.size());
|
||||||
Vector c = a;
|
Vector c = a;
|
||||||
for( size_t i = 0; i < b.size(); i++ ) {
|
for( DenseIndex i = 0; i < b.size(); i++ ) {
|
||||||
const double& ai = a(i), &bi = b(i);
|
const double& ai = a(i), &bi = b(i);
|
||||||
if (bi!=0) c(i) = ai/bi;
|
if (bi!=0) c(i) = ai/bi;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue