knitr::opts_chunk$set( echo = TRUE, collapse = TRUE, comment = "#>" ) library(SolSyl) library(Matrix) library(knitr)
#A B are square Matrices and dimension of A is larger A <- matrix(c(1,0,-1,2,1,0,0,0,-1),3,3,byrow = TRUE) #3x3 Matrix B <- matrix(c(2,1,0,0),2,2,byrow = TRUE) #2x2 Matrix C <- matrix(c(2,2,1,1,1,1),3,2) #3x2 Matrix SolveSylvester(A,B,C)
#A B are square Matrices and dimensions of A and B are the same A <- matrix(c(1,0,-1,2,1,0,0,0,-1),3,3,byrow = TRUE) #3x3 Matrix B <- matrix(c(2,1,0,0,1,3,4,5,0),3,3,byrow = TRUE) #3x3 Matrix C <- matrix(c(2,2,1,1,1,1,3,2,4),3,3) #3x3 Matrix SolveSylvester(A,B,C)
#A B are square Matrices and dimension of B is larger A <- matrix(c(1,0,-1,2),2,2,byrow = TRUE) #2x2 Matrix B <- matrix(c(2,1,0,0,1,3,4,5,0),3,3,byrow = TRUE) #3x3 Matrix C <- matrix(c(2,2,1,3,2,4),2,3) #2x3 Matrix SolveSylvester(A,B,C)
#A B are square Matrices and dimension of B is larger A <- matrix(c(1,0,-1,2),2,2,byrow = TRUE) #2x2 Matrix B <- matrix(c(2,1,0,0,1,3,4,5,0),3,3,byrow = TRUE) #3x3 Matrix C <- matrix(c(2,2,1,3,2,4),2,3) #2x3 Matrix X <- SolveSylvester(A,B,C)
#A B are square Matrices and dimension of B is larger A <- matrix(c(1,0,-1,2),2,2,byrow = TRUE) #2x2 Matrix B <- 2 #number C <- matrix(c(2,2,1,3),2,2) #2x2 Matrix SolveSylvester(A,B,C)
#A B are square Matrices and dimension of B is larger A <- 2 #number B <- matrix(c(1,0,-1,2),2,2,byrow = TRUE) #2x2 Matrix C <- matrix(c(2,2,1,3),2,2) #2x2 Matrix SolveSylvester(A,B,C)
set.seed(123) A <- matrix(rnorm(9,0,1),3,3) B <- 0 C <- matrix(rnorm(9,0,1),3,3) all.equal.numeric(as.vector(solve(A,C)),as.vector(SolveSylvester(A,B,C))) microbenchmark(solve(A,C),SolveSylvester(A,B,C)) #C++ sloves matrix equations faster than R
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.