|
LLVM 23.0.0git
|
Embedding is a datatype that wraps std::vector<double>. More...
#include "llvm/Analysis/IR2Vec.h"
Public Types | |
| using | iterator = std::vector<double>::iterator |
| using | const_iterator = std::vector<double>::const_iterator |
Public Member Functions | |
| Embedding ()=default | |
| Embedding (const std::vector< double > &V) | |
| Embedding (std::vector< double > &&V) | |
| Embedding (std::initializer_list< double > IL) | |
| Embedding (size_t Size) | |
| Embedding (size_t Size, double InitialValue) | |
| size_t | size () const |
| bool | empty () const |
| double & | operator[] (size_t Itr) |
| const double & | operator[] (size_t Itr) const |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
| const std::vector< double > & | getData () const |
| LLVM_ABI Embedding & | operator+= (const Embedding &RHS) |
| Arithmetic operators. | |
| LLVM_ABI Embedding | operator+ (const Embedding &RHS) const |
| LLVM_ABI Embedding & | operator-= (const Embedding &RHS) |
| LLVM_ABI Embedding | operator- (const Embedding &RHS) const |
| LLVM_ABI Embedding & | operator*= (double Factor) |
| LLVM_ABI Embedding | operator* (double Factor) const |
| LLVM_ABI Embedding & | scaleAndAdd (const Embedding &Src, float Factor) |
| Adds Src Embedding scaled by Factor with the called Embedding. | |
| LLVM_ABI bool | approximatelyEquals (const Embedding &RHS, double Tolerance=1e-4) const |
| Returns true if the embedding is approximately equal to the RHS embedding within the specified tolerance. | |
| bool | isZero () const |
| Returns true if all elements of the embedding are zero. | |
| LLVM_ABI void | print (raw_ostream &OS) const |
Embedding is a datatype that wraps std::vector<double>.
It provides additional functionality for arithmetic and comparison operations. It is meant to be used like std::vector<double> but is more restrictive in the sense that it does not allow the user to change the size of the embedding vector. The dimension of the embedding is fixed at the time of construction of Embedding object. But the elements can be modified in-place.
| using llvm::ir2vec::Embedding::const_iterator = std::vector<double>::const_iterator |
| using llvm::ir2vec::Embedding::iterator = std::vector<double>::iterator |
|
default |
Referenced by approximatelyEquals(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), and scaleAndAdd().
|
inline |
|
inline |
Definition at line 95 of file IR2Vec.h.
References llvm::move().
|
inline |
|
inlineexplicit |
|
inline |
Returns true if the embedding is approximately equal to the RHS embedding within the specified tolerance.
Definition at line 132 of file IR2Vec.cpp.
References assert(), Embedding(), llvm::errs(), LLVM_DEBUG, and size().
|
inline |
Definition at line 117 of file IR2Vec.h.
Referenced by operator*=(), operator+=(), and operator-=().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 118 of file IR2Vec.h.
Referenced by operator*=(), operator+=(), and operator-=().
|
inline |
|
inline |
|
inline |
Returns true if all elements of the embedding are zero.
Definition at line 144 of file IR2Vec.h.
References llvm::all_of(), and D().
| Embedding Embedding::operator* | ( | double | Factor | ) | const |
Definition at line 119 of file IR2Vec.cpp.
References Embedding().
| Embedding & Embedding::operator*= | ( | double | Factor | ) |
Definition at line 113 of file IR2Vec.cpp.
References begin(), Embedding(), and end().
Definition at line 94 of file IR2Vec.cpp.
References Embedding().
Arithmetic operators.
Definition at line 87 of file IR2Vec.cpp.
References assert(), begin(), Embedding(), end(), and size().
Definition at line 107 of file IR2Vec.cpp.
References Embedding().
Definition at line 100 of file IR2Vec.cpp.
References assert(), begin(), Embedding(), end(), and size().
|
inline |
|
inline |
| void Embedding::print | ( | raw_ostream & | OS | ) | const |
Definition at line 145 of file IR2Vec.cpp.
References llvm::format().
Adds Src Embedding scaled by Factor with the called Embedding.
Called_Embedding += Src * Factor
Definition at line 125 of file IR2Vec.cpp.
References assert(), Embedding(), and size().
|
inline |
Definition at line 101 of file IR2Vec.h.
Referenced by approximatelyEquals(), operator+=(), operator-=(), and scaleAndAdd().