1 #include <stdio.h> /* fprintf */
2 #include <stdlib.h> /* malloc, free, qsort */
3 #include <string.h> /* memset */
4 #include <time.h> /* clock */
5 #include "zstd_internal.h" /* includes zstd.h */
6 #ifndef ZDICT_STATIC_LINKING_ONLY
7 #define ZDICT_STATIC_LINKING_ONLY
14 unsigned k
; /* Segment size : constraint: 0 < k : Reasonable range [16, 2048+]; Default to 200 */
15 ZDICT_params_t zParams
;
16 } ZDICT_random_params_t
;
19 /*! ZDICT_trainFromBuffer_random():
20 * Train a dictionary from an array of samples.
21 * Samples must be stored concatenated in a single flat buffer `samplesBuffer`,
22 * supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order.
23 * The resulting dictionary will be saved into `dictBuffer`.
24 * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)
25 * or an error code, which can be tested with ZDICT_isError().
27 ZDICTLIB_API
size_t ZDICT_trainFromBuffer_random( void *dictBuffer
, size_t dictBufferCapacity
,
28 const void *samplesBuffer
, const size_t *samplesSizes
, unsigned nbSamples
,
29 ZDICT_random_params_t parameters
);