I think it is because the svd_lapack( ) consider right index as a row,
like this a(col, row)
but, in NCL a(row, col), when you do maxtirx operation ( a#v )
I think you have to transpose the matrix before and after the svd_lapack( ), if you want to use the svd_lapack with ncl matrix operation.
in your example
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
n = 2
a1d = (/.96, 1.72, 2.28, .96/)
a = onedtond(a1d,(/n,n/))
ut = new((/n,n/), typeof(a))
vt = new((/n,n/), typeof(a))
; abuf = a
abuf = transpose(a)
optv = 1
s = svd_lapack(abuf, "S", "S", optv, ut, vt)
u = transpose(ut)
v = transpose(vt)
opt = True
opt@title = "a"
opt@row = True
write_matrix(a, "2f7.2", opt)
opt@title = "u"
write_matrix(u, "2f7.2", opt)
opt@title = "v"
write_matrix(v, "2f7.2", opt)
av = a#v
opt@title = "AV"
write_matrix(av, "2f7.2", opt)
ss = (/(/s(0),0./),(/0.,s(1)/)/)
opt@title = "S"
write_matrix(ss, "2f7.2", opt)
us = u#ss
opt@title = "US"
write_matrix(us, "2f7.2", opt)
Regards,
----------------------------------------------
Kim, Joo-Wan
Numerical Weather Prediction Laboratory
Program in Atmospheric Sciences
Department of Earth and Environmental Sciences
Seoul National University, Seoul 151-747, KOREA
Phone : +82-2-880-6760
C.P. : +82-011-9990-4269
Fax : +82-2-885-4448
E-mail : zooghim@nwp2.snu.ac.kr
----------------------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Wed Oct 26 2005 - 06:49:08 MDT