/// <summary> /// Applies a function to every element of the array. /// </summary> public static TResult[][] Apply <TInput, TResult>(this TInput[][] matrix, Func <TInput, int, int, TResult> func) { return(Apply(matrix, func, Jagged.CreateAs <TInput, TResult>(matrix))); }
/// <summary> /// Creates a matrix of k-hot vectors, where all values at each row are /// zero except for the ones in the positions where <paramref name="mask"/> /// are true, which are set to one. /// </summary> /// /// <typeparam name="T">The data type for the matrix.</typeparam> /// /// <param name="mask">The boolean mask determining where ones will be placed.</param> /// /// <returns>A matrix containing one-hot vectors where only a single position /// is one and the others are zero.</returns> /// public static T[][] KHot <T>(bool[][] mask) { return(KHot <T>(mask, Jagged.CreateAs <bool, T>(mask))); }