(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 6905, 238] NotebookOptionsPosition[ 5948, 206] NotebookOutlinePosition[ 6366, 222] CellTagsIndexPosition[ 6323, 219] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Understanding the Blocks ", StyleBox["B", FontFamily->"Lucida Calligraphy"], ", ", StyleBox["V", FontFamily->"Lucida Calligraphy"], ", ", StyleBox["H", FontFamily->"Lucida Calligraphy"], ", and ", StyleBox["D", FontFamily->"Lucida Calligraphy"] }], "Title"], Cell[TextData[{ "The best way to understand the two-dimensional Haar wavelet transform is to \ simply plug in some numbers and do the computation. To understand the ", StyleBox["block structure", FontSlant->"Italic"], " of the Haar wavelet transform, it is actually easier to see what happens \ to a ", StyleBox["generic", FontSlant->"Italic"], " matrix A!\n\nWe generate a generic 8 x 8 matrix first." }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"A", " ", "=", " ", RowBox[{"Array", "[", RowBox[{"a", ",", RowBox[{"{", RowBox[{"8", ",", "8"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", "A", "]"}], ",", "\"\<.\>\""}], "]"}], ";"}]}], "Input", CellChangeTimes->{{3.4210812033925924`*^9, 3.4210812040488462`*^9}}], Cell["\<\ Now we generate the different portions of the wavelet transform matrix.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"r", "=", RowBox[{ RowBox[{"{", RowBox[{ "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}], "/", "2"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"H", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"RotateRight", "[", RowBox[{"r", ",", RowBox[{"2", "*", "k"}]}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "0", ",", "3"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", "H", "]"}], ",", "\"\<.\>\""}], "]"}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"s", "=", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}], "/", "2"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"G", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"RotateRight", "[", RowBox[{"s", ",", RowBox[{"2", "*", "k"}]}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "0", ",", "3"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", "G", "]"}], ",", "\"\<.\>\""}], "]"}], ";"}]}], "Input", CellChangeTimes->{{3.42108120614261*^9, 3.4210812063457365`*^9}}], Cell[TextData[{ "Here is the block ", StyleBox["B", FontFamily->"Lucida Calligraphy"] }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"Blur", " ", "=", " ", RowBox[{ RowBox[{"H", ".", "A", ".", RowBox[{"Transpose", "[", "H", "]"}]}], " ", "//", "Simplify"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "Blur", "]"}]}], "Input", CellChangeTimes->{{3.421081208158248*^9, 3.421081208314499*^9}}], Cell["\<\ We build this block by taking each 2 x 2 block of A and computing its \ average!\ \>", "Text"], Cell[TextData[{ "Here is the block ", StyleBox["V", FontFamily->"Lucida Calligraphy"] }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"Vert", "=", " ", RowBox[{ RowBox[{"H", ".", "A", ".", RowBox[{"Transpose", "[", "G", "]"}]}], " ", "//", "Simplify"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "Vert", "]"}]}], "Input", CellChangeTimes->{{3.421081209752008*^9, 3.421081209877009*^9}}], Cell["\<\ We build this block by taking each 2 x 2 block of A and (1) subtracting the \ sum of the first column elements from the sum of the second column elements \ and (2) dividing by 4. This is a vertical difference in each 2 x 2 block!\ \>", "Text"], Cell[TextData[{ "Here is the block ", StyleBox["H", FontFamily->"Lucida Calligraphy"] }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"Horiz", "=", " ", RowBox[{ RowBox[{"G", ".", "A", ".", RowBox[{"Transpose", "[", "H", "]"}]}], " ", "//", "Simplify"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "Horiz", "]"}]}], "Input", CellChangeTimes->{{3.421081211455144*^9, 3.42108121156452*^9}}], Cell["\<\ We build this block by taking each 2 x 2 block of A and (1) subtracting the \ sum of the first row elements from the sum of the second row elements and (2) \ dividing by 4. This is a horizontal difference in each 2 x 2 block!\ \>", "Text"], Cell[TextData[{ "Here is the block ", StyleBox["D", FontFamily->"Lucida Calligraphy"] }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"Diag", "=", " ", RowBox[{ RowBox[{"G", ".", "A", ".", RowBox[{"Transpose", "[", "G", "]"}]}], " ", "//", "Simplify"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "Diag", "]"}]}], "Input", CellChangeTimes->{{3.4210812129082785`*^9, 3.421081213033279*^9}}], Cell["\<\ We build this block by taking each 2 x 2 block of A and (1) subtracting the \ sum of the cross diagonal elements from the sum of the main diagonal elements \ and (2) dividing by 4. This is a diagonal difference in each 2 x 2 block!\ \>", "Text"] }, Open ]] }, WindowSize->{1272, 683}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (April 20, 2007)", StyleDefinitions->FrontEnd`FileName[{"Creative"}, "NaturalColor.nb", CharacterEncoding -> "WindowsANSI"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 290, 13, 77, "Title"], Cell[883, 38, 424, 10, 83, "Text"], Cell[1310, 50, 435, 13, 62, "Input"], Cell[1748, 65, 95, 2, 29, "Text"], Cell[1846, 69, 1478, 47, 162, "Input"], Cell[3327, 118, 101, 4, 30, "Text"], Cell[3431, 124, 329, 8, 62, "Input"], Cell[3763, 134, 104, 3, 29, "Text"], Cell[3870, 139, 101, 4, 30, "Text"], Cell[3974, 145, 324, 8, 62, "Input"], Cell[4301, 155, 254, 4, 47, "Text"], Cell[4558, 161, 101, 4, 30, "Text"], Cell[4662, 167, 325, 8, 62, "Input"], Cell[4990, 177, 250, 4, 47, "Text"], Cell[5243, 183, 101, 4, 30, "Text"], Cell[5347, 189, 326, 8, 62, "Input"], Cell[5676, 199, 256, 4, 47, "Text"] }, Open ]] } ] *) (* End of internal cache information *)