CSharp examples for System:Math Vector
Calculate the product of two vectors (a scalar value).
// Licensed under the Apache License, Version 2.0 (the "License"); using System.Collections.Generic; using System;/*from w w w .j av a 2s . co m*/ public class Main{ /// <summary> /// Calculate the product of two vectors (a scalar value). /// </summary> /// <param name="a">First vector to multiply.</param> /// <param name="b">Second vector to multiply.</param> /// <returns>The product of the two vectors (a scalar value).</returns> public static double VectorProduct(double[] a, double[] b) { int length = a.Length; double value = 0; for (int i = 0; i < length; ++i) value += a[i]*b[i]; return value; } }