Det {lazy.symbolic}R Documentation

Determinant of a Symbolic Matrix by Sweeping

Description

Determinant of a Symbolic Matrix by Sweeping

Usage

Det(A, loc = 1:nrow(A), log = 0, simplify = 0, debug = 0)

Arguments

A

A square matrix

loc

vector of pivot locations

log

= 1 to calculate log determinant

simplify

= 0 not to use Simplify nor remove_paren
= 1 to use Simplify

debug

= 1 to print details

Details

Definition of Sweep Operator
C <- matSweep( A, p ) means:
c[i,j] <- c[i,j] - c[i,p]*c[p,j]/c[p,p]
c[p,] <- c[p,]/c[p,p]
c[,p] <- - c[,p]/c[p,p]

# Inversion of A.
matSweep( A, 1:ncol(A) ) == solve(A)
This is equivalent to Inv(A).

The determinant of A is given as the product of all the pivots, c[p,p], when inverting A using sweep operator.

Value

The determinant of A

Examples


# determinant of 2 x 2 A
A <- demomat(2,2,root="a")
Det(A)
Det(A,log=1)

# n x n ( slow !)
set.seed(1701)
n=3
B <- demomat(n,n,root="b")
dd <- Det(B)
Bn <- matrix(runif(n*n),n)
Print(Eval(dd,B=Bn),det(Bn))

# Fully Symbolic Partitioned Matrix: No SMdim attribute but
# fullsymb attribute
Ap=demomat(2,2,root="A", fullsymb=1)
Print(Ap)
Det(Ap)
Det(Ap, 2:1)


[Package lazy.symbolic version 0.1.4 Index]