Walsh matrix: Difference between revisions

Content deleted Content added
Peak (talk | contribs)
Peak (talk | contribs)
Line 829: Line 829:
| reduce range(0; .[$i]|length) as $j ("|"; . + ($in[$i][$j]|lpad($w)))
| 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>
</syntaxhighlight>
'''Walsh matrices'''
'''Walsh matrices'''
Line 863: Line 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>
</syntaxhighlight>
{{output}}
{{output}}
Essentially as for [[#Wren|Wren]].
The output for the first two tasks is essentially as for [[#Wren|Wren]].
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}}==
=={{header|Julia}}==