NAME
normalize_vector - Normalizes the elements of a vector.
SYNOPSIS
#include "m/m_vec_norm.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int normalize_vector
(
Vector **target_vpp,
const Vector *vp,
Norm_method normalization_method
);
PARAMETERS
-
Vector **target_vpp
-
Double pointer to output Vector.
-
const Vector *vp
-
Pointer to input Vector.
-
Norm_method normalization_method
-
Method to use.
Possible values for a
Norm_method
are as follows:
- DONT_NORMALIZE
,
- NORMALIZE_BY_MAGNITUDE
,
- NORMALIZE_BY_MEAN
,
- NORMALIZE_BY_SUM
,
- NORMALIZE_BY_MAX_ABS_VALUE
,
- NORMALIZATION_METHOD_ERROR
DESCRIPTION
This routine normalizes an input vector and places the result into the
specified target vector. The normalization method must be supplied as an
argument.
"target_vpp" is a double pointer to the Vector object to receive the
normalized output.
"vp" points to the source Vector object to normalize.
"normalization_method" indicates which normalization to perform. Currently,
the following values are supported:
DONT_NORMALIZE - Do nothing. "target_vpp" is untouched.
NORMALIZE_BY_MAGNITUDE - Vector magnitude normalized to 1.
NORMALIZE_BY_MEAN - Vector mean value normailized to 1.
NORMALIZE_BY_SUM - Sum of elements normalized to 1.
NORMALIZE_BY_MAX_ABS_VALUE - Maximum absolute value is normalized to 1.
If "vp" is NULL, then "*target_vpp" becomes NULL also (and its contents
are freed if it has any), and NO_ERROR is returned.
All normalization methods divide each element of the vector by the specified
quantity. Errors will be triggered if the normalization quantity is close to
zero.
RETURNS
NO_ERROR on success, ERROR on failure.
RELATED
ow_normalize_vector, normalize_vector_2, ow_normalize_vector_2
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTER
Lindsay Martin and Kobus Barnard
SEE ALSO
scale_vector_by_sum
,
scale_vector_by_mean
,
scale_vector_by_max_abs
,
scale_vector_by_max
,
scale_vector_by_magnitude
,
ow_normalize_vector
,
silent_ow_scale_vector_by_sum
,
safe_ow_scale_vector_by_sum
,
safe_ow_scale_vector_by_sum_2
,
ow_scale_vector_by_sum
,
ow_scale_vector_by_mean
,
ow_scale_vector_by_max_abs
,
ow_scale_vector_by_max
,
ow_scale_vector_by_magnitude
,
normalize_vector_2
,
scale_vector_by_sum_2
,
scale_vector_by_mean_2
,
scale_vector_by_max_abs_2
,
scale_vector_by_max_2
,
scale_vector_by_magnitude_2
,
ow_normalize_vector_2
,
ow_scale_vector_by_sum_2
,
ow_scale_vector_by_mean_2
,
ow_scale_vector_by_max_abs_2
,
ow_scale_vector_by_max_2
,
ow_scale_vector_by_magnitude_2
,
vector_magnitude
,
max_abs_vector_element
,
min_vector_element
,
max_vector_element
,
get_min_vector_element
,
get_max_vector_element
,
max_thresh_vector
,
min_thresh_vector
,
ow_max_thresh_vector
,
ow_min_thresh_vector
,
ow_normalize_log_prob_vp
,
ow_exp_scale_by_sum_log_vector