35 #ifndef _BLAZE_MATH_SUBVECTOR_H_ 36 #define _BLAZE_MATH_SUBVECTOR_H_ 75 class Rand< Subvector<VT,AF,TF,true,CSAs...> >
81 template<
typename SVT >
84 template<
typename SVT,
typename Arg >
100 template<
typename VT
104 template<
typename SVT >
109 using SubvectorType = RemoveReference_t<SVT>;
114 for(
size_t i=0UL; i<
subvector.size(); ++i ) {
131 template<
typename VT
135 template<
typename SVT
141 using SubvectorType = RemoveReference_t<SVT>;
146 for(
size_t i=0UL; i<
subvector.size(); ++i ) {
169 template<
typename VT
173 class Rand< Subvector<VT,AF,TF,false,CSAs...> >
179 template<
typename SVT >
182 template<
typename SVT >
185 template<
typename SVT,
typename Arg >
188 template<
typename SVT,
typename Arg >
204 template<
typename VT
208 template<
typename SVT >
211 using SubvectorType = RemoveReference_t<SVT>;
219 if(
size == 0UL )
return;
221 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
226 while(
subvector.nonZeros() < nonzeros ) {
227 subvector[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
243 template<
typename VT
247 template<
typename SVT >
248 inline void Rand< Subvector<VT,AF,TF,
false,CSAs...> >
::randomize( SVT&&
subvector,
size_t nonzeros )
const 250 using SubvectorType = RemoveReference_t<SVT>;
258 if( nonzeros >
size ) {
262 if(
size == 0UL )
return;
267 while(
subvector.nonZeros() < nonzeros ) {
268 subvector[ rand<size_t>( 0UL,
size-1UL ) ] = rand<ElementType>();
284 template<
typename VT
288 template<
typename SVT
291 const Arg&
min,
const Arg&
max )
const 293 using SubvectorType = RemoveReference_t<SVT>;
301 if(
size == 0UL )
return;
303 const size_t nonzeros( rand<size_t>( 1UL,
std::ceil( 0.5*
size ) ) );
308 while(
subvector.nonZeros() < nonzeros ) {
327 template<
typename VT
331 template<
typename SVT
333 inline void Rand< Subvector<VT,AF,TF,
false,CSAs...> >
::randomize( SVT&&
subvector,
size_t nonzeros,
334 const Arg&
min,
const Arg&
max )
const 336 using SubvectorType = RemoveReference_t<SVT>;
344 if( nonzeros >
size ) {
348 if(
size == 0UL )
return;
353 while(
subvector.nonZeros() < nonzeros ) {
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.Via these flags it is possible to specify subvec...
Definition: AlignmentFlag.h:62
Header file for the implementation of the Submatrix view.
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
decltype(auto) ceil(const DenseMatrix< MT, SO > &dm)
Applies the ceil() function to each single element of the dense matrix dm.
Definition: DMatMapExpr.h:1239
void randomize(T &&value)
Randomization of a given variable.
Definition: Random.h:929
Implementation of a random number generator.
#define BLAZE_CONSTRAINT_MUST_BE_SUBVECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a subvector type (i...
Definition: Subvector.h:61
Constraint on the data type.
Header file for the implementation of the Subvector view.
void randomize(T &value) const
Randomization of the given variable with a new value in the range .
Definition: Random.h:292
Header file for the dense vector SMP implementation.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3080
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:1147
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:61
Constraint on the data type.
Header file for the exception macros of the math module.
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:1179
Constraint on the data type.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Header file for the RemoveReference type trait.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional vector type...
Definition: DenseVector.h:61
Header file for the sparse vector SMP implementation.