归一化压缩距离C代码
有谁知道C语言中是否已经有一个代码可以计算两个文件的NCD(归一化压缩距离),或者我需要自己编写代码?提前致谢!
does anybody knows if there is already a code in C that calculates the NCD (normalized compression distance) for two files or I need to write the code by myself? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为没有任何 C 库可以计算 NCD 系列函数或任何类似的东西。您最好的选择可能是在
MATLAB
中执行此操作,然后将m 文件
转换为等效的C
代码作为mex 文件.或者,您也可以编写自己的代码。
如果您的代码可以在 Linux 系统上运行,那么您可以使用
tar
实用程序以及-z
选项来表示gzip
和-j<
bzip
压缩算法的 /code> 选项。要创建bzip
存档,请使用以下选项:tar -cjf foo.bz2 temp/
创建temp 的
目录并将输出命名为bzip
存档/foo.bz2
。要创建gzip
存档文件,请使用以下选项:tar -cjf foo.gzip temp/
要从
c
程序中调用此代码,您可以使用system()
命令。此命令将您想要调用的任何实用程序(带参数)作为字符串作为输入,并返回一个int
指示成功或失败。您可以像这样调用它:I do not think there are any C libraries out there to compute the NCD family of functions or anything of the sort. Your best bet might be to do this in
MATLAB
and then convert them files
into equivalentC
code as amex file
. Alternatively, you could write your own code too.If your code can run on Linux systems, then you can use the
tar
utility with-z
option forgzip
and-j
option for thebzip
compression algorithm. To create abzip
archive, use the following option:tar -cjf foo.bz2 temp/
creates abzip
archive of thetemp/
directory and names the outputfoo.bz2
. To create agzip
archived file, use the following options:tar -cjf foo.gzip temp/
To call this code from within a
c
program, you can use thesystem()
command. This command takes whatever utility you want to invoke (with parameters) as a string as input and returns anint
indicating success or failure. You can invoke it like so:Ubuntu Hardy Heron 下有一个名为 ncd 的工具。这可能就是您正在寻找的。更多信息:http://manpages.ubuntu.com/manpages/hardy/ man1/ncd.1.html
编辑:
ncd
程序来自libcomplearn
软件包,您可以从此处下载该软件包(源代码位于名为src
的文件夹中):https://launchpad.net/ubuntu/hardy/+source/libcomplearn/1.1.1-1请注意,我还没有查看许可条款和其他限制工具。您可能想在使用该工具或源之前查看它们。
There is a tool called
ncd
under Ubuntu Hardy Heron. It may be what you're looking for. Further info: http://manpages.ubuntu.com/manpages/hardy/man1/ncd.1.htmlEDIT:
The
ncd
program comes from thelibcomplearn
package and you can download this package (the sources are in a folder calledsrc
) from here: https://launchpad.net/ubuntu/hardy/+source/libcomplearn/1.1.1-1Please note that I haven't taken a look at the licensing terms and other limitations of the tool. You might want to have a look at them before using the tool or the sources.