Skip to content

Commit 97293a5

Browse files
authored
Merge pull request #306 from jamesb93/enhance/optimise-spikestotimes
optimise spikes to times sorting
2 parents 1c096a1 + 2095391 commit 97293a5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/flucoma/clients/common/SpikesToTimes.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ Result spikesToTimes(FluidTensorView<T, 2> changePoints, BufferAdaptor* output,
6060
for (index i = 0; i < changePoints.rows(); ++i)
6161
{
6262
// Arg sort
63-
std::vector<index> indices(asUnsigned(changePoints.row(i).size()));
63+
auto thisrow = changePoints.row(i);
64+
std::vector<index> indices(asUnsigned(thisrow.size()));
6465
std::iota(indices.begin(), indices.end(), 0);
65-
std::sort(indices.begin(), indices.end(), [&](index i1, index i2) {
66-
return changePoints.row(i)[i1] > changePoints.row(i)[i2];
66+
std::sort(indices.begin(), indices.end(), [&thisrow](index i1, index i2)
67+
{
68+
return thisrow(i1) > thisrow(i2);
6769
});
6870

6971
// Now put the gathered indicies into ascending order

0 commit comments

Comments
 (0)