/// <summary> /// Implements the map function from functional programming. This 'maps' the /// function lambda onto the vector rv and returns the result. /// </summary> /// <param name="rv">A RowVector object.</param> /// <param name="lambda">A function that takes a double and an index and /// returns a double.</param> /// <returns>A vector with the function lambda mapped onto rv.</returns> public static RowVector Map(this RowVector rv, Func <double, int, double> lambda) { return(new RowVector(rv.Select(lambda).ToList())); }
/// <summary> /// Implements the map function from functional programming. This 'maps' the /// function lambda onto the vector rv and returns the result. /// </summary> /// <param name="rv">A RowVector object.</param> /// <param name="lambda">A function that takes a double and returns a double.</param> /// <returns>A vector with the function lambda mapped onto rv.</returns> public static RowVector Map(this RowVector rv, Func <double, double> lambda) { // Note: the Select method refers to Enumerable.Select in the Linq // namespace. return(new RowVector(rv.Select(lambda).ToList())); }