fastText  d00d36476b15
Fast text processing tool/library
vector.h
Go to the documentation of this file.
1 
10 #ifndef FASTTEXT_VECTOR_H
11 #define FASTTEXT_VECTOR_H
12 
13 #include <cstdint>
14 #include <ostream>
15 
16 #include "real.h"
17 
18 namespace fasttext {
19 
20 class Matrix;
21 class QMatrix;
22 
23 class Vector {
24 
25  public:
26  int64_t m_;
28 
29  explicit Vector(int64_t);
30  ~Vector();
31 
32  real& operator[](int64_t);
33  const real& operator[](int64_t) const;
34 
35  int64_t size() const;
36  void zero();
37  void mul(real);
38  real norm() const;
39  void addVector(const Vector& source);
40  void addVector(const Vector&, real);
41  void addRow(const Matrix&, int64_t);
42  void addRow(const QMatrix&, int64_t);
43  void addRow(const Matrix&, int64_t, real);
44  void mul(const QMatrix&, const Vector&);
45  void mul(const Matrix&, const Vector&);
46  int64_t argmax();
47 };
48 
49 std::ostream& operator<<(std::ostream&, const Vector&);
50 
51 }
52 
53 #endif
void zero()
Definition: vector.cc:35
int64_t size() const
Definition: vector.cc:31
real & operator[](int64_t)
Definition: vector.cc:120
Definition: args.cc:17
Definition: vector.h:23
real * data_
Definition: vector.h:27
int64_t argmax()
Definition: vector.cc:108
void addRow(const Matrix &, int64_t)
Definition: vector.cc:69
Vector(int64_t)
Definition: vector.cc:22
void mul(real)
Definition: vector.cc:49
float real
Definition: real.h:15
Definition: matrix.h:23
int64_t m_
Definition: vector.h:26
std::ostream & operator<<(std::ostream &os, const Vector &v)
Definition: vector.cc:128
~Vector()
Definition: vector.cc:27
Definition: qmatrix.h:29
real norm() const
Definition: vector.cc:41
void addVector(const Vector &source)
Definition: vector.cc:55