15 #include <unordered_map>
16 #include <unordered_set>
30 namespace is_container_impl {
41 template <
typename T, std::
size_t N>
47 template <
typename... Args>
53 template <
typename... Args>
59 template <
typename... Args>
65 template <
typename... Args>
66 struct is_container<std::unordered_set<Args...>> : std::true_type {};
74 static constexpr
bool const value =
88 template <
class Container>
91 const std::array<std::string, 2> &surround = {
"[",
"]"}) {
95 return surround[0] + surround[1];
97 std::ostringstream strStream;
98 strStream << surround[0] << *iter;
99 for (++iter; iter != end; ++iter) {
100 strStream << delimiter << *iter;
102 strStream << surround[1];
103 return strStream.str();
119 template <
class Container,
class F>
123 auto retIter = std::begin(ret);
124 auto lhsIter = std::cbegin(lhs);
125 const auto lhsEnd = std::cend(lhs);
126 auto rhsIter = std::cbegin(rhs);
127 const auto rhsEnd = std::cend(rhs);
129 for (; lhsIter != lhsEnd and rhsIter != rhsEnd;
130 ++lhsIter, ++rhsIter, ++retIter) {
131 *retIter = binaryFunction(*lhsIter, *rhsIter);
148 template <
class Scalar,
class Container,
class F>
152 auto retIter = std::begin(ret);
153 auto rhsIter = std::cbegin(rhs);
154 const auto rhsEnd = std::cend(rhs);
156 for (; rhsIter != rhsEnd; ++rhsIter, ++retIter) {
157 *retIter = binaryFunction(lhs, *rhsIter);
169 template <
class Container>
auto L2Norm(
const Container &c) {
170 return std::sqrt(std::accumulate(std::cbegin(c), std::cend(c), 0.0,
171 [](
auto a,
auto b) {
return a + b * b; }));
186 template <
class Container>
187 std::enable_if_t<ArrayUtils::is_container<Container>::value, std::ostream &>
200 template <
class Container>
201 std::enable_if_t<ArrayUtils::is_container<Container>::value, Container>
213 template <
class Container>
214 std::enable_if_t<ArrayUtils::is_container<Container>::value, Container>
226 template <
class Container>
227 std::enable_if_t<ArrayUtils::is_container<Container>::value, Container>
239 template <
class Scalar,
class Container>
240 std::enable_if_t<ArrayUtils::is_container<Container>::value, Container>
253 template <
class Container>
254 std::enable_if_t<ArrayUtils::is_container<Container>::value,
bool>
256 if (lhs.size() != rhs.size()) {
260 auto lhsIter = std::cbegin(lhs);
261 const auto lhsEnd = std::cend(lhs);
262 auto rhsIter = std::cbegin(rhs);
264 for (; lhsIter != lhsEnd; ++lhsIter, ++rhsIter) {
265 if (*lhsIter != *rhs) {
std::enable_if_t< ArrayUtils::is_container< Container >::value, Container > operator-(const Container &lhs, const Container &rhs)
Definition: ArrayUtils.h:215
std::enable_if_t< ArrayUtils::is_container< Container >::value, bool > operator==(const Container &lhs, const Container &rhs)
Definition: ArrayUtils.h:255
std::enable_if_t< ArrayUtils::is_container< Container >::value, std::ostream & > operator<<(std::ostream &os, const Container &container)
Definition: ArrayUtils.h:188
std::enable_if_t< ArrayUtils::is_container< Container >::value, Container > operator*(const Container &lhs, const Container &rhs)
Definition: ArrayUtils.h:228
std::enable_if_t< ArrayUtils::is_container< Container >::value, Container > operator+(const Container &lhs, const Container &rhs)
Definition: ArrayUtils.h:202
Definition: ArrayUtils.h:23
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
Definition: ArrayUtils.h:90
auto L2Norm(const Container &c)
Definition: ArrayUtils.h:169
Container elementWiseScalarOp(const Scalar &lhs, const Container &rhs, F binaryFunction)
Definition: ArrayUtils.h:149
Container elementWisePairOp(const Container &lhs, const Container &rhs, F binaryFunction)
Definition: ArrayUtils.h:120
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-unstructured.h:270
::xsd::cxx::tree::type container
Alias for the anyType type.
Definition: vtk-unstructured.h:130
Definition: ArrayUtils.h:35
Definition: ArrayUtils.h:73
static constexpr bool const value
Definition: ArrayUtils.h:74