LshProjection
=================

局部敏感哈希（Locality Sensitive Hashing, LSH）投影算子。该算子通过多个哈希组（Hash Groups）对输入特征进行处理，每组生成一个指定位宽（bits_per_hash）的哈希签名（int32）。

内部逻辑基于 FNV1a 哈希算法和加权评分机制，将高维特征映射为低维的离散哈希值。

计算过程：
    1. 对于每个哈希组 $i$，循环执行 $j$ 次（$j < bits\_per\_hash$）。
    2. 每次根据特定的哈希种子 $seed_{i,j}$ 计算特征与权重的加权评分，并通过评分符号决定一个 Bit 位（0 或 1）。
    3. 将生成的 Bit 位拼接成一个完整的 32 位整型哈希签名。

输入：
    - **hash_seed** - 哈希种子数组地址（float 类型）。
    - **feature** - 输入特征向量地址（int32 类型）。
    - **weight** - 权重向量地址（类型随算子名而定，若为 NULL 则不加权）。
    - **hash_group_num** - 生成的哈希组数量（即输出结果的个数）。
    - **bits_per_hash** - 每组哈希签名的有效位数（通常 $\le 32$）。
    - **feature_num** - 特征向量的维度。
    - **core_mask(int, 可选)** - 核掩码（仅适用于共享存储版本）。

输出：
    - **output** - 存储生成的哈希签名地址（int32 数组）。

支持平台：
    ``FT78NE``
    ``MT7004``

.. note::
    - FT78NE 支持权重类型：int8 (i8), int16 (i16), int32 (i32), fp32 (fp), fp64 (dp)
    - MT7004 支持权重类型：int16 (i16), int32 (i32), fp16 (hp), fp32 (fp)
    - 特征输入（feature）在所有平台上固定为 **int32** 类型。
    - 输出结果（output）在所有平台上固定为 **int32** 类型。

**共享存储版本:**

.. c:function:: void i8_lsh_projection_s(const float* hash_seed, const int32_t* feature, const int8_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)
.. c:function:: void i16_lsh_projection_s(const float* hash_seed, const int32_t* feature, const int16_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)
.. c:function:: void i32_lsh_projection_s(const float* hash_seed, const int32_t* feature, const int32_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)
.. c:function:: void hp_lsh_projection_s(const float* hash_seed, const int32_t* feature, const half* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)
.. c:function:: void fp_lsh_projection_s(const float* hash_seed, const int32_t* feature, const float* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)
.. c:function:: void dp_lsh_projection_s(const float* hash_seed, const int32_t* feature, const double* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num, int core_mask)

    **C调用示例：**

    .. code-block:: c
        :linenos:
        :emphasize-lines: 15

        // FT78NE 示例：fp32 权重，多核共享存储
        #include "78NE/utils.h"

        int main() {
            float* hash_seed = (float*)0xA0000000;
            int32_t* feature = (int32_t*)0xA1000000;
            float* weight = (float*)0xA2000000;
            int32_t* output = (int32_t*)0xB0000000;
            
            int hash_group_num = 128;
            int bits_per_hash = 16;
            int feature_num = 64;
            int core_mask = 0xFF;

            fp_lsh_projection_s(hash_seed, feature, weight, output, 
                                hash_group_num, bits_per_hash, feature_num, core_mask);
            return 0;
        }

**私有存储版本:**

.. c:function:: void i8_lsh_projection_p(const float* hash_seed, const int32_t* feature, const int8_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)
.. c:function:: void i16_lsh_projection_p(const float* hash_seed, const int32_t* feature, const int16_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)
.. c:function:: void i32_lsh_projection_p(const float* hash_seed, const int32_t* feature, const int32_t* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)
.. c:function:: void hp_lsh_projection_p(const float* hash_seed, const int32_t* feature, const half* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)
.. c:function:: void fp_lsh_projection_p(const float* hash_seed, const int32_t* feature, const float* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)
.. c:function:: void dp_lsh_projection_p(const float* hash_seed, const int32_t* feature, const double* weight, int32_t* output, int hash_group_num, int bits_per_hash, int feature_num)

    **C调用示例：**

    .. code-block:: c
        :linenos:
        :emphasize-lines: 13

        // MT7004 示例：fp16 (hp) 权重，私有存储单核
        #include <stdio.h>

        int main() {
            float* hash_seed = (float*)0x10000000;
            int32_t* feature = (int32_t*)0x10001000;
            half* weight = (half*)0x10002000;
            int32_t* output = (int32_t*)0x10003000;
            
            int hash_group_num = 64;
            int bits_per_hash = 8;
            int feature_num = 32;

            hp_lsh_projection_p(hash_seed, feature, weight, output, 
                                hash_group_num, bits_per_hash, feature_num);
            return 0;
        }