Пример #1
0
        public Matrix <T> ChangeToThisBasisMatrix(VectorSpace <T> other)
        {
            Matrix <T> fromBasisMatrix = new Matrix <T>();
            Matrix <T> toBasisMatrix   = new Matrix <T>();

            if (other.basis.Length != basis.Length)
            {
                throw new ArgumentException("The two vector spaces must be of the same dimension.");
            }

            for (int i = 0; i < basis.Length; i++)
            {
                if (!IsVectorInSpace(other.basis[i]) || !other.IsVectorInSpace(basis[i]))
                {
                    throw new ArgumentException("A change of basis matrix can only be created for two equivalent vector spaces.");
                }
            }

            foreach (Vector <T> vec in other.basis)
            {
                fromBasisMatrix.AppendColumnVector(vec);
            }

            foreach (IMatrixOperation <T> op in toBasisMatrix.ReducedEchelonFormReductionOperations)
            {
                op.ApplyTo(fromBasisMatrix);
            }

            return(fromBasisMatrix);
        }
Пример #2
0
 public Matrix <T> ChangeFromThisBasisMatrix(VectorSpace <T> other)
 {
     return(other.ChangeToThisBasisMatrix(this));
 }