Mercurial > octave-nkf
comparison libinterp/corefcn/pinv.cc @ 18494:1fa5bba16218
[mq]: pinv
author | Rik <rik@octave.org> |
---|---|
date | Tue, 18 Feb 2014 09:39:36 -0800 |
parents | c5a101de2d88 |
children | 4197fc428c7d |
comparison
equal
deleted
inserted
replaced
18487:8473198fd005 | 18494:1fa5bba16218 |
---|---|
210 %!assert ((a*b)', a*b, tol) | 210 %!assert ((a*b)', a*b, tol) |
211 %!assert (x*y*x, x, -hitol) | 211 %!assert (x*y*x, x, -hitol) |
212 %!assert (y*x*y, y, -hitol) | 212 %!assert (y*x*y, y, -hitol) |
213 %!assert ((x*y)', x*y, hitol) | 213 %!assert ((x*y)', x*y, hitol) |
214 %!assert ((y*x)', y*x, hitol) | 214 %!assert ((y*x)', y*x, hitol) |
215 | |
216 ## Clear shared variables | |
217 %!shared | |
218 | |
219 ## Test pinv for Diagonal matrices | |
220 %!test | |
221 %! x = diag ([3 2 1 0 -0.5]); | |
222 %! y = pinv (x); | |
223 %! assert (typeinfo (y)(1:8), "diagonal"); | |
224 %! assert (isa (y, "double")); | |
225 %! assert (diag (y), [1/3, 1/2, 1, 0 1/-0.5]'); | |
226 %! y = pinv (x, 1); | |
227 %! assert (diag (y), [1/3 1/2 1 0 0]'); | |
228 %! y = pinv (x, 2); | |
229 %! assert (diag (y), [1/3 1/2 0 0 0]'); | |
230 | |
215 */ | 231 */ |