⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matrix_sparse.hpp

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 HPP
📖 第 1 页 / 共 5 页
字号:
            typename self_type::#endif            const_iterator1 end () const {                const self_type &m = (*this) ();                return m.find1 (1, m.size1 (), index2 ());            }            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            const_reverse_iterator1 rbegin () const {                return const_reverse_iterator1 (end ());            }            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            const_reverse_iterator1 rend () const {                return const_reverse_iterator1 (begin ());            }#endif            // Indices            BOOST_UBLAS_INLINE            size_type index1 () const {                BOOST_UBLAS_CHECK (*this != (*this) ().find2 (0, i_, (*this) ().size2 ()), bad_index ());                if (rank_ == 1) {                    const self_type &m = (*this) ();                    BOOST_UBLAS_CHECK (functor_type::index1 ((*it_).first, m.size1 (), m.size2 ()) < (*this) ().size1 (), bad_index ());                    return functor_type::index1 ((*it_).first, m.size1 (), m.size2 ());                } else {                    return i_;                }            }            BOOST_UBLAS_INLINE            size_type index2 () const {                BOOST_UBLAS_CHECK (*this != (*this) ().find2 (0, i_, (*this) ().size2 ()), bad_index ());                if (rank_ == 1) {                    const self_type &m = (*this) ();                    BOOST_UBLAS_CHECK (functor_type::index2 ((*it_).first, m.size1 (), m.size2 ()) < (*this) ().size2 (), bad_index ());                    return functor_type::index2 ((*it_).first, m.size1 (), m.size2 ());                } else {                    return j_;                }            }            // Assignment            BOOST_UBLAS_INLINE            const_iterator2 &operator = (const const_iterator2 &it) {                container_const_reference<self_type>::assign (&it ());                rank_ = it.rank_;                i_ = it.i_;                j_ = it.j_;                it_ = it.it_;                return *this;            }            // Comparison            BOOST_UBLAS_INLINE            bool operator == (const const_iterator2 &it) const {                BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());                // BOOST_UBLAS_CHECK (rank_ == it.rank_, internal_logic ());                if (rank_ == 1 || it.rank_ == 1) {                    return it_ == it.it_;                } else {                    return i_ == it.i_ && j_ == it.j_;                }            }        private:            int rank_;            size_type i_;            size_type j_;            const_iterator_type it_;        };        BOOST_UBLAS_INLINE        const_iterator2 begin2 () const {            return find2 (0, 0, 0);        }        BOOST_UBLAS_INLINE        const_iterator2 end2 () const {            return find2 (0, 0, size2_);        }        class iterator2:            public container_reference<sparse_matrix>,            public bidirectional_iterator_base<sparse_bidirectional_iterator_tag,                                               iterator2, value_type> {        public:            typedef sparse_bidirectional_iterator_tag iterator_category;#ifndef BOOST_MSVC_STD_ITERATOR            typedef typename sparse_matrix::value_type value_type;            typedef typename sparse_matrix::difference_type difference_type;            typedef typename sparse_matrix::true_reference reference;            typedef typename sparse_matrix::pointer pointer;#endif            typedef iterator1 dual_iterator_type;            typedef reverse_iterator1 dual_reverse_iterator_type;            // Construction and destruction            BOOST_UBLAS_INLINE            iterator2 ():                container_reference<self_type> (), rank_ (), i_ (), j_ (), it_ () {}            BOOST_UBLAS_INLINE            iterator2 (self_type &m, int rank, size_type i, size_type j, const iterator_type &it):                container_reference<self_type> (m), rank_ (rank), i_ (i), j_ (j), it_ (it) {}            // Arithmetic            BOOST_UBLAS_INLINE            iterator2 &operator ++ () {                if (rank_ == 1 && functor_type::fast2 ())                    ++ it_;                else                    *this = (*this) ().find2 (rank_, i_, index2 () + 1, 1);                return *this;            }            BOOST_UBLAS_INLINE            iterator2 &operator -- () {                if (rank_ == 1 && functor_type::fast2 ())                    -- it_;                else                    *this = (*this) ().find2 (rank_, i_, index2 () - 1, -1);                return *this;            }            // Dereference            BOOST_UBLAS_INLINE            reference operator * () const {                BOOST_UBLAS_CHECK (index1 () < (*this) ().size1 (), bad_index ());                BOOST_UBLAS_CHECK (index2 () < (*this) ().size2 (), bad_index ());                if (rank_ == 1) {                    return (*it_).second;                } else {                    return (*this) ().at_element (i_, j_);                }            }#ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            iterator1 begin () const {                self_type &m = (*this) ();                return m.find1 (1, 0, index2 ());            }            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            iterator1 end () const {                self_type &m = (*this) ();                return m.find1 (1, m.size1 (), index2 ());            }            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            reverse_iterator1 rbegin () const {                return reverse_iterator1 (end ());            }            BOOST_UBLAS_INLINE#ifdef BOOST_UBLAS_MSVC_NESTED_CLASS_RELATION            typename self_type::#endif            reverse_iterator1 rend () const {                return reverse_iterator1 (begin ());            }#endif            // Indices            BOOST_UBLAS_INLINE            size_type index1 () const {                BOOST_UBLAS_CHECK (*this != (*this) ().find2 (0, i_, (*this) ().size2 ()), bad_index ());                if (rank_ == 1) {                    const self_type &m = (*this) ();                    BOOST_UBLAS_CHECK (functor_type::index1 ((*it_).first, m.size1 (), m.size2 ()) < (*this) ().size1 (), bad_index ());                    return functor_type::index1 ((*it_).first, m.size1 (), m.size2 ());                } else {                    return i_;                }            }            BOOST_UBLAS_INLINE            size_type index2 () const {                BOOST_UBLAS_CHECK (*this != (*this) ().find2 (0, i_, (*this) ().size2 ()), bad_index ());                if (rank_ == 1) {                    const self_type &m = (*this) ();                    BOOST_UBLAS_CHECK (functor_type::index2 ((*it_).first, m.size1 (), m.size2 ()) < (*this) ().size2 (), bad_index ());                    return functor_type::index2 ((*it_).first, m.size1 (), m.size2 ());                } else {                    return j_;                }            }            // Assignment            BOOST_UBLAS_INLINE            iterator2 &operator = (const iterator2 &it) {                container_reference<self_type>::assign (&it ());                rank_ = it.rank_;                i_ = it.i_;                j_ = it.j_;                it_ = it.it_;                return *this;            }            // Comparison            BOOST_UBLAS_INLINE            bool operator == (const iterator2 &it) const {                BOOST_UBLAS_CHECK (&(*this) () == &it (), external_logic ());                // BOOST_UBLAS_CHECK (rank_ == it.rank_, internal_logic ());                if (rank_ == 1 || it.rank_ == 1) {                    return it_ == it.it_;                } else {                    return i_ == it.i_ && j_ == it.j_;                }            }        private:            int rank_;            size_type i_;            size_type j_;            iterator_type it_;            friend class const_iterator2;        };        BOOST_UBLAS_INLINE        iterator2 begin2 () {            return find2 (0, 0, 0);        }        BOOST_UBLAS_INLINE        iterator2 end2 () {            return find2 (0, 0, size2_);        }        // Reverse iterators        BOOST_UBLAS_INLINE        const_reverse_iterator1 rbegin1 () const {            return const_reverse_iterator1 (end1 ());        }        BOOST_UBLAS_INLINE        const_reverse_iterator1 rend1 () const {            return const_reverse_iterator1 (begin1 ());        }        BOOST_UBLAS_INLINE        reverse_iterator1 rbegin1 () {            return reverse_iterator1 (end1 ());        }        BOOST_UBLAS_INLINE        reverse_iterator1 rend1 () {            return reverse_iterator1 (begin1 ());        }        BOOST_UBLAS_INLINE        const_reverse_iterator2 rbegin2 () const {            return const_reverse_iterator2 (end2 ());        }        BOOST_UBLAS_INLINE        const_reverse_iterator2 rend2 () const {            return const_reverse_iterator2 (begin2 ());        }        BOOST_UBLAS_INLINE        reverse_iterator2 rbegin2 () {            return reverse_iterator2 (end2 ());        }        BOOST_UBLAS_INLINE        reverse_iterator2 rend2 () {            return reverse_iterator2 (begin2 ());        }    private:        size_type size1_;        size_type size2_;        array_type data_;        static const value_type zero_;    };    template<class T, class F, class A>    const typename sparse_matrix<T, F, A>::value_type sparse_matrix<T, F, A>::zero_#ifdef BOOST_UBLAS_STATIC_OLD_INIT        = BOOST_UBLAS_TYPENAME sparse_matrix<T, F, A>::value_type#endif        (0);    // Array based sparse matrix class    template<class T, class F, class A>    class sparse_vector_of_sparse_vector:        public matrix_expression<sparse_vector_of_sparse_vector<T, F, A> > {    public:#ifndef BOOST_UBLAS_NO_PROXY_SHORTCUTS        BOOST_UBLAS_USING matrix_expression<sparse_vector_of_sparse_vector<T, F, A> >::operator ();#endif        typedef typename A::size_type size_type;        typedef typename A::difference_type difference_type;        typedef T value_type;        typedef const T &const_reference;#ifndef BOOST_UBLAS_STRICT_MATRIX_SPARSE        typedef typename detail::map_traits<typename A::data_value_type, T>::reference reference;#else        typedef sparse_matrix_element<sparse_vector_of_sparse_vector<T, F, A> > reference;#endif    private:        typedef T &true_reference;        typedef T *pointer;        typedef A array_type;        typedef const A const_array_type;        typedef F functor_type;        typedef sparse_vector_of_sparse_vector<T, F, A> self_type;    public:#ifndef BOOST_UBLAS_CT_REFERENCE_BASE_TYPEDEFS        typedef const matrix_const_reference<const self_type> const_closure_type;#else        typedef const matrix_reference<const self_type> const_closure_type;#endif        typedef matrix_reference<self_type> closure_type;        typedef sparse_vector<T, typename A::value_type> vector_temporary_type;        typedef self_type matrix_temporary_type;        typedef typename A::value_type::second_type vector_data_value_type;        typedef sparse_tag storage_category;        typedef typename F::orientation_category orientation_category;        // Construction and destruction        BOOST_UBLAS_INLINE        sparse_vector_of_sparse_vector ():            matrix_expression<self_type> (),            size1_ (0), size2_ (0), non_zeros_ (0), data_ () {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -