Code Directory
 Visual Basic & VB.NET
New Code
Vue Injector 3.3
Spectrum Analyzer pro Live 2019
Devart Excel Add-in for HubSpot 2.1
RentALLScript - Airbnb clone 2.2
SuiteCRM Theme Customization 7.11.6
iScripts NetMenus 3.1
iScripts EasyIndex 2.2
iScripts EasySnaps 2.0
Australia MyPost shipping For Magento 2 1.0.0
Australia Post eParcel For Magento 1.1.1
Source Control for SQL Server 2.0
Answers phpSoftPro 3.12
Exlcart 2.0
School College ERP 1.3.2
White-label Grocery Delivery App Solution 2.0
Top Code
iScripts EasySnaps 1
iScripts NetMenus 2.0
iScripts EasyIndex 1
ATN Site Builder 3.0
PHP MLM Software 2.0.1
GnuWin64 64
Azizi search engine script PHP 4.1.10
Single Leg MLM 1.2.1
phpEnter 5.1.
IcrediBB Bulletin Board System 1.0
ATN Resume Finder 2.0
Invoice Manager by PHPJabbers 3.0
Deals and Discounts Website Script 1.0.2
Extreme Injector 3.7
School College ERP 1.3.2
Top Rated
phpEnter 5.1.
Quick Maps For Dynamics CRM 3.1
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Fast Sorting of n dimensional array by first dimension 
File ID: 64046

Fast Sorting of n dimensional array by first dimension 
Download Fast Sorting of n dimensional array by first dimension Error Link
License: Freeware
Downloads: 75
Submit Rating:
Fast Sorting of n dimensional array by first dimension  Description
Description: I have looked far and wide for code for fast sorting of n dimensional arrays by the first element, for example if I had the array:
ray = [[1,2,3,7,5][10,11,12,13,14]]

I would want it to come out as
ray = [[1,2,3,5,7][10,11,12,14,13]]

There are several ways to do this. One is
zipped = zip(ray)
ray = zip(zipped)

but this is extremely slow. Numpy has a much faster way to do it, but it wasn't immediately apparent.

if the above were a numpy array you could simply do the following:
indexes = numpy.argsort(ray[0])
for n in xrange(len(ray))
ray[n] = ray[n][indexes]

I did a time test of the two methods below.

License: Freeware

Related: argsort, Lists, numpy, Python, Sorting


Downloads: 75

More Similar Code

This implementation includes modules for very fast loading and saving of n-dimensional, possibly colored and bulky point clouds. The proposed functions can also be used to load and save matrices in ASCII format.

cload -------> loads point clouds from ASCII-files. (Function definitions in cload.c)
csave -------> saves point clouds in plain ASCII and VRML formats. (Function definitions in csave.c)

The class ndSparse defined in this submission will give a lot of the functionality of N-dimensional sparse arrays for N possibly greater than 2. However, it should really be thought of as a way of starting with an ordinary MATLAB sparse matrix and...

Three ways to calculate a distance matrix out of a list of n-dimensional points using scipy.

This function is an implementation of N-dimensional convolution for the special case when the convolution kernel is separable.

A continuous function f(x1, x2, ... xN) is considered separable if there exist N functions f1, f2, ... fN...

function [i,i_] = fgridmin(y)
% Search an N-dimensional array y for points that may be proximate to a global minimum
% of the interpolated array; return the proximate points' N-D subscripts (i) in y. Also
% optionally return the...

MAT2TILES is basically a wrapper for mat2cell but with a more convenient interface when you are simply trying to decompose an N-dimensional array into equal-sized chunks. It takes the desired chunk-size as an input argument, whereas mat2cell does...

This function returns the basis of the intersection of N subspaces defined by their bases, and the dimension of this intersection. The input basis vectors must be row vectors!

A = [1,1,-1,1; %<-basis vector

This function evaluates all possible combinations of N elements
taken by sets of S. Tested under MATLAB 4.2b and 5.2.

This is more useful for the web developers in ASP language to get more details in string handling functions in ASP. This article illustrates the steps to create two dimensional array with variables and suggests the bubble sorting method to arrange...

These files provide a fast implementation of the image-source model (ISM) for the simulation of room impulse responses (RIRs) in small-room acoustics. This implementation produces RIRs that are virtually identical to those obtained with the...

User Review for Fast Sorting of n dimensional array by first dimension
- required fields

Please enter text on the image