x******a 发帖数: 6336 | 1 I need to do some MC simulation with 100000 paths, each path n will generate
20000 numbers and the sum of them will be recorded S_i. I need to keep the
4000 paths' (20000) random numbers generated by the descending order of S_n,
that is, I want to keep all the information of the 4000 paths with the
largest S_i.
how do I do this?
Thanks!
|
d********t 发帖数: 9628 | 2 看你内存有多大了。
generate
the
n,
【在 x******a 的大作中提到】 : I need to do some MC simulation with 100000 paths, each path n will generate : 20000 numbers and the sum of them will be recorded S_i. I need to keep the : 4000 paths' (20000) random numbers generated by the descending order of S_n, : that is, I want to keep all the information of the 4000 paths with the : largest S_i. : how do I do this? : Thanks! :
|
p***o 发帖数: 1252 | 3 Don't know how to use a heap? Then use a map of vectors indexed by S_i.
80M numbers is a piece of cake for C++.
generate
the
n,
【在 x******a 的大作中提到】 : I need to do some MC simulation with 100000 paths, each path n will generate : 20000 numbers and the sum of them will be recorded S_i. I need to keep the : 4000 paths' (20000) random numbers generated by the descending order of S_n, : that is, I want to keep all the information of the 4000 paths with the : largest S_i. : how do I do this? : Thanks! :
|
b***i 发帖数: 3043 | 4 4000 x 20000 才640M 如果double,
generate
the
n,
【在 x******a 的大作中提到】 : I need to do some MC simulation with 100000 paths, each path n will generate : 20000 numbers and the sum of them will be recorded S_i. I need to keep the : 4000 paths' (20000) random numbers generated by the descending order of S_n, : that is, I want to keep all the information of the 4000 paths with the : largest S_i. : how do I do this? : Thanks! :
|
x******a 发帖数: 6336 | 5 4GB RAM, i want to know how to use heap. thanks!
std::map is sorted by key? how do I add and remove the vectors? \
thanks! |
l*********s 发帖数: 5409 | 6 see the number above, you are wrong by 10 folds. It is a piece of cake even
for legacy PCs.
【在 x******a 的大作中提到】 : 4GB RAM, i want to know how to use heap. thanks! : std::map is sorted by key? how do I add and remove the vectors? \ : thanks!
|
x******a 发帖数: 6336 | 7 Sorry, forget to mention the path# and # of number generated each path could
be potentially much larger
even
【在 l*********s 的大作中提到】 : see the number above, you are wrong by 10 folds. It is a piece of cake even : for legacy PCs.
|