11class NormalizedSVector;
67 std::size_t
NNZ() const noexcept;
123 std::vector<
Element>::const_iterator
begin() const noexcept;
132 std::vector<
Element>::const_iterator
end() const noexcept;
202 void clear() noexcept;
257 return base * factor;
345inline std::vector<Element>::const_iterator
SVector::end() const noexcept
A normalized SVector.
Definition svector.h:227
void clear() noexcept
Clear out all entries.
Definition svector.h:266
NormalizedSVector(const SVector &a, const Value &total=1.0)
Construct an NormalizedSVector from a SVector.
NormalizedSVector()
Construct an empty NormalizedSVector.
Definition svector.h:233
A container for sparse vectors.
Definition svector.h:25
bool containsNaN() const
Check if any elements have a NaN value.
Value getMinValue() const
Get the minimum non-zero entry.
friend SVector operator*(const SVector &a, const Value &C)
Multiplication, a*C.
Label getMaxLabel() const
Get the maximum label.
Value getMaxValue() const
Get the maximum non-zero entry.
bool isEmpty() const noexcept
Check if any non-zero elements.
Definition svector.h:331
friend SVector fma(const SVector &a, const Value &C, const SVector &b)
Fused Multiply and Add, C*a+b.
void clear() noexcept
Clear out all non-zero entries.
Definition svector.h:350
SVector()=default
Construct a new SVector object with no non-zero elements.
Value sum() const
Get the sum of values.
friend SVector operator/(const SVector &a, const Value &C)
Division, a/C.
std::vector< Element >::const_iterator begin() const noexcept
Start of the non-zero elements.
Definition svector.h:341
void zeroEntry(const Label &l)
Set the entry at label l to zero.
void add(const SVector &a, const Value &C=1.0)
Inplace Addition (and Multiplication), s=s+a*C.
const Element * data() const noexcept
Directly access the non-zero elements.
Definition svector.h:336
std::vector< Element >::const_iterator end() const noexcept
End of the non-zero elements.
Definition svector.h:345
void normalize(const Value &total=1.0)
s=s/sum(s) * total
void chop(const Value &ref=0.0)
Remove small elements in s.
std::size_t NNZ() const noexcept
Get the number of non-zero elements.
Definition svector.h:326
SVector(const Element *const buff)
Construct a new SVector object with non-zero elements given in buff.
For sparse vector containers and operations.
Definition element.h:10
double Value
Definition types.h:21
unsigned int Label
Definition types.h:15
Contains the label and value of a vector element.
Definition element.h:23