Sha256: 9652608f8180c9fb65f57f258395b8c00cecd495e5b20115721a16a29c3a6180

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

/**
 * Copyright (c) 2016-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#pragma once

#include <cstdint>
#include <ostream>
#include <vector>

#include "real.h"

namespace fasttext {

class Matrix;

class Vector {
 protected:
  std::vector<real> data_;

 public:
  explicit Vector(int64_t);
  Vector(const Vector&) = default;
  Vector(Vector&&) noexcept = default;
  Vector& operator=(const Vector&) = default;
  Vector& operator=(Vector&&) = default;

  inline real* data() {
    return data_.data();
  }
  inline const real* data() const {
    return data_.data();
  }
  inline real& operator[](int64_t i) {
    return data_[i];
  }
  inline const real& operator[](int64_t i) const {
    return data_[i];
  }

  inline int64_t size() const {
    return data_.size();
  }
  void zero();
  void mul(real);
  real norm() const;
  void addVector(const Vector& source);
  void addVector(const Vector&, real);
  void addRow(const Matrix&, int64_t);
  void addRow(const Matrix&, int64_t, real);
  void mul(const Matrix&, const Vector&);
  int64_t argmax();
};

std::ostream& operator<<(std::ostream&, const Vector&);

} // namespace fasttext

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fasttext-0.4.0 vendor/fastText/src/vector.h
fasttext-0.3.0 vendor/fastText/src/vector.h
fasttext-0.2.4 vendor/fastText/src/vector.h
fasttext-0.2.3 vendor/fastText/src/vector.h
fasttext-0.2.2 vendor/fastText/src/vector.h
fasttext-0.2.1 vendor/fastText/src/vector.h
fasttext-0.2.0 vendor/fastText/src/vector.h
fasttext-0.1.3 vendor/fastText/src/vector.h
fasttext-0.1.2 vendor/fastText/src/vector.h
fasttext-0.1.1 vendor/fastText/src/vector.h
fasttext-0.1.0 vendor/fastText/src/vector.h