|
| 1 | +(* Content-type: application/vnd.wolfram.mathematica *) |
| 2 | + |
| 3 | +(*** Wolfram Notebook File ***) |
| 4 | +(* http://www.wolfram.com/nb *) |
| 5 | + |
| 6 | +(* CreatedBy='Mathematica 10.0' *) |
| 7 | + |
| 8 | +(*CacheID: 234*) |
| 9 | +(* Internal cache information: |
| 10 | +NotebookFileLineBreakTest |
| 11 | +NotebookFileLineBreakTest |
| 12 | +NotebookDataPosition[ 158, 7] |
| 13 | +NotebookDataLength[ 10105, 312] |
| 14 | +NotebookOptionsPosition[ 8584, 251] |
| 15 | +NotebookOutlinePosition[ 9218, 277] |
| 16 | +CellTagsIndexPosition[ 9102, 271] |
| 17 | +WindowFrame->Normal*) |
| 18 | + |
| 19 | +(* Beginning of Notebook Content *) |
| 20 | +Notebook[{ |
| 21 | + |
| 22 | +Cell[CellGroupData[{ |
| 23 | +Cell["QUTesting` Documentation", "Chapter", |
| 24 | + CellChangeTimes->{{3.6333515346579514`*^9, 3.63335154627586*^9}, { |
| 25 | + 3.633364320690548*^9, 3.63336432261762*^9}, {3.633459692992848*^9, |
| 26 | + 3.633459695695156*^9}, {3.63352627649533*^9, 3.633526278958379*^9}, { |
| 27 | + 3.636901374637114*^9, 3.636901375728097*^9}}], |
| 28 | + |
| 29 | +Cell[CellGroupData[{ |
| 30 | + |
| 31 | +Cell["Preamble", "Section", |
| 32 | + CellChangeTimes->{{3.633351558518317*^9, 3.633351560041299*^9}, { |
| 33 | + 3.633781254199301*^9, 3.633781256261158*^9}}], |
| 34 | + |
| 35 | +Cell[BoxData[ |
| 36 | + RowBox[{"Needs", "[", "\"\<QUTesting`\>\"", "]"}]], "Input", |
| 37 | + CellChangeTimes->{{3.633351696261045*^9, 3.633351701530016*^9}, { |
| 38 | + 3.633459703938384*^9, 3.633459707396385*^9}, {3.633526282103736*^9, |
| 39 | + 3.633526283991441*^9}, {3.636901378415098*^9, 3.636901380048747*^9}}] |
| 40 | +}, Open ]], |
| 41 | + |
| 42 | +Cell[CellGroupData[{ |
| 43 | + |
| 44 | +Cell["Introduction and Overview", "Section", |
| 45 | + CellChangeTimes->{{3.633351563673402*^9, 3.633351567143589*^9}, { |
| 46 | + 3.633878695511993*^9, 3.633878696655075*^9}}], |
| 47 | + |
| 48 | +Cell["\<\ |
| 49 | +This package contains functions to run the unit tests for the various \ |
| 50 | +packages in QuantumUtils. This can be used to check the installation, and to \ |
| 51 | +check if everything still works after making modifications to the code.\ |
| 52 | +\>", "Text", |
| 53 | + CellChangeTimes->{{3.6369013984973183`*^9, 3.636901432406*^9}}] |
| 54 | +}, Open ]], |
| 55 | + |
| 56 | +Cell[CellGroupData[{ |
| 57 | + |
| 58 | +Cell["Unit Tests", "Section", |
| 59 | + CellChangeTimes->{{3.63335202563237*^9, 3.6333520385490847`*^9}, { |
| 60 | + 3.633441643373975*^9, 3.633441643471745*^9}, {3.633459727021635*^9, |
| 61 | + 3.633459727820011*^9}, {3.633526289590464*^9, 3.6335262930624027`*^9}, { |
| 62 | + 3.63378126135916*^9, 3.633781261452849*^9}, {3.6369014438326187`*^9, |
| 63 | + 3.636901452273589*^9}}], |
| 64 | + |
| 65 | +Cell[CellGroupData[{ |
| 66 | + |
| 67 | +Cell["TestResults", "Subsection", |
| 68 | + CellChangeTimes->{{3.63690145452*^9, 3.6369014577181673`*^9}}], |
| 69 | + |
| 70 | +Cell[TextData[{ |
| 71 | + StyleBox["TestResults[\[OpenCurlyDoubleQuote]", "Input"], |
| 72 | + StyleBox["name\[CloseCurlyDoubleQuote]", "Input", |
| 73 | + FontWeight->"Plain", |
| 74 | + FontSlant->"Italic"], |
| 75 | + StyleBox["]", "Input"], |
| 76 | + " returns the results of the unit tests for ", |
| 77 | + StyleBox["QuantumUtils", |
| 78 | + FontSlant->"Italic"], |
| 79 | + " package ", |
| 80 | + StyleBox["name.m", "Input", |
| 81 | + FontWeight->"Plain", |
| 82 | + FontSlant->"Italic"], |
| 83 | + StyleBox[". These are returned as a list of rules ", |
| 84 | + FontWeight->"Plain"], |
| 85 | + StyleBox["\[OpenCurlyDoubleQuote]", "Input"], |
| 86 | + StyleBox["TestName", "Input", |
| 87 | + FontWeight->"Plain", |
| 88 | + FontSlant->"Italic"], |
| 89 | + StyleBox["\[CloseCurlyDoubleQuote]\[Rule]", "Input"], |
| 90 | + StyleBox["T/F/E", "Input", |
| 91 | + FontWeight->"Plain", |
| 92 | + FontSlant->"Italic"], |
| 93 | + StyleBox[",", |
| 94 | + FontWeight->"Plain"], |
| 95 | + " where result is \[OpenCurlyDoubleQuote]T\[CloseCurlyDoubleQuote] if the \ |
| 96 | +test succeeded, \[OpenCurlyDoubleQuote]F\[CloseCurlyDoubleQuote] if the test \ |
| 97 | +failed, or \[OpenCurlyDoubleQuote]E\[CloseCurlyDoubleQuote] if the test \ |
| 98 | +returned an error and failed to evaluate to True or False.\n\n", |
| 99 | + StyleBox["TestResults[]", "Input"], |
| 100 | + " returns the results of the unit tests for all ", |
| 101 | + StyleBox["QuantumUtils", |
| 102 | + FontSlant->"Italic"], |
| 103 | + " packages." |
| 104 | +}], "Text", |
| 105 | + CellDingbat->"\[FilledSquare]", |
| 106 | + CellChangeTimes->{ |
| 107 | + 3.634311328002417*^9, {3.634316418526174*^9, 3.634316521790423*^9}, { |
| 108 | + 3.634509526888596*^9, 3.634509548646995*^9}, {3.634924751102474*^9, |
| 109 | + 3.634924781111176*^9}, {3.6349258561999493`*^9, 3.6349259526860847`*^9}, { |
| 110 | + 3.634926269549931*^9, 3.6349262813179913`*^9}, {3.634989908112784*^9, |
| 111 | + 3.634989908825219*^9}, {3.636901524340518*^9, 3.636901768172884*^9}}, |
| 112 | + CellTags->"TestResults::usage"], |
| 113 | + |
| 114 | +Cell[CellGroupData[{ |
| 115 | + |
| 116 | +Cell["Example", "Subsubsection", |
| 117 | + CellChangeTimes->{{3.636901500668826*^9, 3.636901501457987*^9}}], |
| 118 | + |
| 119 | +Cell[CellGroupData[{ |
| 120 | + |
| 121 | +Cell[BoxData[ |
| 122 | + RowBox[{ |
| 123 | + RowBox[{"TestResults", "[", "\"\<Tensor\>\"", "]"}], "//", |
| 124 | + "MatrixForm"}]], "Input", |
| 125 | + CellChangeTimes->{{3.636901505101733*^9, 3.636901514385421*^9}, { |
| 126 | + 3.6369023547295713`*^9, 3.6369023553894663`*^9}}], |
| 127 | + |
| 128 | +Cell[BoxData[ |
| 129 | + TagBox[ |
| 130 | + RowBox[{"(", "\[NoBreak]", |
| 131 | + TagBox[GridBox[{ |
| 132 | + { |
| 133 | + RowBox[{"\<\"Tensor:CircleTimes\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 134 | + { |
| 135 | + RowBox[{"\<\"Tensor:\[DoubleStruckOne]\"\>", |
| 136 | + "\[Rule]", "\<\"T\"\>"}]}, |
| 137 | + { |
| 138 | + RowBox[{"\<\"Tensor:BlockMatrix\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 139 | + { |
| 140 | + RowBox[{"\<\"Tensor:UnitArray\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 141 | + { |
| 142 | + RowBox[{"\<\"Tensor:TensorFactorPermutations\"\>", |
| 143 | + "\[Rule]", "\<\"T\"\>"}]}, |
| 144 | + { |
| 145 | + RowBox[{"\<\"Tensor:SwapMatrix\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 146 | + { |
| 147 | + RowBox[{"\<\"Tensor:Com\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 148 | + { |
| 149 | + RowBox[{"\<\"Tensor:ACom\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 150 | + { |
| 151 | + RowBox[{"\<\"Tensor:OuterProduct\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 152 | + { |
| 153 | + RowBox[{"\<\"Tensor:Projector\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 154 | + { |
| 155 | + RowBox[{"\<\"Tensor:MatrixToTensor\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 156 | + { |
| 157 | + RowBox[{"\<\"Tensor:MatrixTranspose\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 158 | + { |
| 159 | + RowBox[{"\<\"Tensor:Swap\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 160 | + { |
| 161 | + RowBox[{"\<\"Tensor:Reshuffle\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 162 | + { |
| 163 | + RowBox[{"\<\"Tensor:Unravel\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 164 | + { |
| 165 | + RowBox[{"\<\"Tensor:Reravel\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 166 | + { |
| 167 | + RowBox[{"\<\"Tensor:PartialTr\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 168 | + { |
| 169 | + RowBox[{"\<\"Tensor:TensorPairContract\"\>", |
| 170 | + "\[Rule]", "\<\"T\"\>"}]}, |
| 171 | + { |
| 172 | + RowBox[{"\<\"Tensor:MatrixContract\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 173 | + { |
| 174 | + RowBox[{"\<\"Tensor:MatrixPairContract\"\>", |
| 175 | + "\[Rule]", "\<\"T\"\>"}]}, |
| 176 | + { |
| 177 | + RowBox[{"\<\"Tensor:Basis\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 178 | + { |
| 179 | + RowBox[{"\<\"Tensor:BasisLabels\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 180 | + { |
| 181 | + RowBox[{"\<\"Tensor:ExpressInBasis\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 182 | + { |
| 183 | + RowBox[{"\<\"Tensor:Vec\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 184 | + { |
| 185 | + RowBox[{"\<\"Tensor:Devec\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 186 | + { |
| 187 | + RowBox[{"\<\"Tensor:ProductIdentity\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 188 | + { |
| 189 | + RowBox[{"\<\"Tensor:BasisMatrix\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 190 | + { |
| 191 | + RowBox[{"\<\"Tensor:BasisTransformation\"\>", "\[Rule]", "\<\"T\"\>"}]}, |
| 192 | + { |
| 193 | + RowBox[{"\<\"Tensor:TP\"\>", "\[Rule]", "\<\"T\"\>"}]} |
| 194 | + }, |
| 195 | + GridBoxAlignment->{ |
| 196 | + "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, |
| 197 | + "RowsIndexed" -> {}}, |
| 198 | + GridBoxSpacings->{"Columns" -> { |
| 199 | + Offset[0.27999999999999997`], { |
| 200 | + Offset[0.5599999999999999]}, |
| 201 | + Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { |
| 202 | + Offset[0.2], { |
| 203 | + Offset[0.4]}, |
| 204 | + Offset[0.2]}, "RowsIndexed" -> {}}], |
| 205 | + Column], "\[NoBreak]", ")"}], |
| 206 | + Function[BoxForm`e$, |
| 207 | + MatrixForm[BoxForm`e$]]]], "Output", |
| 208 | + CellChangeTimes->{{3.6369015104258537`*^9, 3.636901514774818*^9}, |
| 209 | + 3.636902355805007*^9}] |
| 210 | +}, Open ]] |
| 211 | +}, Open ]] |
| 212 | +}, Open ]], |
| 213 | + |
| 214 | +Cell[CellGroupData[{ |
| 215 | + |
| 216 | +Cell["RunAllTests", "Subsection", |
| 217 | + CellChangeTimes->{{3.6335265055504847`*^9, 3.633526507574844*^9}}], |
| 218 | + |
| 219 | +Cell[TextData[{ |
| 220 | + StyleBox["RunAllTests[]", "Input"], |
| 221 | + " runs all ", |
| 222 | + StyleBox["QuantumUtils", |
| 223 | + FontSlant->"Italic"], |
| 224 | + " unit tests and reports on how many succeeded, failed, or returned errors." |
| 225 | +}], "Text", |
| 226 | + CellChangeTimes->{ |
| 227 | + 3.6338786671801777`*^9, {3.636901797949497*^9, 3.636901835178047*^9}}, |
| 228 | + CellTags->"RunAllTests::usage"], |
| 229 | + |
| 230 | +Cell[CellGroupData[{ |
| 231 | + |
| 232 | +Cell["Example", "Subsubsection", |
| 233 | + CellChangeTimes->{{3.633526541390602*^9, 3.633526545774642*^9}}], |
| 234 | + |
| 235 | +Cell[CellGroupData[{ |
| 236 | + |
| 237 | +Cell[BoxData[ |
| 238 | + RowBox[{"RunAllTests", "[", "]"}]], "Input", |
| 239 | + CellChangeTimes->{{3.633526546432682*^9, 3.633526549179888*^9}}], |
| 240 | + |
| 241 | +Cell[BoxData["\<\"209 of 209 unit tests passed.\"\>"], "Print", |
| 242 | + CellChangeTimes->{ |
| 243 | + 3.63352657177526*^9, 3.6335266248302917`*^9, 3.633526667800214*^9, { |
| 244 | + 3.633526701498966*^9, 3.6335267311422577`*^9}, 3.633526763039488*^9, |
| 245 | + 3.6335268894276114`*^9, 3.633527022952025*^9, 3.636901838762259*^9}] |
| 246 | +}, Open ]] |
| 247 | +}, Open ]] |
| 248 | +}, Open ]] |
| 249 | +}, Open ]] |
| 250 | +}, Open ]] |
| 251 | +}, |
| 252 | +WindowSize->{1280, 1000}, |
| 253 | +WindowMargins->{{317, Automatic}, {Automatic, 0}}, |
| 254 | +FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (December 4, \ |
| 255 | +2014)", |
| 256 | +StyleDefinitions->"Default.nb" |
| 257 | +] |
| 258 | +(* End of Notebook Content *) |
| 259 | + |
| 260 | +(* Internal cache information *) |
| 261 | +(*CellTagsOutline |
| 262 | +CellTagsIndex->{ |
| 263 | + "RunAllTests::usage"->{ |
| 264 | + Cell[7612, 218, 333, 9, 31, "Text", |
| 265 | + CellTags->"RunAllTests::usage"]}, |
| 266 | + "TestResults::usage"->{ |
| 267 | + Cell[2349, 69, 1672, 42, 89, "Text", |
| 268 | + CellTags->"TestResults::usage"]} |
| 269 | + } |
| 270 | +*) |
| 271 | +(*CellTagsIndex |
| 272 | +CellTagsIndex->{ |
| 273 | + {"RunAllTests::usage", 8903, 262}, |
| 274 | + {"TestResults::usage", 9003, 265} |
| 275 | + } |
| 276 | +*) |
| 277 | +(*NotebookFileOutline |
| 278 | +Notebook[{ |
| 279 | +Cell[CellGroupData[{ |
| 280 | +Cell[580, 22, 301, 4, 65, "Chapter"], |
| 281 | +Cell[CellGroupData[{ |
| 282 | +Cell[906, 30, 142, 2, 64, "Section"], |
| 283 | +Cell[1051, 34, 285, 4, 28, "Input"] |
| 284 | +}, Open ]], |
| 285 | +Cell[CellGroupData[{ |
| 286 | +Cell[1373, 43, 159, 2, 64, "Section"], |
| 287 | +Cell[1535, 47, 311, 5, 49, "Text"] |
| 288 | +}, Open ]], |
| 289 | +Cell[CellGroupData[{ |
| 290 | +Cell[1883, 57, 341, 5, 64, "Section"], |
| 291 | +Cell[CellGroupData[{ |
| 292 | +Cell[2249, 66, 97, 1, 44, "Subsection"], |
| 293 | +Cell[2349, 69, 1672, 42, 89, "Text", |
| 294 | + CellTags->"TestResults::usage"], |
| 295 | +Cell[CellGroupData[{ |
| 296 | +Cell[4046, 115, 98, 1, 35, "Subsubsection"], |
| 297 | +Cell[CellGroupData[{ |
| 298 | +Cell[4169, 120, 232, 5, 28, "Input"], |
| 299 | +Cell[4404, 127, 3043, 81, 510, "Output"] |
| 300 | +}, Open ]] |
| 301 | +}, Open ]] |
| 302 | +}, Open ]], |
| 303 | +Cell[CellGroupData[{ |
| 304 | +Cell[7508, 215, 101, 1, 44, "Subsection"], |
| 305 | +Cell[7612, 218, 333, 9, 31, "Text", |
| 306 | + CellTags->"RunAllTests::usage"], |
| 307 | +Cell[CellGroupData[{ |
| 308 | +Cell[7970, 231, 98, 1, 35, "Subsubsection"], |
| 309 | +Cell[CellGroupData[{ |
| 310 | +Cell[8093, 236, 125, 2, 28, "Input"], |
| 311 | +Cell[8221, 240, 299, 4, 22, "Print"] |
| 312 | +}, Open ]] |
| 313 | +}, Open ]] |
| 314 | +}, Open ]] |
| 315 | +}, Open ]] |
| 316 | +}, Open ]] |
| 317 | +} |
| 318 | +] |
| 319 | +*) |
| 320 | + |
| 321 | +(* End of internal cache information *) |
0 commit comments