In linear algebra, a diagonal matrix is a matrix in which the entries outside the main diagonal are all zero. The term usually refers to square matrices.An example of a 2-by-2 diagonal matrix is ; the following matrix is a 3-by-3 diagonal matrix: .An identity matrix of any size, or any multiple of it, will be a diagonal matrix.
The entries highlighted in green are called the main skew diagonal entries. An off-diagonal entry is any entry of a matrix that is not on its main diagonal. For example, we may define a diagonal matrix as being a square matrix whose off-diagonal entries are all equal to zero.
The top-right to bottom-left diagonal is sometimes described as the minor diagonal or antidiagonal. The off-diagonal entries are those not on the main diagonal. A diagonal matrix is one whose off-diagonal entries are all zero. A superdiagonal entry is one that is directly above and to the right of the main diagonal.
‘The direct elasticities are given as the bold diagonal numbers and the off-diagonal estimates are cross-elasticities.’ ‘If the off-diagonal elements are nonzero, then the fixation probability is increased, because the invading sequence gets support from its mutational neighbors.’ ‘In this symmetric case, the stability matrix A has ...
Since in general, for , this can be true only if off-diagonal components vanish.Therefore, must be diagonal. Given a diagonal matrix , the matrix power can be computed simply by taking each element to the power in question,
To get a vector holding the max of the off-diagonal elements of each col or row of a matrix requires a few more steps. I was directed here when searching for help on that. Perhaps others will do the same, so I offer this solution, which I found using what I learned here.
off-diagonal entry Let A = ( a i j ) be a square matrix . An element a i j is an off-diagonal entry if a i j is not on the diagonal , i.e., if i ≠ j .
x is a scalar (length-one vector) and the only argument, it returns a square identity matrix of size given by the scalar. x is a ‘numeric’ (complex, numeric, integer, logical, or raw) vector, either of length at least 2 or there were further arguments. This returns a matrix with the given diagonal and zero off-diagonal entries.
Calling diag twice returns a diagonal matrix composed of the diagonal elements of the original matrix. ... or :-by-1), diag treats the input as a matrix from which to extract a diagonal vector. This behavior occurs even if the input array is a vector at run time. To force diag to build a matrix from variable-size inputs that are not 1-by-: ...
The D Matrix (called G by SAS) is the matrix of the variances and covariances of the random effects. The variances are listed on the diagonal of the matrix and the covariances are on the off-diagonal. So a model with a random intercept and random slope (two random effects) would have a 2×2 D matrix.