由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教C++
相关主题
来几个C++测试题C++ Q10: list and sort
How to read binary(data) file generated by Fortran in C/C++ (转载)generate real time charts in C++
An empty C structure QuestionC++ template
multiple random number generator请教一个C++中function pointer的问题。
question for C++ constantC++ 普及课程 (视频)1:Compiler Generated Functions
any lexer/parser enthusiasts here?如何用C++产生随机Poisson分别的随机数?
[合集] 请教一个大公司的笔试题,关于c++随机数的C++怎么定义1列random number generators
Random number generator in C++请教个rng的问题
相关话题的讨论汇总
话题: paths话题: c++话题: 20000话题: generate话题: do
进入Programming版参与讨论
1 (共1页)
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.

1 (共1页)
进入Programming版参与讨论
相关主题
请教个rng的问题question for C++ constant
a simple question about constructorany lexer/parser enthusiasts here?
讨论个idea题[合集] 请教一个大公司的笔试题,关于c++随机数的
Remove elements from multiple vectors in C++Random number generator in C++
来几个C++测试题C++ Q10: list and sort
How to read binary(data) file generated by Fortran in C/C++ (转载)generate real time charts in C++
An empty C structure QuestionC++ template
multiple random number generator请教一个C++中function pointer的问题。
相关话题的讨论汇总
话题: paths话题: c++话题: 20000话题: generate话题: do