Exemplo n.º 1
0
        public void TensorMatrixInvert()
        {
            #if ALLOW_EXCEPTIONS
            InvalidShapeException.NeedTensorSquareMatrix(this);
            #endif

            foreach (var ind in IterateOverMatrices())
            {
                GetSubtensor(ind).InvertMatrix();
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }