35#ifndef _BLAZE_MATH_COMPRESSEDVECTOR_H_
36#define _BLAZE_MATH_COMPRESSEDVECTOR_H_
68template<
typename Type
80 inline const CompressedVector<Type,TF,Tag>
generate(
size_t size )
const
82 CompressedVector<Type,TF,Tag> vector(
size );
97 inline const CompressedVector<Type,TF,Tag>
generate(
size_t size,
size_t nonzeros )
const
99 if( nonzeros >
size ) {
103 CompressedVector<Type,TF,Tag> vector(
size, nonzeros );
118 template<
typename Arg >
119 inline const CompressedVector<Type,TF,Tag>
122 CompressedVector<Type,TF,Tag> vector(
size );
139 template<
typename Arg >
140 inline const CompressedVector<Type,TF,Tag>
143 if( nonzeros >
size ) {
147 CompressedVector<Type,TF,Tag> vector(
size, nonzeros );
160 inline void randomize( CompressedVector<Type,TF,Tag>& vector )
const
162 const size_t size( vector.size() );
164 if(
size == 0UL )
return;
180 inline void randomize( CompressedVector<Type,TF,Tag>& vector,
size_t nonzeros )
const
182 const size_t size( vector.size() );
184 if( nonzeros >
size ) {
188 if(
size == 0UL )
return;
191 vector.reserve( nonzeros );
193 const Indices<size_t> indices( 0UL, vector.size()-1UL, nonzeros );
195 for(
size_t index : indices ) {
209 template<
typename Arg >
210 inline void randomize( CompressedVector<Type,TF,Tag>& vector,
211 const Arg&
min,
const Arg&
max )
const
213 const size_t size( vector.size() );
215 if(
size == 0UL )
return;
233 template<
typename Arg >
234 inline void randomize( CompressedVector<Type,TF,Tag>& vector,
235 size_t nonzeros,
const Arg&
min,
const Arg&
max )
const
237 const size_t size( vector.size() );
239 if( nonzeros >
size ) {
243 if(
size == 0UL )
return;
246 vector.reserve( nonzeros );
248 const Indices<size_t> indices( 0UL, vector.size()-1UL, nonzeros );
250 for(
size_t index : indices ) {
Header file for the complete CompressedMatrix implementation.
Header file for the Indices class.
Header file for all basic SparseVector functionality.
Header file for the complete ZeroVector implementation.
Efficient implementation of an arbitrary sized sparse vector.
Definition CompressedVector.h:220
Default implementation of the Rand class.
Definition Random.h:230
Header file for the implementation of a fixed-size vector.
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1339
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition DMatDMatMapExpr.h:1375
decltype(auto) generate(size_t m, size_t n, OP op)
Generates a new dense matrix filled via the given custom binary operation.
Definition DMatGenExpr.h:675
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition Matrix.h:676
T rand()
Random number function.
Definition Random.h:583
void randomize(T &&value)
Randomization of a given variable.
Definition Random.h:626
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
Header file for the exception macros of the math module.
Implementation of an arbitrarily sized compressed vector.
Implementation of a random number generator.