OpenNN  2.2
Open Neural Networks Library
Public Member Functions | List of all members
OpenNN::Vector< T > Class Template Reference

#include <vector.h>

Inheritance diagram for OpenNN::Vector< T >:

Public Member Functions

 Vector (void)
 
 Vector (const size_t &)
 
 Vector (const size_t &, const T &)
 
 Vector (const std::string &)
 
 Vector (const T &, const double &, const T &)
 
template<class InputIterator >
 Vector (InputIterator, InputIterator)
 
 Vector (const Vector< T > &)
 
virtual ~Vector (void)
 
bool operator== (const T &) const
 
bool operator!= (const T &) const
 
bool operator> (const T &) const
 
bool operator< (const T &) const
 
bool operator>= (const T &) const
 
bool operator<= (const T &) const
 
void set (void)
 
void set (const size_t &)
 
void set (const size_t &, const T &)
 
void set (const std::string &)
 
void set (const T &, const double &, const T &)
 
void set (const Vector &)
 
void initialize (const T &)
 
void initialize_sequential (void)
 
void randomize_uniform (const double &=-1.0, const double &=1.0)
 
void randomize_uniform (const Vector< double > &, const Vector< double > &)
 
void randomize_normal (const double &=0.0, const double &=1.0)
 
void randomize_normal (const Vector< double > &, const Vector< double > &)
 
bool contains (const T &) const
 
bool contains (const Vector< T > &) const
 
bool is_in (const T &, const T &) const
 
bool is_constant (const double &=0.0) const
 
bool is_crescent (void) const
 
bool is_decrescent (void) const
 
size_t count_occurrences (const T &) const
 
Vector< size_t > calculate_occurrence_indices (const T &) const
 
size_t count_greater_than (const T &) const
 
size_t count_less_than (const T &) const
 
Vector< size_t > calculate_less_than_indices (const T &) const
 
Vector< size_t > calculate_greater_than_indices (const T &) const
 
calculate_minimum (void) const
 
calculate_maximum (void) const
 
Vector< T > calculate_minimum_maximum (void) const
 
calculate_minimum_missing_values (const Vector< size_t > &) const
 
calculate_maximum_missing_values (const Vector< size_t > &) const
 
Vector< T > calculate_minimum_maximum_missing_values (const Vector< size_t > &) const
 
Histogram< T > calculate_histogram (const size_t &=10) const
 
Histogram< T > calculate_histogram_missing_values (const Vector< size_t > &, const size_t &=10) const
 
size_t calculate_minimal_index (void) const
 
size_t calculate_maximal_index (void) const
 
Vector< size_t > calculate_minimal_indices (const size_t &) const
 
Vector< size_t > calculate_maximal_indices (const size_t &) const
 
Vector< size_t > calculate_minimal_maximal_index (void) const
 
Vector< T > calculate_pow (const T &) const
 
Vector< T > calculate_competitive (void) const
 
Vector< T > calculate_softmax (void) const
 
Matrix< T > calculate_softmax_Jacobian (void) const
 
Vector< bool > calculate_binary (void) const
 
Vector< T > calculate_cumulative (void) const
 
size_t calculate_cumulative_index (const T &) const
 
size_t calculate_closest_index (const T &) const
 
calculate_sum (void) const
 
calculate_sum_missing_values (const Vector< size_t > &) const
 
calculate_product (void) const
 
double calculate_mean (void) const
 
double calculate_standard_deviation (void) const
 
Vector< double > calculate_mean_standard_deviation (void) const
 
double calculate_mean_missing_values (const Vector< size_t > &) const
 
double calculate_standard_deviation_missing_values (const Vector< size_t > &) const
 
Statistics< T > calculate_statistics (void) const
 
Statistics< T > calculate_statistics_missing_values (const Vector< size_t > &) const
 
double calculate_norm (void) const
 
Vector< T > calculate_norm_gradient (void) const
 
Matrix< T > calculate_norm_Hessian (void) const
 
double calculate_p_norm (const double &) const
 
Vector< double > calculate_p_norm_gradient (const double &) const
 
Vector< T > calculate_normalized (void) const
 
double calculate_distance (const Vector< double > &) const
 
double calculate_sum_squared_error (const Vector< double > &) const
 
double calculate_Minkowski_error (const Vector< double > &, const double &) const
 
calculate_linear_correlation (const Vector< T > &) const
 
calculate_linear_correlation_missing_values (const Vector< T > &, const Vector< size_t > &) const
 
LinearRegressionParameters< T > calculate_linear_regression_parameters (const Vector< T > &) const
 
Vector< T > calculate_absolute_value (void) const
 
void apply_absolute_value (void)
 
Vector< T > calculate_lower_bounded (const T &) const
 
Vector< T > calculate_lower_bounded (const Vector< T > &) const
 
Vector< T > calculate_upper_bounded (const T &) const
 
Vector< T > calculate_upper_bounded (const Vector< T > &) const
 
Vector< T > calculate_lower_upper_bounded (const T &, const T &) const
 
Vector< T > calculate_lower_upper_bounded (const Vector< T > &, const Vector< T > &) const
 
void apply_lower_bound (const T &)
 
void apply_lower_bound (const Vector< T > &)
 
void apply_upper_bound (const T &)
 
void apply_upper_bound (const Vector< T > &)
 
void apply_lower_upper_bounds (const T &, const T &)
 
void apply_lower_upper_bounds (const Vector< T > &, const Vector< T > &)
 
Vector< size_t > calculate_less_rank (void) const
 
Vector< size_t > calculate_greater_rank (void) const
 
Vector< T > operator+ (const T &) const
 
Vector< T > operator+ (const Vector< T > &) const
 
Vector< T > operator- (const T &) const
 
Vector< T > operator- (const Vector< T > &) const
 
Vector< T > operator* (const T &) const
 
Vector< T > operator* (const Vector< T > &) const
 
Matrix< T > operator* (const Matrix< T > &) const
 
double dot (const Vector< double > &) const
 
Vector< double > dot (const Matrix< T > &) const
 
Matrix< T > direct (const Vector< T > &) const
 
Vector< T > operator/ (const T &) const
 
Vector< T > operator/ (const Vector< T > &) const
 
void operator+= (const T &)
 
void operator+= (const Vector< T > &)
 
void operator-= (const T &)
 
void operator-= (const Vector< T > &)
 
void operator*= (const T &)
 
void operator*= (const Vector< T > &)
 
void operator/= (const T &)
 
void operator/= (const Vector< T > &)
 
void filter_positive (void)
 
void filter_negative (void)
 
void scale_minimum_maximum (const T &, const T &)
 
void scale_minimum_maximum (const Statistics< T > &)
 
Statistics< T > scale_minimum_maximum (void)
 
void scale_mean_standard_deviation (const T &, const T &)
 
void scale_mean_standard_deviation (const Statistics< T > &)
 
Statistics< T > scale_mean_standard_deviation (void)
 
void scale_minimum_maximum (const Vector< T > &, const Vector< T > &)
 
void scale_mean_standard_deviation (const Vector< T > &, const Vector< T > &)
 
Vector< T > calculate_scaled_minimum_maximum (const Vector< T > &, const Vector< T > &) const
 
Vector< T > calculate_scaled_mean_standard_deviation (const Vector< T > &, const Vector< T > &) const
 
Vector< T > calculate_unscaled_minimum_maximum (const Vector< T > &, const Vector< T > &) const
 
Vector< T > calculate_unscaled_mean_standard_deviation (const Vector< T > &, const Vector< T > &) const
 
void unscale_minimum_maximum (const Vector< T > &, const Vector< T > &)
 
void unscale_mean_standard_deviation (const Vector< T > &, const Vector< T > &)
 
Matrix< T > arrange_diagonal_matrix (void) const
 
Vector< T > arrange_subvector (const Vector< size_t > &) const
 
Vector< T > arrange_subvector_first (const size_t &) const
 
Vector< T > arrange_subvector_last (const size_t &) const
 
void load (const std::string &)
 
void save (const std::string &) const
 
void tuck_in (const size_t &, const Vector< T > &)
 
Vector< T > take_out (const size_t &, const size_t &) const
 
Vector< T > insert_element (const size_t &, const T &) const
 
Vector< T > remove_element (const size_t &) const
 
Vector< T > remove_value (const T &) const
 
Vector< T > assemble (const Vector< T > &) const
 
std::vector< T > to_std_vector (void) const
 
Matrix< T > to_row_matrix (void) const
 
Matrix< T > to_column_matrix (void) const
 
void parse (const std::string &)
 
std::string to_text () const
 
std::string to_string (const std::string &=" ") const
 
Vector< std::string > write_string_vector (const size_t &=3) const
 
Matrix< T > to_matrix (const size_t &, const size_t &) const
 

Detailed Description

template<typename T>
class OpenNN::Vector< T >

This template represents an array of any kind of numbers or objects. It inherits from the vector of the standard library, and implements additional utilities.

Definition at line 66 of file vector.h.

Constructor & Destructor Documentation

template<class T >
OpenNN::Vector< T >::Vector ( const size_t &  new_size)
explicit

General constructor. It creates a vector of size n, containing n copies of the default value for Type.

Parameters
new_sizeSize of vector.

Definition at line 448 of file vector.h.

template<class T>
OpenNN::Vector< T >::Vector ( const size_t &  new_size,
const T &  value 
)
explicit

Constant reference initialization constructor. It creates a vector of size n, containing n copies of the type value of Type.

Parameters
new_sizeSize of Vector.
valueInitialization value of Type.

Definition at line 459 of file vector.h.

template<class T>
OpenNN::Vector< T >::Vector ( const std::string &  file_name)
explicit

File constructor. It creates a vector object by loading its members from a data file.

Parameters
file_nameName of vector data file.

Definition at line 468 of file vector.h.

template<class T>
OpenNN::Vector< T >::Vector ( const Vector< T > &  other_vector)

Copy constructor. It creates a copy of an existing Vector.

Parameters
other_vectorVector to be copied.

Definition at line 496 of file vector.h.

Member Function Documentation

template<class T>
void OpenNN::Vector< T >::apply_lower_bound ( const T &  lower_bound)

Sets the elements of the vector to a given value if they fall below that value.

Parameters
lower_boundLower bound value.

Definition at line 3194 of file vector.h.

template<class T>
void OpenNN::Vector< T >::apply_lower_bound ( const Vector< T > &  lower_bound)

Sets the elements of the vector to given values if they fall below that values.

Parameters
lower_boundLower bound values.

Definition at line 3214 of file vector.h.

template<class T>
void OpenNN::Vector< T >::apply_lower_upper_bounds ( const T &  lower_bound,
const T &  upper_bound 
)

Sets the elements of the vector to a given lower bound value if they fall below that value, or to a given upper bound value if they fall above that value.

Parameters
lower_boundLower bound value.
upper_boundUpper bound value.

Definition at line 3276 of file vector.h.

template<class T>
void OpenNN::Vector< T >::apply_lower_upper_bounds ( const Vector< T > &  lower_bound,
const Vector< T > &  upper_bound 
)

Sets the elements of the vector to given lower bound values if they fall below that values, or to given upper bound values if they fall above that values.

Parameters
lower_boundLower bound values.
upper_boundUpper bound values.

Definition at line 3302 of file vector.h.

template<class T>
void OpenNN::Vector< T >::apply_upper_bound ( const T &  upper_bound)

Sets the elements of the vector to a given value if they fall above that value.

Parameters
upper_boundUpper bound value.

Definition at line 3234 of file vector.h.

template<class T>
void OpenNN::Vector< T >::apply_upper_bound ( const Vector< T > &  upper_bound)

Sets the elements of the vector to given values if they fall above that values.

Parameters
upper_boundUpper bound values.

Definition at line 3254 of file vector.h.

template<class T >
Matrix< T > OpenNN::Vector< T >::arrange_diagonal_matrix ( void  ) const

Returns a squared matrix in which the entries outside the main diagonal are all zero. The elements in the diagonal are the elements in this vector.

Todo:

Definition at line 4658 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::arrange_subvector ( const Vector< size_t > &  indices) const

Returns another vector whose elements are given by some elements of this vector.

Parameters
indicesIndices of this vector whose elements are required.

Definition at line 4679 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::arrange_subvector_first ( const size_t &  elements_number) const

Returns a vector with the first n elements of this vector.

Parameters
elements_numberSize of the new vector.

Definition at line 4722 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::arrange_subvector_last ( const size_t &  elements_number) const

Returns a vector with the last n elements of this vector.

Parameters
elements_numberSize of the new vector.

Definition at line 4760 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::assemble ( const Vector< T > &  other_vector) const

Assemble two vectors.

Parameters
other_vectorVector to be get_assemblyd to this vector.

Definition at line 5110 of file vector.h.

template<class T >
Vector< bool > OpenNN::Vector< T >::calculate_binary ( void  ) const

This method converts the values of the vector to be binary. The threshold value used is 0.5.

Definition at line 1865 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::calculate_competitive ( void  ) const

Returns the competitive vector of this vector, whose elements are one the bigest element of this vector, and zero for the other elements.

Definition at line 1787 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::calculate_cumulative ( void  ) const

Return the cumulative vector of this vector, where each element is summed up with all the previous ones.

Definition at line 1893 of file vector.h.

template<class T>
size_t OpenNN::Vector< T >::calculate_cumulative_index ( const T &  value) const

This method applies only to cumulative vectors. It returns the index of the first element which is greater than a given value.

Parameters
valueValue.

Definition at line 1920 of file vector.h.

template<class T >
double OpenNN::Vector< T >::calculate_distance ( const Vector< double > &  other_vector) const

Returns the distance between the elements of this vector and the elements of another vector.

Parameters
other_vectorOther vector.

Definition at line 2557 of file vector.h.

template<class T >
Vector< size_t > OpenNN::Vector< T >::calculate_greater_rank ( void  ) const

Returns a vector with the rank of the elements of this vector. The smallest element will have rank size-1, and the greatest element will have 0. That is, small values correspond to big ranks.

Definition at line 3360 of file vector.h.

template<class T>
Vector< size_t > OpenNN::Vector< T >::calculate_greater_than_indices ( const T &  value) const

Returns the vector indices at which the vector elements are greater than some given value.

Parameters
valueValue.

Definition at line 1219 of file vector.h.

template<class T >
Histogram< T > OpenNN::Vector< T >::calculate_histogram ( const size_t &  bins_number = 10) const

This method bins the elements of the vector into a given number of equally spaced containers. It returns a vector of two vectors. The size of both subvectors is the number of bins. The first subvector contains the frequency of the bins. The second subvector contains the center of the bins.

Definition at line 1445 of file vector.h.

template<class T >
Histogram< T > OpenNN::Vector< T >::calculate_histogram_missing_values ( const Vector< size_t > &  missing_indices,
const size_t &  bins_number = 10 
) const

This method bins the elements of the vector into a given number of equally spaced containers. It returns a vector of two vectors. The size of both subvectors is the number of bins. The first subvector contains the frequency of the bins. The second subvector contains the center of the bins.

Definition at line 1533 of file vector.h.

template<class T >
Vector< size_t > OpenNN::Vector< T >::calculate_less_rank ( void  ) const

Returns a vector with the rank of the elements of this vector. The smallest element will have rank 0, and the greatest element will have size-1. That is, small values correspond with small ranks.

Definition at line 3328 of file vector.h.

template<class T>
Vector< size_t > OpenNN::Vector< T >::calculate_less_than_indices ( const T &  value) const

Returns the vector indices at which the vector elements are less than some given value.

Parameters
valueValue.

Definition at line 1195 of file vector.h.

template<class T>
T OpenNN::Vector< T >::calculate_linear_correlation ( const Vector< T > &  other) const

Calculates the linear correlation coefficient (R-value) between another vector and this vector.

Parameters
otherVector for computing the linear correlation with this vector.

Definition at line 2675 of file vector.h.

template<class T>
T OpenNN::Vector< T >::calculate_linear_correlation_missing_values ( const Vector< T > &  other,
const Vector< size_t > &  missing_indices 
) const

Calculates the linear correlation coefficient (R-value) between another vector and this vector when there are missing values in the data.

Parameters
otherVector for computing the linear correlation with this vector.
missing_indicesVector with the indices of the missing values.

Definition at line 2749 of file vector.h.

template<class T>
LinearRegressionParameters< T > OpenNN::Vector< T >::calculate_linear_regression_parameters ( const Vector< T > &  other) const

Calculates the linear regression parameters (intercept, slope and correlation) between another vector and this vector. It returns a linear regression parameters structure.

Parameters
otherOther vector for the linear regression analysis.

Definition at line 2830 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_lower_bounded ( const T &  lower_bound) const

Returns a vector with the bounded elements from below of the current vector.

Parameters
lower_boundLower bound values.

Definition at line 2950 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_lower_bounded ( const Vector< T > &  lower_bound) const

Returns a vector with the bounded elements from above of the current vector.

Parameters
lower_boundLower bound values.

Definition at line 2978 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_lower_upper_bounded ( const T &  lower_bound,
const T &  upper_bound 
) const

This method bounds the elements of the vector if they fall above or below their lower or upper bound values, respectively.

Parameters
lower_boundLower bound value.
upper_boundUpper bound value.

Definition at line 3106 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_lower_upper_bounded ( const Vector< T > &  lower_bound,
const Vector< T > &  upper_bound 
) const

This method bounds the elements of the vector if they fall above or below their corresponding lower or upper bound values, respectively.

Parameters
lower_boundLower bound values.
upper_boundUpper bound values.

Definition at line 3140 of file vector.h.

template<class T >
Vector< size_t > OpenNN::Vector< T >::calculate_maximal_indices ( const size_t &  number) const

Returns the indices of the largest elements in the vector.

Parameters
numberNumber of maximal indices to be computed.

Definition at line 1700 of file vector.h.

template<class T >
Vector< size_t > OpenNN::Vector< T >::calculate_minimal_indices ( const size_t &  number) const

Returns the indices of the smallest elements in the vector.

Parameters
numberNumber of minimal indices to be computed.

Definition at line 1671 of file vector.h.

template<class T >
double OpenNN::Vector< T >::calculate_Minkowski_error ( const Vector< double > &  other_vector,
const double &  Minkowski_parameter 
) const

Returns the Minkowski squared error between the elements of this vector and the elements of another vector.

Parameters
other_vectorOther vector.
Minkowski_parameterMinkowski exponent.

Definition at line 2613 of file vector.h.

template<class T>
Vector< size_t > OpenNN::Vector< T >::calculate_occurrence_indices ( const T &  value) const

Returns the vector indices at which the vector elements take some given value.

Parameters
valueValue.

Definition at line 1118 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_pow ( const T &  exponent) const

Returns a vector with the elements of this vector raised to a power exponent.

Parameters
exponentPow exponent.

Definition at line 1766 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_scaled_mean_standard_deviation ( const Vector< T > &  mean,
const Vector< T > &  standard_deviation 
) const

Returns a vector with the scaled elements of this vector acording to the mean and standard deviation method. The size of the mean and standard deviation vectors must be equal to the size of the vector.

Parameters
meanMean values.
standard_deviationStandard deviation values.

Definition at line 4342 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_scaled_minimum_maximum ( const Vector< T > &  minimum,
const Vector< T > &  maximum 
) const

Returns a vector with the scaled elements of this vector acording to the minimum and maximum method. The size of the minimum and maximum vectors must be equal to the size of the vector.

Parameters
minimumMinimum values.
maximumMaximum values.

Definition at line 4275 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::calculate_softmax ( void  ) const

Returns the softmax vector of this vector, whose elements sum one, and can be interpreted as probabilities.

Definition at line 1807 of file vector.h.

template<class T >
double OpenNN::Vector< T >::calculate_sum_squared_error ( const Vector< double > &  other_vector) const

Returns the sum squared error between the elements of this vector and the elements of another vector.

Parameters
other_vectorOther vector.

Definition at line 2569 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_unscaled_mean_standard_deviation ( const Vector< T > &  mean,
const Vector< T > &  standard_deviation 
) const

Returns a vector with the unscaled elements of this vector acording to the mean and standard deviation method. The size of the mean and standard deviation vectors must be equal to the size of the vector.

Parameters
meanMean values.
standard_deviationStandard deviation values.

Definition at line 4470 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_unscaled_minimum_maximum ( const Vector< T > &  minimum,
const Vector< T > &  maximum 
) const

Returns a vector with the unscaled elements of this vector acording to the minimum and maximum method. The size of the minimum and maximum vectors must be equal to the size of the vector.

Parameters
minimumMinimum values.
maximumMaximum values.

Definition at line 4405 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_upper_bounded ( const T &  upper_bound) const

This method bounds the elements of the vector if they fall above an upper bound value.

Parameters
upper_boundUpper bound value.

Definition at line 3027 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::calculate_upper_bounded ( const Vector< T > &  upper_bound) const

This method bounds the elements of the vector if they fall above their corresponding upper bound values.

Parameters
upper_boundUpper bound values.

Definition at line 3055 of file vector.h.

template<class T>
size_t OpenNN::Vector< T >::count_greater_than ( const T &  value) const

Returns the number of elements which are greater than some given value.

Parameters
valueValue.

Definition at line 1147 of file vector.h.

template<class T>
size_t OpenNN::Vector< T >::count_less_than ( const T &  value) const

Returns the number of elements which are less than some given value.

Parameters
valueValue.

Definition at line 1171 of file vector.h.

template<class T>
Matrix< T > OpenNN::Vector< T >::direct ( const Vector< T > &  other_vector) const

Outer product vector*vector arithmetic operator.

Parameters
other_vectorvector to be multiplied to this vector.

Definition at line 3697 of file vector.h.

template<class T >
double OpenNN::Vector< T >::dot ( const Vector< double > &  other_vector) const

Dot product vector*vector arithmetic operator.

Parameters
other_vectorvector to be multiplied to this vector.

Definition at line 3654 of file vector.h.

template<class T>
Vector< double > OpenNN::Vector< T >::dot ( const Matrix< T > &  matrix) const

Returns the dot product of this vector with a matrix. The number of rows of the matrix must be equal to the size of the vector.

Parameters
matrixmatrix to be multiplied to this vector.

Definition at line 3603 of file vector.h.

template<class T>
void OpenNN::Vector< T >::initialize ( const T &  value)

Initializes all the elements of the vector with a given value.

Parameters
valueType value.

Definition at line 753 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::insert_element ( const size_t &  index,
const T &  value 
) const

Returns a new vector with a new element inserted.

Parameters
indexPosition of the new element.
valueValue of the new element.

Definition at line 4967 of file vector.h.

template<class T >
bool OpenNN::Vector< T >::is_constant ( const double &  tolerance = 0.0) const

Returns true if all the elements have the same value within a defined tolerance , and false otherwise.

Parameters
toleranceTolerance value, so that if abs(max-min) <= tol, then the vector is considered constant.

Definition at line 1028 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::is_in ( const T &  minimum,
const T &  maximum 
) const

Returns true if the value of all the elements fall in some given range, and false otherwise.

Parameters
minimumMinimum value of the range.
maximumMaximum value of the range.

Definition at line 1005 of file vector.h.

template<class T >
void OpenNN::Vector< T >::load ( const std::string &  file_name)

Loads the members of a vector from an data file. Please be careful with the file format, which is specified in the OpenNN manual.

Parameters
file_nameName of vector file.

Definition at line 4799 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator!= ( const T &  value) const

Not equivalent relational operator between this vector and a Type value. It produces true if some element of this vector is not equal to the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 540 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator* ( const T &  scalar) const
inline

Product vector*scalar arithmetic operator.

Parameters
scalarScalar value to be multiplied to this vector.

Definition at line 3503 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator* ( const Vector< T > &  other_vector) const
inline

Element by element product vector*vector arithmetic operator.

Parameters
other_vectorvector to be multiplied to this vector.

Definition at line 3521 of file vector.h.

template<class T>
Matrix< T > OpenNN::Vector< T >::operator* ( const Matrix< T > &  matrix) const
inline

Element by row product vector*matrix arithmetic operator.

Parameters
matrixmatrix to be multiplied to this vector.

Definition at line 3558 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator*= ( const T &  value)

Scalar product and assignment operator.

Parameters
valueScalar value to be multiplied to this vector.

Definition at line 3901 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator*= ( const Vector< T > &  other_vector)

Vector product and assignment operator.

Parameters
other_vectorVector to be multiplied to this vector.

Definition at line 3918 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator+ ( const T &  scalar) const
inline

Sum vector+scalar arithmetic operator.

Parameters
scalarScalar value to be added to this vector.

Definition at line 3391 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator+ ( const Vector< T > &  other_vector) const
inline

Sum vector+vector arithmetic operator.

Parameters
other_vectorVector to be added to this vector.

Definition at line 3411 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator+= ( const T &  value)

Scalar sum and assignment operator.

Parameters
valueScalar value to be added to this vector.

Definition at line 3795 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator+= ( const Vector< T > &  other_vector)

Vector sum and assignment operator.

Parameters
other_vectorVector to be added to this vector.

Definition at line 3812 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator- ( const T &  scalar) const
inline

Difference vector-scalar arithmetic operator.

Parameters
scalarScalar value to be subtracted to this vector.

Definition at line 3448 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator- ( const Vector< T > &  other_vector) const
inline

Difference vector-vector arithmetic operator.

Parameters
other_vectorvector to be subtracted to this vector.

Definition at line 3466 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator-= ( const T &  value)

Scalar rest and assignment operator.

Parameters
valueScalar value to be subtracted to this vector.

Definition at line 3848 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator-= ( const Vector< T > &  other_vector)

Vector rest and assignment operator.

Parameters
other_vectorVector to be subtracted to this vector.

Definition at line 3865 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator/ ( const T &  scalar) const

Cocient vector/scalar arithmetic operator.

Parameters
scalarScalar value to be divided to this vector.

Definition at line 3740 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::operator/ ( const Vector< T > &  other_vector) const

Cocient vector/vector arithmetic operator.

Parameters
other_vectorvector to be divided to this vector.

Definition at line 3758 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator/= ( const T &  value)

Scalar division and assignment operator.

Parameters
valueScalar value to be divided to this vector.

Definition at line 3954 of file vector.h.

template<class T>
void OpenNN::Vector< T >::operator/= ( const Vector< T > &  other_vector)

Vector division and assignment operator.

Parameters
other_vectorVector to be divided to this vector.

Definition at line 3971 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator< ( const T &  value) const

Less than relational operator between this vector and a Type value. It produces true if all the elements of this vector are less than the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 586 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator<= ( const T &  value) const

Less than or equal to than relational operator between this vector and a Type value. It produces true if all the elements of this vector are less than or equal to the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 632 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator== ( const T &  value) const

Equal to operator between this vector and a Type value. It produces true if all the elements of this vector are equal to the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 517 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator> ( const T &  value) const

Greater than relational operator between this vector and a Type value. It produces true if all the elements of this vector are greater than the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 563 of file vector.h.

template<class T>
bool OpenNN::Vector< T >::operator>= ( const T &  value) const

Greater than or equal to than relational operator between this vector and a Type value. It produces true if all the elements of this vector are greater than or equal to the Type value, and false otherwise.

Parameters
valueType value to be compared with.

Definition at line 609 of file vector.h.

template<class T >
void OpenNN::Vector< T >::parse ( const std::string &  str)

This method takes a string representation of a vector and sets this vector to have size equal to the number of words and values equal to that words.

Parameters
strString to be parsed.

Definition at line 5217 of file vector.h.

template<class T >
void OpenNN::Vector< T >::randomize_normal ( const double &  mean = 0.0,
const double &  standard_deviation = 1.0 
)

Assigns random values to each element in the vector. These are taken from a normal distribution with single mean and standard deviation values for all the elements.

Parameters
meanMean value of uniform distribution.
standard_deviationStandard deviation value of uniform distribution.

Definition at line 867 of file vector.h.

template<class T >
void OpenNN::Vector< T >::randomize_normal ( const Vector< double > &  mean,
const Vector< double > &  standard_deviation 
)

Assigns random values to each element in the vector. These are taken from normal distributions with given means and standard deviations for each element.

Parameters
meanMean values of normal distributions.
standard_deviationStandard deviation values of normal distributions.

Definition at line 903 of file vector.h.

template<class T >
void OpenNN::Vector< T >::randomize_uniform ( const double &  minimum = -1.0,
const double &  maximum = 1.0 
)

Assigns a random value comprised between a minimum value and a maximum value to each element in the vector.

Parameters
minimumMinimum initialization value.
maximumMaximum initialization value.

Definition at line 781 of file vector.h.

template<class T >
void OpenNN::Vector< T >::randomize_uniform ( const Vector< double > &  minimums,
const Vector< double > &  maximums 
)

Assigns a random value comprised between given minimum and a maximum values to every element in the vector.

Parameters
minimumsMinimum initialization values.
maximumsMaximum initialization values.

Definition at line 817 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::remove_element ( const size_t &  index) const

Returns a new vector which is a copy of this vector but with a given element removed. Therefore, the size of the new vector is the size of this vector minus one.

Parameters
indexIndex of element to be removed.

Definition at line 5017 of file vector.h.

template<class T>
Vector< T > OpenNN::Vector< T >::remove_value ( const T &  value) const

Construct a copy of this vector but without a certain value. Note that the new vector might have a different size than this vector.

Parameters
valueValue of elements to be removed.

Definition at line 5063 of file vector.h.

template<class T >
void OpenNN::Vector< T >::save ( const std::string &  file_name) const

Saves to a data file the elements of the vector. The file format is as follows: element_0 element_1 ... element_N-1

Parameters
file_nameName of vector data file.

Definition at line 4845 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_mean_standard_deviation ( const T &  mean,
const T &  standard_deviation 
)

Normalizes the elements of this vector using the mean and standard deviation method.

Parameters
meanMean value for the scaling.
standard_deviationStandard deviation value for the scaling.

Definition at line 4093 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_mean_standard_deviation ( const Statistics< T > &  statistics)

Normalizes the elements of this vector using the mean and standard deviation method.

Parameters
statisticsStatistics structure, which contains the mean and standard deviation values for the scaling.

Definition at line 4116 of file vector.h.

template<class T>
Statistics< T > OpenNN::Vector< T >::scale_mean_standard_deviation ( void  )

Normalizes the elements of the vector with the mean and standard deviation method. The values used are those calculated from the vector. It also returns the statistics from the vector.

Definition at line 4129 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_mean_standard_deviation ( const Vector< T > &  mean,
const Vector< T > &  standard_deviation 
)

Scales the vector elements with given mean and standard deviation values. It updates the data in the vector. The size of the mean and standard deviation vectors must be equal to the size of the vector.

Parameters
meanMean values.
standard_deviationStandard deviation values.

Definition at line 4212 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_minimum_maximum ( const T &  minimum,
const T &  maximum 
)

Normalizes the elements of this vector using the minimum and maximum method.

Parameters
minimumMinimum value for the scaling.
maximumMaximum value for the scaling.

Definition at line 4041 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_minimum_maximum ( const Statistics< T > &  statistics)

Normalizes the elements of this vector using the minimum and maximum method.

Parameters
statisticsStatistics structure, which contains the minimum and maximum values for the scaling.

Definition at line 4063 of file vector.h.

template<class T>
Statistics< T > OpenNN::Vector< T >::scale_minimum_maximum ( void  )

Normalizes the elements of the vector with the minimum and maximum method. The minimum and maximum values used are those calculated from the vector. It also returns the statistics from the vector.

Definition at line 4076 of file vector.h.

template<class T>
void OpenNN::Vector< T >::scale_minimum_maximum ( const Vector< T > &  minimum,
const Vector< T > &  maximum 
)

Scales the vectir elements with given minimum and maximum values. It updates the data in the vector. The size of the minimum and maximum vectors must be equal to the size of the vector.

Parameters
minimumMinimum values.
maximumMaximum values.

Definition at line 4148 of file vector.h.

template<class T >
void OpenNN::Vector< T >::set ( const size_t &  new_size)

Sets a new size to the vector. It does not initialize the data.

Parameters
new_sizeSize for the vector.

Definition at line 668 of file vector.h.

template<class T>
void OpenNN::Vector< T >::set ( const size_t &  new_size,
const T &  new_value 
)

Sets a new size to the vector and initializes all its elements with a given value.

Parameters
new_sizeSize for the vector.
new_valueValue for all the elements.

Definition at line 681 of file vector.h.

template<class T>
void OpenNN::Vector< T >::set ( const std::string &  file_name)

Sets all the members of a vector object by loading them from a data file. The format is specified in the OpenNN manual.

Parameters
file_nameName of vector data file.

Definition at line 696 of file vector.h.

template<class T>
void OpenNN::Vector< T >::set ( const T &  first,
const double &  step,
const T &  last 
)

Makes this vector to have elements starting from a given value, continuing with a step value and finishing with a given value. Depending on the starting, step and finishin values, this method can produce a variety of sizes and data.

Parameters
firstStarting value.
stepStep value.
lastFinishing value.

Definition at line 711 of file vector.h.

template<class T>
void OpenNN::Vector< T >::set ( const Vector< T > &  other_vector)

Sets the members of this object with the values of another vector.

Parameters
other_vectorObject to set this vector.

Definition at line 741 of file vector.h.

template<class T >
Vector< T > OpenNN::Vector< T >::take_out ( const size_t &  position,
const size_t &  other_size 
) const

Extract a vector of a given size from a given position

Parameters
positionExtraction position.
other_sizeSize of vector to be extracted.

Definition at line 4928 of file vector.h.

template<class T >
Matrix< T > OpenNN::Vector< T >::to_column_matrix ( void  ) const

Returns a column matrix with number of rows equal to the size of this vector and number of columns equal to one.

Definition at line 5196 of file vector.h.

template<class T >
Matrix< T > OpenNN::Vector< T >::to_matrix ( const size_t &  rows_number,
const size_t &  columns_number 
) const

Returns a matrix with given numbers of rows and columns and with the elements of this vector ordered by rows. The number of rows multiplied by the number of columns must be equal to the size of this vector.

Parameters
rows_numberNumber of rows in the new matrix.
columns_numberNumber of columns in the new matrix.

Definition at line 5338 of file vector.h.

template<class T >
Matrix< T > OpenNN::Vector< T >::to_row_matrix ( void  ) const

Returns a row matrix with number of rows equal to one and number of columns equal to the size of this vector.

Definition at line 5175 of file vector.h.

template<class T>
void OpenNN::Vector< T >::tuck_in ( const size_t &  position,
const Vector< T > &  other_vector 
)

Insert another vector starting from a given position.

Parameters
positionInsertion position.
other_vectorVector to be inserted.

Definition at line 4891 of file vector.h.

template<class T>
void OpenNN::Vector< T >::unscale_mean_standard_deviation ( const Vector< T > &  mean,
const Vector< T > &  standard_deviation 
)

Unscales the vector elements with given mean and standard deviation values. It updates the vector elements. The size of the mean and standard deviation vectors must be equal to the size of the vector.

Parameters
meanMean values.
standard_deviationStandard deviation values.

Definition at line 4598 of file vector.h.

template<class T>
void OpenNN::Vector< T >::unscale_minimum_maximum ( const Vector< T > &  minimum,
const Vector< T > &  maximum 
)

Unscales the vector elements with given minimum and maximum values. It updates the vector elements. The size of the minimum and maximum vectors must be equal to the size of the vector.

Parameters
minimumMinimum values.
maximumMaximum deviation values.

Definition at line 4536 of file vector.h.


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