GCC Code Coverage Report


Directory: ./
File: src/math/constraint-base.cpp
Date: 2024-11-10 01:12:44
Exec Total Coverage
Lines: 0 15 0.0%
Branches: 0 18 0.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2017 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17
18 #include <tsid/math/constraint-base.hpp>
19
20 using namespace tsid::math;
21
22 ConstraintBase::ConstraintBase(const std::string& name) : m_name(name) {}
23
24 ConstraintBase::ConstraintBase(const std::string& name, const unsigned int rows,
25 const unsigned int cols)
26 : m_name(name) {
27 m_A = Matrix::Zero(rows, cols);
28 }
29
30 ConstraintBase::ConstraintBase(const std::string& name, ConstRefMatrix A)
31 : m_name(name), m_A(A) {}
32
33 const std::string& ConstraintBase::name() const { return m_name; }
34
35 const Matrix& ConstraintBase::matrix() const { return m_A; }
36
37 Matrix& ConstraintBase::matrix() { return m_A; }
38
39 bool ConstraintBase::setMatrix(ConstRefMatrix A) {
40 PINOCCHIO_CHECK_INPUT_ARGUMENT(m_A.cols() == A.cols(),
41 "cols do not match the constraint dimension");
42 PINOCCHIO_CHECK_INPUT_ARGUMENT(m_A.rows() == A.rows(),
43 "rows do not match the constraint dimension");
44 m_A = A;
45 return true;
46 }
47