public static ref BlockMatrix <M, N, T> Mul <M, K, N, T>(BlockMatrix <M, K, T> A, BlockMatrix <K, N, T> B, ref BlockMatrix <M, N, T> X) where M : ITypeNat, new() where K : ITypeNat, new() where N : ITypeNat, new() where T : unmanaged { var m = nati <M>(); var n = nati <N>(); for (var i = 0; i < m; i++) { for (var j = 0; j < n; j++) { X[i, j] = dot(A.GetRow(i), B.GetCol(j)); } } return(ref X); }
public static ref BlockMatrix <N, T> Mul <N, T>(BlockMatrix <N, T> A, BlockMatrix <N, T> B, ref BlockMatrix <N, T> X) where N : ITypeNat, new() where T : unmanaged { var n = nati <N>(); for (var i = 0; i < n; i++) { for (var j = 0; j < n; j++) { X[i, j] = dot(A.Row(i), B.Col(j)); } } return(ref X); }
public static string Format <N, T>(this BlockMatrix <N, T> src, int?cellwidth = null, char?cellsep = null, Func <T, string> render = null) where N : ITypeNat, new() where T : struct => src.ToRectangular().Format(cellwidth, cellsep, render);
void VerifyRightStochastic <N, T>(BlockMatrix <N, T> m, N n = default) where N : ITypeNat, new() where T : struct { Claim.yea(m.IsRightStochastic()); }
public static Matrix <M, N, T> ToMatrix <M, N, T>(this BlockMatrix <M, N, T> src) where M : ITypeNat, new() where N : ITypeNat, new() where T : unmanaged => Matrix.Load <M, N, T>(src.Unblocked.ToArray());