コード例 #1
0
ファイル: VectorUtils.cs プロジェクト: zyw400/machinelearning
        /// <summary>
        /// Multiplies arrays Dst *= A element by element and returns the result in <paramref name="dst"/> (Hadamard product).
        /// </summary>
        public static void MulElementWise(ref VBuffer <Float> a, ref VBuffer <Float> dst)
        {
            Contracts.Check(a.Length == dst.Length, "Vectors must have the same dimensionality.");

            if (a.IsDense && dst.IsDense)
            {
                SseUtils.MulElementWise(a.Values, dst.Values, dst.Values, a.Length);
            }
            else
            {
                VBufferUtils.ApplyWithEitherDefined(ref a, ref dst, (int ind, Float v1, ref Float v2) => { v2 *= v1; });
            }
        }
コード例 #2
0
 public static void MulElementWise(float[] src1, float[] src2, float[] dst, int count) => SseUtils.MulElementWise(src1, src2, dst, count);