Walsh matrix: Difference between revisions
Content deleted Content added
→{{header|jq}}: kprod |
|||
Line 798: | Line 798: | ||
'''Works with jaq, the Rust implementation of jq''' |
'''Works with jaq, the Rust implementation of jq''' |
||
This entry uses a non-recursive method for creating Walsh matrices, but the `kprod` definition |
|||
at [[Kronecker_product#jq]] could also be used as follows: |
|||
<syntaxhighlight lang="jq"> |
|||
## Generate a Walsh matrix of size 2^$n for $n >= 1 |
|||
def walshMatrix: |
|||
. as $n |
|||
| [[1, 1], [1, -1]] as $w2 |
|||
| if $n < 2 then $w2 else kprod($w2; $n - 1 | walshMatrix) end; |
|||
</syntaxhighlight> |
|||
<syntaxhighlight lang="jq"> |
<syntaxhighlight lang="jq"> |
||
## Generic matrix functions |
## Generic matrix functions |