vec(4rheolef)

πŸ“¦
version 7.2 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu questing

πŸ’– vec β€” the distributed vector, but make it fashion πŸ’–

okay bestie, welcome to vec(4rheolef) β€” yes that's section 4rheolef, the rheolef-7.2 era, and this page is literally about the vector class and it's a whole vibe. grab a strawberry πŸ“ and let's go.


✨ NAME ✨

vec β€” a distributed vector (from rheolef-7.2, no cap) πŸ¦‹


✨ DESCRIPTION ✨

so the tea is: this vector class is that girl because she supports both the sequential memory model and the distributed memory model. she contains multitudes πŸ’…. and on top of all that, standard linear algebra is supported too. iconic behavior, honestly. πŸ‘‘


✨ EXAMPLE ✨

here's her in her natural habitat, looking gorgeous:

vec<double> x (100, 3.14);
vec<double> y (100, 6.28);
vec<double> z = 2.5*x + y;
dout << x << endl;

like?? 2.5*x + y just working like that? she ate and left no crumbs πŸ”₯


✨ IMPLEMENTATION ✨

ngl, this documentation was generated straight from the file linalg/lib/vec.h β€” so you know it's the real thing, not a rumor 🌸

the vec class is a template class, and it takes both the floating type and the memory model as parameters. the implementation is based on the disarray(4) container, which is giving foundation, giving support system 🫢

template <class T, class M = rheo_default_memory_model>
class vec : public disarray<T, M> {
public:

// typedef:

    typedef disarray<T, M>                                   base;
    typedef T                                                value_type;
    typedef typename base::size_type                         size_type;
    typedef std::ptrdiff_t                                   difference_type;
    typedef range                                            range_type;
    typedef typename base::reference                         reference;
    typedef typename base::const_reference                   const_reference;
    typedef typename base::iterator                          iterator;
    typedef typename base::const_iterator                    const_iterator;
    typedef typename float_traits <value_type>::type         float_type;

// allocator/deallocator:

    vec (const vec<T,M>&);
    vec<T,M>& operator= (const vec<T,M>& x);

    vec (const distributor& ownership,
        const T&  init_val = std::numeric_limits<T>::max());

    vec (const std::initializer_list<details::vec_concat_value<T,M> >& init_list);

    vec<T,M>& operator= (const std::initializer_list<details::vec_concat_value<T,M> >& init_list);
    vec(size_type dis_size = 0,
        const T&  init_val = std::numeric_limits<T>::max());

    void resize (
        const distributor& ownership,
        const T&  init_val = std::numeric_limits<T>::max());

    void resize (
        size_type size = 0,
        const T&  init_val = std::numeric_limits<T>::max());

// accessors:

    const_reference operator[] (size_type i) const;
    reference       operator[] (size_type i);

    T min () const;
    T max () const;
    T max_abs () const;

    int constraint_process_rank() const;

// range:

    vec(const vec_range<T,M>& vr);
    vec(const vec_range_const<T,M>& vr);
    vec<T,M>& operator= (const vec_range<T,M>& vr);
    vec<T,M>& operator= (const vec_range_const<T,M>& vr);

    vec_range_const<T,M> operator[] (const range_type& r) const;
    vec_range<T,M>       operator[] (const range_type& r);

// assignment to a constant:

    vec<T,M>& operator= (const int& expr);
    vec<T,M>& operator= (const T& expr);

// expression template:

    template <class Expr,
              class Sfinae
                  = typename std::enable_if<
                             details::is_vec_expr_v2_arg<Expr>::value
                          && ! details::is_vec<Expr>::value
                      >::type>
    vec (const Expr& expr);

    template <class Expr,
              class Sfinae
                  = typename std::enable_if<
                             details::is_vec_expr_v2_arg<Expr>::value
                          && ! details::is_vec<Expr>::value
                      >::type>
    vec<T, M>& operator=  (const Expr& expr);
};

like, the typedefs? the constructors? the expression templates with std::enable_if doing her little sfinae dance? main character energy fr fr πŸ’– every single one of these is exactly as written, don't let anyone tell you otherwise.


✨ AUTHOR ✨

the legend herself/himself: Pierre Saramito <Pierre.Saramito@imag.fr> πŸ‘‘πŸ’œ


Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr>

GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. (bestie that's the legal version of "no refunds" 😭 but also slay, free software rights πŸŽ€)


okay that's the whole page, and yeah β€” this is from rheolef, Version 7.2, and the page is vec(4rheolef). go forth and distribute your vectors, babe πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from