Skip to content
Back to formatted view

Raw Message

Message-ID: <48426bb5-aa2f-30d3-9ef3-4aab41be5af5@syonic.eu>
Date: 2021-09-14T13:46:46Z
From: Leonard Mada
Subject: Fastest way to extract rows of smaller matrix many times by index to make larger matrix? and multiply columsn of matrix by vector

Hello Nevil,


you could test something like:


# the Matrix
m = matrix(1:1000, ncol=10)
m = t(m)

# Extract Data
idcol = sample(seq(100), 100, TRUE); # now columns
for(i in 1:100) {
 ??? m2 = m[ , idcol];
}
m2 = t(m2); # transpose back


It may be faster, although I did not benchmark it.


There may be more complex variants. Maybe it is warranted to try for 
10^7 extractions:

- e.g. extracting one row and replacing all occurrences of that row;


Sincerely,


Leonard


========


It seems I cannot extract digested mail anymore. I hope though that the 
message is processed properly.