diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index 1e04bc58a..6248ad77d 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -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 diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index c8dc46ed5..2b177e3d7 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -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 inline MATRIX prod(const MATRIX& A, const MATRIX&B) { diff --git a/gtsam/base/tests/testMatrix.cpp b/gtsam/base/tests/testMatrix.cpp index 4c8808722..ede59a204 100644 --- a/gtsam/base/tests/testMatrix.cpp +++ b/gtsam/base/tests/testMatrix.cpp @@ -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); } /* ************************************************************************* */ diff --git a/gtsam/linear/iterative.h b/gtsam/linear/iterative.h index 22f65b8de..9bd1831e9 100644 --- a/gtsam/linear/iterative.h +++ b/gtsam/linear/iterative.h @@ -61,7 +61,7 @@ namespace gtsam { /** Apply operator A'*e */ Vector operator^(const Vector& e) const { - return A_ ^ e; + return A_.transpose() * e; } /** @@ -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()); } /** Apply operator A */