GCC Code Coverage Report


Directory: ./
File: src/function/difference.cc
Date: 2025-05-05 12:19:30
Exec Total Coverage
Lines: 0 28 0.0%
Branches: 0 46 0.0%

Line Branch Exec Source
1 // Copyright (c) 2018, Joseph Mirabel
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // 1. Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28
29 #include <hpp/constraints/function/difference.hh>
30 #include <hpp/constraints/matrix-view.hh>
31
32 namespace hpp {
33 namespace constraints {
34 namespace function {
35 namespace {
36 std::string toStr(const segment_t& s) {
37 std::ostringstream os;
38 os << pretty_print(s);
39 return os.str();
40 }
41 } // namespace
42
43 Difference::Difference(const DifferentiableFunctionPtr_t& inner,
44 const size_type& nArgs, const size_type& nDers,
45 const segment_t& lInArgs, const segment_t& lInDers,
46 const segment_t& rInArgs, const segment_t& rInDers)
47 : DifferentiableFunction(
48 nArgs, nDers, LiegroupSpace::Rn(inner->outputSpace()->nv()),
49 inner->name() + " | " + toStr(lInArgs) + " - " + toStr(rInArgs)),
50 inner_(inner),
51 lsa_(lInArgs),
52 lsd_(lInDers),
53 rsa_(rInArgs),
54 rsd_(rInDers),
55 l_(inner->outputSpace()),
56 r_(inner->outputSpace()) {
57 activeParameters_.setConstant(false);
58 activeParameters_.segment(lsa_.first, lsa_.second) =
59 inner_->activeParameters();
60 activeParameters_.segment(rsa_.first, rsa_.second) =
61 inner_->activeParameters();
62
63 activeDerivativeParameters_.setConstant(false);
64 activeDerivativeParameters_.segment(lsd_.first, lsd_.second) =
65 inner_->activeDerivativeParameters();
66 activeDerivativeParameters_.segment(rsd_.first, rsd_.second) =
67 inner_->activeDerivativeParameters();
68 }
69
70 std::ostream& Difference::print(std::ostream& os) const {
71 constraints::DifferentiableFunction::print(os);
72 return os << incindent << iendl << *inner_ << decindent;
73 }
74 } // namespace function
75 } // namespace constraints
76 } // namespace hpp
77