arma::normalise to normalise
Signed-off-by: Omar Shrit <omar@avontech.fr>
This commit is contained in:
@@ -107,7 +107,7 @@ class ProjVector
|
||||
* @param vect Vector to be considered.
|
||||
*/
|
||||
ProjVector(const arma::vec& vect) :
|
||||
projVect(arma::normalise(vect))
|
||||
projVect(normalise(vect))
|
||||
{};
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,8 +91,8 @@ void CosineEmbeddingLossType<MatType>::Backward(
|
||||
{
|
||||
const int multiplier = similarity ? 1 : -1;
|
||||
outputTemp(arma::span(i, i + cols -1)) = -1 * multiplier *
|
||||
(arma::normalise(inputTemp2(arma::span(i, i + cols - 1))) -
|
||||
cosDist * arma::normalise(inputTemp1(arma::span(i, i + cols -
|
||||
(normalise(inputTemp2(arma::span(i, i + cols - 1))) -
|
||||
cosDist * normalise(inputTemp1(arma::span(i, i + cols -
|
||||
1)))) / std::sqrt(arma::accu(arma::pow(inputTemp1(arma::span(i, i +
|
||||
cols - 1)), 2)));
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class CosineSearch
|
||||
CosineSearch(const arma::mat& referenceSet)
|
||||
{
|
||||
// Normalize all vectors to unit length.
|
||||
arma::mat normalizedSet = arma::normalise(referenceSet, 2, 0);
|
||||
arma::mat normalizedSet = normalise(referenceSet, 2, 0);
|
||||
|
||||
neighborSearch.Train(std::move(normalizedSet));
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class CosineSearch
|
||||
arma::Mat<size_t>& neighbors, arma::mat& similarities)
|
||||
{
|
||||
// Normalize query vectors to unit length.
|
||||
arma::mat normalizedQuery = arma::normalise(query, 2, 0);
|
||||
arma::mat normalizedQuery = normalise(query, 2, 0);
|
||||
|
||||
neighborSearch.Search(normalizedQuery, k, neighbors, similarities);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class PearsonSearch
|
||||
// For each vector x, first subtract mean(x) from each element in x.
|
||||
// Then normalize the vector to unit length.
|
||||
arma::mat normalizedSet(arma::size(referenceSet));
|
||||
normalizedSet = arma::normalise(
|
||||
normalizedSet = normalise(
|
||||
referenceSet.each_row() - arma::mean(referenceSet));
|
||||
|
||||
neighborSearch.Train(std::move(normalizedSet));
|
||||
@@ -79,7 +79,7 @@ class PearsonSearch
|
||||
// For each vector x, first subtract mean(x) from each element in x.
|
||||
// Then normalize the vector to unit length.
|
||||
arma::mat normalizedQuery;
|
||||
normalizedQuery = arma::normalise(query.each_row() - arma::mean(query));
|
||||
normalizedQuery = normalise(query.each_row() - arma::mean(query));
|
||||
|
||||
neighborSearch.Search(normalizedQuery, k, neighbors, similarities);
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ void GenerateNoisySinRNN(arma::cube& data,
|
||||
|
||||
arma::colvec y = x;
|
||||
if (normalize)
|
||||
y = arma::normalise(x);
|
||||
y = normalise(x);
|
||||
|
||||
// Now break this into columns of rho size slices.
|
||||
size_t numColumns = y.n_elem / rho;
|
||||
|
||||
Reference in New Issue
Block a user