summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/complex.c2
-rw-r--r--examples/crandom_ex.c2
-rw-r--r--examples/demos.c2
-rw-r--r--examples/ex_gauss1.c10
-rw-r--r--examples/ex_gauss2.c2
5 files changed, 9 insertions, 9 deletions
diff --git a/examples/complex.c b/examples/complex.c
index 13c36d97..c6390d52 100644
--- a/examples/complex.c
+++ b/examples/complex.c
@@ -22,7 +22,7 @@ int main() {
cmap_map myMap = cmap_map_init();
cmap_lst listMap = cmap_lst_init();
clist_arr tableList = clist_arr_init();
- carray2f arr2 = carray2f_with_value(xdim, ydim, 1.f);
+ carray2f arr2 = carray2f_with_values(xdim, ydim, 1.f);
printf("arr2 size: %zu x %zu\n", arr2.xdim, arr2.ydim);
diff --git a/examples/crandom_ex.c b/examples/crandom_ex.c
index 4fa1d487..1d1691af 100644
--- a/examples/crandom_ex.c
+++ b/examples/crandom_ex.c
@@ -13,7 +13,7 @@ int main()
uint64_t sum = 0;
- stc64_normalf_t dist2 = stc64_normalf_init(R / 2.0, R / 6.0);
+ stc64_normalf_t dist2 = stc64_normalf_init((float)R / 2.0, (float)R / 6.0);
size_t N2 = 10000000;
int hist[R] = {0};
sum = 0;
diff --git a/examples/demos.c b/examples/demos.c
index 3502f5f1..e63d5660 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -184,7 +184,7 @@ using_carray3(f, float);
void arraydemo1()
{
printf("\nARRAYDEMO1\n");
- carray3f arr3 = carray3f_with_value(30, 20, 10, 0.0f);
+ carray3f arr3 = carray3f_with_values(30, 20, 10, 0.0f);
arr3.data[5][4][3] = 10.2f;
float **arr2 = arr3.data[5];
float *arr1 = arr3.data[5][4];
diff --git a/examples/ex_gauss1.c b/examples/ex_gauss1.c
index 75b96482..5613d2b3 100644
--- a/examples/ex_gauss1.c
+++ b/examples/ex_gauss1.c
@@ -10,12 +10,12 @@
using_cmap(i, int, size_t);
// Declare int vector with map entries that can be sorted by map keys.
-struct mapval {int first; size_t second;};
-static int compare(struct mapval *a, struct mapval *b) {
+c_struct (mapval) {int first; size_t second;};
+static int compare(mapval *a, mapval *b) {
return c_default_compare(&a->first, &b->first);
}
-using_cvec(e, struct mapval, compare);
+using_cvec(e, mapval, compare);
int main()
{
@@ -39,13 +39,13 @@ int main()
// Transfer map to vec and sort it by map keys.
cvec_e vhist = cvec_e_init();
c_foreach (i, cmap_i, mhist)
- cvec_e_push_back(&vhist, (struct mapval){i.ref->first, i.ref->second});
+ cvec_e_push_back(&vhist, c_make(mapval){i.ref->first, i.ref->second});
cvec_e_sort(&vhist);
// Print the gaussian bar chart
cstr bar = cstr_init();
c_foreach (i, cvec_e, vhist) {
- size_t n = (size_t) (i.ref->second * StdDev * Scale * 2.5 / N);
+ size_t n = (size_t) (i.ref->second * StdDev * Scale * 2.5 / (float)N);
if (n > 0) {
cstr_resize(&bar, n, '*');
printf("%4d %s\n", i.ref->first, bar.str);
diff --git a/examples/ex_gauss2.c b/examples/ex_gauss2.c
index 60195e7d..bd2f41bd 100644
--- a/examples/ex_gauss2.c
+++ b/examples/ex_gauss2.c
@@ -30,7 +30,7 @@ int main()
// Print the gaussian bar chart
cstr bar = cstr_init();
c_foreach (i, csmap_i, mhist) {
- size_t n = (size_t) (i.ref->second * StdDev * Scale * 2.5 / N);
+ size_t n = (size_t) (i.ref->second * StdDev * Scale * 2.5 / (float)N);
if (n > 0) {
cstr_resize(&bar, n, '*');
printf("%4d %s\n", i.ref->first, bar.str);