DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// // Copyright (c) 2000-2002 // Joerg Walter, Mathias Koch // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // The authors gratefully acknowledge the support of // GeNeSys mbH & Co. KG in producing this work. // #ifndef _BOOST_UBLAS_VECTOR_ASSIGN_ #define _BOOST_UBLAS_VECTOR_ASSIGN_ #include
// scalar_assign // Required for make_conformant storage #include
// Iterators based on ideas of Jeremy Siek namespace boost { namespace numeric { namespace ublas { namespace detail { // Weak equality check - useful to compare equality two arbitary vector expression results. // Since the actual expressions are unknown, we check for and arbitary error bound // on the relative error. // For a linear expression the infinity norm makes sense as we do not know how the elements will be // combined in the expression. False positive results are inevitable for arbirary expressions! template
BOOST_UBLAS_INLINE bool equals (const vector_expression
&e1, const vector_expression
&e2, S epsilon, S min_norm) { return norm_inf (e1 - e2) < epsilon * std::max
(std::max
(norm_inf (e1), norm_inf (e2)), min_norm); } template
BOOST_UBLAS_INLINE bool expression_type_check (const vector_expression
&e1, const vector_expression
&e2) { typedef typename type_traits
::promote_type>::real_type real_type; return equals (e1, e2, BOOST_UBLAS_TYPE_CHECK_EPSILON, BOOST_UBLAS_TYPE_CHECK_MIN); } // Make sparse proxies conformant template
// BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void make_conformant (V &v, const vector_expression
&e) { BOOST_UBLAS_CHECK (v.size () == e ().size (), bad_size ()); typedef typename V::size_type size_type; typedef typename V::difference_type difference_type; typedef typename V::value_type value_type; // FIXME unbounded_array with push_back maybe better std::vector
index; typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); typename E::const_iterator ite (e ().begin ()); typename E::const_iterator ite_end (e ().end ()); if (it != it_end && ite != ite_end) { size_type it_index = it.index (), ite_index = ite.index (); while (true) { difference_type compare = it_index - ite_index; if (compare == 0) { ++ it, ++ ite; if (it != it_end && ite != ite_end) { it_index = it.index (); ite_index = ite.index (); } else break; } else if (compare < 0) { increment (it, it_end, - compare); if (it != it_end) it_index = it.index (); else break; } else if (compare > 0) { if (*ite != value_type/*zero*/()) index.push_back (ite.index ()); ++ ite; if (ite != ite_end) ite_index = ite.index (); else break; } } } while (ite != ite_end) { if (*ite != value_type/*zero*/()) index.push_back (ite.index ()); ++ ite; } for (size_type k = 0; k < index.size (); ++ k) v (index [k]) = value_type/*zero*/(); } }//namespace detail // Explicitly iterating template
class F, class V, class T> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void iterating_vector_assign_scalar (V &v, const T &t) { typedef F
functor_type; typedef typename V::difference_type difference_type; difference_type size (v.size ()); typename V::iterator it (v.begin ()); BOOST_UBLAS_CHECK (v.end () - it == size, bad_size ()); #ifndef BOOST_UBLAS_USE_DUFF_DEVICE while (-- size >= 0) functor_type::apply (*it, t), ++ it; #else DD (size, 4, r, (functor_type::apply (*it, t), ++ it)); #endif } // Explicitly case template
class F, class V, class T> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void indexing_vector_assign_scalar (V &v, const T &t) { typedef F
functor_type; typedef typename V::size_type size_type; size_type size (v.size ()); #ifndef BOOST_UBLAS_USE_DUFF_DEVICE for (size_type i = 0; i < size; ++ i) functor_type::apply (v (i), t); #else size_type i (0); DD (size, 4, r, (functor_type::apply (v (i), t), ++ i)); #endif } // Dense (proxy) case template
class F, class V, class T> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign_scalar (V &v, const T &t, dense_proxy_tag) { #ifdef BOOST_UBLAS_USE_INDEXING indexing_vector_assign_scalar
(v, t); #elif BOOST_UBLAS_USE_ITERATING iterating_vector_assign_scalar
(v, t); #else typedef typename V::size_type size_type; size_type size (v.size ()); if (size >= BOOST_UBLAS_ITERATOR_THRESHOLD) iterating_vector_assign_scalar
(v, t); else indexing_vector_assign_scalar
(v, t); #endif } // Packed (proxy) case template
class F, class V, class T> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign_scalar (V &v, const T &t, packed_proxy_tag) { typedef F
functor_type; typedef typename V::difference_type difference_type; typename V::iterator it (v.begin ()); difference_type size (v.end () - it); while (-- size >= 0) functor_type::apply (*it, t), ++ it; } // Sparse (proxy) case template
class F, class V, class T> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign_scalar (V &v, const T &t, sparse_proxy_tag) { typedef F
functor_type; typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); while (it != it_end) functor_type::apply (*it, t), ++ it; } // Dispatcher template
class F, class V, class T> BOOST_UBLAS_INLINE void vector_assign_scalar (V &v, const T &t) { typedef typename V::storage_category storage_category; vector_assign_scalar
(v, t, storage_category ()); } template
struct vector_assign_traits { typedef SC storage_category; }; template
struct vector_assign_traits
{ typedef packed_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template
struct vector_assign_traits
{ typedef packed_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template
struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_assign_traits
{ typedef sparse_proxy_tag storage_category; }; // Explicitly iterating template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void iterating_vector_assign (V &v, const vector_expression
&e) { typedef F
functor_type; typedef typename V::difference_type difference_type; difference_type size (BOOST_UBLAS_SAME (v.size (), e ().size ())); typename V::iterator it (v.begin ()); BOOST_UBLAS_CHECK (v.end () - it == size, bad_size ()); typename E::const_iterator ite (e ().begin ()); BOOST_UBLAS_CHECK (e ().end () - ite == size, bad_size ()); #ifndef BOOST_UBLAS_USE_DUFF_DEVICE while (-- size >= 0) functor_type::apply (*it, *ite), ++ it, ++ ite; #else DD (size, 2, r, (functor_type::apply (*it, *ite), ++ it, ++ ite)); #endif } // Explicitly indexing template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void indexing_vector_assign (V &v, const vector_expression
&e) { typedef F
functor_type; typedef typename V::size_type size_type; size_type size (BOOST_UBLAS_SAME (v.size (), e ().size ())); #ifndef BOOST_UBLAS_USE_DUFF_DEVICE for (size_type i = 0; i < size; ++ i) functor_type::apply (v (i), e () (i)); #else size_type i (0); DD (size, 2, r, (functor_type::apply (v (i), e () (i)), ++ i)); #endif } // Dense (proxy) case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign (V &v, const vector_expression
&e, dense_proxy_tag) { #ifdef BOOST_UBLAS_USE_INDEXING indexing_vector_assign
(v, e); #elif BOOST_UBLAS_USE_ITERATING iterating_vector_assign
(v, e); #else typedef typename V::size_type size_type; size_type size (BOOST_UBLAS_SAME (v.size (), e ().size ())); if (size >= BOOST_UBLAS_ITERATOR_THRESHOLD) iterating_vector_assign
(v, e); else indexing_vector_assign
(v, e); #endif } // Packed (proxy) case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign (V &v, const vector_expression
&e, packed_proxy_tag) { BOOST_UBLAS_CHECK (v.size () == e ().size (), bad_size ()); typedef F
functor_type; typedef typename V::difference_type difference_type; typedef typename V::value_type value_type; #if BOOST_UBLAS_TYPE_CHECK vector
cv (v.size ()); indexing_vector_assign
(cv, v); indexing_vector_assign
(cv, e); #endif typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); typename E::const_iterator ite (e ().begin ()); typename E::const_iterator ite_end (e ().end ()); difference_type it_size (it_end - it); difference_type ite_size (ite_end - ite); if (it_size > 0 && ite_size > 0) { difference_type size ((std::min) (difference_type (it.index () - ite.index ()), ite_size)); if (size > 0) { ite += size; ite_size -= size; } } if (it_size > 0 && ite_size > 0) { difference_type size ((std::min) (difference_type (ite.index () - it.index ()), it_size)); if (size > 0) { it_size -= size; if (!functor_type::computed) { while (-- size >= 0) // zeroing functor_type::apply (*it, value_type/*zero*/()), ++ it; } else { it += size; } } } difference_type size ((std::min) (it_size, ite_size)); it_size -= size; ite_size -= size; while (-- size >= 0) functor_type::apply (*it, *ite), ++ it, ++ ite; size = it_size; if (!functor_type::computed) { while (-- size >= 0) // zeroing functor_type::apply (*it, value_type/*zero*/()), ++ it; } else { it += size; } #if BOOST_UBLAS_TYPE_CHECK if (! disable_type_check
::value) BOOST_UBLAS_CHECK (detail::expression_type_check (v, cv), external_logic ("external logic or bad condition of inputs")); #endif } // Sparse case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign (V &v, const vector_expression
&e, sparse_tag) { BOOST_UBLAS_CHECK (v.size () == e ().size (), bad_size ()); typedef F
functor_type; BOOST_STATIC_ASSERT ((!functor_type::computed)); typedef typename V::value_type value_type; #if BOOST_UBLAS_TYPE_CHECK vector
cv (v.size ()); indexing_vector_assign
(cv, v); indexing_vector_assign
(cv, e); #endif v.clear (); typename E::const_iterator ite (e ().begin ()); typename E::const_iterator ite_end (e ().end ()); while (ite != ite_end) { value_type t (*ite); if (t != value_type/*zero*/()) v.insert_element (ite.index (), t); ++ ite; } #if BOOST_UBLAS_TYPE_CHECK if (! disable_type_check
::value) BOOST_UBLAS_CHECK (detail::expression_type_check (v, cv), external_logic ("external logic or bad condition of inputs")); #endif } // Sparse proxy or functional case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_assign (V &v, const vector_expression
&e, sparse_proxy_tag) { BOOST_UBLAS_CHECK (v.size () == e ().size (), bad_size ()); typedef F
functor_type; typedef typename V::size_type size_type; typedef typename V::difference_type difference_type; typedef typename V::value_type value_type; typedef typename V::reference reference; #if BOOST_UBLAS_TYPE_CHECK vector
cv (v.size ()); indexing_vector_assign
(cv, v); indexing_vector_assign
(cv, e); #endif detail::make_conformant (v, e); typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); typename E::const_iterator ite (e ().begin ()); typename E::const_iterator ite_end (e ().end ()); if (it != it_end && ite != ite_end) { size_type it_index = it.index (), ite_index = ite.index (); while (true) { difference_type compare = it_index - ite_index; if (compare == 0) { functor_type::apply (*it, *ite); ++ it, ++ ite; if (it != it_end && ite != ite_end) { it_index = it.index (); ite_index = ite.index (); } else break; } else if (compare < 0) { if (!functor_type::computed) { functor_type::apply (*it, value_type/*zero*/()); ++ it; } else increment (it, it_end, - compare); if (it != it_end) it_index = it.index (); else break; } else if (compare > 0) { increment (ite, ite_end, compare); if (ite != ite_end) ite_index = ite.index (); else break; } } } if (!functor_type::computed) { while (it != it_end) { // zeroing functor_type::apply (*it, value_type/*zero*/()); ++ it; } } else { it = it_end; } #if BOOST_UBLAS_TYPE_CHECK if (! disable_type_check
::value) BOOST_UBLAS_CHECK (detail::expression_type_check (v, cv), external_logic ("external logic or bad condition of inputs")); #endif } // Dispatcher template
class F, class V, class E> BOOST_UBLAS_INLINE void vector_assign (V &v, const vector_expression
&e) { typedef typename vector_assign_traits
::computed, typename E::const_iterator::iterator_category>::storage_category storage_category; vector_assign
(v, e, storage_category ()); } template
struct vector_swap_traits { typedef SC storage_category; }; template<> struct vector_swap_traits
{ typedef sparse_proxy_tag storage_category; }; template<> struct vector_swap_traits
{ typedef sparse_proxy_tag storage_category; }; // Dense (proxy) case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_swap (V &v, vector_expression
&e, dense_proxy_tag) { typedef F
functor_type; typedef typename V::difference_type difference_type; difference_type size (BOOST_UBLAS_SAME (v.size (), e ().size ())); typename V::iterator it (v.begin ()); typename E::iterator ite (e ().begin ()); while (-- size >= 0) functor_type::apply (*it, *ite), ++ it, ++ ite; } // Packed (proxy) case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_swap (V &v, vector_expression
&e, packed_proxy_tag) { typedef F
functor_type; typedef typename V::difference_type difference_type; typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); typename E::iterator ite (e ().begin ()); typename E::iterator ite_end (e ().end ()); difference_type it_size (it_end - it); difference_type ite_size (ite_end - ite); if (it_size > 0 && ite_size > 0) { difference_type size ((std::min) (difference_type (it.index () - ite.index ()), ite_size)); if (size > 0) { ite += size; ite_size -= size; } } if (it_size > 0 && ite_size > 0) { difference_type size ((std::min) (difference_type (ite.index () - it.index ()), it_size)); if (size > 0) it_size -= size; } difference_type size ((std::min) (it_size, ite_size)); it_size -= size; ite_size -= size; while (-- size >= 0) functor_type::apply (*it, *ite), ++ it, ++ ite; } // Sparse proxy case template
class F, class V, class E> // BOOST_UBLAS_INLINE This function seems to be big. So we do not let the compiler inline it. void vector_swap (V &v, vector_expression
&e, sparse_proxy_tag) { BOOST_UBLAS_CHECK (v.size () == e ().size (), bad_size ()); typedef F
functor_type; typedef typename V::size_type size_type; typedef typename V::difference_type difference_type; typedef typename V::value_type value_type; detail::make_conformant (v, e); // FIXME should be a seperate restriction for E detail::make_conformant (e (), v); typename V::iterator it (v.begin ()); typename V::iterator it_end (v.end ()); typename E::iterator ite (e ().begin ()); typename E::iterator ite_end (e ().end ()); if (it != it_end && ite != ite_end) { size_type it_index = it.index (), ite_index = ite.index (); while (true) { difference_type compare = it_index - ite_index; if (compare == 0) { functor_type::apply (*it, *ite); ++ it, ++ ite; if (it != it_end && ite != ite_end) { it_index = it.index (); ite_index = ite.index (); } else break; } else if (compare < 0) { increment (it, it_end, - compare); if (it != it_end) it_index = it.index (); else break; } else if (compare > 0) { increment (ite, ite_end, compare); if (ite != ite_end) ite_index = ite.index (); else break; } } } #if BOOST_UBLAS_TYPE_CHECK increment (ite, ite_end); increment (it, it_end); #endif } // Dispatcher template
class F, class V, class E> BOOST_UBLAS_INLINE void vector_swap (V &v, vector_expression
&e) { typedef typename vector_swap_traits
::storage_category storage_category; vector_swap
(v, e, storage_category ()); } }}} #endif
vector_assign.hpp
Page URL
File URL
Prev
11/11 Next
Download
( 24 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.