All Projects → dselivanov → r-sparsepp

dselivanov / r-sparsepp

Licence: other
Rcpp interface to sparsepp - efficient hash map for C++

Programming Languages

r
7636 projects
shell
77523 projects

Projects that are alternatives of or similar to r-sparsepp

hashmap
Faster hash maps in R
Stars: ✭ 72 (+500%)
Mutual labels:  rcpp, hashmap
simplehstore
🏪 Easy way to use a PostgreSQL database (and the HSTORE feature) from Go
Stars: ✭ 54 (+350%)
Mutual labels:  hashmap
ctl
My variant of the C Template Library
Stars: ✭ 105 (+775%)
Mutual labels:  hashmap
Notes
This is a learning note | Java基础,JVM,源码,大数据,面经
Stars: ✭ 69 (+475%)
Mutual labels:  hashmap
Harbol
Harbol is a collection of data structure and miscellaneous libraries, similar in nature to C++'s Boost, STL, and GNOME's GLib
Stars: ✭ 18 (+50%)
Mutual labels:  hashmap
URT
Fast Unit Root Tests and OLS regression in C++ with wrappers for R and Python
Stars: ✭ 70 (+483.33%)
Mutual labels:  rcpp
indicium
🔎 A simple in-memory search for collections and key-value stores.
Stars: ✭ 41 (+241.67%)
Mutual labels:  hashmap
scalable-concurrent-containers
High performance containers and utilities for concurrent and asynchronous programming
Stars: ✭ 101 (+741.67%)
Mutual labels:  hashmap
RcppMeCab
RcppMeCab: Rcpp Interface of CJK Morpheme Analyzer MeCab
Stars: ✭ 24 (+100%)
Mutual labels:  rcpp
rcppfastfloat
Rcpp Bindings for the 'fastfloat' Header-Only Library
Stars: ✭ 18 (+50%)
Mutual labels:  rcpp
needle
📌📚 An extensive standalone data structure library for JavaScript.
Stars: ✭ 25 (+108.33%)
Mutual labels:  hashmap
rcpp progress
RcppProgress R package: An interruptible progress bar with OpenMP support for c++ in R packages
Stars: ✭ 26 (+116.67%)
Mutual labels:  rcpp
RcppXPtrUtils
XPtr Add-Ons for 'Rcpp'
Stars: ✭ 17 (+41.67%)
Mutual labels:  rcpp
textTinyR
Text Processing for Small or Big Data Files in R
Stars: ✭ 32 (+166.67%)
Mutual labels:  rcpp
shoki
Purely functional data structures in Java
Stars: ✭ 30 (+150%)
Mutual labels:  hashmap
sfheaders
Build sf objects from R and Rcpp
Stars: ✭ 70 (+483.33%)
Mutual labels:  rcpp
ABCoptim
An implementation of the Artificial Bee Colony (ABC) Algorithm
Stars: ✭ 26 (+116.67%)
Mutual labels:  rcpp
velcro
Collection initialization macros for Rust
Stars: ✭ 45 (+275%)
Mutual labels:  hashmap
rcpp-api
Source for the Unofficial Rcpp API Documentation
Stars: ✭ 42 (+250%)
Mutual labels:  rcpp
rcpparrayfire
R and ArrayFire library via Rcpp
Stars: ✭ 17 (+41.67%)
Mutual labels:  rcpp

CRAN_Status_Badge License

Benchmarks

Check original sparsepp repository and write-up which compares hashmap implementations.

insert-benchmark

Use sparsepp from another package

To use C++ code from sparsepp:

  1. In DESCRIPTION, add LinkingTo: sparsepp.
  2. In the C++ file, add: #include <sparsepp/spp.h>

Simple example

#include <sparsepp/spp.h>
using spp::sparse_hash_map;
sparse_hash_map<string, int> smap;

Defining custom hash function

#include <iostream>
#include <functional>
#include <string>
#include <sparsepp/spp.h>

using std::string;

struct Person 
{
    bool operator==(const Person &o) const 
    { return _first == o._first && _last == o._last; }

    string _first;
    string _last;
};

namespace std
{
    // inject specialization of std::hash for Person into namespace std
    // ----------------------------------------------------------------
    template<> 
    struct hash<Person>
    {
        std::size_t operator()(Person const &p) const
        {
            std::size_t seed = 0;
            spp::hash_combine(seed, p._first);
            spp::hash_combine(seed, p._last);
            return seed;
        }
    };
}

int main()
{
    // As we have defined a specialization of std::hash() for Person, 
    // we can now create sparse_hash_set or sparse_hash_map of Persons
    // ----------------------------------------------------------------
    spp::sparse_hash_set<Person> persons = { { "John", "Galt" }, 
                                             { "Jane", "Doe" } };
    for (auto& p: persons)
        std::cout << p._first << ' ' << p._last << '\n';
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].