/// <summary>
        /// Adds the <see cref="DiagonalMatrix{T}"/> and the <see cref="DiagonalMatrix{T}"/>.
        /// </summary>
        /// <typeparam name="T">Type of matrices elements.</typeparam>
        /// <param name="firstMatrix">The first matrix to add.</param>
        /// <param name="secondMatrix">The second matrix to add.</param>
        /// <returns>The matrix of added matrices elements.</returns>
        public static DiagonalMatrix <T> Add <T>(this DiagonalMatrix <T> firstMatrix, DiagonalMatrix <T> secondMatrix)
        {
            CheckMatrix <T>(firstMatrix, secondMatrix);

            T[,] resultArray = new T[firstMatrix.Order, secondMatrix.Order];

            for (int i = 0; i < firstMatrix.Order; i++)
            {
                resultArray[i, i] = (dynamic)firstMatrix[i, i] + (dynamic)secondMatrix[i, i];
            }

            return(new DiagonalMatrix <T>(resultArray));
        }
 /// <summary>
 /// Adds the <see cref="SquareMatrix{T}"/> and the <see cref="DiagonalMatrix{T}"/>.
 /// </summary>
 /// <typeparam name="T">Type of matrices elements.</typeparam>
 /// <param name="firstMatrix">The first matrix to add.</param>
 /// <param name="secondMatrix">The second matrix to add.</param>
 /// <returns>The matrix of added matrices elements.</returns>
 public static SquareMatrix <T> Add <T>(this SquareMatrix <T> firstMatrix, DiagonalMatrix <T> secondMatrix)
 {
     return(new SquareMatrix <T>(AddMatrix <T>(firstMatrix, secondMatrix)));
 }
 /// <summary>
 /// Adds the <see cref="DiagonalMatrix{T}"/> and the <see cref="SquareMatrix{T}"/>.
 /// </summary>
 /// <typeparam name="T">Type of matrices elements.</typeparam>
 /// <param name="firstMatrix">The first matrix to add.</param>
 /// <param name="secondMatrix">The second matrix to add.</param>
 /// <returns>The matrix of added matrices elements.</returns>
 public static SquareMatrix <T> Add <T>(this DiagonalMatrix <T> firstMatrix, SquareMatrix <T> secondMatrix) => Add(secondMatrix, firstMatrix);