Double-precision vector for use with LAPACK. More...
Public Member Functions | |
void | Alias (const GenVector &other) |
Makes this vector an alias of another vector. | |
void | Alias (T *in_ptr, index_t in_length) |
Alias a particular memory region of doubles. | |
void | Alias (const GenVector &other) |
Makes this vector an alias of another vector. | |
void | Alias (T *in_ptr, index_t in_length) |
Alias a particular memory region of doubles. | |
ASSIGN_VIA_COPY_CONSTRUCTION (GenVector) | |
ASSIGN_VIA_COPY_CONSTRUCTION (GenVector) | |
void | Copy (const T *doubles, index_t in_length) |
Makes this uninitialized vector a copy of the other vector. | |
void | Copy (const GenVector &other) |
Makes this uninitialized vector a copy of the other vector. | |
void | Copy (const T *doubles, index_t in_length) |
Makes this uninitialized vector a copy of the other vector. | |
void | Copy (const GenVector &other) |
Makes this uninitialized vector a copy of the other vector. | |
void | CopyValues (const T *src_ptr) |
Copies all of the values from an array of doubles to this vector. | |
void | CopyValues (const GenVector &other) |
Copies the values from another vector to this vector. | |
void | CopyValues (const T *src_ptr) |
Copies all of the values from an array of doubles to this vector. | |
void | CopyValues (const GenVector &other) |
Copies the values from another vector to this vector. | |
void | Destruct () |
Uninitializes so that you can call another initializer. | |
void | Destruct () |
Uninitializes so that you can call another initializer. | |
GenVector (const GenVector &other) | |
Copy constructor -- for use in collections. | |
GenVector () | |
Creates a completely uninitialized Vector which must be initialized. | |
GenVector (const GenVector &other) | |
Copy constructor -- for use in collections. | |
GenVector () | |
Creates a completely uninitialized Vector which must be initialized. | |
T | get (index_t i) const |
Gets a value to the i'th element of this vector (convenient when you have a pointer to a vector). | |
T | get (index_t i) const |
Gets a value to the i'th element of this vector (convenient when you have a pointer to a vector). | |
void | Init (index_t in_length) |
Creates a vector of a particular length, but does not initialize the values in it. | |
void | Init (index_t in_length) |
Creates a vector of a particular length, but does not initialize the values in it. | |
index_t | length () const |
The number of elements in this vector. | |
index_t | length () const |
The number of elements in this vector. | |
void | MakeSubvector (index_t start_index, index_t len, GenVector *dest) |
Initializes an uninitialized vector as an alias to a a sub-region of this vector. | |
void | MakeSubvector (index_t start_index, index_t len, GenVector *dest) |
Initializes an uninitialized vector as an alias to a a sub-region of this vector. | |
T & | operator[] (index_t i) |
Gets a mutable reference to the i'th element of this vector. | |
T | operator[] (index_t i) const |
Gets the i'th element of this vector. | |
T & | operator[] (index_t i) |
Gets a mutable reference to the i'th element of this vector. | |
T | operator[] (index_t i) const |
Gets the i'th element of this vector. | |
void | Own (T *in_ptr, index_t in_length) |
Become owner of a particular pointer in memory that was allocated with mem::Alloc<double>. | |
void | Own (GenVector *other) |
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard. | |
void | Own (T *in_ptr, index_t in_length) |
Become owner of a particular pointer in memory that was allocated with mem::Alloc<double>. | |
void | Own (GenVector *other) |
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard. | |
void | PrintDebug (const char *name="", FILE *stream=stderr) const |
Prints to a stream as a debug message. | |
void | PrintDebug (const char *name="", FILE *stream=stderr) const |
Prints to a stream as a debug message. | |
const T * | ptr () const |
A pointer to the C-style array containing the elements of this vector. | |
T * | ptr () |
A pointer to the C-style array containing the elements of this vector. | |
const T * | ptr () const |
A pointer to the C-style array containing the elements of this vector. | |
T * | ptr () |
A pointer to the C-style array containing the elements of this vector. | |
void | SetAll (T d) |
Sets all elements to the same value. | |
void | SetAll (T d) |
Sets all elements to the same value. | |
void | SetZero () |
Sets all elements to zero. | |
void | SetZero () |
Sets all elements to zero. | |
void | StaticCopy (const T *doubles, index_t in_length) |
Makes this uninitialized vector a static copy of the other vector. | |
void | StaticCopy (const GenVector &other) |
Makes this uninitialized vector a static copy of the other vector. | |
void | StaticCopy (const T *doubles, index_t in_length) |
Makes this uninitialized vector a static copy of the other vector. | |
void | StaticCopy (const GenVector &other) |
Makes this uninitialized vector a static copy of the other vector. | |
void | StaticInit (index_t in_length) |
Creates a vector of a particular length statically, but does not initialize the values in it. | |
void | StaticInit (index_t in_length) |
Creates a vector of a particular length statically, but does not initialize the values in it. | |
void | StaticOwn (T *in_ptr, index_t in_length) |
Become owner of a particular pointer in memory that was allocated statically. | |
void | StaticOwn (GenVector *other) |
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard statically. | |
void | StaticOwn (T *in_ptr, index_t in_length) |
Become owner of a particular pointer in memory that was allocated statically. | |
void | StaticOwn (GenVector *other) |
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard statically. | |
void | SwapValues (GenVector *other) |
Swaps all values in this vector with values in the other. | |
void | SwapValues (GenVector *other) |
Swaps all values in this vector with values in the other. | |
void | WeakCopy (const GenVector &other) |
Implements the "Copiable" interface using . | |
void | WeakCopy (const GenVector &other) |
Implements the "Copiable" interface using . | |
~GenVector () | |
Destroys the Vector, freeing the memory if this copy is not an alias. | |
~GenVector () | |
Destroys the Vector, freeing the memory if this copy is not an alias. |
Double-precision vector for use with LAPACK.
This supports aliasing, so you can have weak copies of a vector, or weak copies to subsections of a vector (or weak copies to a column of a matrix).
Vectors were never meant to support resizing, nor was it meant to hold anything but floating-point values. For a suitable structure, see ArrayList.
Vector orig; orig.Init(5); for (index_t i = 0; i < 5; i++) { orig[i] = 2.0; } Vector an_alias; an_alias.Alias(orig); an_alias[4] = 99; assert(orig[4] == 9);
Definition at line 74 of file matrix.h.
void GenVector< T >::Alias | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
void GenVector< T >::Alias | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
Alias a particular memory region of doubles.
Definition at line 226 of file matrix.h.
Referenced by GenVector< index_t >::Alias(), AllkNN::ComputeNeighbors(), DiskAllNN::InitNaive(), GenMatrix< double >::MakeColumnSubvector(), GenMatrix< double >::MakeColumnVector(), GenVector< index_t >::MakeSubvector(), and GenVector< index_t >::WeakCopy().
void GenVector< T >::Copy | ( | const T * | doubles, | |
index_t | in_length | |||
) | [inline] |
void GenVector< T >::Copy | ( | const T * | doubles, | |
index_t | in_length | |||
) | [inline] |
Makes this uninitialized vector a copy of the other vector.
other | the vector to explicitly copy |
Definition at line 175 of file matrix.h.
Referenced by SimpleNaiveBayesClassifier::Classify(), GenVector< index_t >::Copy(), GenVector< index_t >::CopyValues(), FastICA::DeflationFixedPointICA(), DiscreteHMM::GenerateInit(), GenVector< index_t >::GenVector(), MoGL2E::GoodnessOfFitTerm_(), MoGL2E::RegularizationTerm_(), and GenVector< index_t >::StaticCopy().
void GenVector< T >::CopyValues | ( | const T * | src_ptr | ) | [inline] |
void GenVector< T >::CopyValues | ( | const T * | src_ptr | ) | [inline] |
Copies the values from another vector to this vector.
other | the vector to copy from |
Definition at line 343 of file matrix.h.
Referenced by OrthoRangeSearch< T >::Compute(), FastICA::DeflationFixedPointICA(), DoSvmNormalize(), MoGEM::ExpectationMaximization(), MoGL2E::GoodnessOfFitTerm_(), MoGEM::KMeans(), MoGL2E::KMeans_(), MoGEM::Loglikelihood(), linalg__private::MakeSubMatrixByColumns(), MoGL2E::MultiplePointsGenerator(), and RandVector().
void GenVector< T >::Destruct | ( | ) | [inline] |
void GenVector< T >::Destruct | ( | ) | [inline] |
Uninitializes so that you can call another initializer.
Definition at line 118 of file matrix.h.
Referenced by AllkNN::Destruct(), GaussianHMM::LoadProfile(), and GenVector< index_t >::~GenVector().
T GenVector< T >::get | ( | index_t | i | ) | const [inline] |
Gets a value to the i'th element of this vector (convenient when you have a pointer to a vector).
This is identical to the array subscript operator, except for the following reason:
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T GenVector< T >::get | ( | index_t | i | ) | const [inline] |
Gets a value to the i'th element of this vector (convenient when you have a pointer to a vector).
This is identical to the array subscript operator, except for the following reason:
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
Definition at line 421 of file matrix.h.
Referenced by MoGEM::ExpectationMaximization(), extract_sub_vector_of_vector(), extract_sub_vector_of_vector_init(), GaussianHMM::ForwardProcedure(), DiscreteHMM::ForwardProcedure(), MoGL2E::GoodnessOfFitTerm_(), NaiveKde< TKernel >::Init(), MoGEM::Loglikelihood(), MoGL2E::MultiplePointsGenerator(), MoGL2E::RegularizationTerm_(), set_portion_of_matrix(), MixtureofGaussianHMM::Train(), and DiscreteHMM::Train().
void GenVector< T >::Init | ( | index_t | in_length | ) | [inline] |
void GenVector< T >::Init | ( | index_t | in_length | ) | [inline] |
Creates a vector of a particular length, but does not initialize the values in it.
Definition at line 135 of file matrix.h.
Referenced by la::AddInit(), DHrectBound< t_pow >::CalculateMidpoint(), linalg__private::Center(), MixtureofGaussianHMM::ComputeLogLikelihood(), GaussianHMM::ComputeLogLikelihood(), DiscreteHMM::ComputeLogLikelihood(), MixtureofGaussianHMM::DecodeInit(), GaussianHMM::DecodeInit(), DiscreteHMM::DecodeInit(), FastICA::DeflationFixedPointICA(), DoSvmNormalize(), AllNN::EmitResults(), MoGEM::ExpectationMaximization(), MixtureofGaussianHMM::GenerateInit(), GaussianHMM::GenerateInit(), DiscreteHMM::GenerateInit(), NaiveKde< TKernel >::get_density_estimates(), FFTKde::get_density_estimates(), DualtreeVKde< TKernel >::get_density_estimates(), DualtreeKde< TKernelAux >::get_density_estimates(), FastICA::GetSamples(), MoGL2E::GoodnessOfFitTerm_(), SeriesExpansionAux::Init(), MultSeriesExpansionAux::Init(), NaiveKde< TKernel >::Init(), FFTKde::Init(), AllkNN::Init(), AllkFN::Init(), AllNN::Init(), GaussianHMM::InitFromData(), DiscreteHMM::InitFromData(), GaussianHMM::InitFromFile(), GaussianHMM::InitGaussParameter(), MoGL2E::InitialPointGenerator(), AllkFN::InitNaive(), AllNN::InitNaive(), MoGEM::KMeans(), MoGL2E::KMeans_(), MoGEM::Loglikelihood(), MoGL2E::MultiplePointsGenerator(), MoGL2E::RegularizationTerm_(), la::ScaleInit(), DatasetScaler::StandardizeData(), GenVector< index_t >::StaticInit(), la::SubInit(), MixtureofGaussianHMM::Train(), and DiscreteHMM::Train().
index_t GenVector< T >::length | ( | ) | const [inline] |
The number of elements in this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
index_t GenVector< T >::length | ( | ) | const [inline] |
The number of elements in this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
Definition at line 374 of file matrix.h.
Referenced by DHrectBound< t_pow >::Add(), la::AddExpert(), la::AddInit(), la::AddOverwrite(), la::AddTo(), GenVector< index_t >::Alias(), GenMatrix< double >::AliasColVector(), GenMatrix< double >::AliasRowVector(), DiscreteHMM::ComputeLogLikelihood(), NaiveKde< TKernel >::ComputeMaximumRelativeError(), AllkNN::ComputeNaive(), AllkFN::ComputeNaive(), AllkNN::ComputeNeighbors(), AllkFN::ComputeNeighbors(), DHrectBound< t_pow >::Contains(), GenVector< index_t >::Copy(), GenVector< index_t >::CopyValues(), DiscreteHMM::DecodeInit(), InfomaxICA::displayVector(), LMetric< t_pow >::Distance(), la::DistanceSqEuclidean(), DoSvmNormalize(), la::Dot(), DiskAllNN::EmitResults(), AllNN::EmitResults(), MixtureofGaussianHMM::EstimateInit(), GaussianHMM::EstimateInit(), DiscreteHMM::EstimateInit(), DiscreteHMM::ForwardProcedure(), NaiveKde< TKernel >::get_density_estimates(), FFTKde::get_density_estimates(), DualtreeVKde< TKernel >::get_density_estimates(), DualtreeKde< TKernelAux >::get_density_estimates(), MoGL2E::GoodnessOfFitTerm_(), NaiveKde< TKernel >::Init(), GenMatrix< double >::InitDiagonal(), MoGL2E::L2Error(), MoGL2E::L2ErrorForOpt(), la::LeastSquareFit(), la::LengthEuclidean(), tree::MakeKdTreeMidpointSelective(), linalg__private::MakeSubMatrixByColumns(), DHrectBound< t_pow >::MaxDistanceSq(), DHrectBound< t_pow >::MinDistanceSq(), DHrectBound< t_pow >::operator|=(), GenVector< index_t >::Own(), LMetric< t_pow >::PowDistance(), GenVector< index_t >::PrintDebug(), RandVector(), DHrectBound< t_pow >::RangeDistanceSq(), MoGL2E::RegularizationTerm_(), la::Scale(), la::ScaleInit(), la::ScaleOverwrite(), la::ScaleRows(), MultFarFieldExpansion< TKernelAux >::set_center(), FarFieldExpansion< TKernelAux >::set_center(), GenMatrix< double >::SetDiagonal(), GenVector< index_t >::StaticCopy(), GenMatrix< double >::StaticInitDiagonal(), GenVector< index_t >::StaticOwn(), la::SubFrom(), la::SubInit(), la::SubOverwrite(), GenVector< index_t >::SwapValues(), DiscreteHMM::ViterbiInit(), linalg__private::WhitenUsingEig(), and linalg__private::WhitenUsingSVD().
void GenVector< T >::MakeSubvector | ( | index_t | start_index, | |
index_t | len, | |||
GenVector< T > * | dest | |||
) | [inline] |
Initializes an uninitialized vector as an alias to a a sub-region of this vector.
start_index | the first index | |
len | the length | |
dest | an UNINITIALIZED vector to use |
Definition at line 318 of file matrix.h.
Referenced by GeneralCrossValidator< TLearner >::Run(), and SimpleCrossValidator< TClassifier >::Run().
T& GenVector< T >::operator[] | ( | index_t | i | ) | [inline] |
Gets a mutable reference to the i'th element of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T GenVector< T >::operator[] | ( | index_t | i | ) | const [inline] |
Gets the i'th element of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T& GenVector< T >::operator[] | ( | index_t | i | ) | [inline] |
Gets a mutable reference to the i'th element of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T GenVector< T >::operator[] | ( | index_t | i | ) | const [inline] |
Gets the i'th element of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
void GenVector< T >::Own | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
Become owner of a particular pointer in memory that was allocated with mem::Alloc<double>.
void GenVector< T >::Own | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
Become owner of a particular pointer in memory that was allocated with mem::Alloc<double>.
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard.
The other vector must be the "owning copy" of its memory.
other | a pointer to the vector whose contents will be owned |
Definition at line 259 of file matrix.h.
Referenced by GenVector< index_t >::Own(), and GenVector< index_t >::StaticOwn().
void GenVector< T >::PrintDebug | ( | const char * | name = "" , |
|
FILE * | stream = stderr | |||
) | const [inline] |
void GenVector< T >::PrintDebug | ( | const char * | name = "" , |
|
FILE * | stream = stderr | |||
) | const [inline] |
const T* GenVector< T >::ptr | ( | ) | const [inline] |
A pointer to the C-style array containing the elements of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T* GenVector< T >::ptr | ( | ) | [inline] |
A pointer to the C-style array containing the elements of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
const T* GenVector< T >::ptr | ( | ) | const [inline] |
A pointer to the C-style array containing the elements of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
T* GenVector< T >::ptr | ( | ) | [inline] |
A pointer to the C-style array containing the elements of this vector.
Reimplemented in SmallVector< t_length >, and SmallVector< t_length >.
Definition at line 381 of file matrix.h.
Referenced by la::AddExpert(), la::AddOverwrite(), la::AddTo(), GenMatrix< double >::AliasColVector(), GenMatrix< double >::AliasRowVector(), FFTKde::Compute(), GenVector< index_t >::Copy(), GenMatrix< double >::CopyVectorToColumn(), LMetric< t_pow >::Distance(), la::DistanceSqEuclidean(), la::Dot(), MoGL2E::L2ErrorForOpt(), la::LengthEuclidean(), DHrectBound< t_pow >::MinDistanceSq(), LMetric< t_pow >::PowDistance(), DHrectBound< t_pow >::RangeDistanceSq(), MoGL2E::RegularizationTerm_(), la::Scale(), la::ScaleOverwrite(), la::ScaleRows(), DatasetScaler::StandardizeData(), GenVector< index_t >::StaticCopy(), la::SubFrom(), and la::SubOverwrite().
void GenVector< T >::SetAll | ( | T | d | ) | [inline] |
void GenVector< T >::SetAll | ( | T | d | ) | [inline] |
Sets all elements to the same value.
Definition at line 158 of file matrix.h.
Referenced by MoGEM::ExpectationMaximization(), MoGL2E::GoodnessOfFitTerm_(), DiskAllNN::Init(), AllkNN::Init(), AllkFN::Init(), AllNN::Init(), DiskAllNN::InitNaive(), AllkFN::InitNaive(), AllNN::InitNaive(), MoGEM::KMeans(), MoGL2E::KMeans_(), MoGL2E::L2Error(), and GenVector< index_t >::SetZero().
void GenVector< T >::SetZero | ( | ) | [inline] |
void GenVector< T >::SetZero | ( | ) | [inline] |
Sets all elements to zero.
Definition at line 165 of file matrix.h.
Referenced by linalg__private::Center(), FFTKde::Compute(), FastICA::DeflationFixedPointICA(), DoSvmNormalize(), GaussianHMM::ForwardProcedure(), DiscreteHMM::ForwardProcedure(), NaiveKde< TKernel >::Init(), GaussianHMM::InitGaussParameter(), RandVector(), DatasetScaler::StandardizeData(), and MixtureofGaussianHMM::Train().
void GenVector< T >::StaticCopy | ( | const T * | doubles, | |
index_t | in_length | |||
) | [inline] |
void GenVector< T >::StaticCopy | ( | const T * | doubles, | |
index_t | in_length | |||
) | [inline] |
Makes this uninitialized vector a static copy of the other vector.
This copy will not be freed!
other | the vector to explicitly copy |
Definition at line 199 of file matrix.h.
Referenced by GenVector< index_t >::StaticCopy().
void GenVector< T >::StaticInit | ( | index_t | in_length | ) | [inline] |
void GenVector< T >::StaticInit | ( | index_t | in_length | ) | [inline] |
Creates a vector of a particular length statically, but does not initialize the values in it.
This vector will not be freed!
Definition at line 145 of file matrix.h.
Referenced by DiskAllNN::EmitResults(), DiskAllNN::Init(), and DiskAllNN::InitNaive().
void GenVector< T >::StaticOwn | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
void GenVector< T >::StaticOwn | ( | T * | in_ptr, | |
index_t | in_length | |||
) | [inline] |
Makes this vector the "owning copy" of the other vector; the other vector becomes an alias and this becomes the standard statically.
The other vector must have been allocated statically.
other | a pointer to the vector whose contents will be owned |
Definition at line 286 of file matrix.h.
Referenced by GenVector< index_t >::StaticOwn().