hpp-constraints 6.0.0
Definition of basic geometric constraints for motion planning
Loading...
Searching...
No Matches
matrix-view.hh
Go to the documentation of this file.
1// Copyright (c) 2017, 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
29namespace Eigen {
30template <typename Derived>
32 const Eigen::ArrayBase<Derived>& array) {
33 segments_t res;
34 for (size_type i = 0; i < array.derived().size(); ++i)
35 if (array.derived()[i]) res.push_back(segment_t(i, 1));
36 shrink(res);
37 return res;
38}
39} // namespace Eigen
40
41#include <hpp/pinocchio/util.hh>
42
43namespace hpp {
44template <int Option>
45struct prettyPrint<Eigen::BlockIndex::segments_t, Option> {
46 static std::ostream& run(std::ostream& os,
47 const constraints::segments_t& segs) {
49 return os;
50 }
51};
52} // namespace hpp
Definition fwd.hh:38
std::vector< segment_t > segments_t
Definition fwd.hh:84
Definition active-set-differentiable-function.hh:36
static void shrink(segments_t &a)
static segments_t fromLogicalExpression(const Eigen::ArrayBase< Derived > &array)
Definition matrix-view.hh:31
hpp::constraints::size_type size_type
Index of vector or matrix.
Definition matrix-view.hh:51
hpp::constraints::segment_t segment_t
Interval of indices [first, first + second - 1].
Definition matrix-view.hh:53
hpp::constraints::segments_t segments_t
vector of segments
Definition matrix-view.hh:55
static void run(std::ostream &os, const BlockIndexType &bi)
Definition matrix-view.hh:366
static std::ostream & run(std::ostream &os, const constraints::segments_t &segs)
Definition matrix-view.hh:46