Construct a matrix by accumulation of indexed values (C, C++, or Fortran)

Completed Posted 6 years ago Paid on delivery
Completed Paid on delivery

INTRO: The function 'accumarray' in MATLAB is too slow for my codes (because they use large vectors and matrices), so I am seeking a FASTER version satisfying my needs. I am seeking the fastest possible implementation.

GOAL: Write a C, C++, or Fortran code which performs part of the functionality of the MATLAB function "accumarray". Your code must then be made into a MEX function for calling from MATLAB.

DETAILS: Your function must reproduce the following behavior (or similar):

%% GIVEN EXAMPLE INPUTS (This is MATLAB code):

numvalues = 10^6; % number of values to accumulate

matSize = 288; % width of matrix

vals = ones(numvalues,1); % values to be accumulated

xn = uint32(randi(matSize,numvalues,1)); % x index for values

yn = uint32(randi(matSize,numvalues,1)); % y index for values

zn = uint32(randi(matSize,numvalues,1)); % z index for values

pos3 = yn+(xn-1)*matSize+(zn-1)*matSize^2; % only needed for alternative code

%% YOUR FUNCTION WILL GIVE THE SAME OUTPUT THAT MATLAB GIVES USING ACCUMARRAY AS FOLLOWS:

newMat3 = accumarray([yn, xn, zn], vals, [matSize matSize matSize]); % a 3D evaluation

newMat2 = accumarray([yn, xn], vals, [matSize matSize]); % a 2D evaluation

newMat1 = accumarray(yn, vals, [matSize 1]); % a 1D evaluation

%% The above form is preferred, but the following alternative is also acceptable if it improves speed in your function:

newMat3 = accumarray(pos3,vals,[matSize^3 1]);

If possible, please report your expected speedup times.

I am also open to other ideas about how to speedup this function.

Algorithm C Programming C++ Programming Matlab and Mathematica Software Architecture

Project ID: #15873044

About the project

14 proposals Remote project Active 6 years ago

Awarded to:

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 7 years. My work is online game developing, and mainly focus on server side, using c++ under Linux environ More

$60 USD in 2 days
(157 Reviews)
7.1

14 freelancers are bidding on average $144 for this job

utkarshkatiyar19

A proposal has not yet been provided

$120 USD in 3 days
(429 Reviews)
7.4
xiqian88

How are you today? I have good experience with c/c++ and fortran also matlab i prefer working with c/c++ I have worked similar work but i got without clear algorithm It is very hard to convert to other code. Let' More

$155 USD in 3 days
(49 Reviews)
6.8
hmramezani

Hello I can help you with your task please check my reviews for more information I have also some questions Relevant Skills and Experience MATLAB c cpp python algorithms

$150 USD in 3 days
(141 Reviews)
7.0
VolKa

Hi. I am good in both Matlab and Fortran (you can find this from my profile with a lot of projects done). So I am sure I will be able to do this functionality using Fortran. Regards

$200 USD in 5 days
(153 Reviews)
6.6
ThanassisKalv

cool project, speeding up is always a challenge I enjoy. I quickly tested your Matlab script, the 3D version is 10x faster when gpuArray() (needs CUDA support) is used, with 1D I don't think you can see any special More

$120 USD in 2 days
(110 Reviews)
6.3
schoudhary1553

Greetings, I can help you in Construct a matrix by accumulation of indexed values . Please ping me for more discussion. Please see my profile i have deliver almost 280 projects with 100% client satisfaction. I More

$160 USD in 3 days
(74 Reviews)
6.4
zkutch

Hello More 20 years mathematics and programming experience. I need more details to set real price and time. Regards.

$155 USD in 7 days
(26 Reviews)
4.9
EndersonFalcon

I have interested in your project, talk with me for know more about my experience or your requirements. Best regards, Enderson J. Falcón G.

$77 USD in 5 days
(7 Reviews)
3.6
rfurch

A proposal has not yet been provided

$200 USD in 7 days
(1 Review)
2.7