hpp-constraints: include/hpp/constraints/impl/matrix-view.hh Source File

hpp-constraints 9.0.2 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
29 namespace Eigen {
30 template <typename Derived>
31 typename BlockIndex::segments_t BlockIndex::fromLogicalExpression(
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
43 namespace hpp {
44 template <int Option>
45 struct prettyPrint<Eigen::BlockIndex::segments_t, Option> {
46 static std::ostream& run(std::ostream& os,
47 const constraints::segments_t& segs) {
48 Eigen::internal::print_indices::run(os, segs);
49 return os;
50 }
51};
52} // namespace hpp
Eigen
Definition fwd.hh:39
hpp::constraints::segments_t
std::vector< segment_t > segments_t
Definition fwd.hh:86
hpp
Eigen::BlockIndex::shrink
static void shrink(segments_t &a)
Eigen::BlockIndex::fromLogicalExpression
static segments_t fromLogicalExpression(const Eigen::ArrayBase< Derived > &array)
Definition matrix-view.hh:31
Eigen::BlockIndex::size_type
hpp::constraints::size_type size_type
Index of vector or matrix.
Definition matrix-view.hh:51
Eigen::BlockIndex::segment_t
hpp::constraints::segment_t segment_t
Interval of indices [first, first + second - 1].
Definition matrix-view.hh:53
Eigen::BlockIndex::segments_t
hpp::constraints::segments_t segments_t
vector of segments
Definition matrix-view.hh:55
Eigen::internal::print_indices::run
static void run(std::ostream &os, const BlockIndexType &bi)
Definition matrix-view.hh:366
hpp::prettyPrint< Eigen::BlockIndex::segments_t, Option >::run
static std::ostream & run(std::ostream &os, const constraints::segments_t &segs)
Definition matrix-view.hh:46
hpp::prettyPrint
util.hh