inst/include/keops/lib/sequences/README.md

The Art of C++ / Sequences

Release Download TravisCI AppVeyor

The Art of C++ / Sequences is a zero-dependency C++11 header-only library that provides efficient algorithms to generate and work on variadic templates and std::integer_sequence.

Compatibility

Provided algorithms and examples

Header tao/seq/integer_sequence.hpp

Provides:

Notes:

Header tao/seq/make_integer_sequence.hpp

Efficient versions of sequence generators.

Examples:

Notes:

libc++ already has very efficient versions for the above, so they are pulled in with a using-declaration. Only if we don't know if the STL's versions are at least O(log N) we provide our own implementations.

Our own implementation has O(log N) instantiation depth. This allows for very large sequences without the need to increase the compiler's default instantiation depth limits. For example, GCC and Clang generate index_sequence<10000> in ~0.15s (on my machine, of course). The standard library version from libstdc++, when trying to create index_sequence<5000> and with its O(N) implementation, requires ~30s, >3GB of RAM and -ftemplate-depth=5100.

Header tao/seq/make_integer_range.hpp

Generate half-open ranges of integers.

Examples:

Header tao/seq/sum.hpp

Integral constant to provide the sum of Ns. If no Ns are given, the result is T(0).

Examples:

Header tao/seq/prod.hpp

Integral constant to provide the product of Ns. If no Ns are given, the result is T(1).

Examples:

Header tao/seq/partial_sum.hpp

Integral constant to provide the sum of the first I elements.

Examples:

Header tao/seq/partial_prod.hpp

Integral constant to provide the product of the first I elements of Ns.

Examples:

Header tao/seq/exclusive_scan.hpp

Provides a sequence with the exclusive scan of the input sequence.

Examples:

Header tao/seq/inclusive_scan.hpp

Provides a sequence with the inclusive scan of the input sequence.

Examples:

Header tao/seq/zip.hpp

Applies a binary operation to elements from two sequences.

Notes:

Both sequences may have a different element type, the resulting sequence's type is calculated with std::common_type_t.

Header tao/seq/plus.hpp

Provides a sequence which is the element-wise sum of its input sequences.

Notes:

Both sequences may have a different element type, the resulting sequence's type is calculated with std::common_type_t.

Examples:

Header tao/seq/minus.hpp

Provides a sequence which is the element-wise sum of its input sequences.

Notes:

Both sequences may have a different element type, the resulting sequence's type is calculated with std::common_type_t.

Examples:

Header tao/seq/multiply.hpp

Provides a sequence which is the element-wise product of its input sequences.

Notes:

Both sequences may have a different element type, the resulting sequence's type is calculated with std::common_type_t.

Examples:

Header tao/seq/head.hpp

Integral constant to provide the first element of a non-empty sequence.

Header tao/seq/tail.hpp

Removed the first element of a non-empty sequence.

Header tao/seq/select.hpp

Integral constant to provide the I-th element of a non-empty sequence.

Header tao/seq/first.hpp

Sequence that contains only the first I elements of a given sequence.

Header tao/seq/concatenate.hpp

Concatenate the values of all sequences.

Notes:

The sequences may have different element types, the resulting sequence's type is calculated with std::common_type_t.

Header tao/seq/difference.hpp

Builds the difference of two sequences, i.e. a sequence that contains all elements of T that are not in U.

Examples:

Notes:

Both sequences may have a different element type, the resulting sequence's type is calculated with std::common_type_t.

Header tao/seq/accumulate.hpp

Result of a left fold of the given values over OP.

Header tao/seq/reduce.hpp

Reduces the given values in an unspecified order over OP.

Header tao/seq/min.hpp

Integral constant to provide the minimum value.

Header tao/seq/max.hpp

Integral constant to provide the maximum value.

Header tao/seq/map.hpp

Map a sequence of indices to a sequence of values.

Examples:

Header tao/seq/is_all.hpp

Integral constant which is true if all boolean parameters are true (logical and).

Examples:

Header tao/seq/is_any.hpp

Integral constant which is true if any boolean parameter is true (logical or).

Examples:

Header tao/seq/contains.hpp

Integral constant which is true if an element N is part of a list of elements Ns....

Examples:

Header tao/seq/index_of.hpp

Integral constant which is the smallest index of an element N in a list of elements Ns....

Note: Ns... must contain N, otherwise a static_assert is triggered.

Examples:

Header tao/seq/scale.hpp

Scales a sequence by a factor F.

Examples:

Header tao/seq/at_index.hpp

Returns the I-th type from a list of types Ts....

Examples:

Header tao/seq/reverse.hpp

Reverses a sequence.

Examples:

Header tao/seq/sort.hpp

Sort a sequence according to a given predicate.

Examples:

Given a predicate less...

struct less
{
   template< typename T, T A, T B >
   using apply = std::integral_constant< bool, ( A < B ) >;
};

Changelog

2.0.1

Released 2019-11-09

2.0.0

Released 2019-11-07

1.0.2

Released 2018-07-22

1.0.1

Released 2018-07-21

1.0.0

Released 2018-06-29

License

The Art of C++ is certified Open Source software. It may be used for any purpose, including commercial purposes, at absolutely no cost. It is distributed under the terms of the MIT license reproduced here.

Copyright (c) 2015-2019 Daniel Frey

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



Try the rkeops package in your browser

Any scripts or data that you put into this service are public.

rkeops documentation built on Feb. 17, 2021, 5:08 p.m.