00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <stdlib.h>
00021 #include <stdint.h>
00022 #include <stdio.h>
00023 #include <string.h>
00024 #include <ccn/matrix.h>
00025
00026 void
00027 Dump(struct ccn_matrix *m)
00028 {
00029 struct ccn_matrix_bounds r;
00030 int res = ccn_matrix_getbounds(m, &r);
00031 printf("ccn_matrix_getbounds res = %d, rows [%ld..%ld), cols [%ld..%ld)\n",
00032 res,
00033 (long)r.row_min, (long)r.row_max,
00034 (long)r.col_min, (long)r.col_max);
00035 }
00036
00037 int
00038 main(int argc, char **argv)
00039 {
00040
00041 struct ccn_matrix *m;
00042
00043 m = ccn_matrix_create();
00044
00045 Dump(m);
00046 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00047 Dump(m); printf(" ccn_matrix_store(m, 1, 100, 30);" "\n");
00048 ccn_matrix_store(m, 1, 100, 30);
00049 Dump(m);
00050 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 31415926, 101));
00051 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00052 Dump(m); printf(" ccn_matrix_store(m, 31415926, 101, 43);" "\n");
00053 ccn_matrix_store(m, 31415926, 101, 43);
00054 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 31415926, 101));
00055 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00056 Dump(m);
00057 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00058 Dump(m); printf(" ccn_matrix_store(m, 1, 100, 0);" "\n");
00059 ccn_matrix_store(m, 1, 100, 0);
00060 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 31415926, 101));
00061 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00062 Dump(m); printf(" ccn_matrix_store(m, 31415926, 101, 0);" "\n");
00063 ccn_matrix_store(m, 31415926, 101, 0);
00064 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 31415926, 101));
00065 printf("%d: %ld\n", __LINE__, (long)ccn_matrix_fetch(m, 1, 100));
00066 Dump(m);
00067 ccn_matrix_destroy(&m);
00068 return(0);
00069 }