@ -770,16 +770,23 @@ namespace storm {
template < typename T >
void SparseMatrix < T > : : multiplyWithVector ( std : : vector < T > const & vector , std : : vector < T > & result ) const {
# ifdef STORM_HAVE_INTELTBB
tbb : : parallel_for ( tbb : : blocked_range < uint_fast64_t > ( 0 , result . size ( ) , 10 ) ,
[ & ] ( tbb : : blocked_range < uint_fast64_t > const & range ) {
uint_fast64_t startRow = range . begin ( ) ;
uint_fast64_t endRow = range . end ( ) ;
const_iterator it = this - > begin ( startRow ) ;
if ( this - > getNonzeroEntryCount ( ) > 10000 ) {
return this - > multiplyWithVectorParallel ( vector , result ) ;
} else {
return this - > multiplyWithVectorSequential ( vector , result ) ;
}
# else
return multiplyWithVectorSequential ( vector , result ) ;
# endif
}
template < typename T >
void SparseMatrix < T > : : multiplyWithVectorSequential ( std : : vector < T > const & vector , std : : vector < T > & result ) const {
const_iterator it = this - > begin ( ) ;
const_iterator ite ;
std : : vector < uint_fast64_t > : : const_iterator rowIterator = this - > rowIndications . begin ( ) + startRow ;
std : : vector < uint_fast64_t > : : const_iterator rowIteratorEnd = this - > rowIndications . begin ( ) + endRow ;
std : : vector < T > : : iterator resultIterator = result . begin ( ) + startRow ;
std : : vector < T > : : iterator resultIteratorEnd = result . begin ( ) + endRow ;
typename std : : vector < uint_fast64_t > : : const_iterator rowIterator = rowIndications . begin ( ) ;
typename std : : vector < T > : : iterator resultIterator = result . begin ( ) ;
typename std : : vector < T > : : iterator resultIteratorEnd = result . end ( ) ;
for ( ; resultIterator ! = resultIteratorEnd ; + + rowIterator , + + resultIterator ) {
* resultIterator = storm : : utility : : constantZero < T > ( ) ;
@ -788,13 +795,21 @@ namespace storm {
* resultIterator + = it - > getValue ( ) * vector [ it - > getColumn ( ) ] ;
}
}
} ) ;
# else
const_iterator it = this - > begin ( ) ;
}
# ifdef STORM_HAVE_INTELTBB
template < typename T >
void SparseMatrix < T > : : multiplyWithVectorParallel ( std : : vector < T > const & vector , std : : vector < T > & result ) const {
tbb : : parallel_for ( tbb : : blocked_range < uint_fast64_t > ( 0 , result . size ( ) , 10 ) ,
[ & ] ( tbb : : blocked_range < uint_fast64_t > const & range ) {
uint_fast64_t startRow = range . begin ( ) ;
uint_fast64_t endRow = range . end ( ) ;
const_iterator it = this - > begin ( startRow ) ;
const_iterator ite ;
typename std : : vector < uint_fast64_t > : : const_iterator rowIterator = rowIndications . begin ( ) ;
typename std : : vector < T > : : iterator resultIterator = result . begin ( ) ;
typename std : : vector < T > : : iterator resultIteratorEnd = result . end ( ) ;
std : : vector < uint_fast64_t > : : const_iterator rowIterator = this - > rowIndications . begin ( ) + startRow ;
std : : vector < uint_fast64_t > : : const_iterator rowIteratorEnd = this - > rowIndications . begin ( ) + endRow ;
typename std : : vector < T > : : iterator resultIterator = result . begin ( ) + startRow ;
typename std : : vector < T > : : iterator resultIteratorEnd = result . begin ( ) + endRow ;
for ( ; resultIterator ! = resultIteratorEnd ; + + rowIterator , + + resultIterator ) {
* resultIterator = storm : : utility : : constantZero < T > ( ) ;
@ -803,8 +818,9 @@ namespace storm {
* resultIterator + = it - > getValue ( ) * vector [ it - > getColumn ( ) ] ;
}
}
# endif
} ) ;
}
# endif
template < typename T >
uint_fast64_t SparseMatrix < T > : : getSizeInMemory ( ) const {