Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove operator^ from Matrix and SubgraphPreconditioner #1969

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions gtsam/base/Matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,6 @@ bool linear_dependent(const Matrix& A, const Matrix& B, double tol) {
}

/* ************************************************************************* */
Vector operator^(const Matrix& A, const Vector & v) {
if (A.rows()!=v.size()) {
throw std::invalid_argument("Matrix operator^ : A.m(" + std::to_string(A.rows()) + ")!=v.size(" +
std::to_string(v.size()) + ")");
}
// Vector vt = v.transpose();
// Vector vtA = vt * A;
// return vtA.transpose();
return A.transpose() * v;
}

const Eigen::IOFormat& matlabFormat() {
static const Eigen::IOFormat matlab(
Eigen::StreamPrecision, // precision
Expand Down
6 changes: 0 additions & 6 deletions gtsam/base/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ GTSAM_EXPORT bool linear_independent(const Matrix& A, const Matrix& B, double to
*/
GTSAM_EXPORT bool linear_dependent(const Matrix& A, const Matrix& B, double tol = 1e-9);

/**
* overload ^ for trans(A)*v
* We transpose the vectors for speed.
*/
GTSAM_EXPORT Vector operator^(const Matrix& A, const Vector & v);

/** products using old-style format to improve compatibility */
template<class MATRIX>
inline MATRIX prod(const MATRIX& A, const MATRIX&B) {
Expand Down
2 changes: 1 addition & 1 deletion gtsam/base/tests/testMatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ TEST(Matrix, matrix_vector_multiplication )
Vector AtAv = Vector3(142., 188., 234.);

EQUALITY(A*v,Av);
EQUALITY(A^Av,AtAv);
EQUALITY(A.transpose() * Av,AtAv);
}

/* ************************************************************************* */
Expand Down
4 changes: 2 additions & 2 deletions gtsam/linear/iterative.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace gtsam {

/** Apply operator A'*e */
Vector operator^(const Vector& e) const {
dellaert marked this conversation as resolved.
Show resolved Hide resolved
return A_ ^ e;
return A_.transpose() * e;
}

/**
Expand All @@ -71,7 +71,7 @@ namespace gtsam {

/** gradient of objective function 0.5*|Ax-b_|^2 at x = A_'*(Ax-b_) */
Vector gradient(const Vector& x) const {
return A() ^ (A() * x - b());
return A().transpose() * (A() * x - b());
dellaert marked this conversation as resolved.
Show resolved Hide resolved
}

/** Apply operator A */
Expand Down
Loading