# gramschmidt: Gram-Schmidt In pracma: Practical Numerical Math Functions

## Description

Modified Gram-Schmidt Process

## Usage

 `1` ``` gramSchmidt(A, tol = .Machine\$double.eps^0.5) ```

## Arguments

 `A` numeric matrix with `nrow(A)>=ncol(A)`. `tol` numerical tolerance for being equal to zero.

## Details

The modified Gram-Schmidt process uses the classical orthogonalization process to generate step by step an orthonoral basis of a vector space. The modified Gram-Schmidt iteration uses orthogonal projectors in order ro make the process numerically more stable.

## Value

List with two matrices `Q` and `R`, `Q` orthonormal and `R` upper triangular, such that `A=Q%*%R`.

## References

Trefethen, L. N., and D. Bau III. (1997). Numerical Linear Algebra. SIAM, Society for Industrial and Applied Mathematics, Philadelphia.

`householder, givens`

## Examples

 ```1 2 3 4 5``` ```## QR decomposition A <- matrix(c(0,-4,2, 6,-3,-2, 8,1,-1), 3, 3, byrow=TRUE) gs <- gramSchmidt(A) (Q <- gs\$Q); (R <- gs\$R) Q %*% R # = A ```

### Example output

```     [,1]  [,2]  [,3]
[1,]  0.0 -0.80  0.60
[2,]  0.6 -0.48 -0.64
[3,]  0.8  0.36  0.48
[,1] [,2] [,3]
[1,]   10   -1   -2
[2,]    0    5   -1
[3,]    0    0    2
[,1] [,2] [,3]
[1,]    0   -4    2
[2,]    6   -3   -2
[3,]    8    1   -1
```

pracma documentation built on Dec. 11, 2021, 9:57 a.m.