Walsh matrix: Difference between revisions
Content deleted Content added
Line 829:
| reduce range(0; .[$i]|length) as $j ("|"; . + ($in[$i][$j]|lpad($w)))
| . + " |" ;
def cprint:
. as $in
| range(0; length) as $i
| reduce range(0; .[$i]|length) as $j (""; . + ($in[$i][$j]));
def color: if . == 1 then "🟥" else "🟩" end;
</syntaxhighlight>
'''Walsh matrices'''
Line 863 ⟶ 870:
"";
def task3:
task1, task2▼
5 as $order
| pow(2; $order)
| "Walsh matrix - order \($order) (\(.) x \(.)), natural order:",
(walshMatrix | map(map(color)) | cprint),
"";
def task4:
5 as $order
| pow(2; $order)
| "Walsh matrix - order \($order) (\(.) x \(.)), sequency order:",
(walshMatrix | sort_by( signChanges ) | map(map(color)) | cprint),
"";
▲task1, task2, task3, task4
</syntaxhighlight>
{{output}}
The output for the last two tasks is as follows:
<pre>
Walsh matrix - order 5 (32 x 32), natural order:
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩
🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩
🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥
🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩
🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥
🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥
🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩
🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩
🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥
🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥
🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩
🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥
🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩
🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩
🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥
🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥
🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩
🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥
🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩
🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩
🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥
🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥
🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩
🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩
🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥
🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩
🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥
🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥
🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩
Walsh matrix - order 5 (32 x 32), sequency order:
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩
🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥
🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩
🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥
🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟥🟥🟥🟥🟩🟩🟩🟩
🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥
🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩
🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥
🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩
🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥
🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩
🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥
🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟥🟥🟩🟩🟥🟥🟩🟩
🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥
🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩
🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥
🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩
🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥
🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩
🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥
🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟥🟩🟩🟥🟩🟥🟥🟩
🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥
🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩
🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥
🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩
🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥
🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩
🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥
🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟥🟩🟥🟩🟥🟩🟥🟩
🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥
🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩🟥🟩
</pre>
=={{header|Julia}}==
|