# R Programming Task on Matrix

summary_statistics_A <- function(matrix){
vec = sort(as.vector(matrix))
len = length(vec)

if(isSymmetric(matrix) && is.numeric(matrix)){
min = vec[1]

max = vec[len]

mean = sum(vec)/len

median = ifelse(len%%2 == 0, (vec[(len)/2]+vec[len/2 + 1])/2, vec[(len+1)/2])

sd = sqrt((sum(vec^2) – len*mean^2)/(len-1))

eigen_values <- function (x, symmetric)
{
x <- unname(as.matrix(x))
n <- nrow(x)
if (!n)
stop(“0 x 0 matrix”)
if (n != ncol(x))
stop(“non-square matrix in ‘eigen'”)
n <- as.integer(n)
if (is.na(n))
stop(“invalid nrow(x)”)
complex.x <- is.complex(x)
if (!all(is.finite(x)))
stop(“infinite or missing values in ‘x'”)
if (missing(symmetric))
symmetric <- isSymmetric.matrix(x)
if (symmetric) {
z <- if (!complex.x)
.Internal(La_rs(x, F))
else .Internal(La_rs_cmplx(x, F))
ord <- rev(seq_along(z\$values))
}
else {
z <- if (!complex.x)
.Internal(La_rg(x, F))
else .Internal(La_rg_cmplx(x, F))
ord <- sort.list(Mod(z\$values), decreasing = TRUE)
}
if (F)
list(values = z\$values[ord], vectors = NULL)
else structure(class = “eigen”, list(values = z\$values[ord]))
}

eigen_values = eigen_values(matrix)\$values

return(list(minimum = min, maximum = max ,mean = mean ,median = median, standard_deviation = sd, Eigen_values = eigen_values))
}

else{
return(“Warning: Input should have a symmetric matrix and numerical values”)
}

}