FlexELA
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
svec::NormalizedSVector Class Reference

A normalized SVector. More...

#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)
 

Detailed Description

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()

Constructor & Destructor Documentation

◆ NormalizedSVector()

svec::NormalizedSVector::NormalizedSVector ( const SVector a,
const Value total = 1.0 
)

Construct an NormalizedSVector from a SVector.

Parameters
athe base SVector \( \mathbf{a} \)
totalthe total value \( T \)

Member Function Documentation

◆ clear()

void svec::NormalizedSVector::clear ( )
inlinenoexcept

Clear out all entries.

Has the effect of \( \mathbf{a} \gets \mathbf{0} \)

◆ operator SVector()

svec::NormalizedSVector::operator SVector ( ) const
inline

Convert the NormalizedSVector to an SVector.

\[ \mathbf{s} \gets \left(\frac{T}{\sum \mathbf{a}}\right) \times \mathbf{a} \]

Returns
SVector \( \mathbf{s} \)

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