public void TensorMatrixInvert() { #if ALLOW_EXCEPTIONS InvalidShapeException.NeedTensorSquareMatrix(this); #endif foreach (var ind in IterateOverMatrices()) { GetSubtensor(ind).InvertMatrix(); } }
public GenTensor <T> TensorDeterminantGaussianSimple() { #if ALLOW_EXCEPTIONS InvalidShapeException.NeedTensorSquareMatrix(this); #endif var res = GenTensor <T> .CreateTensor(Shape.SubShape(0, 2), ind => GetSubtensor(ind).DeterminantGaussianSimple()); return(res); }
public static GenTensor <T> TensorMatrixDivide(GenTensor <T> a, GenTensor <T> b) { #if ALLOW_EXCEPTIONS InvalidShapeException.NeedTensorSquareMatrix(a); InvalidShapeException.NeedTensorSquareMatrix(b); if (a.Shape != b.Shape) { throw new InvalidShapeException("Should be of the same shape"); } #endif var res = new GenTensor <T>(a.Shape); foreach (var ind in res.IterateOverMatrices()) { res.SetSubtensor( MatrixDivide( a.GetSubtensor(ind), b.GetSubtensor(ind) ), ind); } return(res); }