R/is.symmetric.matrix.R

Defines functions is.symmetric.matrix

Documented in is.symmetric.matrix

is.symmetric.matrix <- function( x )
{
###
### this function determines if the matrix is symmetric
###
### argument
### x = a numeric matrix object
###
    if ( !is.matrix( x ) ) {
        stop( "argument x is not a matrix" )
    }
    if ( !is.numeric( x ) ) {
        stop( "argument x is not a numeric matrix" )
    }    
    if ( !is.square.matrix( x ) )
        stop( "argument x is not a square numeric matrix" )
    return( sum( x == t(x) ) == ( nrow(x) ^ 2 ) )
}

Try the matrixcalc package in your browser

Any scripts or data that you put into this service are public.

matrixcalc documentation built on July 28, 2021, 9:06 a.m.