Singular value decomposition functions
function svdcov( x[*][*] : float, y[*][*] : float, nsvd : integer, homlft[*][*] : float, hetlft[*][*] : float, homrgt[*][*] : float, hetrgt[*][*] : float ) function svdstd( x[*][*] : float, y[*][*] : float, nsvd : integer, homlft[*][*] : float, hetlft[*][*] : float, homrgt[*][*] : float, hetrgt[*][*] : float )
Both of these functions return the following attributes:
- fnorm (scalar, float)
- fnorm
- condn (scalar, float)
- condition number
- rank (scalar, float)
- calculated rank
- lapack_err (scalar, float)
- LAPACK error code
begin ; ================================> ; PARAMETERS ntime = 8 ; # time steps ncols = 3 ; # columns (stations or grid pts) for S ncolz = 6 ; # columns (stations or grid pts) for Z nsvd = 3 ; # svd patterns to calculate ; [nsvd <= min(ncols, ncolz) ] xmsg = -999.9 ; missing value ; ================================> ; READ THE ASCII FILE ; open "files" as 2-D s = asciiread ("svdrdm_S.asc",(/ntime,ncols/), "float") z = asciiread ("svdrdm_Z.asc",(/ntime,ncolz/), "float") s!0 = "time" ; name dimensions for reordering s!1 = "col" z!0 = "time" z!1 = "col" homlft = new((/nsvd,ncols/),float) hetlft = new((/nsvd,ncols/),float) homrgt = new((/nsvd,ncolz/),float) hetrgt = new((/nsvd,ncolz/),float) x = svdcov(s(col|:,time|:),z(col|:,time|:),nsvd,homlft,hetlft,homrgt,hetrgt) print("svdcov: percent variance= " + x) s2 = s(col |:,time |:) ; for a cleaner look one might do this z2 = z(col |:,time |:) y = svdstd(s2,z2,nsvd,homlft,hetlft,homrgt,hetrgt) print("svdstd: percent variance= " + y) end
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?