fastText: /data/users/cpuhrsch/fbsource/fbcode/deeplearning/fastText/src/vector.h Source File

| 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_;
27 real* data_;
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
fasttext::Vector::zero
void zero()
Definition: vector.cc:35
fasttext::Vector::size
int64_t size() const
Definition: vector.cc:31
fasttext::Vector::operator[]
real & operator[](int64_t)
Definition: vector.cc:120
fasttext
Definition: args.cc:17
fasttext::Vector
Definition: vector.h:23
fasttext::Vector::data_
real * data_
Definition: vector.h:27
fasttext::Vector::argmax
int64_t argmax()
Definition: vector.cc:108
real.h
fasttext::Vector::addRow
void addRow(const Matrix &, int64_t)
Definition: vector.cc:69
fasttext::Vector::Vector
Vector(int64_t)
Definition: vector.cc:22
fasttext::Vector::mul
void mul(real)
Definition: vector.cc:49
fasttext::real
float real
Definition: real.h:15
fasttext::Matrix
Definition: matrix.h:23
fasttext::Vector::m_
int64_t m_
Definition: vector.h:26
fasttext::operator<<
std::ostream & operator<<(std::ostream &os, const Vector &v)
Definition: vector.cc:128
fasttext::Vector::~Vector
~Vector()
Definition: vector.cc:27
fasttext::QMatrix
Definition: qmatrix.h:29
fasttext::Vector::norm
real norm() const
Definition: vector.cc:41
fasttext::Vector::addVector
void addVector(const Vector &source)
Definition: vector.cc:55