libmir / mir

Mir (backports): Sparse tensors, Hoffman
http://mir.libmir.org
Boost Software License 1.0
209 stars 20 forks source link

assumeSameStructure for packed slices #359

Closed ljubobratovicrelja closed 7 years ago

ljubobratovicrelja commented 8 years ago

I'd like to use assumeSameStructure to zip packed slices, but: Error: static assert "Packed slices not allowed in slice tuples" - why's that? And is there a plan to support this in future? If not, is there a workaround?

9il commented 8 years ago

I'd like to use assumeSameStructure to zip packed slices, but: Error: static assert "Packed slices not allowed in slice tuples" - why's that?

Because it has low priority in my TODO.

You can use mapSlice!identical as workaround. This will make a slice not packed.

auto identical(T)(auto ref T a)
{
    return a;
}
ljubobratovicrelja commented 8 years ago

Awesome, thanks!

9il commented 7 years ago

zip now supports packed slices if they all have the same shape packs.