/// <summary> /// Calculates the sum for a given set of __inputVecType__s. /// </summary> public static __inputVecType__ Sum(this __inputVecType__[] vectors) { __inputVecType__ sum = __inputVecType__.Zero; for (var i = 0; i < vectors.Length; i++) { sum += vectors[i]; } return(sum); }
//# foreach(var scalar in Meta.VecFieldTypes) //# { //# foreach(var dim in Meta.VecTypeDimensions) //# { //# var inputVecType = Meta.VecTypeOf(dim, scalar).Name; //# var outputVecType = scalar.IsReal ? inputVecType : Meta.VecTypeOf(dim, Meta.DoubleType).Name; //# var scalarType = scalar.IsReal ? scalar.Name : Meta.DoubleType.Name; //# var cast = scalar.IsReal ? "" : "(" + outputVecType + ")"; #region __inputVecType__ #region Sum /// <summary> /// Calculates the sum for a given set of __inputVecType__s. /// </summary> public static __inputVecType__ Sum(this IEnumerable <__inputVecType__> vectors) { __inputVecType__ sum = __inputVecType__.Zero; foreach (var e in vectors) { sum += e; } return(sum); }