SHOGUN  v3.2.0
所有成员列表 | Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 成员函数
SGVector< T > 模板类 参考

详细描述

template<class T>
class shogun::SGVector< T >

shogun vector

在文件 ProbabilityDistribution.h19 行定义.

类 SGVector< T > 继承关系图:
Inheritance graph
[图例]

Public 成员函数

 SGVector ()
 
 SGVector (T *v, index_t len, bool ref_counting=true)
 
 SGVector (index_t len, bool ref_counting=true)
 
 SGVector (const SGVector &orig)
 
void set (SGVector< T > orig)
 
virtual ~SGVector ()
 
int32_t size () const
 
 operator T* ()
 
void zero ()
 
void set_const (T const_elem)
 
void range_fill (T start=0)
 
void random (T min_value, T max_value)
 
void randperm ()
 
index_t find_position_to_insert (T element)
 
void qsort ()
 
SGVector< index_targsort ()
 
bool is_sorted () const
 
SGVector< T > clone () const
 
SGVector< T > get ()
 
const T & get_element (index_t index)
 
void set_element (const T &p_element, index_t index)
 
void resize_vector (int32_t n)
 
const T & operator[] (uint64_t index) const
 
const T & operator[] (int64_t index) const
 
const T & operator[] (uint32_t index) const
 
const T & operator[] (int32_t index) const
 
T & operator[] (uint64_t index)
 
T & operator[] (int64_t index)
 
T & operator[] (uint32_t index)
 
T & operator[] (int32_t index)
 
void add (const SGVector< T > x)
 
void add (const SGSparseVector< T > &x)
 
void add (const T x)
 
SGVector< T > operator+ (SGVector< T > x)
 
SGVector< T > operator+= (SGVector< T > x)
 
SGVector< T > operator+= (SGSparseVector< T > &x)
 
bool equals (SGVector< T > &other)
 
void permute ()
 
void permute (CRandom *rand)
 
product ()
 return product(vec) 更多...
 
void display_size () const
 
void display_vector (const char *name="vector", const char *prefix="") const
 
SGVector< index_tfind (T elem)
 
template<typename Predicate >
SGVector< index_tfind_if (Predicate p)
 
void scale (T alpha)
 scale vector inplace 更多...
 
float64_t mean () const
 
void load (CFile *loader)
 
void save (CFile *saver)
 
void abs ()
 absolute value of vector elements 更多...
 
void acos ()
 arc cosine of vector elements 更多...
 
void asin ()
 arc sine of vector elements 更多...
 
void atan ()
 arc tangent of vector elements 更多...
 
void atan2 (T x)
 atan2 of vector elements 更多...
 
void cos ()
 cosine of vector elements 更多...
 
void cosh ()
 hyperbolic cosine of vector elements 更多...
 
void exp ()
 exponential of vector elements 更多...
 
void log ()
 natural logarithm of vector elements 更多...
 
void log10 ()
 common logarithm of vector elements 更多...
 
void pow (T q)
 power of vector elements 更多...
 
void sin ()
 sine of vector elements 更多...
 
void sinh ()
 hyperbolic sine of vector elements 更多...
 
void sqrt ()
 square root of vector elements 更多...
 
void tan ()
 tangent of vector elements 更多...
 
void tanh ()
 hyperbolic tangent of vector elements 更多...
 
SGVector< float64_tget_real ()
 
SGVector< float64_tget_imag ()
 
template<>
void zero ()
 
template<>
SGVector< index_targsort ()
 
template<>
bool is_sorted () const
 
template<>
index_t find_position_to_insert (complex128_t element)
 
template<>
void range_fill_vector (complex128_t *vec, int32_t len, complex128_t start)
 
template<>
void display_vector (const bool *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const char *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const uint8_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const int8_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const uint16_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const int16_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const int32_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const uint32_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const int64_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const uint64_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const float32_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const float64_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const floatmax_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void display_vector (const complex128_t *vector, int32_t n, const char *name, const char *prefix)
 
template<>
void vec1_plus_scalar_times_vec2 (float64_t *vec1, float64_t scalar, const float64_t *vec2, int32_t n)
 
template<>
void vec1_plus_scalar_times_vec2 (float32_t *vec1, float32_t scalar, const float32_t *vec2, int32_t n)
 
template<>
void random_vector (complex128_t *vec, int32_t len, complex128_t min_value, complex128_t max_value)
 
template<>
SGVector< complex128_trandperm_vec (int32_t n)
 
template<>
complex128_trandperm (int32_t n)
 
template<>
void randperm (complex128_t *perm, int32_t n)
 
template<>
bool twonorm (const bool *x, int32_t len)
 
template<>
char twonorm (const char *x, int32_t len)
 
template<>
int8_t twonorm (const int8_t *x, int32_t len)
 
template<>
uint8_t twonorm (const uint8_t *x, int32_t len)
 
template<>
int16_t twonorm (const int16_t *x, int32_t len)
 
template<>
uint16_t twonorm (const uint16_t *x, int32_t len)
 
template<>
int32_t twonorm (const int32_t *x, int32_t len)
 
template<>
uint32_t twonorm (const uint32_t *x, int32_t len)
 
template<>
int64_t twonorm (const int64_t *x, int32_t len)
 
template<>
uint64_t twonorm (const uint64_t *x, int32_t len)
 
template<>
float32_t twonorm (const float32_t *x, int32_t len)
 
template<>
float64_t twonorm (const float64_t *v, int32_t n)
 
template<>
floatmax_t twonorm (const floatmax_t *x, int32_t len)
 
template<>
complex128_t twonorm (const complex128_t *x, int32_t len)
 
template<>
complex128_t qsq (complex128_t *x, int32_t len, float64_t q)
 
template<>
complex128_t qnorm (complex128_t *x, int32_t len, float64_t q)
 
template<>
float64_t max_abs (float64_t *vec, int32_t len)
 
template<>
float32_t max_abs (float32_t *vec, int32_t len)
 
template<>
complex128_t max_abs (complex128_t *vec, int32_t len)
 
template<>
int32_t arg_max_abs (float64_t *vec, int32_t inc, int32_t len, float64_t *maxv_ptr)
 
template<>
int32_t arg_max_abs (float32_t *vec, int32_t inc, int32_t len, float32_t *maxv_ptr)
 
template<>
int32_t arg_max_abs (complex128_t *vec, int32_t inc, int32_t len, complex128_t *maxv_ptr)
 
template<>
int32_t arg_max (complex128_t *vec, int32_t inc, int32_t len, complex128_t *maxv_ptr)
 
template<>
int32_t arg_min (complex128_t *vec, int32_t inc, int32_t len, complex128_t *minv_ptr)
 
template<>
float64_t sum_abs (float64_t *vec, int32_t len)
 
template<>
float32_t sum_abs (float32_t *vec, int32_t len)
 
template<>
int32_t unique (complex128_t *output, int32_t size)
 
template<>
void scale_vector (float64_t alpha, float64_t *vec, int32_t len)
 
template<>
void scale_vector (float32_t alpha, float32_t *vec, int32_t len)
 
template<>
float64_t mean () const
 
template<>
void load (CFile *loader)
 
template<>
void save (CFile *saver)
 
template<>
float64_tlinspace (complex128_t start, complex128_t end, int32_t n)
 
template<>
void pow (complex128_t q)
 
int32_t ref_count ()
 

静态 Public 成员函数

static SGVector< T > randperm_vec (int32_t n)
 
static T * randperm (int32_t n)
 
static SGVector< float64_tlinspace_vec (T start, T end, int32_t n)
 
static float64_tlinspace (T start, T end, int32_t n)
 
static T * clone_vector (const T *vec, int32_t len)
 
static void fill_vector (T *vec, int32_t len, T value)
 
static void range_fill_vector (T *vec, int32_t len, T start=0)
 
static void random_vector (T *vec, int32_t len, T min_value, T max_value)
 
static void randperm (T *perm, int32_t n)
 
static void permute (T *vec, int32_t n)
 
static void permute (T *vec, int32_t n, CRandom *rand)
 
static void permute_vector (SGVector< T > vec)
 
static T twonorm (const T *x, int32_t len)
 || x ||_2 更多...
 
static float64_t onenorm (T *x, int32_t len)
 || x ||_1 更多...
 
static T qsq (T *x, int32_t len, float64_t q)
 || x ||_q^q 更多...
 
static T qnorm (T *x, int32_t len, float64_t q)
 || x ||_q 更多...
 
static void vec1_plus_scalar_times_vec2 (T *vec1, const T scalar, const T *vec2, int32_t n)
 x=x+alpha*y 更多...
 
static float64_t dot (const bool *v1, const bool *v2, int32_t n)
 compute dot product between v1 and v2 (blas optimized) 更多...
 
static floatmax_t dot (const floatmax_t *v1, const floatmax_t *v2, int32_t n)
 compute dot product between v1 and v2 (blas optimized) 更多...
 
static float64_t dot (const float64_t *v1, const float64_t *v2, int32_t n)
 compute dot product between v1 and v2 (blas optimized) 更多...
 
static float32_t dot (const float32_t *v1, const float32_t *v2, int32_t n)
 compute dot product between v1 and v2 (blas optimized) 更多...
 
static float64_t dot (const uint64_t *v1, const uint64_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 64bit unsigned ints) 更多...
 
static float64_t dot (const int64_t *v1, const int64_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 64bit ints) 更多...
 
static float64_t dot (const int32_t *v1, const int32_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 32bit ints) 更多...
 
static float64_t dot (const uint32_t *v1, const uint32_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 32bit unsigned ints) 更多...
 
static float64_t dot (const uint16_t *v1, const uint16_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 16bit unsigned ints) 更多...
 
static float64_t dot (const int16_t *v1, const int16_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 16bit unsigned ints) 更多...
 
static float64_t dot (const char *v1, const char *v2, int32_t n)
 compute dot product between v1 and v2 (for 8bit (un)signed ints) 更多...
 
static float64_t dot (const uint8_t *v1, const uint8_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 8bit (un)signed ints) 更多...
 
static float64_t dot (const int8_t *v1, const int8_t *v2, int32_t n)
 compute dot product between v1 and v2 (for 8bit (un)signed ints) 更多...
 
static float64_t dot (const float64_t *v1, const char *v2, int32_t n)
 compute dot product between v1 and v2 更多...
 
static void vector_multiply (T *target, const T *v1, const T *v2, int32_t len)
 compute vector multiplication 更多...
 
static void add (T *target, T alpha, const T *v1, T beta, const T *v2, int32_t len)
 target=alpha*vec1 + beta*vec2 更多...
 
static void add_scalar (T alpha, T *vec, int32_t len)
 add scalar to vector inplace 更多...
 
static void scale_vector (T alpha, T *vec, int32_t len)
 scale vector inplace 更多...
 
static T sum (T *vec, int32_t len)
 return sum(vec) 更多...
 
static T sum (SGVector< T > vec)
 return sum(vec) 更多...
 
static T product (T *vec, int32_t len)
 return the product of the vectors elements 更多...
 
static T min (T *vec, int32_t len)
 
static T max_abs (T *vec, int32_t len)
 
static T max (T *vec, int32_t len)
 
static int32_t arg_max (T *vec, int32_t inc, int32_t len, T *maxv_ptr=NULL)
 return arg_max(vec) 更多...
 
static int32_t arg_max_abs (T *vec, int32_t inc, int32_t len, T *maxv_ptr=NULL)
 return arg_max_abs(vec) 更多...
 
static int32_t arg_min (T *vec, int32_t inc, int32_t len, T *minv_ptr=NULL)
 return arg_min(vec) 更多...
 
static T sum_abs (T *vec, int32_t len)
 return sum(abs(vec)) 更多...
 
static bool fequal (T x, T y, float64_t precision=1e-6)
 return sum(abs(vec)) 更多...
 
static int32_t unique (T *output, int32_t size)
 
static void display_vector (const T *vector, int32_t n, const char *name="vector", const char *prefix="")
 display vector (useful for debugging) 更多...
 
static void display_vector (const SGVector< T >, const char *name="vector", const char *prefix="")
 display vector (useful for debugging) 更多...
 
static SGMatrix< T > convert_to_matrix (SGVector< T > vector, index_t nrows, index_t ncols, bool fortran_order)
 
static void convert_to_matrix (T *&matrix, index_t nrows, index_t ncols, const T *vector, int32_t vlen, bool fortran_order)
 

Public 属性

T * vector
 
index_t vlen
 

Protected 成员函数

virtual void copy_data (const SGReferencedData &orig)
 
virtual void init_data ()
 
virtual void free_data ()
 
void copy_refcount (const SGReferencedData &orig)
 
int32_t ref ()
 
int32_t unref ()
 

构造及析构函数说明

◆ SGVector() [1/4]

SGVector ( )

default constructor

在文件 SGVector.cpp73 行定义.

◆ SGVector() [2/4]

SGVector ( T *  v,
index_t  len,
bool  ref_counting = true 
)

constructor for setting params

在文件 SGVector.cpp79 行定义.

◆ SGVector() [3/4]

SGVector ( index_t  len,
bool  ref_counting = true 
)

constructor to create new vector in memory

在文件 SGVector.cpp85 行定义.

◆ SGVector() [4/4]

SGVector ( const SGVector< T > &  orig)

copy constructor

在文件 SGVector.cpp92 行定义.

◆ ~SGVector()

~SGVector ( )
virtual

empty destructor

在文件 SGVector.cpp104 行定义.

成员函数说明

◆ abs()

void abs ( )

absolute value of vector elements

◆ acos()

void acos ( )

arc cosine of vector elements

◆ add() [1/4]

void add ( const SGVector< T >  x)

add vector to current vector

参数
xadd vector x to current vector

在文件 SGVector.cpp329 行定义.

◆ add() [2/4]

void add ( const SGSparseVector< T > &  x)

add sparse vector to current vector

参数
xadd sparse vector x to current vector

在文件 SGVector.cpp348 行定义.

◆ add() [3/4]

void add ( const T  x)

add scalar to current vector

参数
xadd vector x to current vector

在文件 SGVector.cpp339 行定义.

◆ add() [4/4]

static void add ( T *  target,
alpha,
const T *  v1,
beta,
const T *  v2,
int32_t  len 
)
static

target=alpha*vec1 + beta*vec2

在文件 SGVector.h487 行定义.

◆ add_scalar()

static void add_scalar ( alpha,
T *  vec,
int32_t  len 
)
static

add scalar to vector inplace

在文件 SGVector.h496 行定义.

◆ arg_max() [1/2]

int32_t arg_max ( T *  vec,
int32_t  inc,
int32_t  len,
T *  maxv_ptr = NULL 
)
static

return arg_max(vec)

在文件 SGVector.cpp1048 行定义.

◆ arg_max() [2/2]

int32_t arg_max ( complex128_t vec,
int32_t  inc,
int32_t  len,
complex128_t maxv_ptr 
)

在文件 SGVector.cpp1068 行定义.

◆ arg_max_abs() [1/4]

int32_t arg_max_abs ( T *  vec,
int32_t  inc,
int32_t  len,
T *  maxv_ptr = NULL 
)
static

return arg_max_abs(vec)

在文件 SGVector.cpp1019 行定义.

◆ arg_max_abs() [2/4]

int32_t arg_max_abs ( float64_t vec,
int32_t  inc,
int32_t  len,
float64_t maxv_ptr 
)

在文件 SGVector.cpp994 行定义.

◆ arg_max_abs() [3/4]

int32_t arg_max_abs ( float32_t vec,
int32_t  inc,
int32_t  len,
float32_t maxv_ptr 
)

在文件 SGVector.cpp1006 行定义.

◆ arg_max_abs() [4/4]

int32_t arg_max_abs ( complex128_t vec,
int32_t  inc,
int32_t  len,
complex128_t maxv_ptr 
)

在文件 SGVector.cpp1039 行定义.

◆ arg_min() [1/2]

int32_t arg_min ( T *  vec,
int32_t  inc,
int32_t  len,
T *  minv_ptr = NULL 
)
static

return arg_min(vec)

在文件 SGVector.cpp1079 行定义.

◆ arg_min() [2/2]

int32_t arg_min ( complex128_t vec,
int32_t  inc,
int32_t  len,
complex128_t minv_ptr 
)

在文件 SGVector.cpp1099 行定义.

◆ argsort() [1/2]

SGVector< index_t > argsort ( )

get sorted index.

idx = v.argsort() is similar to Matlab [~, idx] = sort(v)

返回
sorted index for this vector

在文件 SGVector.cpp194 行定义.

◆ argsort() [2/2]

SGVector< index_t > argsort ( )

在文件 SGVector.cpp207 行定义.

◆ asin()

void asin ( )

arc sine of vector elements

◆ atan()

void atan ( )

arc tangent of vector elements

◆ atan2()

void atan2 ( x)

atan2 of vector elements

在文件 SGVector.cpp1314 行定义.

◆ clone()

SGVector< T > clone ( ) const

clone vector

在文件 SGVector.cpp257 行定义.

◆ clone_vector()

T * clone_vector ( const T *  vec,
int32_t  len 
)
static

clone vector

在文件 SGVector.cpp263 行定义.

◆ convert_to_matrix() [1/2]

SGMatrix< T > convert_to_matrix ( SGVector< T >  vector,
index_t  nrows,
index_t  ncols,
bool  fortran_order 
)
static

create SGMatrix from linear vector

参数
vectorsource vector
nrowsnumber of rows
ncolsnumber of cols
fortran_orderorder of stroing matrix in linear vector true - column-major order (FORTRAN, MATLAB, R) false - row-major order (C, Python)
返回
matrix

在文件 SGVector.cpp1376 行定义.

◆ convert_to_matrix() [2/2]

void convert_to_matrix ( T *&  matrix,
index_t  nrows,
index_t  ncols,
const T *  vector,
int32_t  vlen,
bool  fortran_order 
)
static

create matrix from linear vector

参数
matrixdestination memory
nrowsnumber of rows
ncolsnumber of cols
vectorsource vector
vlenlenght of source vector
fortran_orderorder of stroing matrix in linear vector true - column-major order (FORTRAN, MATLAB, R) false - row-major order (C, Python)
返回
matrix

在文件 SGVector.cpp1390 行定义.

◆ copy_data()

void copy_data ( const SGReferencedData orig)
protectedvirtual

needs to be overridden to copy data

实现了 SGReferencedData.

在文件 SGVector.cpp368 行定义.

◆ copy_refcount()

void copy_refcount ( const SGReferencedData orig)
protectedinherited

copy refcount

在文件 SGReferencedData.cpp58 行定义.

◆ cos()

void cos ( )

cosine of vector elements

◆ cosh()

void cosh ( )

hyperbolic cosine of vector elements

◆ display_size()

void display_size ( ) const

display array size

在文件 SGVector.cpp362 行定义.

◆ display_vector() [1/17]

void display_vector ( const bool *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp419 行定义.

◆ display_vector() [2/17]

void display_vector ( const char *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp430 行定义.

◆ display_vector() [3/17]

void display_vector ( const uint8_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp441 行定义.

◆ display_vector() [4/17]

void display_vector ( const int8_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp452 行定义.

◆ display_vector() [5/17]

void display_vector ( const uint16_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp463 行定义.

◆ display_vector() [6/17]

void display_vector ( const int16_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp474 行定义.

◆ display_vector() [7/17]

void display_vector ( const int32_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp485 行定义.

◆ display_vector() [8/17]

void display_vector ( const uint32_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp496 行定义.

◆ display_vector() [9/17]

void display_vector ( const int64_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp508 行定义.

◆ display_vector() [10/17]

void display_vector ( const uint64_t *  vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp519 行定义.

◆ display_vector() [11/17]

void display_vector ( const float32_t vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp530 行定义.

◆ display_vector() [12/17]

void display_vector ( const float64_t vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp541 行定义.

◆ display_vector() [13/17]

void display_vector ( const floatmax_t vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp552 行定义.

◆ display_vector() [14/17]

void display_vector ( const complex128_t vector,
int32_t  n,
const char *  name,
const char *  prefix 
)

在文件 SGVector.cpp566 行定义.

◆ display_vector() [15/17]

void display_vector ( const char *  name = "vector",
const char *  prefix = "" 
) const

display vector

在文件 SGVector.cpp405 行定义.

◆ display_vector() [16/17]

static void display_vector ( const T *  vector,
int32_t  n,
const char *  name = "vector",
const char *  prefix = "" 
)
static

display vector (useful for debugging)

◆ display_vector() [17/17]

void display_vector ( const SGVector< T >  vector,
const char *  name = "vector",
const char *  prefix = "" 
)
static

display vector (useful for debugging)

在文件 SGVector.cpp412 行定义.

◆ dot() [1/14]

static float64_t dot ( const bool *  v1,
const bool *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (blas optimized)

在文件 SGVector.h344 行定义.

◆ dot() [2/14]

static floatmax_t dot ( const floatmax_t v1,
const floatmax_t v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (blas optimized)

在文件 SGVector.h353 行定义.

◆ dot() [3/14]

float64_t dot ( const float64_t v1,
const float64_t v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (blas optimized)

在文件 SGVector.cpp614 行定义.

◆ dot() [4/14]

float32_t dot ( const float32_t v1,
const float32_t v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (blas optimized)

在文件 SGVector.cpp632 行定义.

◆ dot() [5/14]

static float64_t dot ( const uint64_t *  v1,
const uint64_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 64bit unsigned ints)

在文件 SGVector.h369 行定义.

◆ dot() [6/14]

static float64_t dot ( const int64_t *  v1,
const int64_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 64bit ints)

在文件 SGVector.h379 行定义.

◆ dot() [7/14]

static float64_t dot ( const int32_t *  v1,
const int32_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 32bit ints)

在文件 SGVector.h390 行定义.

◆ dot() [8/14]

static float64_t dot ( const uint32_t *  v1,
const uint32_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 32bit unsigned ints)

在文件 SGVector.h401 行定义.

◆ dot() [9/14]

static float64_t dot ( const uint16_t *  v1,
const uint16_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 16bit unsigned ints)

在文件 SGVector.h412 行定义.

◆ dot() [10/14]

static float64_t dot ( const int16_t *  v1,
const int16_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 16bit unsigned ints)

在文件 SGVector.h423 行定义.

◆ dot() [11/14]

static float64_t dot ( const char *  v1,
const char *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 8bit (un)signed ints)

在文件 SGVector.h434 行定义.

◆ dot() [12/14]

static float64_t dot ( const uint8_t *  v1,
const uint8_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 8bit (un)signed ints)

在文件 SGVector.h445 行定义.

◆ dot() [13/14]

static float64_t dot ( const int8_t *  v1,
const int8_t *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2 (for 8bit (un)signed ints)

在文件 SGVector.h456 行定义.

◆ dot() [14/14]

static float64_t dot ( const float64_t v1,
const char *  v2,
int32_t  n 
)
static

compute dot product between v1 and v2

在文件 SGVector.h467 行定义.

◆ equals()

bool equals ( SGVector< T > &  other)

equals method up to precision for vectors (element-wise)

参数
othervector to compare with
返回
false if any element differs or if sizes are different, true otherwise

在文件 SGVector.cpp390 行定义.

◆ exp()

void exp ( )

exponential of vector elements

◆ fequal()

bool fequal ( x,
y,
float64_t  precision = 1e-6 
)
static

return sum(abs(vec))

在文件 SGVector.cpp1138 行定义.

◆ fill_vector()

void fill_vector ( T *  vec,
int32_t  len,
value 
)
static

fill vector

在文件 SGVector.cpp271 行定义.

◆ find()

SGVector< index_t > find ( elem)

find index for occurance of an element

参数
elemthe element to find

在文件 SGVector.cpp1166 行定义.

◆ find_if()

SGVector<index_t> find_if ( Predicate  p)

find index for elements where the predicate returns true

参数
pthe predicate, it should accept the value of the element and return a bool

在文件 SGVector.h592 行定义.

◆ find_position_to_insert() [1/2]

index_t find_position_to_insert ( element)

For a sorted (ascending) vector, gets the index after the first element that is smaller than the given one

参数
elementelement to find index for
返回
index of the first element greater than given one

在文件 SGVector.cpp237 行定义.

◆ find_position_to_insert() [2/2]

index_t find_position_to_insert ( complex128_t  element)

在文件 SGVector.cpp249 行定义.

◆ free_data()

void free_data ( )
protectedvirtual

needs to be overridden to free data

实现了 SGReferencedData.

在文件 SGVector.cpp382 行定义.

◆ get()

SGVector<T> get ( )

get the vector (no copying is done here)

返回
the refcount increased vector

在文件 SGVector.h169 行定义.

◆ get_element()

const T & get_element ( index_t  index)

get vector element at index

参数
indexindex
返回
vector element at index

在文件 SGVector.cpp293 行定义.

◆ get_imag()

SGVector< float64_t > get_imag ( )

imag part of a complex128_t vector

在文件 SGVector.cpp1367 行定义.

◆ get_real()

SGVector< float64_t > get_real ( )

real part of a complex128_t vector

在文件 SGVector.cpp1359 行定义.

◆ init_data()

void init_data ( )
protectedvirtual

needs to be overridden to initialize empty data

实现了 SGReferencedData.

在文件 SGVector.cpp375 行定义.

◆ is_sorted() [1/2]

bool is_sorted ( ) const

check if vector is sorted

返回
true if vector is sorted, false otherwise

在文件 SGVector.cpp215 行定义.

◆ is_sorted() [2/2]

bool is_sorted ( ) const

在文件 SGVector.cpp230 行定义.

◆ linspace() [1/2]

float64_t * linspace ( start,
end,
int32_t  n 
)
static

Returns an array with n linearly spaced elements between start and end.

参数
startbeginning of the interval to divide
endupper bound of the interval to divide
nnumber of elements used to divide the interval
返回
array with linearly spaced elements within the interval

在文件 SGVector.cpp1336 行定义.

◆ linspace() [2/2]

float64_t * linspace ( complex128_t  start,
complex128_t  end,
int32_t  n 
)

在文件 SGVector.cpp1345 行定义.

◆ linspace_vec()

SGVector< float64_t > linspace_vec ( start,
end,
int32_t  n 
)
static

Returns a vector with n linearly spaced elements between start and end.

参数
startbeginning of the interval to divide
endupper bound of the interval to divide
nnumber of elements used to divide the interval
返回
vector with linearly spaced elements within the interval

在文件 SGVector.cpp1330 行定义.

◆ load() [1/2]

void load ( CFile loader)

load vector from file

参数
loaderFile object via which to load data

在文件 SGVector.cpp1222 行定义.

◆ load() [2/2]

void load ( CFile loader)

在文件 SGVector.cpp1237 行定义.

◆ log()

void log ( )

natural logarithm of vector elements

◆ log10()

void log10 ( )

common logarithm of vector elements

◆ max()

T max ( T *  vec,
int32_t  len 
)
static
返回
max(vec)

在文件 SGVector.cpp981 行定义.

◆ max_abs() [1/4]

T max_abs ( T *  vec,
int32_t  len 
)
static
返回
max(abs(vec))
max_abs(vec)

在文件 SGVector.cpp961 行定义.

◆ max_abs() [2/4]

float64_t max_abs ( float64_t vec,
int32_t  len 
)

在文件 SGVector.cpp939 行定义.

◆ max_abs() [3/4]

float32_t max_abs ( float32_t vec,
int32_t  len 
)

在文件 SGVector.cpp949 行定义.

◆ max_abs() [4/4]

complex128_t max_abs ( complex128_t vec,
int32_t  len 
)

在文件 SGVector.cpp973 行定义.

◆ mean() [1/2]

float64_t mean ( ) const

compute the mean value of the vector

返回
the mean value

在文件 SGVector.cpp1205 行定义.

◆ mean() [2/2]

float64_t mean ( ) const

在文件 SGVector.cpp1216 行定义.

◆ min()

T min ( T *  vec,
int32_t  len 
)
static
返回
min(vec)

在文件 SGVector.cpp926 行定义.

◆ onenorm()

float64_t onenorm ( T *  x,
int32_t  len 
)
static

|| x ||_1

在文件 SGVector.cpp882 行定义.

◆ operator T*()

operator T* ( )

cast to pointer

在文件 SGVector.h57 行定义.

◆ operator+()

SGVector< T > operator+ ( SGVector< T >  x)

addition operator

在文件 SGVector.cpp318 行定义.

◆ operator+=() [1/2]

SGVector<T> operator+= ( SGVector< T >  x)

inplace addition operator

在文件 SGVector.h298 行定义.

◆ operator+=() [2/2]

SGVector<T> operator+= ( SGSparseVector< T > &  x)

inplace addition operator for sparse vector

在文件 SGVector.h305 行定义.

◆ operator[]() [1/8]

const T& operator[] ( uint64_t  index) const

operator overload for vector read only access

参数
indexdimension to access

在文件 SGVector.h201 行定义.

◆ operator[]() [2/8]

const T& operator[] ( int64_t  index) const

operator overload for vector read only access

参数
indexdimension to access

在文件 SGVector.h211 行定义.

◆ operator[]() [3/8]

const T& operator[] ( uint32_t  index) const

operator overload for vector read only access

参数
indexdimension to access

在文件 SGVector.h221 行定义.

◆ operator[]() [4/8]

const T& operator[] ( int32_t  index) const

operator overload for vector read only access

参数
indexdimension to access

在文件 SGVector.h231 行定义.

◆ operator[]() [5/8]

T& operator[] ( uint64_t  index)

operator overload for vector r/w access

参数
indexdimension to access

在文件 SGVector.h241 行定义.

◆ operator[]() [6/8]

T& operator[] ( int64_t  index)

operator overload for vector r/w access

参数
indexdimension to access

在文件 SGVector.h251 行定义.

◆ operator[]() [7/8]

T& operator[] ( uint32_t  index)

operator overload for vector r/w access

参数
indexdimension to access

在文件 SGVector.h261 行定义.

◆ operator[]() [8/8]

T& operator[] ( int32_t  index)

operator overload for vector r/w access

参数
indexdimension to access

在文件 SGVector.h271 行定义.

◆ permute() [1/4]

void permute ( T *  vec,
int32_t  n 
)
static

permute

在文件 SGVector.cpp710 行定义.

◆ permute() [2/4]

void permute ( T *  vec,
int32_t  n,
CRandom rand 
)
static

permute with given CRandom state

在文件 SGVector.cpp717 行定义.

◆ permute() [3/4]

void permute ( )

create a random permutation in place

在文件 SGVector.cpp724 行定义.

◆ permute() [4/4]

void permute ( CRandom rand)

create a random permutation with given CRandom state

在文件 SGVector.cpp730 行定义.

◆ permute_vector()

void permute_vector ( SGVector< T >  vec)
static

permute vector

在文件 SGVector.cpp736 行定义.

◆ pow() [1/2]

void pow ( q)

power of vector elements

在文件 SGVector.cpp1323 行定义.

◆ pow() [2/2]

void pow ( complex128_t  q)

在文件 SGVector.cpp1353 行定义.

◆ product() [1/2]

static T product ( T *  vec,
int32_t  len 
)
static

return the product of the vectors elements

在文件 SGVector.h522 行定义.

◆ product() [2/2]

T product ( )

return product(vec)

在文件 SGVector.h532 行定义.

◆ qnorm() [1/2]

T qnorm ( T *  x,
int32_t  len,
float64_t  q 
)
static

|| x ||_q

在文件 SGVector.cpp911 行定义.

◆ qnorm() [2/2]

complex128_t qnorm ( complex128_t x,
int32_t  len,
float64_t  q 
)

在文件 SGVector.cpp918 行定义.

◆ qsort()

void qsort ( )

quicksort the vector it is sorted from in ascending (for type T)

在文件 SGVector.cpp169 行定义.

◆ qsq() [1/2]

T qsq ( T *  x,
int32_t  len,
float64_t  q 
)
static

|| x ||_q^q

在文件 SGVector.cpp893 行定义.

◆ qsq() [2/2]

complex128_t qsq ( complex128_t x,
int32_t  len,
float64_t  q 
)

在文件 SGVector.cpp903 行定义.

◆ random()

void random ( min_value,
max_value 
)

create random vector

参数
min_value[min_value,max_value]
max_value

在文件 SGVector.cpp153 行定义.

◆ random_vector() [1/2]

void random_vector ( T *  vec,
int32_t  len,
min_value,
max_value 
)
static

random vector

在文件 SGVector.cpp650 行定义.

◆ random_vector() [2/2]

void random_vector ( complex128_t vec,
int32_t  len,
complex128_t  min_value,
complex128_t  max_value 
)

在文件 SGVector.cpp657 行定义.

◆ randperm() [1/5]

void randperm ( )

Returns a random permutation of number from 0 to len-1

在文件 SGVector.cpp161 行定义.

◆ randperm() [2/5]

T * randperm ( int32_t  n)
static

Returns a random permutation of number from 0 to n-1. Caller has to free memory.

参数
nrange of permutation
返回
random permutation of number from 0 to n-1

在文件 SGVector.cpp678 行定义.

◆ randperm() [3/5]

void randperm ( T *  perm,
int32_t  n 
)
static

random permatutaion

在文件 SGVector.cpp695 行定义.

◆ randperm() [4/5]

complex128_t * randperm ( int32_t  n)

在文件 SGVector.cpp687 行定义.

◆ randperm() [5/5]

void randperm ( complex128_t perm,
int32_t  n 
)

在文件 SGVector.cpp703 行定义.

◆ randperm_vec() [1/2]

SGVector< T > randperm_vec ( int32_t  n)
static

Returns a random permutation of number from 0 to n-1

在文件 SGVector.cpp664 行定义.

◆ randperm_vec() [2/2]

SGVector< complex128_t > randperm_vec ( int32_t  n)

在文件 SGVector.cpp670 行定义.

◆ range_fill()

void range_fill ( start = 0)

range fill a vector with start...start+len-1

参数
start- value to be assigned to first element of vector

在文件 SGVector.cpp145 行定义.

◆ range_fill_vector() [1/2]

void range_fill_vector ( T *  vec,
int32_t  len,
start = 0 
)
static

range fill vector

在文件 SGVector.cpp278 行定义.

◆ range_fill_vector() [2/2]

void range_fill_vector ( complex128_t vec,
int32_t  len,
complex128_t  start 
)

在文件 SGVector.cpp285 行定义.

◆ ref()

int32_t ref ( )
protectedinherited

increase reference counter

返回
reference count

在文件 SGReferencedData.cpp67 行定义.

◆ ref_count()

int32_t ref_count ( )
inherited

display reference counter

返回
reference count

在文件 SGReferencedData.cpp44 行定义.

◆ resize_vector()

void resize_vector ( int32_t  n)

resize vector

参数
nnew size
返回
if resizing was successful

在文件 SGVector.cpp307 行定义.

◆ save() [1/2]

void save ( CFile saver)

save vector to file

参数
saverFile object via which to save data

在文件 SGVector.cpp1242 行定义.

◆ save() [2/2]

void save ( CFile saver)

在文件 SGVector.cpp1252 行定义.

◆ scale()

void scale ( alpha)

scale vector inplace

在文件 SGVector.cpp1200 行定义.

◆ scale_vector() [1/3]

void scale_vector ( alpha,
T *  vec,
int32_t  len 
)
static

scale vector inplace

在文件 SGVector.cpp1179 行定义.

◆ scale_vector() [2/3]

void scale_vector ( float64_t  alpha,
float64_t vec,
int32_t  len 
)

在文件 SGVector.cpp1187 行定义.

◆ scale_vector() [3/3]

void scale_vector ( float32_t  alpha,
float32_t vec,
int32_t  len 
)

在文件 SGVector.cpp1193 行定义.

◆ set()

void set ( SGVector< T >  orig)

wrapper for the copy constructor useful for SWIG interfaces

参数
origvector to set

在文件 SGVector.cpp98 行定义.

◆ set_const()

void set_const ( const_elem)

set vector to a constant

参数
const_elem- value to set vector to

在文件 SGVector.cpp124 行定义.

◆ set_element()

void set_element ( const T &  p_element,
index_t  index 
)

set vector element at index 'index' return false in case of trouble

参数
p_elementvector element to set
indexindex
返回
if setting was successful

在文件 SGVector.cpp300 行定义.

◆ sin()

void sin ( )

sine of vector elements

◆ sinh()

void sinh ( )

hyperbolic sine of vector elements

◆ size()

int32_t size ( ) const

size

在文件 SGVector.h54 行定义.

◆ sqrt()

void sqrt ( )

square root of vector elements

◆ sum() [1/2]

static T sum ( T *  vec,
int32_t  len 
)
static

return sum(vec)

在文件 SGVector.h506 行定义.

◆ sum() [2/2]

static T sum ( SGVector< T >  vec)
static

return sum(vec)

在文件 SGVector.h516 行定义.

◆ sum_abs() [1/3]

T sum_abs ( T *  vec,
int32_t  len 
)
static

return sum(abs(vec))

在文件 SGVector.cpp1109 行定义.

◆ sum_abs() [2/3]

float64_t sum_abs ( float64_t vec,
int32_t  len 
)

在文件 SGVector.cpp1120 行定义.

◆ sum_abs() [3/3]

float32_t sum_abs ( float32_t vec,
int32_t  len 
)

在文件 SGVector.cpp1128 行定义.

◆ tan()

void tan ( )

tangent of vector elements

◆ tanh()

void tanh ( )

hyperbolic tangent of vector elements

◆ twonorm() [1/15]

static T twonorm ( const T *  x,
int32_t  len 
)
static

|| x ||_2

◆ twonorm() [2/15]

bool twonorm ( const bool *  x,
int32_t  len 
)

在文件 SGVector.cpp746 行定义.

◆ twonorm() [3/15]

char twonorm ( const char *  x,
int32_t  len 
)

在文件 SGVector.cpp753 行定义.

◆ twonorm() [4/15]

int8_t twonorm ( const int8_t *  x,
int32_t  len 
)

在文件 SGVector.cpp760 行定义.

◆ twonorm() [5/15]

uint8_t twonorm ( const uint8_t *  x,
int32_t  len 
)

在文件 SGVector.cpp770 行定义.

◆ twonorm() [6/15]

int16_t twonorm ( const int16_t *  x,
int32_t  len 
)

在文件 SGVector.cpp780 行定义.

◆ twonorm() [7/15]

uint16_t twonorm ( const uint16_t *  x,
int32_t  len 
)

在文件 SGVector.cpp790 行定义.

◆ twonorm() [8/15]

int32_t twonorm ( const int32_t *  x,
int32_t  len 
)

在文件 SGVector.cpp800 行定义.

◆ twonorm() [9/15]

uint32_t twonorm ( const uint32_t *  x,
int32_t  len 
)

在文件 SGVector.cpp810 行定义.

◆ twonorm() [10/15]

int64_t twonorm ( const int64_t *  x,
int32_t  len 
)

在文件 SGVector.cpp820 行定义.

◆ twonorm() [11/15]

uint64_t twonorm ( const uint64_t *  x,
int32_t  len 
)

在文件 SGVector.cpp830 行定义.

◆ twonorm() [12/15]

float32_t twonorm ( const float32_t x,
int32_t  len 
)

在文件 SGVector.cpp840 行定义.

◆ twonorm() [13/15]

float64_t twonorm ( const float64_t v,
int32_t  n 
)

在文件 SGVector.cpp850 行定义.

◆ twonorm() [14/15]

floatmax_t twonorm ( const floatmax_t x,
int32_t  len 
)

在文件 SGVector.cpp862 行定义.

◆ twonorm() [15/15]

complex128_t twonorm ( const complex128_t x,
int32_t  len 
)

在文件 SGVector.cpp872 行定义.

◆ unique() [1/2]

int32_t unique ( T *  output,
int32_t  size 
)
static

performs a inplace unique of a vector of type T using quicksort returns the new number of elements

在文件 SGVector.cpp1144 行定义.

◆ unique() [2/2]

int32_t unique ( complex128_t output,
int32_t  size 
)

在文件 SGVector.cpp1158 行定义.

◆ unref()

int32_t unref ( )
protectedinherited

decrement reference counter and deallocate object if refcount is zero before or after decrementing it

返回
reference count

在文件 SGReferencedData.cpp87 行定义.

◆ vec1_plus_scalar_times_vec2() [1/3]

void vec1_plus_scalar_times_vec2 ( T *  vec1,
const T  scalar,
const T *  vec2,
int32_t  n 
)
static

x=x+alpha*y

在文件 SGVector.cpp580 行定义.

◆ vec1_plus_scalar_times_vec2() [2/3]

void vec1_plus_scalar_times_vec2 ( float64_t vec1,
float64_t  scalar,
const float64_t vec2,
int32_t  n 
)

在文件 SGVector.cpp588 行定义.

◆ vec1_plus_scalar_times_vec2() [3/3]

void vec1_plus_scalar_times_vec2 ( float32_t vec1,
float32_t  scalar,
const float32_t vec2,
int32_t  n 
)

在文件 SGVector.cpp601 行定义.

◆ vector_multiply()

static void vector_multiply ( T *  target,
const T *  v1,
const T *  v2,
int32_t  len 
)
static

compute vector multiplication

在文件 SGVector.h478 行定义.

◆ zero() [1/2]

void zero ( )

fill vector with zeros

在文件 SGVector.cpp110 行定义.

◆ zero() [2/2]

void zero ( )

在文件 SGVector.cpp117 行定义.

类成员变量说明

◆ vector

T* vector

vector

在文件 SGVector.h704 行定义.

◆ vlen

index_t vlen

length of vector

在文件 SGVector.h706 行定义.


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation