Make Json encoded array interface. */
| 23 | |
| 24 | /* Make Json encoded array interface. */ |
| 25 | static void MakeArrayInterface(size_t data, size_t n, char const* typestr, size_t length, |
| 26 | char* out) { |
| 27 | static char const kTemplate[] = |
| 28 | "{\"data\": [%lu, true], \"shape\": [%lu, %lu], \"typestr\": \"%s\", \"version\": 3}"; |
| 29 | memset(out, '\0', length); |
| 30 | sprintf(out, kTemplate, data, n, 1ul, typestr); |
| 31 | } |
| 32 | /* Make Json encoded DMatrix configuration. */ |
| 33 | static void MakeConfig(int n_threads, size_t length, char* out) { |
| 34 | static char const kTemplate[] = "{\"missing\": NaN, \"nthread\": %d}"; |