![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <HashSet.h>


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, Tensor > | Insert (const Tensor &input_keys) |
| std::pair< Tensor, Tensor > | Find (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< DeviceHashBackend > | GetDeviceHashBackend () const |
| Return the implementation of the device hash backend. More... | |
Public Member Functions inherited from cloudViewer::core::IsDevice | |
| IsDevice ()=default | |
| virtual | ~IsDevice ()=default |
| bool | IsCPU () const |
| bool | IsCUDA () const |
| bool | IsSYCL () 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... | |
| cloudViewer::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.
Definition at line 20 of file HashSet.cpp.
|
default |
Default destructor.
| std::vector< int64_t > cloudViewer::core::HashSet::BucketSizes | ( | ) | const |
Return number of elements per bucket.
Definition at line 108 of file HashSet.cpp.
| void cloudViewer::core::HashSet::Clear | ( | ) |
Clear stored map without reallocating the buffers.
Definition at line 77 of file HashSet.cpp.
| HashSet cloudViewer::core::HashSet::Clone | ( | ) | const |
Clone the hash set with buffers.
Definition at line 88 of file HashSet.cpp.
References GetDevice(), and HashSet().
Referenced by cloudViewer::core::pybind_core_hashset().
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).
Definition at line 44 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset().
Same as Erase, but takes output_masks as input. If its shape and type matches, reallocation is not needed.
Definition at line 69 of file HashSet.cpp.
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).
Definition at line 38 of file HashSet.cpp.
References cloudViewer::core::make_pair().
Referenced by cloudViewer::core::pybind_core_hashset(), and cloudViewer::t::geometry::PointCloud::VoxelDownSample().
| void cloudViewer::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.
Definition at line 63 of file HashSet.cpp.
| Tensor cloudViewer::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.
Definition at line 50 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset().
| void cloudViewer::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.
Definition at line 73 of file HashSet.cpp.
| int64_t cloudViewer::core::HashSet::GetBucketCount | ( | ) | const |
Get the number of buckets of the internal hash set.
Definition at line 102 of file HashSet.cpp.
| int64_t cloudViewer::core::HashSet::GetCapacity | ( | ) | const |
Get the capacity of the hash set.
Definition at line 100 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset().
|
overridevirtual |
Get the device of the hash set.
Implements cloudViewer::core::IsDevice.
Definition at line 104 of file HashSet.cpp.
Referenced by Clone(), and cloudViewer::core::pybind_core_hashset().
| std::shared_ptr< DeviceHashBackend > cloudViewer::core::HashSet::GetDeviceHashBackend | ( | ) | const |
Return the implementation of the device hash backend.
Definition at line 114 of file HashSet.cpp.
| Tensor cloudViewer::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}})
Definition at line 106 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset().
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).
Definition at line 32 of file HashSet.cpp.
References cloudViewer::core::make_pair().
Referenced by cloudViewer::core::pybind_core_hashset(), cloudViewer::t::geometry::PointCloud::RemoveDuplicatedPoints(), and cloudViewer::t::geometry::PointCloud::VoxelDownSample().
| void cloudViewer::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.
Definition at line 56 of file HashSet.cpp.
|
static |
Load active keys and values from a npz file that contains 'key'.
Definition at line 83 of file HashSet.cpp.
References HashSet(), and cloudViewer::t::io::ReadHashMap().
Referenced by cloudViewer::core::pybind_core_hashset().
| float cloudViewer::core::HashSet::LoadFactor | ( | ) | const |
Return size / bucket_count.
Definition at line 112 of file HashSet.cpp.
| void cloudViewer::core::HashSet::Reserve | ( | int64_t | capacity | ) |
Reserve the internal hash map with the capcity by rehashing.
Definition at line 30 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset().
| void cloudViewer::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.
Definition at line 79 of file HashSet.cpp.
References cloudViewer::t::io::WriteHashMap().
Referenced by cloudViewer::core::pybind_core_hashset().
| int64_t cloudViewer::core::HashSet::Size | ( | ) | const |
Get the size (number of active entries) of the hash set.
Definition at line 98 of file HashSet.cpp.
Referenced by cloudViewer::core::pybind_core_hashset(), and cloudViewer::t::geometry::PointCloud::VoxelDownSample().
Convert the hash set to another device.
Definition at line 93 of file HashSet.cpp.
References copy, and HashSet().
Referenced by cloudViewer::core::pybind_core_hashset().