mlpack
lin_alg_impl.hpp
Go to the documentation of this file.
1 
10 #ifndef MLPACK_CORE_MATH_LIN_ALG_IMPL_HPP
11 #define MLPACK_CORE_MATH_LIN_ALG_IMPL_HPP
12 
13 #include "lin_alg.hpp"
14 
15 namespace mlpack {
16 namespace math {
17 
18 inline size_t SvecIndex(size_t i, size_t j, size_t n)
19 {
20  if (i > j)
21  std::swap(i, j);
22  return (j-i) + (n*(n+1) - (n-i)*(n-i+1))/2;
23 }
24 
25 } // namespace math
26 } // namespace mlpack
27 
28 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
size_t SvecIndex(size_t i, size_t j, size_t n)
Return the index such that A[i,j] == factr(i, j) * svec(A)[pos(i, j)], where factr(i, j) = sqrt(2) if i != j and 1 otherwise.
Definition: lin_alg_impl.hpp:18