LLVM 22.0.0git
Public Types | Public Member Functions | List of all members
llvm::ir2vec::Embedding Struct Reference

Embedding is a datatype that wraps std::vector<double>. More...

#include "llvm/Analysis/IR2Vec.h"

Public Types

using iterator = typename std::vector< double >::iterator
 
using const_iterator = typename 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 Embeddingoperator+= (const Embedding &RHS)
 Arithmetic operators.
 
LLVM_ABI Embedding operator+ (const Embedding &RHS) const
 
LLVM_ABI Embeddingoperator-= (const Embedding &RHS)
 
LLVM_ABI Embedding operator- (const Embedding &RHS) const
 
LLVM_ABI Embeddingoperator*= (double Factor)
 
LLVM_ABI Embedding operator* (double Factor) const
 
LLVM_ABI EmbeddingscaleAndAdd (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.
 
LLVM_ABI void print (raw_ostream &OS) const
 

Detailed Description

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.

Definition at line 79 of file IR2Vec.h.

Member Typedef Documentation

◆ const_iterator

using llvm::ir2vec::Embedding::const_iterator = typename std::vector<double>::const_iterator

Definition at line 106 of file IR2Vec.h.

◆ iterator

using llvm::ir2vec::Embedding::iterator = typename std::vector<double>::iterator

Definition at line 105 of file IR2Vec.h.

Constructor & Destructor Documentation

◆ Embedding() [1/6]

llvm::ir2vec::Embedding::Embedding ( )
default

◆ Embedding() [2/6]

llvm::ir2vec::Embedding::Embedding ( const std::vector< double > &  V)
inline

Definition at line 85 of file IR2Vec.h.

◆ Embedding() [3/6]

llvm::ir2vec::Embedding::Embedding ( std::vector< double > &&  V)
inline

Definition at line 86 of file IR2Vec.h.

◆ Embedding() [4/6]

llvm::ir2vec::Embedding::Embedding ( std::initializer_list< double >  IL)
inline

Definition at line 87 of file IR2Vec.h.

◆ Embedding() [5/6]

llvm::ir2vec::Embedding::Embedding ( size_t  Size)
inlineexplicit

Definition at line 89 of file IR2Vec.h.

◆ Embedding() [6/6]

llvm::ir2vec::Embedding::Embedding ( size_t  Size,
double  InitialValue 
)
inline

Definition at line 90 of file IR2Vec.h.

Member Function Documentation

◆ approximatelyEquals()

bool Embedding::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.

Definition at line 131 of file IR2Vec.cpp.

References assert(), llvm::errs(), LLVM_DEBUG, RHS, and size().

Referenced by llvm::FunctionPropertiesInfo::operator==().

◆ begin() [1/2]

iterator llvm::ir2vec::Embedding::begin ( )
inline

Definition at line 108 of file IR2Vec.h.

Referenced by operator*=(), operator+=(), and operator-=().

◆ begin() [2/2]

const_iterator llvm::ir2vec::Embedding::begin ( ) const
inline

Definition at line 110 of file IR2Vec.h.

◆ cbegin()

const_iterator llvm::ir2vec::Embedding::cbegin ( ) const
inline

Definition at line 112 of file IR2Vec.h.

◆ cend()

const_iterator llvm::ir2vec::Embedding::cend ( ) const
inline

Definition at line 113 of file IR2Vec.h.

◆ empty()

bool llvm::ir2vec::Embedding::empty ( ) const
inline

Definition at line 93 of file IR2Vec.h.

◆ end() [1/2]

iterator llvm::ir2vec::Embedding::end ( )
inline

Definition at line 109 of file IR2Vec.h.

Referenced by operator*=(), operator+=(), and operator-=().

◆ end() [2/2]

const_iterator llvm::ir2vec::Embedding::end ( ) const
inline

Definition at line 111 of file IR2Vec.h.

◆ getData()

const std::vector< double > & llvm::ir2vec::Embedding::getData ( ) const
inline

Definition at line 115 of file IR2Vec.h.

◆ operator*()

Embedding Embedding::operator* ( double  Factor) const

Definition at line 118 of file IR2Vec.cpp.

◆ operator*=()

Embedding & Embedding::operator*= ( double  Factor)

Definition at line 112 of file IR2Vec.cpp.

References begin(), and end().

◆ operator+()

Embedding Embedding::operator+ ( const Embedding RHS) const

Definition at line 93 of file IR2Vec.cpp.

References RHS.

◆ operator+=()

Embedding & Embedding::operator+= ( const Embedding RHS)

Arithmetic operators.

Definition at line 86 of file IR2Vec.cpp.

References assert(), begin(), end(), and size().

◆ operator-()

Embedding Embedding::operator- ( const Embedding RHS) const

Definition at line 106 of file IR2Vec.cpp.

References RHS.

◆ operator-=()

Embedding & Embedding::operator-= ( const Embedding RHS)

Definition at line 99 of file IR2Vec.cpp.

References assert(), begin(), end(), and size().

◆ operator[]() [1/2]

double & llvm::ir2vec::Embedding::operator[] ( size_t  Itr)
inline

Definition at line 95 of file IR2Vec.h.

References assert().

◆ operator[]() [2/2]

const double & llvm::ir2vec::Embedding::operator[] ( size_t  Itr) const
inline

Definition at line 100 of file IR2Vec.h.

References assert().

◆ print()

void Embedding::print ( raw_ostream OS) const

Definition at line 144 of file IR2Vec.cpp.

References llvm::format(), and OS.

◆ scaleAndAdd()

Embedding & Embedding::scaleAndAdd ( const Embedding Src,
float  Factor 
)

Adds Src Embedding scaled by Factor with the called Embedding.

Called_Embedding += Src * Factor

Definition at line 124 of file IR2Vec.cpp.

References assert(), and size().

◆ size()

size_t llvm::ir2vec::Embedding::size ( ) const
inline

Definition at line 92 of file IR2Vec.h.

Referenced by approximatelyEquals(), operator+=(), operator-=(), and scaleAndAdd().


The documentation for this struct was generated from the following files: