isSymmetric()
R語言中的函數用於檢查矩陣是否為對稱矩陣。對稱矩陣是其轉置等於矩陣本身的矩陣。
用法: isSymmetric(x)
參數:
x:要檢查的矩陣
範例1:
# R program to check if
# a matrix is symmetric
# Creating a diagonal matrix
x1 <- diag(3)
# Creating a matrix
x2 <- matrix(c(1, 2, 2, 3), 2)
# Calling isSymmetric() function
isSymmetric(x1)
isSymmetric(x2)
輸出:
[1] TRUE [1] TRUE
範例2:
# R program to check if
# a matrix is symmetric
# Creating a matrix
x1 <- matrix(c(1:9), 3, 3)
# Calling isSymmetric() function
isSymmetric(x1)
輸出:
[1] FALSE
相關用法
- R語言 is.matrix()用法及代碼示例
- R語言 data.matrix()用法及代碼示例
- R語言 as.matrix()用法及代碼示例
- R語言 exists()用法及代碼示例
- R語言 is.logical()用法及代碼示例
- R語言 is.unsorted()用法及代碼示例
- R語言 is.primitive()用法及代碼示例
- R語言 determinant()用法及代碼示例
- R語言 lower.tri()用法及代碼示例
- R語言 dim()用法及代碼示例
- R語言 colSums()用法及代碼示例
- R語言 col()用法及代碼示例
- R語言 colMeans()用法及代碼示例
- R語言 det()用法及代碼示例
- R語言 diag()用法及代碼示例
- R語言 str_detect()用法及代碼示例
- R語言 apply()用法及代碼示例
- R語言 row()用法及代碼示例
注:本文由純淨天空篩選整理自nidhi_biet大神的英文原創作品 Check if a Matrix is Symmetric or not in R Programming – isSymmetric() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。