Skip to content

Instantly share code, notes, and snippets.

View JohanMabille's full-sized avatar

Johan Mabille JohanMabille

View GitHub Profile
class base
{
public:
virtual void compute() = 0;
};
class coo_matrix_impl : public base
{
public:
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/lib/pkgconfig/libzmq.pc
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/local_lat
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/remote_lat
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/local_thr
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/remote_thr
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/inproc_lat
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/inproc_thr
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/bin/proxy_thr
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/lib/libzmq.so.5.2.2
/home/yoyo/dev/quantstack/xeus-python-wheel/_skbuild/linux-x86_64-3.8/cmake-install/lib/libzmq.so.5
template <class T, layout_type L, class A>
class xarray
{
public:
using self_type = xarray<T, L, A>;
static self_type from_shape(const shape_type& s)
{
return self_type(s);
template <class T, layout_type L, class A>
xarray<T, L, A>::xarray(nested_initializer_list_t<value_type, 2> s)
: xarray()
{
resize(shape<shape_type>(t));
L == layout_type::row_major
? nested_copy(m_storage_begin(), s)
: nested_copy(
this->template begin<layout_type::column_major>(),
s
template <class T, class S>
void nested_copy(T& iter, const S& s)
{
*iter++ = s;
}
template <class T, class S>
void nested_copy(T& iter, std::initializer_list<S> s)
{
for(auto it = s.begin(); it != s.end(); ++it)
template <class U>
struct initializer_dimension
{
static constexpr std::size_t value =
initializer_depth_impl<U>::value;
};
template <class U>
struct initializer_depth_impl
{
static constexpr std::size_t value = 0;
};
template <class T>
struct initializer_depth_impl<std::initializer_list<T>>
{
static constexpr std::size_t value = 1 +
template <std::size_t I>
struct initializer_shape_impl
{
template <class T>
static constexpr std::size_t value(T t)
{
return t.size() == 0 ? 0
initializer_shape_impl<I - 1>::value(*t.begin());
}
};
template <class R, class U, size_t... I>
constexpr initializer_shape(U t, std::index_sequence<I...>)
{
using size_type = typename R::value_type;
return R{size_type(initializer_shape_impl<I>::value(t))...};
}
template <class R, class T>
constexpr R shape(T t)
{
template <class T, layout_type L = XTENSOR_DEFAULT_LAYOUT,
class A = std::allocator<T>>
class xarray
{
public:
xarray(const value_type& t);
xarray(nested_initializer_list_t<value_type, 1> t);
xarray(nested_initializer_list_t<value_type, 2> t);
xarray(nested_initializer_list_t<value_type, 3> t);