📜  红宝石 |矩阵 laplace_expansion()函数

📅  最后修改于: 2022-05-13 01:55:37.061000             🧑  作者: Mango

红宝石 |矩阵 laplace_expansion()函数

laplace_expansion()是 Ruby 中的一个内置方法,它沿给定的行或列返回给定矩阵的 laplace_expansion。换句话说,它返回 拉普拉斯展开

示例 1

CPP
#Ruby program for laplace_expansion() method in Matrix
 
#Include matrix
require "matrix"
 
#Initialize a matrix
    mat1
    = Matrix[[ 1, 21 ], [ 31, 18 ]]
 
#Prints the value of mat1.laplace_expansion
#first row
      puts mat1.laplace_expansion(row : 1)


CPP
#Ruby program for laplace_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.laplace_expansion
#first row
      puts mat1.laplace_expansion(column : 0)


输出

-633

示例 2

CPP

#Ruby program for laplace_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.laplace_expansion
#first row
      puts mat1.laplace_expansion(column : 0)

输出

-5