"docs/en_US/Compression/Overview.md" did not exist on "9b49245e6ebdfdc6d4ade82c6f9f2333afab1c0d"
Commit 97d5b3ca authored by Paul's avatar Paul
Browse files

Formatting

parent 86576438
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
namespace rtg { namespace rtg {
template<bool... Bs> template <bool... Bs>
struct and_ struct and_ : std::is_same<and_<Bs...>, and_<(Bs || true)...>>
: std::is_same<and_<Bs...>, and_<(Bs || true)...>> {
{}; };
#define RTG_REQUIRES(...) class = typename std::enable_if<and_<__VA_ARGS__, true>{}>::type #define RTG_REQUIRES(...) class = typename std::enable_if<and_<__VA_ARGS__, true>{}>::type
......
...@@ -62,7 +62,7 @@ struct shape ...@@ -62,7 +62,7 @@ struct shape
std::size_t index(std::initializer_list<std::size_t> l) const; std::size_t index(std::initializer_list<std::size_t> l) const;
std::size_t index(const std::vector<std::size_t>& l) const; std::size_t index(const std::vector<std::size_t>& l) const;
template<class Iterator> template <class Iterator>
std::size_t index(Iterator start, Iterator last) const std::size_t index(Iterator start, Iterator last) const
{ {
assert(std::distance(start, last) <= this->lens().size()); assert(std::distance(start, last) <= this->lens().size());
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
namespace rtg { namespace rtg {
template<class F> template <class F>
void shape_for_each(const rtg::shape& s, F f) void shape_for_each(const rtg::shape& s, F f)
{ {
// Ensure calls to f use const ref to vector // Ensure calls to f use const ref to vector
auto call = [&f](const std::vector<std::size_t>& i) { f(i); }; auto call = [&f](const std::vector<std::size_t>& i) { f(i); };
std::vector<std::size_t> indices(s.lens().size()); std::vector<std::size_t> indices(s.lens().size());
for(std::size_t i = 0;i < s.elements();i++) { for(std::size_t i = 0; i < s.elements(); i++)
{
std::transform(s.strides().begin(), std::transform(s.strides().begin(),
s.strides().end(), s.strides().end(),
s.lens().begin(), s.lens().begin(),
...@@ -22,7 +23,6 @@ void shape_for_each(const rtg::shape& s, F f) ...@@ -22,7 +23,6 @@ void shape_for_each(const rtg::shape& s, F f)
} }
} }
} // namespace rtg } // namespace rtg
#endif #endif
...@@ -63,8 +63,10 @@ std::size_t shape::index(const std::vector<std::size_t>& l) const ...@@ -63,8 +63,10 @@ std::size_t shape::index(const std::vector<std::size_t>& l) const
std::size_t shape::index(std::size_t i) const std::size_t shape::index(std::size_t i) const
{ {
assert(this->lens().size() == this->strides().size()); assert(this->lens().size() == this->strides().size());
if (this->packed()) return i; if(this->packed())
else return std::inner_product( return i;
else
return std::inner_product(
this->lens().begin(), this->lens().begin(),
this->lens().end(), this->lens().end(),
this->strides().begin(), this->strides().begin(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment