help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: index() function in the C++ API


From: mpuglia
Subject: Re: index() function in the C++ API
Date: Fri, 31 May 2013 22:22:11 -0700 (PDT)

To answer my own question, it looks something like this:

MArray<int> idx(dim_vector(20000,1));  //populate with indices in any order
idx_vector ind_vec_rows(':');
idx_vector ind_vec_cols(idx);
Matrix b = a.index(ind_vec_rows, ind_vec_cols);

And it's about 5x faster than using b.insert(a.column(i),0,i)) in a for
loop.

Does anyone know if there is way to access/assign the index values in the
ind_vec_cols vector?  This would be useful for reordering the ind_vector a
second time, rather than reordering the MArray and creating a new idx_vector
every time.  I can't find anything in the API that seems to do it though.






--
View this message in context: 
http://octave.1599824.n4.nabble.com/index-function-in-the-C-API-tp4653527p4653592.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]