-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
256 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
__site/ | ||
node_modules/ | ||
Manifest.toml | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Learning Materials | ||
|
||
This page contains a series of materials for learning quantum information, many-body physics and scientific computing. These materials target students at the Hong Kong University of Science and Technology (Guangzhou) and are freely available to the public. | ||
|
||
## Videos | ||
|
||
~~~ | ||
<iframe width="560" height="315" src="https://www.youtube.com/embed/eGpDw8tVG3c?si=xOBU69a4aZ66fnd8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
~~~ | ||
|
||
## Books | ||
- Quantum computation and quantum information | ||
- Quantum computation and quantum information. Nielsen M A, Chuang I L. Cambridge university press, 2010. | ||
|
||
- Computational complexity | ||
- The nature of computation. Moore C, Mertens S. OUP Oxford, 2011. | ||
|
||
- Scientific computing | ||
- Matrix computations. Golub G H, Van Loan C F. JHU press, 2013. | ||
- Exact exponential algorithms. Fedor V. Fomin , Dieter Kratsch. Springer, 2010. | ||
|
||
## Learn Programming | ||
The following resources are used for Julia programming language training: | ||
- [Modern Julia Workflows](https://modernjuliaworkflows.github.io/) | ||
- [Think Julia: How to Think Like a Computer Scientist](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) | ||
- [GitHub: JuliaComputing/Training](https://github.com/JuliaComputing/Training) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Reading List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
var lunr = require("lunr"); | ||
var cheerio = require("cheerio"); | ||
|
||
// don't modify this, it'll be modified on the fly by lunr() in Franklin | ||
const PATH_PREPEND = ".."; | ||
|
||
const HTML_FOLDER = "../../__site"; | ||
const OUTPUT_INDEX = "lunr_index.js"; | ||
|
||
function isHtml(filename) { | ||
lower = filename.toLowerCase(); | ||
return (lower.endsWith(".htm") || lower.endsWith(".html")); | ||
} | ||
|
||
function findHtml(folder) { | ||
if (!fs.existsSync(folder)) { | ||
console.log("Could not find folder: ", folder); | ||
return; | ||
} | ||
var files = fs.readdirSync(folder); | ||
var htmls = []; | ||
for (var i = 0; i < files.length; i++) { | ||
var filename = path.join(folder, files[i]); | ||
var stat = fs.lstatSync(filename); | ||
if (stat.isDirectory()) { | ||
if (stat == "assets" || stat == "css" || stat == "libs" ) { | ||
continue | ||
} | ||
var recursed = findHtml(filename); | ||
for (var j = 0; j < recursed.length; j++) { | ||
recursed[j] = path.join(files[i], recursed[j]).replace(/\\/g, "/"); | ||
} | ||
htmls.push.apply(htmls, recursed); | ||
} | ||
else if (isHtml(filename)){ | ||
htmls.push(files[i]); | ||
}; | ||
}; | ||
return htmls; | ||
}; | ||
|
||
function readHtml(root, file, fileId) { | ||
var filename = path.join(root, file); | ||
var txt = fs.readFileSync(filename).toString(); | ||
var $ = cheerio.load(txt); | ||
var title = $("title").text(); | ||
if (typeof title == 'undefined') title = file; | ||
var body = $("body").text() | ||
if (typeof body == 'undefined') body = ""; | ||
|
||
var data = { | ||
"id": fileId, | ||
"l": filename, | ||
"t": title, | ||
"b": body | ||
} | ||
return data; | ||
} | ||
|
||
function buildIndex(docs) { | ||
var idx = lunr(function () { | ||
this.ref('id'); | ||
this.field('t'); // title | ||
this.field('b'); // body | ||
docs.forEach(function (doc) { | ||
this.add(doc); | ||
}, this); | ||
}); | ||
return idx; | ||
} | ||
|
||
function buildPreviews(docs) { | ||
var result = {}; | ||
for (var i = 0; i < docs.length; i++) { | ||
var doc = docs[i]; | ||
result[doc["id"]] = { | ||
"t": doc["t"], | ||
"l": doc["l"].replace(/^\.\.\/\.\.\/__site/gi, '/' + PATH_PREPEND) | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
function main() { | ||
files = findHtml(HTML_FOLDER); | ||
var docs = []; | ||
for (var i = 0; i < files.length; i++) { | ||
docs.push(readHtml(HTML_FOLDER, files[i], i)); | ||
} | ||
var idx = buildIndex(docs); | ||
var prev = buildPreviews(docs); | ||
var js = "const LUNR_DATA = " + JSON.stringify(idx) + ";\n" + | ||
"const PREVIEW_LOOKUP = " + JSON.stringify(prev) + ";"; | ||
fs.writeFile(OUTPUT_INDEX, js, function(err) { | ||
if(err) { | ||
return console.log(err); | ||
} | ||
}); | ||
} | ||
|
||
main(); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// This file and its minified version is adapted from https://github.com/BLE-LTER/Lunr-Index-and-Search-for-Static-Sites which is unlicensed. | ||
// | ||
|
||
"use strict"; | ||
|
||
var LUNR_CONFIG = { | ||
"resultsElementId": "searchResults", // Element to contain results | ||
"countElementId": "resultCount" // Element showing number of results | ||
}; | ||
|
||
|
||
// Get URL arguments | ||
function getParameterByName(name) { | ||
var url = window.location.href; | ||
name = name.replace(/[\[\]]/g, "\\$&"); | ||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | ||
results = regex.exec(url); | ||
if (!results) return null; | ||
if (!results[2]) return ""; | ||
return decodeURIComponent(results[2].replace(/\+/g, " ")); | ||
} | ||
|
||
|
||
// Parse search results into HTML | ||
function parseLunrResults(results) { | ||
var html = []; | ||
for (var i = 0; i < results.length; i++) { | ||
var id = results[i]["ref"]; | ||
var item = PREVIEW_LOOKUP[id] | ||
var title = item["t"]; | ||
var preview = item["p"]; | ||
var link = item["l"].replace("__site/", ""); | ||
var result = ('<li><span class="result-title"><a href="' + link + '">' | ||
+ title + '</a></span>'); | ||
html.push(result); | ||
} | ||
if (html.length) { | ||
html.join(""); | ||
return '<ul>'+html+'</ul>' | ||
} | ||
else { | ||
return ""; | ||
} | ||
} | ||
|
||
|
||
function escapeHtml(unsafe) { | ||
return unsafe | ||
.replace(/&/g, "&") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">") | ||
.replace(/"/g, """) | ||
.replace(/'/g, "'"); | ||
} | ||
|
||
|
||
function showResultCount(total) { | ||
var element = document.getElementById(LUNR_CONFIG["countElementId"]) | ||
if (element !== null) { | ||
element.innerHTML = total + "."; | ||
} | ||
} | ||
|
||
|
||
function searchLunr(query) { | ||
var idx = lunr.Index.load(LUNR_DATA); | ||
// Write results to page | ||
var results = idx.search(query); | ||
var resultHtml = parseLunrResults(results); | ||
var elementId = LUNR_CONFIG["resultsElementId"]; | ||
document.getElementById(elementId).innerHTML = resultHtml; | ||
// Write the number of results | ||
showResultCount(results.length); | ||
} | ||
|
||
|
||
// When the window loads, read query parameters and perform search | ||
window.onload = function() { | ||
var query = getParameterByName("q"); | ||
if (query != "" && query != null) { | ||
document.forms.lunrSearchForm.q.value = query; | ||
searchLunr(query); | ||
} else { | ||
// empty query: show 0 results (no query) | ||
showResultCount("0 (empty query)"); | ||
} | ||
document.getElementById("focus").focus(); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@def title = "Search ⋅ Quantum Bay" | ||
|
||
## Search | ||
|
||
Number of results found: ~~~<span id="resultCount"></span>~~~ | ||
|
||
~~~ | ||
<div id="searchResults"></div> | ||
~~~ |