linbox
Public Member Functions
RandomSparseStream< Field, _Vector, RandIter, Trait > Class Template Referenceabstract

Random sparse vector stream. More...

#include <stream.h>

+ Inheritance diagram for RandomSparseStream< Field, _Vector, RandIter, Trait >:
+ Collaboration diagram for RandomSparseStream< Field, _Vector, RandIter, Trait >:

Public Member Functions

 RandomSparseStream (const Field &F, RandIter &r, double p, size_t n, size_t m=0, uint64_t seed=(uint64_t) time(NULL))
 Constructor. More...
 
Vector & get (Vector &v)
 Get next element. More...
 
Self_toperator>> (Vector &v)
 Extraction operator form.
 
size_t size () const
 Number of vectors to be created.
 
size_t pos () const
 Number of vectors created so far.
 
size_t dim () const
 Dimension of the space.
 
 operator bool () const
 Check whether we have reached the end.
 
void reset ()
 Reset the stream to start at the beginning.
 
void setP (double p)
 Set the probability of a nonzero entry.
 
virtual Vector & get (Vector &v)=0
 Get the next vector from the factory and store it in v.
 
Self_toperator>> (Vector &v)
 Extraction operator form.
 
virtual size_t size () const=0
 Get the number of vectors to be constructed in this stream.
 
virtual size_t pos () const=0
 Get the number of vectors constructed so far.
 
virtual size_t dim () const=0
 Get the dimension of each vector.
 
virtual operator bool () const=0
 Return true if and only if the vector stream still has more vectors to construct.
 
void rewind ()
 Alias for reset.
 
Legacy interface

These functions provide compatiblity with older parts of the library.

Their use is deprecated.

Vector & next (Vector &v)
 
size_t j () const
 
size_t m () const
 
size_t n () const
 
Legacy interface

These functions provide compatiblity with older parts of the library.

Their use is deprecated.

Vector & next (Vector &v)
 
size_t j () const
 
size_t m () const
 
size_t n () const
 

Detailed Description

template<class Field, class _Vector = Sparse_Vector<typename Field::Element>, class RandIter = typename Field::RandIter, class Trait = typename VectorTraits<_Vector>::VectorCategory>
class LinBox::RandomSparseStream< Field, _Vector, RandIter, Trait >

Random sparse vector stream.

Generates a sequence of random sparse vectors over a given field

Examples
examples/dot-product.C.

Constructor & Destructor Documentation

◆ RandomSparseStream()

RandomSparseStream ( const Field &  F,
RandIter &  r,
double  p,
size_t  n,
size_t  m = 0,
uint64_t  seed = (uint64_t) time(NULL) 
)

Constructor.

Construct a new stream with the given field and vector size.

Parameters
FField over which to create random vectors
r
nSize of vectors
pProportion of nonzero entries
mNumber of vectors to return (0 for unlimited)
seed

Member Function Documentation

◆ get()

Vector& get ( Vector &  v)

Get next element.

Parameters
vVector into which to generate random vector
Returns
reference to new random vector

The documentation for this class was generated from the following file: