Beispiel #1
0
        /// <summary>
        /// Outer product of two vectors
        /// </summary>
        /// <param name="u">First vector</param>
        /// <param name="v">Second vector</param>
        /// <returns>Matrix M[i,j] = u[i]*v[j] </returns>
        public static Matrix <T> OuterProduct(Vector <T> u, Vector <T> v)
        {
            var matrix = u.CreateMatrix(u.Count, v.Count);

            for (var i = 0; i < u.Count; i++)
            {
                matrix.SetRow(i, v.Multiply(u.At(i)));
            }

            return(matrix);
        }