示例#1
0
        /// <summary>
        /// Creates a new <see cref="Matrix{T}"/> object that copies all properties from a compatiable <see cref="Multiarray{T}"/> object subject to an associated mathematical field.
        /// </summary>
        /// <param name="field">The mathematical field containing elements of type <c>T</c>.</param>
        /// <param name="array">The multi-array to copy from.</param>
        private Matrix(BaseField <T> field, Multiarray <T> array)
            : base(array)
        {
            Field = field;

            Rows    = array.Order[0];
            Columns = array.Order[1];
        }
示例#2
0
        /// <summary>
        /// Creates a <see cref="Matrix{T}"/> object of a specified type with an associated mathematical field from a <see cref="Multiarray{T}"/> of the same type.
        /// </summary>
        /// <param name="field">The mathematical field.</param>
        /// <param name="array">The multi-array of data.</param>
        /// <returns>The newly created <see cref="Matrix{T}"/> object.</returns>
        public static Matrix <T> FromMultiarray(BaseField <T> field, Multiarray <T> array)
        {
            // Must check that field is non-null and multi-array is matrix.
            if (field == null)
            {
                throw new ArgumentNullException();
            }
            if (!array.IsMatrix())
            {
                throw new RankException();
            }

            return(new Matrix <T>(field, array));
        }