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_OPERATION_SPARSE_ #define _BOOST_UBLAS_OPERATION_SPARSE_ #include
// These scaled additions were borrowed from MTL unashamedly. // But Alexei Novakov had a lot of ideas to improve these. Thanks. namespace boost { namespace numeric { namespace ublas { template
BOOST_UBLAS_INLINE M & sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2, M &m, TRI, row_major_tag) { typedef M matrix_type; typedef TRI triangular_restriction; typedef const E1 expression1_type; typedef const E2 expression2_type; typedef typename M::size_type size_type; typedef typename M::value_type value_type; // ISSUE why is there a dense vector here? vector
temporary (e2 ().size2 ()); temporary.clear (); typename expression1_type::const_iterator1 it1 (e1 ().begin1 ()); typename expression1_type::const_iterator1 it1_end (e1 ().end1 ()); while (it1 != it1_end) { size_type jb (temporary.size ()); size_type je (0); #ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION typename expression1_type::const_iterator2 it2 (it1.begin ()); typename expression1_type::const_iterator2 it2_end (it1.end ()); #else typename expression1_type::const_iterator2 it2 (boost::numeric::ublas::begin (it1, iterator1_tag ())); typename expression1_type::const_iterator2 it2_end (boost::numeric::ublas::end (it1, iterator1_tag ())); #endif while (it2 != it2_end) { // temporary.plus_assign (*it2 * row (e2 (), it2.index2 ())); matrix_row
mr (e2 (), it2.index2 ()); typename matrix_row
::const_iterator itr (mr.begin ()); typename matrix_row
::const_iterator itr_end (mr.end ()); while (itr != itr_end) { size_type j (itr.index ()); temporary (j) += *it2 * *itr; jb = (std::min) (jb, j); je = (std::max) (je, j); ++ itr; } ++ it2; } for (size_type j = jb; j < je + 1; ++ j) { if (temporary (j) != value_type/*zero*/()) { // FIXME we'll need to extend the container interface! // m.push_back (it1.index1 (), j, temporary (j)); // FIXME What to do with adaptors? // m.insert (it1.index1 (), j, temporary (j)); if (triangular_restriction::other (it1.index1 (), j)) m (it1.index1 (), j) = temporary (j); temporary (j) = value_type/*zero*/(); } } ++ it1; } return m; } template
BOOST_UBLAS_INLINE M & sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2, M &m, TRI, column_major_tag) { typedef M matrix_type; typedef TRI triangular_restriction; typedef const E1 expression1_type; typedef const E2 expression2_type; typedef typename M::size_type size_type; typedef typename M::value_type value_type; // ISSUE why is there a dense vector here? vector
temporary (e1 ().size1 ()); temporary.clear (); typename expression2_type::const_iterator2 it2 (e2 ().begin2 ()); typename expression2_type::const_iterator2 it2_end (e2 ().end2 ()); while (it2 != it2_end) { size_type ib (temporary.size ()); size_type ie (0); #ifndef BOOST_UBLAS_NO_NESTED_CLASS_RELATION typename expression2_type::const_iterator1 it1 (it2.begin ()); typename expression2_type::const_iterator1 it1_end (it2.end ()); #else typename expression2_type::const_iterator1 it1 (boost::numeric::ublas::begin (it2, iterator2_tag ())); typename expression2_type::const_iterator1 it1_end (boost::numeric::ublas::end (it2, iterator2_tag ())); #endif while (it1 != it1_end) { // column (m, it2.index2 ()).plus_assign (*it1 * column (e1 (), it1.index1 ())); matrix_column
mc (e1 (), it1.index1 ()); typename matrix_column
::const_iterator itc (mc.begin ()); typename matrix_column
::const_iterator itc_end (mc.end ()); while (itc != itc_end) { size_type i (itc.index ()); temporary (i) += *it1 * *itc; ib = (std::min) (ib, i); ie = (std::max) (ie, i); ++ itc; } ++ it1; } for (size_type i = ib; i < ie + 1; ++ i) { if (temporary (i) != value_type/*zero*/()) { // FIXME we'll need to extend the container interface! // m.push_back (i, it2.index2 (), temporary (i)); // FIXME What to do with adaptors? // m.insert (i, it2.index2 (), temporary (i)); if (triangular_restriction::other (i, it2.index2 ())) m (i, it2.index2 ()) = temporary (i); temporary (i) = value_type/*zero*/(); } } ++ it2; } return m; } // Dispatcher template
BOOST_UBLAS_INLINE M & sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2, M &m, TRI, bool init = true) { typedef typename M::value_type value_type; typedef TRI triangular_restriction; typedef typename M::orientation_category orientation_category; if (init) m.assign (zero_matrix
(e1 ().size1 (), e2 ().size2 ())); return sparse_prod (e1, e2, m, triangular_restriction (), orientation_category ()); } template
BOOST_UBLAS_INLINE M sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2, TRI) { typedef M matrix_type; typedef TRI triangular_restriction; matrix_type m (e1 ().size1 (), e2 ().size2 ()); // FIXME needed for c_matrix?! // return sparse_prod (e1, e2, m, triangular_restriction (), false); return sparse_prod (e1, e2, m, triangular_restriction (), true); } template
BOOST_UBLAS_INLINE M & sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2, M &m, bool init = true) { typedef typename M::value_type value_type; typedef typename M::orientation_category orientation_category; if (init) m.assign (zero_matrix
(e1 ().size1 (), e2 ().size2 ())); return sparse_prod (e1, e2, m, full (), orientation_category ()); } template
BOOST_UBLAS_INLINE M sparse_prod (const matrix_expression
&e1, const matrix_expression
&e2) { typedef M matrix_type; matrix_type m (e1 ().size1 (), e2 ().size2 ()); // FIXME needed for c_matrix?! // return sparse_prod (e1, e2, m, full (), false); return sparse_prod (e1, e2, m, full (), true); } }}} #endif
operation_sparse.hpp
Page URL
File URL
Prev
16/26
Next
Download
( 8 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.