cofactor_expansion()是Ruby中的內置方法,它沿著給定的行或列返回給定矩陣的cofactor_expansion。換句話說,它返回Laplace展開。
用法: mat1.cofactor_expansion(row: num or col:num)
參數:該函數接受一個必填參數行或列,其返回的是cofactor_expansion。
返回值:它沿著給定的行或列返回給定矩陣的cofactor-expansion。
例子1:
# Ruby program for cofactor_expansion() method in Matrix
# Include matrix
require "matrix"
# Initialize a matrix
mat1 = Matrix[[1, 21], [31, 18]]
# Prints the value of mat1.cofactor_expansion
# first row
puts mat1.cofactor_expansion(row:1)
輸出:
-633
例子2:
# Ruby program for cofactor_expansion() method in Matrix
# Include matrix
require "matrix"
# Initialize a matrix
mat1 = Matrix[[13, 1, 5], [12, 1, 5], [11, 2, 5]]
# Prints the value of mat1.cofactor_expansion
# first row
puts mat1.cofactor_expansion(column:0)
輸出:
-5
相關用法
- Ruby Matrix inv()用法及代碼示例
- Ruby Matrix det()用法及代碼示例
- Ruby Matrix tr()用法及代碼示例
- Ruby Matrix lup()用法及代碼示例
- Ruby Matrix t()用法及代碼示例
- Ruby Matrix row()用法及代碼示例
- Ruby Matrix eql?用法及代碼示例
- Ruby Matrix I()用法及代碼示例
- Ruby Matrix zero?()用法及代碼示例
- Ruby Matrix zero()用法及代碼示例
- Ruby Matrix to_a()用法及代碼示例
- Ruby Matrix scalar()用法及代碼示例
- Ruby Matrix column_size()用法及代碼示例
- Ruby Matrix round()用法及代碼示例
- Ruby Matrix unit()用法及代碼示例
注:本文由純淨天空篩選整理自gopaldave大神的英文原創作品 Ruby | Matrix cofactor_expansion() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。