tarf_monte_carlo 3.61 → 3.62
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/tarf_monte_carlo/tarf_monte_carlo.c +0 -11
- data/lib/tarf_monte_carlo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774a60220745dc9096b8d91dd54d01a7053bc78a3f3b70fcc631e9c451d59ede
|
4
|
+
data.tar.gz: d2a4bbf7986e338fdec318e7a0045fb92ceb86e9a7b276ad1bdfd8ae0a38d53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f01816bea5fc7b19ecc9ee8c8d7ebb5179e63e1042c676a2aafcb04d68dac922f8c1bfbe6b71676d7a74aeffc4107a571340fdf442eafcb8c552cb803cefeaa
|
7
|
+
data.tar.gz: 7fdd0048cf2e8acbe0322da4f0618de813dc7de0245a2a30fc3f9b88b92138983e7239a6cc146eaafa2c03633250e461ab1abb654a28eed1321983c522f23d82
|
@@ -211,7 +211,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
211
211
|
//
|
212
212
|
// first create a 1-D array of pointers, and then, for each array entry, create another 1-D array.
|
213
213
|
//
|
214
|
-
double payoffmet[SCount];
|
215
214
|
double **metrics;
|
216
215
|
if (barrier_variations(KType)){
|
217
216
|
metrics = ( double** ) malloc( BARRIER_DP * sizeof(double*) );
|
@@ -236,8 +235,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
236
235
|
// run simulations loop
|
237
236
|
for( sim_count = 0; sim_count < SCount; sim_count += 2 ) {
|
238
237
|
// initial spot rate for each iteration would be current spot rate
|
239
|
-
payoffmet[sim_count] = 0;
|
240
|
-
payoffmet[sim_count + 1] = 0;
|
241
238
|
double Spot = S, Spot_dash = S;
|
242
239
|
double sim[NL], sim_pos[NL], sim_neg[NL], sim_dash[NL], sim_dash_pos[NL], sim_dash_neg[NL];
|
243
240
|
|
@@ -749,8 +746,6 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
749
746
|
pvs_neg[sim_count] = sim_neg_sum;
|
750
747
|
pvs_neg[sim_count + 1] = sim_dash_neg_sum;
|
751
748
|
|
752
|
-
payoffmet[sim_count] = sim_pos_sum;
|
753
|
-
payoffmet[sim_count + 1] = sim_dash_pos_sum;
|
754
749
|
|
755
750
|
if (barrier_variations(KType)){
|
756
751
|
if ((point_pos < DATAPOINTS) && (sim_count % INTERVAL) == 0){
|
@@ -826,18 +821,12 @@ VALUE method_run_monte_carlo( VALUE self, VALUE args ) {
|
|
826
821
|
}
|
827
822
|
}
|
828
823
|
|
829
|
-
|
830
|
-
VALUE py_final_metrics = rb_ary_new();
|
831
|
-
for(metric = 0; metric < SCount; metric++) {
|
832
|
-
rb_ary_push(py_final_metrics, DBL2NUM(payoffmet[metric]));
|
833
|
-
}
|
834
824
|
// rb_p(rb_str_new2("Generating output hash"));
|
835
825
|
VALUE final_pvs = rb_hash_new();
|
836
826
|
rb_hash_aset(final_pvs, rb_str_new2("positive_pv"), DBL2NUM( pvs_pos_sum / SCount ));
|
837
827
|
rb_hash_aset(final_pvs, rb_str_new2("negative_pv"), DBL2NUM( pvs_neg_sum / SCount ));
|
838
828
|
rb_hash_aset(final_pvs, rb_str_new2("total_pv"), DBL2NUM( (pvs_neg_sum + pvs_pos_sum) / SCount ));
|
839
829
|
rb_hash_aset(final_pvs, rb_str_new2("metrics"), final_metrics);
|
840
|
-
rb_hash_aset(final_pvs, rb_str_new2("payoffmetrics"), py_final_metrics);
|
841
830
|
|
842
831
|
//
|
843
832
|
// free your arrays from memory once you're done using them
|