summaryrefslogtreecommitdiffhomepage
path: root/examples/ex_gaussian.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-09-18 11:55:29 +0200
committerTyge Løvset <[email protected]>2020-09-18 11:55:29 +0200
commit681873e4cb6ea076b79c6c70b2df2ba4e4c19bda (patch)
tree69c0c3290189163937d4ab4203fe4565094657b0 /examples/ex_gaussian.c
parent692ab82818e2d65177e06d7717d9184b7bc27ff1 (diff)
downloadSTC-modified-681873e4cb6ea076b79c6c70b2df2ba4e4c19bda.tar.gz
STC-modified-681873e4cb6ea076b79c6c70b2df2ba4e4c19bda.zip
Changed <container>_ini macro constant to <container>_INIT, and <container>_destroy() to <container>_del.
Diffstat (limited to 'examples/ex_gaussian.c')
-rw-r--r--examples/ex_gaussian.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/ex_gaussian.c b/examples/ex_gaussian.c
index 033c0ebd..e5dad57a 100644
--- a/examples/ex_gaussian.c
+++ b/examples/ex_gaussian.c
@@ -14,7 +14,7 @@ static int compare(cmap_i_entry_t *a, cmap_i_entry_t *b) {
return c_default_compare(&a->first, &b->first);
}
// Vector: typetag 'e' for (map) entry
-using_cvec(e, cmap_i_entry_t, c_default_destroy, compare);
+using_cvec(e, cmap_i_entry_t, c_default_del, compare);
int main()
{
@@ -29,20 +29,20 @@ int main()
crand_normal_f64_t dist = crand_normal_f64_init(Mean, StdDev);
// Create histogram map
- cmap_i mhist = cmap_ini;
+ cmap_i mhist = cmap_INIT;
for (size_t i = 0; i < N; ++i) {
int index = (int) round( crand_normal_f64(&rng, &dist) );
cmap_i_emplace(&mhist, index, 0).first->second += 1;
}
// Transfer map to vec and sort it by map keys.
- cvec_e vhist = cvec_ini;
+ cvec_e vhist = cvec_INIT;
c_foreach (i, cmap_i, mhist)
cvec_e_push_back(&vhist, *i.get);
cvec_e_sort(&vhist);
// Print the gaussian bar chart
- cstr_t bar = cstr_ini;
+ cstr_t bar = cstr_INIT;
c_foreach (i, cvec_e, vhist) {
size_t n = (size_t) (i.get->second * Mag / N);
if (n > 0) {
@@ -52,7 +52,7 @@ int main()
}
}
// Cleanup
- cstr_destroy(&bar);
- cmap_i_destroy(&mhist);
- cvec_e_destroy(&vhist);
+ cstr_del(&bar);
+ cmap_i_del(&mhist);
+ cvec_e_del(&vhist);
}