matrix.h
Go to the documentation of this file.
#ifndef FASTTEXT_MATRIX_H
#define FASTTEXT_MATRIX_H
#include <cstdint>
#include <istream>
#include <ostream>
#include "real.h"
namespace fasttext {
class Vector;
class Matrix {
public:
real* data_;
int64_t m_;
int64_t n_;
Matrix();
Matrix(int64_t, int64_t);
Matrix(const Matrix&);
Matrix& operator=(const Matrix&);
~Matrix();
inline const real& at(int64_t i, int64_t j) const {return data_[i * n_ + j];};
inline real& at(int64_t i, int64_t j) {return data_[i * n_ + j];};
void zero();
void uniform(real);
real dotRow(const Vector&, int64_t) const;
void addRow(const Vector&, int64_t, real);
void multiplyRow(const Vector& nums, int64_t ib = 0, int64_t ie = -1);
void divideRow(const Vector& denoms, int64_t ib = 0, int64_t ie = -1);
real l2NormRow(int64_t i) const;
void l2NormRow(Vector& norms) const;
void save(std::ostream&);
void load(std::istream&);
};
}
#endif
fasttext::Matrix::dotRow
real dotRow(const Vector &, int64_t) const
Definition: matrix.cc:68
fasttext::Matrix::at
const real & at(int64_t i, int64_t j) const
Definition: matrix.h:36
fasttext::Matrix::m_
int64_t m_
Definition: matrix.h:27
fasttext::Matrix::at
real & at(int64_t i, int64_t j)
Definition: matrix.h:37
fasttext
Definition: args.cc:17
fasttext::Vector
Definition: vector.h:23
fasttext::Matrix::l2NormRow
real l2NormRow(int64_t i) const
Definition: matrix.cc:114
real.h
fasttext::Matrix::~Matrix
~Matrix()
Definition: matrix.cc:50
fasttext::Matrix::n_
int64_t n_
Definition: matrix.h:28
fasttext::Matrix::zero
void zero()
Definition: matrix.cc:54
fasttext::Matrix::save
void save(std::ostream &)
Definition: matrix.cc:130
fasttext::Matrix::divideRow
void divideRow(const Vector &denoms, int64_t ib=0, int64_t ie=-1)
Definition: matrix.cc:101
fasttext::Matrix::load
void load(std::istream &)
Definition: matrix.cc:136
fasttext::Matrix::operator=
Matrix & operator=(const Matrix &)
Definition: matrix.cc:42
fasttext::Matrix::multiplyRow
void multiplyRow(const Vector &nums, int64_t ib=0, int64_t ie=-1)
Definition: matrix.cc:88
fasttext::Matrix::addRow
void addRow(const Vector &, int64_t, real)
Definition: matrix.cc:79
fasttext::real
float real
Definition: real.h:15
fasttext::Matrix
Definition: matrix.h:23
fasttext::Matrix::uniform
void uniform(real)
Definition: matrix.cc:60
fasttext::Matrix::data_
real * data_
Definition: matrix.h:26
fasttext::Matrix::Matrix
Matrix()
Definition: matrix.cc:21