Movatterモバイル変換


[0]ホーム

URL:


Stephen Wolfram's A New Kind of Science | Online

Notes

Chapter 10:Processes of Perception and Analysis

Section 5:Data Compression


Recursive subdivision [encoding]

In one dimension, encoding can be done using

Subdivide[a_] := Flatten[If[Length[a] 2, a, If[Apply[SameQ, a], {1,First[a]},{0, Map[Subdivide, Partition[a, Length[a]/2]]}]]]

Inn dimensions, it can be done using

Subdivide[a_, n_] := With[{s = Table[1, {n}]}, Flatten[If[Dimensions[a] 2s, a, If[Apply[SameQ, Flatten[a]],{1, First[Flatten[a]]}, {0, Map[Subdivide[#, n] &,Partition[a, 1/2Length[a] s], {n}]}]]]]


[8]ページ先頭

©2009-2025 Movatter.jp