├── README.md ├── spinDown.idraw ├── spinUp.idraw ├── confusedCat.jpg ├── animated-qubits.png ├── interferometer.jpg ├── doubleHadamardOf0.png ├── classicalRandomNot.png ├── interferencePattern.jpg ├── .gitignore ├── jshintConfig.json ├── main.js ├── package.json ├── browserSupportDetection.js ├── gulpfile.js ├── src ├── manageHelpSections.js └── manageAnimatedQubitExamples.js ├── LICENSE ├── spinDown.svg ├── spinUp.svg ├── main.css ├── index.html ├── part2.html └── jquery.min.js /README.md: -------------------------------------------------------------------------------- 1 | An introductory article on Quantum Computing -------------------------------------------------------------------------------- /spinDown.idraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/spinDown.idraw -------------------------------------------------------------------------------- /spinUp.idraw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/spinUp.idraw -------------------------------------------------------------------------------- /confusedCat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/confusedCat.jpg -------------------------------------------------------------------------------- /animated-qubits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/animated-qubits.png -------------------------------------------------------------------------------- /interferometer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/interferometer.jpg -------------------------------------------------------------------------------- /doubleHadamardOf0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/doubleHadamardOf0.png -------------------------------------------------------------------------------- /classicalRandomNot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/classicalRandomNot.png -------------------------------------------------------------------------------- /interferencePattern.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidbkemp/QuantumComputingArticle/HEAD/interferencePattern.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.deps.js 3 | *.seed 4 | *.log 5 | *.csv 6 | *.dat 7 | *.out 8 | *.pid 9 | *.gz 10 | *.iml 11 | .idea 12 | 13 | pids 14 | logs 15 | results 16 | 17 | node_modules 18 | bower_components 19 | -------------------------------------------------------------------------------- /jshintConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "eqnull":true, 3 | "eqeqeq":true, 4 | "forin":true, 5 | "immed":true, 6 | "latedef":true, 7 | "newcap":true, 8 | "noarg":true, 9 | "nonew":true, 10 | "regexp":true, 11 | "undef":true, 12 | "unused":true, 13 | "strict":true, 14 | "trailing":true 15 | } -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | /*global jQuery, require */ 2 | 3 | (function () { 4 | "use strict"; 5 | 6 | var manageHelpSections = require("./src/manageHelpSections.js"); 7 | var manageAnimatedQubitExamples = require("./src/manageAnimatedQubitExamples.js"); 8 | 9 | jQuery(function onLoad() { 10 | manageHelpSections(); 11 | manageAnimatedQubitExamples(); 12 | }); 13 | 14 | }()); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "quantum-computation-article", 3 | "version": "0.0.0", 4 | "description": "An introduction to quantum computing", 5 | "main": "main.js", 6 | "repository": "tbd", 7 | "private": true, 8 | "scripts": { 9 | "build": "gulp", 10 | "watch": "gulp watch" 11 | }, 12 | "author": "David Kemp", 13 | "license": "Creative Commons & MIT", 14 | "devDependencies": { 15 | "animated-qubits": "0.0.8", 16 | "q": "~1.0.0", 17 | "jsqubits": "~0.2.0", 18 | "gulp": "~3.8.6", 19 | "gulp-util": "~3.0.0", 20 | "gulp-browserify": "~0.5.0", 21 | "gulp-uglify": "~0.3.1", 22 | "gulp-jshint": "~1.7.1" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /browserSupportDetection.js: -------------------------------------------------------------------------------- 1 | /*global document, alert */ 2 | (function () { 3 | "use strict"; 4 | 5 | function supportsSvg() { 6 | try { 7 | return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); 8 | } catch (error) { 9 | return false; 10 | } 11 | } 12 | 13 | function supportsES5() { 14 | return [].forEach != null && Object.keys != null; 15 | } 16 | 17 | if (!supportsSvg() || !supportsES5()) { 18 | alert("It seems that your browser does not support some features required by this site. Please try a more modern browser (eg. Google Chrome)"); 19 | } 20 | 21 | })(); 22 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var gutil = require('gulp-util'); 3 | var browserify = require('gulp-browserify'); 4 | var uglify = require('gulp-uglify'); 5 | var jshint = require('gulp-jshint'); 6 | 7 | var scripts = ["main.js", "browserSupportDetection.js", "src/**/*.js"]; 8 | 9 | gulp.task('browserify', function() { 10 | gulp.src('main.js') 11 | .pipe(browserify()) 12 | .pipe(uglify()) 13 | .pipe(gulp.dest("dist")); 14 | }); 15 | 16 | gulp.task('hint', function() { 17 | gulp.src(scripts) 18 | .pipe(jshint('jshintConfig.json')) 19 | .pipe(jshint.reporter('default')); 20 | }); 21 | 22 | gulp.task('watch', ['default'], function () { 23 | gulp.watch(scripts, ['default']); 24 | }); 25 | 26 | gulp.task('default', ['browserify', 'hint']); -------------------------------------------------------------------------------- /src/manageHelpSections.js: -------------------------------------------------------------------------------- 1 | /*global jQuery, module */ 2 | 3 | (function () { 4 | "use strict"; 5 | 6 | function manageHelpSection() { 7 | /*jshint validthis:true */ 8 | var helpElement, helpContent, helpButton; 9 | 10 | function showHelp() { 11 | helpElement.html(helpContent); 12 | } 13 | 14 | helpElement = jQuery(this); 15 | helpContent = helpElement.html(); 16 | helpButton = jQuery(" 120 | 123 | 124 | 125 |
State: 126 | 127 |
128 | 129 | 130 | 131 | 132 | 133 | 134 |

Random NOT

135 |

Random NOT: A NOT operator that has a specified chance of flipping a bit.

136 |

137 | Although not very common, 138 | the “Random NOT” is still just a classical (non-quantum) operator, 139 | but it will help me explain the workings of some quantum operators. 140 |

141 |

142 | Consider applying a Random NOT twice to a bit whose initial value is 0, 143 | where the operator has, for instance, a 30% chance of flipping the bit. 144 | What is the probability of the final state being 0? 145 |

146 |

147 | There are a couple of possible scenarios. 148 | For instance, the first Random NOT might flip the bit from 0 to 1, 149 | and the second Random NOT might flip the bit back to 0. 150 | We represent this as: 151 |

152 |

153 | 0 → 1 → 0 154 |

155 |

There are two paths leading to a final state of 0:

156 | 164 |

And so the final state will be 0 with a probability of 49% + 9% = 58%

165 | Probability tree for random NOT 166 | 167 | 168 |

Random NOT (your turn)

169 |

Next we provide an interactive animation of the Random NOT operator.

170 |

The blue disk now splits in two so that we can track the different possible outcomes.

171 |

The probability of being in a state is represented by the radius of the disk.

172 |

173 | Press the “Random NOT” button multiple times and 174 | note how the arrows add head to tail. 175 |

176 |

177 | Still nothing quantum mechanical about any of this. 178 | We are still just warming up. 179 |

180 | 181 |
182 |
183 |
184 | 187 |
188 |
189 |
State: 190 | 191 |
192 | 193 |
194 | 195 | 196 | 197 | 198 |

Measurement

199 |

200 | We have seen how a random NOT operator can 201 | cause a conventional computer to have various probabilities 202 | of being in different states. 203 | Of course 204 | in reality it is in only one of those states. 205 | We just don't know which one. 206 | Strangely, this is an assumption about reality that we will need to reconsider 207 | when we look at qubits. 208 |

209 |

210 | If you peek at the system to determine its actual state, 211 | then the probabilities all collapse 212 | so that one state (the observed state) 213 | is deemed to now have a probability of 1, 214 | and all the others are deemed to have a probability of 0. 215 |

216 |

217 | Remember, the larger the blue disk, 218 | the more likely the system will turn out to be in that state. 219 |

220 |

221 | In quantum computing, 222 | the word measurement refers to this act of peeking. 223 |

224 |

225 | Press the “Random NOT” button multiple times 226 | and then press the “measurement” button. 227 |

228 |

229 | Note that there is still nothing quantum mechanical about this yet. 230 | That comes next! 231 |

232 | 233 |
234 |
235 |
236 | 239 |
240 |
241 | 242 |
243 |
244 |
State: 245 | 246 |
247 | 248 |
249 | 250 | 251 | 252 | 253 |

Hadamard of 0

254 |

255 | The “Hadamard operator” is 256 | a special quantum operator that can be applied to qubits. 257 |

258 |

259 | Warning: this first look at quantum operators will be pretty boring. 260 | I promise it will get interesting soon! 261 |

262 |

As you will see below, the Hadamard initially acts like a Random NOT with 50% chance of success.

263 |

264 | In this interactive example, 265 | I purposely disable the Hadamard button after you press it. 266 | Later in this article we will see what happens when you apply the Hadamard twice in a row. 267 |

268 | 269 | 270 |
271 |
272 |
273 | 277 |
278 |
279 | 280 |
281 |
282 |
State:
283 | 284 |
285 | 286 | 287 | 288 |

Nothing unusual about that was there?

289 |

But you will be surprised by what comes next...

290 | 291 | 292 | 293 | 294 |

Hadamard of 1

295 |

Things start to become weird when you look at the Hadamard of 1.

296 |

Look carefully at the arrow directions.

297 |
298 |
299 |
300 | 304 |
305 |
306 | 307 |
308 |
309 |
State:
310 | 311 |
312 | 313 | 314 | 315 |

Huh?

316 | Photograph of confused cat 317 | 318 | 319 | 320 |

Phase

321 |

322 | Puzzled? 323 | You should be if this is all new to you. 324 | Please hang in there for a while longer. 325 |

326 | 327 |

328 | The arrow directions represent what physicists call phase: 329 |

330 | 331 | 336 | 337 |

338 | In the case of nuclear spin, 339 | phases can be manipulated by applying electric and/or 340 | magnetic fields. 341 |

342 |

343 | We will see the importance of phase in a moment, 344 | but first let's look at another interesting quantum computing operator... 345 |

346 | 347 | 348 | 349 |

T Operator

350 |

The T operator rotates the phase of 1, but leaves 0 untouched.

351 |

Note how it does not affect the probabilities at all.

352 |
353 |
354 |
355 | 359 |
360 |
361 |
State:
362 | 363 |
364 | 365 | 366 | 367 | 368 |

Measurement Revisited

369 |

Recall:

370 | 378 |

379 | Important: 380 | The likelihood of a state being observed 381 | is entirely determined by the size of the blue disk, 382 | and is completely unaffected 383 | by the direction of the arrow. 384 |

385 |
386 |
387 |
388 | 389 |
390 |
391 | 392 |
393 |
394 |
State:
395 | 396 |
397 | 398 | 399 | 400 |

Quantum Interference

401 | 402 |

Consider what happens when we apply a Hadamard operation twice in a row.

403 | 404 |

405 | Let's assume that a qubit is initially known to definitely have the value 0. 406 | If you were to apply the Hadamard to it twice in a row, 407 | then there are four equally likely scenarios 408 | (Recall that “x → y → z” 409 | means “the qubit starts with a value x, 410 | the first Hadamard results in the qubit having the value y, 411 | and the second Hadamard results in the qubit having the value z”): 412 |

413 | 419 | 420 |

421 | So the final value should be equally likely to be 0 or 1 but, 422 | in reality, 423 | applying the Hadamard operator twice in a row 424 | always returns the qubit to its original value. 425 | In our case, where the qubit is initially 0, 426 | two applications of the Hadamard will result in it being 0 again. 427 |

428 | 429 |

430 | Try it out. 431 | Press the “Apply Hadamard” button twice 432 | and watch it return to having a 100% likelihood of having the value 0. 433 |

434 | 435 |
436 |
437 |
438 | 439 |
440 |
441 |
State:
442 | 443 |
444 | 445 | 446 | 447 |

Totally confused?

448 |
449 | If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. 450 |
451 | Niels Bohr 452 |
453 | 454 | 455 | 456 |

What is going on here?

457 | 458 |

459 | The state of the qubit after the first Hadamard 460 | seems to have a 50% chance of being 0 461 | and a 50% chance of being 1. 462 |

463 |

464 | The second Hadamard is applied to both the 0 and 1 states 465 | and the results are combined. 466 |

467 | 468 |

469 | The arrows still add head to tail. 470 |

471 | 472 |

473 | 474 | The two different scenarios ending in a 1 state have opposite phases 475 | and so they cancel each other out. 476 | 477 |

478 |

479 | This process of phases causing possible outcomes to cancel or re-enforce 480 | is what physicists call interference. 481 |

482 | 483 |

This is what philosophers of physics loose sleep over.

484 | 485 | Paths for applying Hadamard twice to 0. 486 | 487 |

488 | By the way, 489 | the mathematically inclined may be worried about 490 | all the probabilities not adding up to 1 any more. 491 | The trick is that 492 | the arrow lengths now have to represent 493 | the square roots of the probabilities. 494 | We will briefly cover this in more detail in the section entitled 495 | Some mathematics 496 | in Part 2. 497 |

498 | 499 | 500 | 501 | 502 |

Hadamard of 1 (revisited)

503 |

504 | It is instructive to observe the effects of applying 505 | a Hadamard twice in a row when the initial value is 1. 506 | This time, the qubit returns to 1: 507 |

508 |
509 |
510 |
511 | 512 |
513 |
514 |
State:
515 | 516 |
517 | 518 | 519 | 520 |

Different kinds of uncertainty

521 | 522 |

523 | We are actually dealing with two different kinds of uncertainty: 524 |

525 | 526 | 540 | 541 | 542 | 543 |

Small Diversion: Superposition of Locations

544 | 545 |

546 | So far, the rather abstract phenomenon of nuclear spin is 547 | the only approach that I have mentioned for creating qubits. 548 |

549 |

550 | Quantum physics seems even more bizarre 551 | when you discover that physical objects can be 552 | in superpositions of different locations. 553 |

554 |

555 | The photons travelling through an “interferometer” 556 | are in superpositions of locations that can be kilometres apart 557 | (as they are in the 558 | LIGO 559 | interferometer). 560 |

561 |

562 | A simple interferometer is shown below. 563 | Photons are emitted by a light source 564 | (e.g. a laser) 565 | that is pointing at a 566 | “half silvered mirror”, 567 | which reflects some of the light and lets some of the light through. 568 |

569 | Interferometer 570 |

571 | Individual photons end up in a superposition of 572 | having been reflected 573 | and having been let through. 574 | A couple more mirrors are used to bring the split light beam back together 575 | at a detector. 576 | The positions of the mirrors and the detector all effect the lengths of 577 | the two different paths, 578 | so that one path can be longer than the other. 579 | Like the T operator described earlier, 580 | a change in the relative path lengths will alter 581 | the relative phases of the two photon states. 582 | A difference equal to the wavelength of light is enough to 583 | change the relative phases by an entire 360 degrees. 584 | If the phases are exactly opposite, 585 | then they will cancel each other out, 586 | and the detector will not detect anything. 587 | The resulting effect will be an alternating series of light 588 | and dark concentric rings like those shown below. 589 |

590 | 591 | 592 |

593 | This interference effect even happens when 594 | the light source is slowly emitting photons 595 | one at a time. 596 |

597 | 598 | 599 | Interference Pattern 600 | 601 |

602 | It is tempting to think that the half silvered mirror 603 | is splitting each photon in two 604 | and that the interference effects are caused by the two photons 605 | interacting with each other. 606 | But this is not what happens. 607 |

608 |

609 | If detectors are placed on the two paths, 610 | and the light source is slowly emitting photons 611 | one at a time, 612 | then the detectors only ever detect a photon 613 | on one path or the other. 614 | They never detect two photons at once! 615 | (Well, they very occasionally do due to the light source 616 | very occasionally emitting two at once, 617 | but the frequency that this should happen is 618 | easily predicted and verified.) 619 |

620 | 621 |

622 | If detectors are placed on either or both of the two paths, 623 | then the act of detecting the presence (or absence) of the photon 624 | causes the superposition to collapse to one or the other, 625 | and the interference effects disappear, 626 | even if the detector lets the photon continue on. 627 |

628 | 629 | 630 | 631 |

632 | It gets even more interesting when you have more than one qubit 633 |

634 | 635 |

636 | The quantum weirdness rises to a whole new level when there are two or more qubits interacting. 637 | This is explored in Part 2. 638 |

639 |

640 | If you want to experiment with various single qubit quantum operations first, 641 | then have a play with the 642 | 643 | Quantum Computer Gate Playground 644 | 645 |

646 | 647 | 648 |
649 |

Attributions

650 |

Michelson Interferometer: http://commons.wikimedia.org/wiki/File:Michaelson_with_letters.jpg

651 |

Interference Pattern: http://commons.wikimedia.org/wiki/File:Zonenplatte_Cosinus.png

652 |
653 | 654 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 673 | 674 | 675 | -------------------------------------------------------------------------------- /part2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | An Interactive Introduction To Quantum Computing Part 2 7 | 8 | 9 | 10 | 11 |
12 | 13 |

An Interactive Introduction To Quantum Computing Part 2

14 |
15 | Quantum Search 16 |
17 | 18 |

19 | This article was originally written in 2014, 20 | but has had some minor improvements in December 2017 and January 2018 21 | when I received some useful feedback after the article 22 | had unexpectedly been posted on 23 | Hacker News 24 | in December 2017. 25 |

26 | 27 |

28 | This is Part 2 of a two part series. 29 | In Part 1 30 | I explained some of the basics of qubits, 31 | including the mysterious notions of phase and quantum interference. 32 | Here in Part 2, you will learn 33 | how quantum computers may one day be able to solve search problems 34 | faster than conventional computers. 35 |

36 | 37 |

Multiple qubits

38 |

39 | Important: There is something really important I feel the need to emphasize 40 | as we start dealing with multiple qubits. 41 |

42 |

The blue disks introduced in Part 1 do not correspond to single qubits.

43 |

44 | Each blue disk corresponds to a distinct state of the entire quantum system. 45 | If you are not sure what I mean by that, 46 | then please hang in there, 47 | it will hopefully become aparent very soon. 48 |

49 | 50 | 51 | 52 |

Controlled NOT

53 |

54 | The Controlled NOT operator is a very simple but powerful 55 | two-qubit operator. 56 |

57 |

58 | The Controlled NOT operator modifies the value of one qubit (the target qubit) 59 | based on the value of another qubit (the control qubit). 60 |

61 |

62 | Specifically, the Controlled NOT operator flips the value of the target qubit 63 | if the control qubit has a value of 1. 64 |

65 |

66 | For example: 67 | Suppose we have two qubits with 68 | an initial value of “11”. 69 | Let's use the left qubit as the control qubit 70 | and the right qubit as the target. 71 | Then the result of applying a Controlled NOT 72 | will be “10”. 73 | As usual, we represent this as 74 | “11 → 10” 75 |

76 |

77 | Continuing with our choice of left qubit as control qubit 78 | and right qubit as target, 79 | there are four scenarios to consider for 80 | the Controlled NOT operator. 81 |

82 | 88 | 89 | 90 | 91 |

Quantum Entanglement

92 |

93 | A combination of the Hadamard followed by a Controlled NOT 94 | can put two qubits into a state of “quantum entanglement”. 95 |

96 |

97 | In what follows, we take a two qubit system in the state “00”, 98 | apply the Hadamard operation to the left qubit, 99 | and then use that left qubit as the control in a Controlled NOT 100 | of the right qubit: 101 |

102 |

Initial State

103 |
104 |
State:
105 | 106 |
107 | 108 |

After applying a Hadamard to the left qubit

109 |

110 | When you apply a Hadamard to the left qubit, 111 | that qubit goes into 112 | a superposition of 0 and 1. 113 | The right qubit is not touched and continues to have the value 0. 114 | So the pair of qubits goes into 115 | a superposition of 00 and 10. 116 |

117 |
118 |
State:
119 | 120 |
121 |

After a Controlled NOT of the right qubit controlled by the left qubit

122 |

123 | The Controlled NOT will leave the 00 state unchanged as the control qubit (left qubit) is 0. 124 |

125 |

126 | When acting on the 10 state, the control qubit is 1, 127 | and so the target bit is flipped resulting in 11. 128 | So the pair of qubits goes into 129 | a superposition of 00 and 11. 130 |

131 |
132 |
State:
133 | 134 |
135 |

136 | Note that, if you were to measure the qubits while they are in this state, 137 | you would find that they are either both 0 or both 1. 138 | This sort of correlation between qubit values 139 | within a superposition is called 140 | “quantum entanglement”. 141 |

142 |

143 | Why quantum entanglement is so special deserves an entire article of its own. 144 | For now, I am simply using entanglement to 145 | emphasise how quantum superposition can apply to 146 | the combined state of a number of qubits. 147 |

148 | 149 | 150 | 151 |

Arbitrary Logic Functions

152 |

153 | In addition to the NOT operator that we have already seen, 154 | a quantum computer can implement the standard 155 | logic functions of AND and OR. 156 | From these, one can compute any function over a fixed number of bits. 157 |

158 |

159 | The details are surprisingly fascinating 160 | and not as straight forward as you might expect. 161 | However, 162 | for the purposes of this article, 163 | I want you to trust me when I say it can be done. 164 | This will allow us to move more quickly to 165 | the even more fascinating topic of quantum search. 166 |

167 |

168 | Before we can cover quantum search, 169 | there is one more quantum operator I need to introduce. 170 |

171 | 172 | 173 | 174 |

Controlled Phase Flip

175 |

176 | Recall that the term phase, 177 | introduced in Part 1, 178 | refers to the arrow direction of a state. 179 |

180 |

181 | The controlled phase flip is a multi qubit operator. 182 | It flips the phase of the states where 183 | all of the specified qubits have the value of 1. 184 |

185 | 186 |

187 | More useful to us, however, 188 | is a generalised form of the controlled phase flip. 189 | It will flip the phase of the states where the target qubits 190 | have any specified combination of 1's and 0's. 191 |

192 | 193 |

Try it yourself:

194 | 195 |
196 |
197 |
198 | 201 | 204 | 207 | 210 |
211 |
212 | 213 |
214 | 215 | 216 | 217 | 218 | 219 |

Quantum Search

220 |

221 | Imagine you are trying to crack an n-bit encryption key by brute force: 222 | i.e. by trying every one of the 2n possible values. 223 |

224 |

225 | This is a classic needle in a haystack search problem. 226 |

227 |

228 | In other words, 229 | it belongs to a class of problems for which 230 | there exists an efficient function, 231 | called an oracle (or verification) function, 232 | that takes a candidate value as input 233 | and returns true if the candidate is the correct value. 234 | However, 235 | the only way to find the correct value 236 | is to test the oracle function on practically every possible value. 237 |

238 |

239 | A conventional computer will need to evaluate the oracle function, 240 | on average, 241 | 2n-1 times. 242 |

243 |

244 | By using 245 | Grover's algorithm, 246 | a quantum computer only needs to evaluate the oracle function less than 247 | √(2n) times. 248 |

249 |

250 | Even if a conventional computer can compute the oracle function in a nanosecond, 251 | if the input was 64 bits long, 252 | then it would probably take hundreds of years 253 | for that conventional computer 254 | to find the answer. 255 | A quantum computer might possibly take just a few seconds. 256 | 257 | A conventional computer would have to evaluate the oracle function an average of 258 | 263 times, 259 | compared to just over four billion times for a quantum computer. 260 | It is likely however, 261 | at least in the early days of quantum computing, 262 | that individual operations on a quantum computer may be vastly slower 263 | than on a conventional computer. 264 | It may take a while before quantum computers ever get 265 | to solve a problem any faster than conventional computers. 266 | 267 |

268 |

269 | For the extremely simple case where the input is only 2 bits, 270 | there are four possible answers. 271 | A conventional computer may need to test up to three 272 | of those possible values. 273 | (If it isn't the first three, 274 | then you can infer it must be fourth one without testing it.) 275 | As you will see below, 276 | a quantum computer can find the answer 277 | using a single invocation of the oracle function. 278 |

279 | 280 | 281 | 282 |

Quatum Search over 2 Qubits

283 | 284 |

285 | First recall that 286 | the objective is to find the value of x 287 | for which the oracle function is true. 288 | For Grover's Search Algorithm to work, 289 | it is essential that the oracle function is true 290 | for exactly one value of x. 291 |

292 | 293 |

294 | In the conventional descriptions of Grover's Search Algorithm, 295 | it is assumed that the the oracle function 296 | will flip the value of an “output” qubit 297 | when the input matches the desired result. 298 | It is a lot more convenient if we do away with the output bit, 299 | and instead flip the phase 300 | when the input matches the desired result. 301 |

302 | 303 |

304 | Here are the steps to Grover's Search Algorithm 305 | for the very simple case of two bits. 306 |

307 |

308 | For example, the problem may be to 309 | find factors of 15 that are less than 4. 310 | This is obviously trivial for such small values, 311 | but the problem of finding factors for very large numbers 312 | (e.g. numbers with over 100 digits) 313 | is currently a very computationally expensive problem. 314 |

315 | 316 |
    317 |
  1. 318 | Start with the qubits in a superposition of all possible states: 319 | 00, 01, 10, and 11 (all with the same phase). 320 |
  2. 321 |
  3. 322 | Apply the oracle function once only. 323 | Note that, 324 | because the system starts in a superposition of all possible states, 325 | the oracle function is effectively applied to all possible states, 326 | but it will only flip the phase of the state for which we are searching. 327 | If you were to perform a measurement now, 328 | all the possible outcomes are still equally likely 329 | and so we don't seem to have made any progress. 330 | However, the next three steps use quantum interference to find the correct answer. 331 |
  4. 332 |
  5. Apply a Hadamard operation to both qubits.
  6. 333 |
  7. Flip the phase of the 00 state.
  8. 334 |
  9. Apply a Hadamard operation to both qubits again.
  10. 335 |
  11. 336 | Constructive and destructive quantum interference will ensure that, 337 | of the four possible states, 338 | a measurement is guaranteed to result in only the desired state. 339 |
  12. 340 |
341 | 342 |

343 | You can try it yourself below. 344 | Your task is to find the value for which the oracle function 345 | f 346 | is "true". 347 | i.e. the state for which 348 | f 349 | will flip the phase. 350 | On a classical computer you would typically end up testing 351 | at least half the states before finding the answer. 352 | On a quantum computer you can test all the states simultaneously. 353 |

354 | 355 |
357 |
358 |
359 |
360 | Apply the oracle function (to all states): 361 | 364 |
365 | 366 |
367 | 369 | 371 |
372 |
373 | 375 |
376 |
377 | 379 | 381 |
382 |
383 | Only the searched-for state now has a non-zero probability 384 | and a measurement can be safely applied. 385 |
386 |
387 |
388 | 389 |
390 | 391 |
392 |
393 | 394 | 395 |

396 | Don't forget, 397 | unlike what happens in the animation, 398 | each operation is effectively applied to 399 | all the states simultaneously. 400 |

401 | 402 | 403 | 404 | 405 |

Beyond Quantum Search

406 |

407 | The two bit search is a bit of a special case 408 | where the oracle function only needs to be invoked once. 409 | As the number of bits increases, 410 | it becomes necessary to invoke the oracle function multiple times. 411 | In fact it needs to be invoked 412 | ¼π√(2n) 413 | times. 414 |

415 |

416 | While general quantum search techniques may seem quite impressive, 417 | even ¼π√(2n) gets very large very quickly. 418 |

419 |

420 | All you have to do is double the number of bits to wipe out any advantages. 421 | For example, 422 | over a 128 bit search space, 423 | a quantum computer would need to evaluate the oracle function 424 | almost as many times as a conventional computer does 425 | over a 64 bit search space. 426 | Even at one evaluation per nanosecond, 427 | it would take hundreds of years to crack 428 | a 128 bit encryption key. 429 |

430 |

431 | However, 432 | encryption keys 433 | commonly used for securing internet traffic 434 | (RSA keys) 435 | can be broken using a special purpose quantum algorithm. 436 | These encryption schemes rely on the difficulty of 437 | factoring very large numbers, 438 | something that can be easily done on a quantum computer using 439 | Shor's Algorithm. 440 |

441 |

442 | Shor's Algorithm has a “asymptotic” behaviour of 443 | O((log N)3). 444 | I won't try to explain 445 | the exact meaning of this statement, 446 | but it is quite possible that 447 | current encryption keys could be broken in sub-second time frames. 448 | Also, simply doubling the length of the key would have a barely noticeable 449 | effect on the time taken. 450 | The limiting factor is likely to be the number of qubits required 451 | since you need at least as many qubits as the key length. 452 |

453 | 454 | 455 | 456 |

D-Wave

457 |

458 | You may have heard of 459 | D-Wave 460 | quantum computers. 461 |

462 |

463 | These are currently the only commercially available quantum computers. 464 | D-Wave are building quantum computers containing 512 qubits, 465 | which in theory could be in a super position of 466 | 2512 states. 467 | 468 | Update Jan 2017: 469 | 470 | D-Wave have now built a 2000 qubit system 471 | and have plans for a 4000 qubit system. 472 | 473 | 474 |

475 |

476 | Despite having such a large number of qubits, 477 | there is little evidence that they have been solving 478 | problems any faster than conventional computers. 479 |

480 |

481 | D-Wave computers are special purpose 482 | “quantum annealing” computers. 483 | The quantum computers that I have been describing so far are 484 | known as “quantum gate” computers. 485 | Describing the differences are beyond the scope of this 486 | (already long) article. 487 |

488 |

489 | Before they can start out-performing conventional computers, 490 | it is possible that D-Wave simply needs to use more qubits, 491 | or perhaps they may need to figure out how to make 492 | more effective use of their existing qubits. 493 | However, 494 | it quite possibly will not be long before 495 | we start seeing impressive results. 496 |

497 | 498 | 499 | 500 |

Some philosophy

501 |

502 | Describing quantum computing 503 | in terms of superpositions of states 504 | that “collapse” 505 | to the observed state 506 | upon “measurement” 507 | is a very conventional approach 508 | to explaining the physics 509 | behind quantum computing. 510 | However, there are some serious 511 | deficiencies with this approach. 512 |

513 |

514 | Probably the most fundamental problem is: 515 | 516 | What is so special about measurement that it causes 517 | quantum superpositions to collapse? 518 | 519 |

520 |

521 | The measuring equipment itself is made of the same stuff 522 | as the qubits being measured 523 | (protons, neutrons, electrons, and photons). 524 |

525 |

526 | When measuring a qubit that is in a superposition of 527 | two different states, 528 | there is nothing in quantum physics that says why 529 | the measuring equipment 530 | might cause the superposition to collapse to a single state 531 | instead of the measuring equipment 532 | becoming entangled with the qubit. 533 | Instead of the quantum state collapsing, 534 | the result could be a superposition of the following two states: 535 |

536 | 540 |

541 | If you consider your conscious awareness to be 542 | nothing more than patterns of activity in your brain, 543 | and that your brain is governed by the laws of physics, 544 | then there is nothing in quantum physics that says why, 545 | when you look at the measurement outcome, 546 | you yourself do not become entangled with 547 | the quantum qubit and 548 | the measuring equipment. 549 | The result would be a superposition of the following two states: 550 |

551 | 557 |

558 | Think of it as two alternative realities existing. 559 | In one reality you see a 0, 560 | and in the other you see a 1. 561 | Quantum interference is the only ways that these realities interact. 562 |

563 |

564 | Variations on this interpretation of quantum physics 565 | are taken quite seriously 566 | by many physicists and physics philosophers, and is 567 | commonly referred to as the “Many Worlds” 568 | interpretation of quantum physics. 569 | Much has been written on the topic, 570 | and an internet search will point you to 571 | many good (and not so good) articles. 572 |

573 |

574 | Quantum computing 575 | provides a nice way of looking at some of these issues. 576 | It may even provide a way of simulating ideas by, 577 | for example, 578 | representing different states of an observer using qubits. 579 |

580 | 581 |

582 | This article has already covered more topics than I originally planned. 583 | However, I feel the need to include a little bit of 584 | a mathematical explanation to some of the material. 585 | For those that are not interested in the mathematics, 586 | feel free to skip to the 587 | Useful Links Section 588 | at the end. 589 |

590 | 591 | 592 |

Some mathematics

593 |

594 | In this article 595 | I used little blue disks with red arrows 596 | to represent the probabilities 597 | of a set of bits or qubits 598 | being in different states. 599 | It is likely that I caused some confusion 600 | by quietly using the disks in subtly different ways 601 | when describing 602 | two quite different types of uncertainty. 603 |

604 |

605 | When describing ordinary non-quantum bits, 606 | the system is in a definite state, 607 | but which state that is may be unknown. 608 | In this situation, 609 | it is most convenient if 610 | the arrow lengths are proportional to the probabilities 611 | of the respective states 612 | so that they can be added head to tail. 613 | If there were two scenarios, S1 and S2, both ending in the same state, 614 | where S1 has a probability of p1 615 | and S2 has a probability of p2, 616 | then the probability of that final state is 617 | p1 + p2. 618 |

619 |

620 | When describing qubits 621 | in a superposition of different states, 622 | it is no longer simply a case of not knowing which state they are in, 623 | the system actually seems to be in multiple states at once. 624 | In this situation, 625 | it is most convenient if 626 | the arrow lengths are proportional to the square roots of the probabilities 627 | of the respective states 628 | (the disk areas now effectively represent probabilities 629 | except for a factor of π). 630 | The arrow directions represent their phases. 631 | When two scenarios end in the same state, 632 | you need to use vector addition to add the arrows. 633 |

634 |

635 | The arrows represent what physicists call “amplitudes”. 636 |

637 |

638 | Conventionally, an amplitude is represented using a complex number 639 | whose value on the complex number plane coincides with the end of our arrow. 640 | If our arrow has a length r and a phase θ, 641 | then it is represented as the complex number: 642 |

643 |

644 | r (cos(θ) + i sin(θ)) 645 |

646 |

647 | If a state had this amplitude, 648 | then the probability of that state being the outcome 649 | of a measurement is r2. 650 |

651 |

652 | When we talk of “adding arrows head to tail”, 653 | we can simply add the corresponding complex numbers using 654 | ordinary complex number arithmetic. 655 |

656 |

657 | Given that the probabilities of all possible outcomes have to add up to 1, 658 | it follows that the sum of the squares of the amplitude magnitudes 659 | also have to add up to 1. 660 | All quantum operators preserve this property. 661 |

662 |

663 | If the amplitudes for the 0 and 1 states of a qubit are 664 | the (possibly complex) numbers 665 | a0 666 | and 667 | a1 668 | respectively, 669 | then applying a Hadamard results in 670 | the amplitudes of 0 and 1 becoming 671 | (1/√2)(a0 + a1) 672 | and 673 | (1/√2)(a0 - a1) 674 | respectively. 675 |

676 |

677 | For the simple case of a qubit being 100% in 678 | the 1 state with a phase of 0, 679 | applying a Hadamard results in 680 | the amplitudes of 0 and 1 being 681 | 1/√2 and -1/√2 respectively. 682 | Notice that if you square and add these together that you get 1. 683 |

684 |

685 | That is already more mathematics as I wanted to cover in this article. 686 | For more, see some of the useful links listed in the next section. 687 |

688 | 689 | 690 | 691 | 692 | 693 | 723 | 724 | 725 | 726 | 728 | 729 | 730 | 731 | 732 |
733 | 734 | 744 | 745 | 746 | 747 | -------------------------------------------------------------------------------- /jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v2.1.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ 2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m=a.document,n="2.1.0",o=function(a,b){return new o.fn.init(a,b)},p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};o.fn=o.prototype={jquery:n,constructor:o,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=o.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return o.each(this,a,b)},map:function(a){return this.pushStack(o.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},o.extend=o.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||o.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(o.isPlainObject(d)||(e=o.isArray(d)))?(e?(e=!1,f=c&&o.isArray(c)?c:[]):f=c&&o.isPlainObject(c)?c:{},g[b]=o.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},o.extend({expando:"jQuery"+(n+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===o.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isPlainObject:function(a){if("object"!==o.type(a)||a.nodeType||o.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=o.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?o.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),o.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||o.guid++,f):void 0},now:Date.now,support:l}),o.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=o.type(a);return"function"===c||o.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+")"+K+"*(?:([*^$|!~]?=)"+K+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+M+")|)|)"+K+"*\\]",O=":("+L+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(O),U=new RegExp("^"+M+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L.replace("w","w*")+")"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=/'|\\/g,ab=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),bb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{G.apply(D=H.call(t.childNodes),t.childNodes),D[t.childNodes.length].nodeType}catch(cb){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function db(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return G.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(_,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=$.test(a)&&mb(b.parentNode)||b,v=m.join(",")}if(v)try{return G.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(P,"$1"),b,d,e)}function eb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function fb(a){return a[s]=!0,a}function gb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function hb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function ib(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||B)-(~a.sourceIndex||B);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a){return a&&typeof a.getElementsByTagName!==A&&a}c=db.support={},f=db.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=db.setDocument=function(a){var b,e=a?a.ownerDocument||a:t,g=e.defaultView;return e!==l&&9===e.nodeType&&e.documentElement?(l=e,m=e.documentElement,n=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){k()},!1):g.attachEvent&&g.attachEvent("onunload",function(){k()})),c.attributes=gb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=gb(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(e.getElementsByClassName)&&gb(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=gb(function(a){return m.appendChild(a).id=s,!e.getElementsByName||!e.getElementsByName(s).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==A&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==A&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==A?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==A&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(e.querySelectorAll))&&(gb(function(a){a.innerHTML="",a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||o.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&o.push("name"+K+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),b=Y.test(m.compareDocumentPosition),r=b||Y.test(m.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},z=b?function(a,b){if(a===b)return j=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===t&&r(t,a)?-1:b===e||b.ownerDocument===t&&r(t,b)?1:i?I.call(i,a)-I.call(i,b):0:4&d?-1:1)}:function(a,b){if(a===b)return j=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],k=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:i?I.call(i,a)-I.call(i,b):0;if(f===g)return ib(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)k.unshift(c);while(h[d]===k[d])d++;return d?ib(h[d],k[d]):h[d]===t?-1:k[d]===t?1:0},e):l},db.matches=function(a,b){return db(a,null,null,b)},db.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(S,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return db(b,l,null,[a]).length>0},db.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},db.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!n):void 0;return void 0!==f?f:c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},db.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},db.uniqueSort=function(a){var b,d=[],e=0,f=0;if(j=!c.detectDuplicates,i=!c.sortStable&&a.slice(0),a.sort(z),j){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return i=null,a},e=db.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=db.selectors={cacheLength:50,createPseudo:fb,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||db.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&db.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return V.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&T.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ab,bb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==A&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=db.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||db.error("unsupported pseudo: "+a);return e[s]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:fb(function(a){var b=[],c=[],d=g(a.replace(P,"$1"));return d[s]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return db(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:fb(function(a){return U.test(a||"")||db.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=v++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[u,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[s]||(b[s]={}),(h=i[d])&&h[0]===u&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ub(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],i=g||d.relative[" "],j=g?1:0,k=qb(function(a){return a===b},i,!0),l=qb(function(a){return I.call(b,a)>-1},i,!0),m=[function(a,c,d){return!g&&(d||c!==h)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>j;j++)if(c=d.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=d.filter[a[j].type].apply(null,a[j].matches),c[s]){for(e=++j;f>e;e++)if(d.relative[a[e].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(P,"$1"),c,e>j&&ub(a.slice(j,e)),f>e&&ub(a=a.slice(e)),f>e&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,i,j,k){var m,n,o,p=0,q="0",r=f&&[],s=[],t=h,v=f||e&&d.find.TAG("*",k),w=u+=null==t?1:Math.random()||.1,x=v.length;for(k&&(h=g!==l&&g);q!==x&&null!=(m=v[q]);q++){if(e&&m){n=0;while(o=a[n++])if(o(m,g,i)){j.push(m);break}k&&(u=w)}c&&((m=!o&&m)&&p--,f&&r.push(m))}if(p+=q,c&&q!==p){n=0;while(o=b[n++])o(r,s,g,i);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=E.call(j));s=sb(s)}G.apply(j,s),k&&!f&&s.length>0&&p+b.length>1&&db.uniqueSort(j)}return k&&(u=w,h=t),r};return c?fb(f):f}g=db.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){for(var d=0,e=b.length;e>d;d++)db(a,b[d],c);return c}function xb(a,b,e,f){var h,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(ab,bb),b)||[])[0],!b)return e;a=a.slice(i.shift().value.length)}h=V.needsContext.test(a)?0:i.length;while(h--){if(j=i[h],d.relative[k=j.type])break;if((l=d.find[k])&&(f=l(j.matches[0].replace(ab,bb),$.test(i[0].type)&&mb(b.parentNode)||b))){if(i.splice(h,1),a=f.length&&pb(i),!a)return G.apply(e,f),e;break}}}return g(a,m)(f,b,!n,e,$.test(a)&&mb(b.parentNode)||b),e}return c.sortStable=s.split("").sort(z).join("")===s,c.detectDuplicates=!!j,k(),c.sortDetached=gb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),gb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||hb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&gb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||hb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),gb(function(a){return null==a.getAttribute("disabled")})||hb(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),db}(a);o.find=t,o.expr=t.selectors,o.expr[":"]=o.expr.pseudos,o.unique=t.uniqueSort,o.text=t.getText,o.isXMLDoc=t.isXML,o.contains=t.contains;var u=o.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(o.isFunction(b))return o.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return o.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return o.filter(b,a,c);b=o.filter(b,a)}return o.grep(a,function(a){return g.call(b,a)>=0!==c})}o.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?o.find.matchesSelector(d,a)?[d]:[]:o.find.matches(a,o.grep(b,function(a){return 1===a.nodeType}))},o.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(o(a).filter(function(){for(b=0;c>b;b++)if(o.contains(e[b],this))return!0}));for(b=0;c>b;b++)o.find(a,e[b],d);return d=this.pushStack(c>1?o.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?o(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=o.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof o?b[0]:b,o.merge(this,o.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),v.test(c[1])&&o.isPlainObject(b))for(c in b)o.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=m.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):o.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(o):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),o.makeArray(a,this))};A.prototype=o.fn,y=o(m);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};o.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&o(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),o.fn.extend({has:function(a){var b=o(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(o.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?o(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&o.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?o.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(o(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(o.unique(o.merge(this.get(),o(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}o.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return o.dir(a,"parentNode")},parentsUntil:function(a,b,c){return o.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return o.dir(a,"nextSibling")},prevAll:function(a){return o.dir(a,"previousSibling")},nextUntil:function(a,b,c){return o.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return o.dir(a,"previousSibling",c)},siblings:function(a){return o.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return o.sibling(a.firstChild)},contents:function(a){return a.contentDocument||o.merge([],a.childNodes)}},function(a,b){o.fn[a]=function(c,d){var e=o.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=o.filter(d,e)),this.length>1&&(C[a]||o.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return o.each(a.match(E)||[],function(a,c){b[c]=!0}),b}o.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):o.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){o.each(b,function(b,c){var d=o.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&o.each(arguments,function(a,b){var c;while((c=o.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?o.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},o.extend({Deferred:function(a){var b=[["resolve","done",o.Callbacks("once memory"),"resolved"],["reject","fail",o.Callbacks("once memory"),"rejected"],["notify","progress",o.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return o.Deferred(function(c){o.each(b,function(b,f){var g=o.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&o.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?o.extend(a,d):d}},e={};return d.pipe=d.then,o.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&o.isFunction(a.promise)?e:0,g=1===f?a:o.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&o.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;o.fn.ready=function(a){return o.ready.promise().done(a),this},o.extend({isReady:!1,readyWait:1,holdReady:function(a){a?o.readyWait++:o.ready(!0)},ready:function(a){(a===!0?--o.readyWait:o.isReady)||(o.isReady=!0,a!==!0&&--o.readyWait>0||(H.resolveWith(m,[o]),o.fn.trigger&&o(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),o.ready()}o.ready.promise=function(b){return H||(H=o.Deferred(),"complete"===m.readyState?setTimeout(o.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},o.ready.promise();var J=o.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===o.type(c)){e=!0;for(h in c)o.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,o.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(o(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};o.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=o.expando+Math.random()}K.uid=1,K.accepts=o.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,o.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(o.isEmptyObject(f))o.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,o.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{o.isArray(b)?d=b.concat(b.map(o.camelCase)):(e=o.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!o.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?o.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}o.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),o.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length; 3 | while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=o.camelCase(d.slice(5)),P(f,d,e[d]));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=o.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),o.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||o.isArray(c)?d=L.access(a,b,o.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=o.queue(a,b),d=c.length,e=c.shift(),f=o._queueHooks(a,b),g=function(){o.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:o.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),o.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";l.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return m.activeElement}catch(a){}}o.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=o.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof o!==U&&o.event.triggered!==b.type?o.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n&&(l=o.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=o.event.special[n]||{},k=o.extend({type:n,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&o.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(n,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),o.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],n=q=h[1],p=(h[2]||"").split(".").sort(),n){l=o.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||o.removeEvent(a,n,r.handle),delete i[n])}else for(n in i)o.event.remove(a,n+b[j],c,d,!0);o.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,p=[d||m],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||m,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+o.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[o.expando]?b:new o.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:o.makeArray(c,[b]),n=o.event.special[q]||{},e||!n.trigger||n.trigger.apply(d,c)!==!1)){if(!e&&!n.noBubble&&!o.isWindow(d)){for(i=n.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||m)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:n.bindType||q,l=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),l&&l.apply(g,c),l=k&&g[k],l&&l.apply&&o.acceptData(g)&&(b.result=l.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||n._default&&n._default.apply(p.pop(),c)!==!1||!o.acceptData(d)||k&&o.isFunction(d[q])&&!o.isWindow(d)&&(h=d[k],h&&(d[k]=null),o.event.triggered=q,d[q](),o.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=o.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=o.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=o.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((o.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?o(e,this).index(i)>=0:o.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return o.nodeName(a,"table")&&o.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)o.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=o.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&o.nodeName(a,b)?o.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}o.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=o.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||o.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,n=a.length;n>m;m++)if(e=a[m],e||0===e)if("object"===o.type(e))o.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;o.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===o.inArray(e,d))&&(i=o.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f,g,h=o.event.special,i=0;void 0!==(c=a[i]);i++){if(o.acceptData(c)&&(f=c[L.expando],f&&(b=L.cache[f]))){if(d=Object.keys(b.events||{}),d.length)for(g=0;void 0!==(e=d[g]);g++)h[e]?o.event.remove(c,e):o.removeEvent(c,e,b.handle);L.cache[f]&&delete L.cache[f]}delete M.cache[c[M.expando]]}}}),o.fn.extend({text:function(a){return J(this,function(a){return void 0===a?o.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?o.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||o.cleanData(ob(c)),c.parentNode&&(b&&o.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(o.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return o.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(o.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,o.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,k=this.length,m=this,n=k-1,p=a[0],q=o.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=o.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=o.map(ob(c,"script"),kb),g=f.length;k>j;j++)h=c,j!==n&&(h=o.clone(h,!0,!0),g&&o.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,o.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&o.contains(i,h)&&(h.src?o._evalUrl&&o._evalUrl(h.src):o.globalEval(h.textContent.replace(hb,"")))}return this}}),o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){o.fn[a]=function(a){for(var c,d=[],e=o(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),o(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d=o(c.createElement(b)).appendTo(c.body),e=a.getDefaultComputedStyle?a.getDefaultComputedStyle(d[0]).display:o.css(d[0],"display");return d.detach(),e}function tb(a){var b=m,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||o("