|
FlexELA
|
#include <svector.h>
Public Member Functions | |
| NormalizedSVector () | |
| Construct an empty NormalizedSVector. | |
| NormalizedSVector (const SVector &a, const Value &total=1.0) | |
| Construct an NormalizedSVector from a SVector. | |
| operator SVector () const | |
| Convert the NormalizedSVector to an SVector. | |
| void | clear () noexcept |
| Clear out all entries. | |
Friends | |
| void | SVector::add (const NormalizedSVector &a, const Value &C) |
A normalized SVector.
It is often the case where an SVector is normalized followed by multiple calls to SVector::add() including multiplication. In this case, using NormalizedSVector requires only one division operation rather than two.
The NormalizedSVector \( \tilde{\mathbf{s}} \) is stored in the form,
\[ \tilde{s} = \left(\frac{T}{\sum \mathbf{a}}\right) \times \mathbf{a} \]
where \(\mathbf{a}\) and \( T \) are set by NormalizedSVector()
Construct an NormalizedSVector from a SVector.
| a | the base SVector \( \mathbf{a} \) |
| total | the total value \( T \) |
|
inlinenoexcept |
Clear out all entries.
Has the effect of \( \mathbf{a} \gets \mathbf{0} \)
|
inline |
Convert the NormalizedSVector to an SVector.
\[ \mathbf{s} \gets \left(\frac{T}{\sum \mathbf{a}}\right) \times \mathbf{a} \]