散列函数矩阵 [英] Hash function to matrix
问题描述
我有两个矩阵,我需要对它们进行比较,但我不希望通过位置来比较的位置,我觉得这是不是最好的方法。我想到的哈希函数,有没有人知道如何计算矩阵的哈希?
I have two matrices and I need to compare them, but I don't want to compare position by position, I think that is not the best way. I thought of hash functions, does anyone know how to calculate the hash of a matrix?
推荐答案
如果您的矩阵实现为数组,我建议使用 memcmp()
从文件string.h
来确定它们是否相等。
If your matrices are implemented as arrays, I'd suggest using memcmp()
from string.h
to determine if they are equal.
如果浮点值都参与和值与实际计算结果,有没有办法解决他们检查通过值值,因为你必须包括epsilons,以适应数字错误。
If floating point values are involved and the values result from actual computations, there's no way around checking them value by value, as you'll have to include epsilons to accomodate numeric errors.
这篇关于散列函数矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!