build:
python3 setup.py build_ext -if
using:
from parallelsort import parallelsort
import numpy as np
arr = np.random.uniform(0,100,100000000)
// #include <algorithm> // std::sort, std::stable_sort | |
#include <parallel/algorithm> | |
void argsort(unsigned long *pidx, const double *parr, unsigned long length) | |
{ | |
// Sort indexes based on comparing values in v | |
// Because Cython pass data blob as pointer, so access the array as pointer style. | |
unsigned long *pidx2 = pidx + length; | |
// double *parr2 = parr + length; | |
__gnu_parallel::sort(pidx, pidx2, |
build:
python3 setup.py build_ext -if
using:
from parallelsort import parallelsort
import numpy as np
arr = np.random.uniform(0,100,100000000)
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
'''simply copy to python command line and press enter.''' | |
import time | |
from os.path import expanduser | |
timestamp = None |
import json | |
import pandas as pd | |
try: | |
with open("data.1pif", "r") as f: | |
lines = f.readlines() | |
lines = [l for l in lines if not l.startswith("***")] | |
data = json.loads("[" + ",".join(lines) + "]") | |
except: |