Closed zhoujie757 closed 1 year ago
That is correct, the count_min_sketch.c
is the implementation of the count_min_sketch.h
and the combination of them is what defines the library. To use it you need to include the .h
version and compile the source. Per the README:
To use the library, copy the src/count_min_sketch.h
and src/count_min_sketch.c
files into your project and include it where needed.
Once it is included you can utilize the cms in your own code:
#include <stdio.h>
#include "count_min_sketch.h"
CountMinSketch cms;
cms_init(&cms, 10000, 7);
int i, res;
for (i = 0; i < 10; i++) {
res = cms_add(&cms, "this is a test");
}
res = cms_check(&cms, "this is a test");
if (res != 10) {
printf("Error with lookup: %d\n", res);
}
cms_destroy(&cms);
OK, thank you. But could you tell me what hash functions are used in this code and where are they?
学习的乐趣 @.***
------------------ 原始邮件 ------------------ 发件人: "barrust/count-min-sketch" @.>; 发送时间: 2023年3月21日(星期二) 上午10:43 @.>; @.**@.>; 主题: Re: [barrust/count-min-sketch] how to use it (Issue #20)
That is correct, the count_min_sketch.c is the implementation of the count_min_sketch.h and the combination of them is what defines the library. To use it you need to include the .h version and compile the source. Per the README:
To use the library, copy the src/count_min_sketch.h and src/count_min_sketch.c files into your project and include it where needed.
Once it is included you can utilize the cms in your own code:
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
OK,thank you so much. I benifit a lot from it.
学习的乐趣 @.***
------------------ 原始邮件 ------------------ 发件人: "barrust/count-min-sketch" @.>; 发送时间: 2023年3月21日(星期二) 晚上7:54 @.>; @.**@.>; 主题: Re: [barrust/count-min-sketch] how to use it (Issue #20)
It uses an fnv-1a hash.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Please one more question. If countmin_sketch's width is 'w' and depth is 'd', it should have 'd' hash functions. Why there is only an fnv-1a hash?
学习的乐趣 @.***
------------------ 原始邮件 ------------------ 发件人: "barrust/count-min-sketch" @.>; 发送时间: 2023年3月21日(星期二) 晚上7:54 @.>; @.**@.>; 主题: Re: [barrust/count-min-sketch] how to use it (Issue #20)
It uses an fnv-1a hash.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
The library uses a seed value in the fnv-1a hash to allow the same hash to produce different values for each depth level. This means we don't need to come up with n
different hashes that are each different types.
Dear writer: I have a question. When the depth is 3, I inserted two hunderd thousand data into countmin sketch. However, when I checked one of the data, why the result is 0? Here is a picture, first three outputs are belonging to "bins[bin]", the last data is result, I can't understand why the result is 0? In principle, the result can only be too large. Look forward to your reply.
学习的乐趣 @.***
------------------ 原始邮件 ------------------ 发件人: "barrust/count-min-sketch" @.>; 发送时间: 2023年3月22日(星期三) 晚上9:53 @.>; @.**@.>; 主题: Re: [barrust/count-min-sketch] how to use it (Issue #20)
The library uses a seed value in the fnv-1a hash to allow the same hash to produce different values for each depth level. This means we don't need to come up with n different hashes that are each different types.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I'd need more information and possibly code example that replicates the issue to be able to figure out what is happening. I could also be based on the depth x width of the CMS that could be the issue.
there is not a main function in the "count_min_sketch.c ", and the "test.c" doesn't include the "count_min_sketch.c", so what is the role of “count_min_sketch.c”, how can I use it to insert data and query data?