Last data update: 2014.03.03

R: Albers' example Matrix with "Difficult" Eigen Factorization
CAexR Documentation

Albers' example Matrix with "Difficult" Eigen Factorization

Description

An example of a sparse matrix for which eigen() seemed to be difficult, an unscaled version of this has been posted to the web, accompanying an E-mail to R-help (https://stat.ethz.ch/mailman/listinfo/r-help), by Casper J Albers, Open University, UK.

Usage

data(CAex)

Format

This is a 72 * 72 symmetric matrix with 216 non-zero entries in five bands, stored as sparse matrix of class dgCMatrix.

Details

Historical note (2006-03-30): In earlier versions of R, eigen(CAex) fell into an infinite loop whereas eigen(CAex, EISPACK=TRUE) had been okay.

Examples

data(CAex)
str(CAex) # of class "dgCMatrix"

image(CAex)# -> it's a simple band matrix with 5 bands
## and the eigen values are basically 1 (42 times) and 0 (30 x):
zapsmall(ev <- eigen(CAex, only.values=TRUE)$values)
## i.e., the matrix is symmetric, hence
sCA <- as(CAex, "symmetricMatrix")
## and
stopifnot(class(sCA) == "dsCMatrix",
          as(sCA, "matrix") == as(CAex, "matrix"))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Matrix)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Matrix/CAex.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CAex
> ### Title: Albers' example Matrix with "Difficult" Eigen Factorization
> ### Aliases: CAex
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(CAex)
> str(CAex) # of class "dgCMatrix"
Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  ..@ i       : int [1:216] 0 24 48 1 25 49 2 26 50 3 ...
  ..@ p       : int [1:73] 0 3 6 9 12 15 18 21 24 27 ...
  ..@ Dim     : int [1:2] 72 72
  ..@ Dimnames:List of 2
  .. ..$ : NULL
  .. ..$ : NULL
  ..@ x       : num [1:216] 0.999998 -0.001312 -0.000527 0.999999 -0.000903 ...
  ..@ factors : list()
> 
> image(CAex)# -> it's a simple band matrix with 5 bands
> ## and the eigen values are basically 1 (42 times) and 0 (30 x):
> zapsmall(ev <- eigen(CAex, only.values=TRUE)$values)
 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> ## i.e., the matrix is symmetric, hence
> sCA <- as(CAex, "symmetricMatrix")
> ## and
> stopifnot(class(sCA) == "dsCMatrix",
+           as(sCA, "matrix") == as(CAex, "matrix"))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>