Singular value decomposition: Difference between revisions
→{{header|J}}: another example
(J draft) |
(→{{header|J}}: another example) |
||
Line 235:
=={{header|J}}==
Using https://github.com/jsoftware/math_misc and providing a test matrix inline
Assumed pre-requisite:
<syntaxhighlight lang=J> svd 3 0,:4 5▼
<syntaxhighlight lang=J> install'all'</syntaxhighlight>
Task example:
<syntaxhighlight lang=J> require'math/misc/svd'
svd 3 0,:4 5
┌──────────────────┬──────────────┬──────────────────┐
│0.316228 _0.948683│6.7082 2.23607│0.707107 _0.707107│
│0.948683 0.316228│ │0.707107 0.707107│
└──────────────────┴──────────────┴──────────────────┘</syntaxhighlight>
Asymmetric example:
┌──────────────────────────────┬────────────────────────┬─────────────────────────────┐
│0.0872159 _0.426839 _0.875752│68.6864 2.90306 0.868048│0.499426 0.860756 _0.0983486│
│ 0.265687 _0.830077 0.466712│ │0.554592 _0.230425 0.799582│
│ 0.499894 _0.0635067 _0.12233│ │0.665583 _0.453876 _0.592449│
│ 0.819701 0.353195 0.0165088│ │ │
└──────────────────────────────┴────────────────────────┴─────────────────────────────┘</syntaxhighlight>
<span style="background-color: black">File i/o is also implementable, though the current task specification (where the input matrix format is different from the output matrix format) seems unnecessary.</span>
|