Open3D (C++ API)  0.18.0+252c867
Public Member Functions | Static Public Member Functions
open3d::core::HashSet Class Reference

#include <HashSet.h>

Inheritance diagram for open3d::core::HashSet:
open3d::core::IsDevice

Public Member Functions

 HashSet (int64_t init_capacity, const Dtype &key_dtype, const SizeVector &key_element_shape, const Device &device, const HashBackendType &backend=HashBackendType::Default)
 Initialize a hash set given a key dtype and element shape. More...
 
 ~HashSet ()=default
 Default destructor. More...
 
void Reserve (int64_t capacity)
 Reserve the internal hash map with the capcity by rehashing. More...
 
std::pair< Tensor, TensorInsert (const Tensor &input_keys)
 
std::pair< Tensor, TensorFind (const Tensor &input_keys)
 
Tensor Erase (const Tensor &input_keys)
 
Tensor GetActiveIndices () const
 
void Insert (const Tensor &input_keys, Tensor &output_buf_indices, Tensor &output_masks)
 
void Find (const Tensor &input_keys, Tensor &output_buf_indices, Tensor &output_masks)
 
void Erase (const Tensor &input_keys, Tensor &output_masks)
 
void GetActiveIndices (Tensor &output_buf_indices) const
 
void Clear ()
 Clear stored map without reallocating the buffers. More...
 
void Save (const std::string &file_name)
 
HashSet Clone () const
 Clone the hash set with buffers. More...
 
HashSet To (const Device &device, bool copy=false) const
 Convert the hash set to another device. More...
 
int64_t Size () const
 Get the size (number of active entries) of the hash set. More...
 
int64_t GetCapacity () const
 Get the capacity of the hash set. More...
 
int64_t GetBucketCount () const
 Get the number of buckets of the internal hash set. More...
 
Device GetDevice () const override
 Get the device of the hash set. More...
 
Tensor GetKeyTensor () const
 
std::vector< int64_t > BucketSizes () const
 Return number of elements per bucket. More...
 
float LoadFactor () const
 Return size / bucket_count. More...
 
std::shared_ptr< DeviceHashBackendGetDeviceHashBackend () const
 Return the implementation of the device hash backend. More...
 
- Public Member Functions inherited from open3d::core::IsDevice
 IsDevice ()=default
 
virtual ~IsDevice ()=default
 
bool IsCPU () const
 
bool IsCUDA () const
 

Static Public Member Functions

static HashSet Load (const std::string &file_name)
 Load active keys and values from a npz file that contains 'key'. More...
 

Constructor & Destructor Documentation

◆ HashSet()

open3d::core::HashSet::HashSet ( int64_t  init_capacity,
const Dtype key_dtype,
const SizeVector key_element_shape,
const Device device,
const HashBackendType backend = HashBackendType::Default 
)

Initialize a hash set given a key dtype and element shape.

◆ ~HashSet()

open3d::core::HashSet::~HashSet ( )
default

Default destructor.

Member Function Documentation

◆ BucketSizes()

std::vector< int64_t > open3d::core::HashSet::BucketSizes ( ) const

Return number of elements per bucket.

◆ Clear()

void open3d::core::HashSet::Clear ( )

Clear stored map without reallocating the buffers.

◆ Clone()

HashSet open3d::core::HashSet::Clone ( ) const

Clone the hash set with buffers.

◆ Erase() [1/2]

Tensor open3d::core::HashSet::Erase ( const Tensor input_keys)

Parallel erase an array of keys in Tensor. Return: output_masks stores if the erase is a success or failure (key not found all already erased in another thread).

◆ Erase() [2/2]

void open3d::core::HashSet::Erase ( const Tensor input_keys,
Tensor output_masks 
)

Same as Erase, but takes output_masks as input. If its shape and type matches, reallocation is not needed.

◆ Find() [1/2]

std::pair< Tensor, Tensor > open3d::core::HashSet::Find ( const Tensor input_keys)

Parallel find an array of keys in Tensor. Return: output_buf_indices, its role is the same as in Insert. Return: output_masks stores if the finding is a success or failure (key not found).

◆ Find() [2/2]

void open3d::core::HashSet::Find ( const Tensor input_keys,
Tensor output_buf_indices,
Tensor output_masks 
)

Same as Find, but takes output_buf_indices and output_masks as input. If their shapes and types match, reallocation is not needed.

◆ GetActiveIndices() [1/2]

Tensor open3d::core::HashSet::GetActiveIndices ( ) const

Parallel collect all indices in the buffer corresponding to the active entries in the hash map. Return output_buf_indices, collected buffer indices.

◆ GetActiveIndices() [2/2]

void open3d::core::HashSet::GetActiveIndices ( Tensor output_buf_indices) const

Same as GetActiveIndices, but takes output_buf_indices as input. If its shape and type matches, reallocation is not needed.

◆ GetBucketCount()

int64_t open3d::core::HashSet::GetBucketCount ( ) const

Get the number of buckets of the internal hash set.

◆ GetCapacity()

int64_t open3d::core::HashSet::GetCapacity ( ) const

Get the capacity of the hash set.

◆ GetDevice()

Device open3d::core::HashSet::GetDevice ( ) const
overridevirtual

Get the device of the hash set.

Implements open3d::core::IsDevice.

◆ GetDeviceHashBackend()

std::shared_ptr< DeviceHashBackend > open3d::core::HashSet::GetDeviceHashBackend ( ) const

Return the implementation of the device hash backend.

◆ GetKeyTensor()

Tensor open3d::core::HashSet::GetKeyTensor ( ) const

Get the key tensor buffer to be used along with buf_indices and masks. Example: GetKeyTensor().IndexGet({buf_indices.To(core::Int64).IndexGet{masks}})

◆ Insert() [1/2]

std::pair< Tensor, Tensor > open3d::core::HashSet::Insert ( const Tensor input_keys)

Parallel insert arrays of keys and values in Tensors. Return: output_buf_indices stores buffer indices that access buffer tensors obtained from GetKeyTensor() and GetValueTensor() via advanced indexing. NOTE: output_buf_indices are stored in Int32. A conversion to Int64 is required for further indexing. Return: output_masks stores if the insertion is a success or failure (key already exists).

◆ Insert() [2/2]

void open3d::core::HashSet::Insert ( const Tensor input_keys,
Tensor output_buf_indices,
Tensor output_masks 
)

Same as Insert, but takes output_buf_indices and output_masks as input. If their shapes and types match, reallocation is not needed.

◆ Load()

HashSet open3d::core::HashSet::Load ( const std::string &  file_name)
static

Load active keys and values from a npz file that contains 'key'.

◆ LoadFactor()

float open3d::core::HashSet::LoadFactor ( ) const

Return size / bucket_count.

◆ Reserve()

void open3d::core::HashSet::Reserve ( int64_t  capacity)

Reserve the internal hash map with the capcity by rehashing.

◆ Save()

void open3d::core::HashSet::Save ( const std::string &  file_name)

Save active keys to a npz file at 'key'. The file name should end with 'npz', otherwise 'npz' will be added as an extension.

◆ Size()

int64_t open3d::core::HashSet::Size ( ) const

Get the size (number of active entries) of the hash set.

◆ To()

HashSet open3d::core::HashSet::To ( const Device device,
bool  copy = false 
) const

Convert the hash set to another device.


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