Skip to content

Commit 2672158

Browse files
committed
Update documentation
0 parents  commit 2672158

158 files changed

Lines changed: 10871 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.buildinfo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sphinx build info version 1
2+
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3+
config: 855df3a51e555380713f322953b3ef35
4+
tags: 645f666f9bcd5a90fca523b33c5a78b7

.nojekyll

Whitespace-only changes.

_sources/intro.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Welcome to nanoblas' documentation!
2+
3+
4+
nanoblas is a C++ library for basic linear algebra operations.
5+
The library provides template classes **Vector** and **Matrix**.
6+
7+
## Installation
8+
9+
install it via git-clone:
10+
11+
git clone https://github.com/TUWien-ASC/nanoblas.git
12+
13+
14+
To configure and build some tests do
15+
16+
cd nanoblas
17+
mkdir build
18+
cd build
19+
cmake ..
20+
make
21+
22+
23+
## Using nanoblas
24+
25+
To use ASC-bla in your code, set the compiler include path properly, and include the header files
26+
27+
#include <vector.hpp>
28+
#include <matrix.hpp>
29+
30+
All objects are implemented in the namespace ASC_bla. To use them with less typing, you can set
31+
32+
namespace bla = nanoblas;
33+
34+
or even
35+
36+
37+
using namespace nanoblas;
38+
39+
40+
41+
You can create vectors and compute with vectors like:
42+
43+
44+
```cpp
45+
Vector<double> x(5), y(5), z(5);
46+
for (int i = 0; i < x.size(); i++)
47+
x(i) = i;
48+
y = 5.0
49+
z = x+3*y;
50+
cout << "z = " << z << endl;
51+
```
52+
53+
For matrices you can choose between row-major (`RowMajor`) or column-major (`ColMajor`) storage,
54+
default is row-major.
55+
56+
```cpp
57+
Matrix<double,RowMajor> m1(5,3), m2(3,3);
58+
for (int i = 0; i < m1.rows(); i++)
59+
for (int j = 0; j < m1.cols(); j++)
60+
m1(i,j) = i+j;
61+
m2 = 3.7;
62+
Matrix<double> product = m1 * m2;
63+
```
64+
65+
You can extract a row or a column of a matrix:
66+
67+
```cpp
68+
Vector col1 = product.col(1);
69+
```
70+
71+
some changes ...
72+
73+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// @ts-check
2+
3+
// Extra JS capability for selected tabs to be synced
4+
// The selection is stored in local storage so that it persists across page loads.
5+
6+
/**
7+
* @type {Record<string, HTMLElement[]>}
8+
*/
9+
let sd_id_to_elements = {};
10+
const storageKeyPrefix = "sphinx-design-tab-id-";
11+
12+
/**
13+
* Create a key for a tab element.
14+
* @param {HTMLElement} el - The tab element.
15+
* @returns {[string, string, string] | null} - The key.
16+
*
17+
*/
18+
function create_key(el) {
19+
let syncId = el.getAttribute("data-sync-id");
20+
let syncGroup = el.getAttribute("data-sync-group");
21+
if (!syncId || !syncGroup) return null;
22+
return [syncGroup, syncId, syncGroup + "--" + syncId];
23+
}
24+
25+
/**
26+
* Initialize the tab selection.
27+
*
28+
*/
29+
function ready() {
30+
// Find all tabs with sync data
31+
32+
/** @type {string[]} */
33+
let groups = [];
34+
35+
document.querySelectorAll(".sd-tab-label").forEach((label) => {
36+
if (label instanceof HTMLElement) {
37+
let data = create_key(label);
38+
if (data) {
39+
let [group, id, key] = data;
40+
41+
// add click event listener
42+
// @ts-ignore
43+
label.onclick = onSDLabelClick;
44+
45+
// store map of key to elements
46+
if (!sd_id_to_elements[key]) {
47+
sd_id_to_elements[key] = [];
48+
}
49+
sd_id_to_elements[key].push(label);
50+
51+
if (groups.indexOf(group) === -1) {
52+
groups.push(group);
53+
// Check if a specific tab has been selected via URL parameter
54+
const tabParam = new URLSearchParams(window.location.search).get(
55+
group
56+
);
57+
if (tabParam) {
58+
console.log(
59+
"sphinx-design: Selecting tab id for group '" +
60+
group +
61+
"' from URL parameter: " +
62+
tabParam
63+
);
64+
window.sessionStorage.setItem(storageKeyPrefix + group, tabParam);
65+
}
66+
}
67+
68+
// Check is a specific tab has been selected previously
69+
let previousId = window.sessionStorage.getItem(
70+
storageKeyPrefix + group
71+
);
72+
if (previousId === id) {
73+
// console.log(
74+
// "sphinx-design: Selecting tab from session storage: " + id
75+
// );
76+
// @ts-ignore
77+
label.previousElementSibling.checked = true;
78+
}
79+
}
80+
}
81+
});
82+
}
83+
84+
/**
85+
* Activate other tabs with the same sync id.
86+
*
87+
* @this {HTMLElement} - The element that was clicked.
88+
*/
89+
function onSDLabelClick() {
90+
let data = create_key(this);
91+
if (!data) return;
92+
let [group, id, key] = data;
93+
for (const label of sd_id_to_elements[key]) {
94+
if (label === this) continue;
95+
// @ts-ignore
96+
label.previousElementSibling.checked = true;
97+
}
98+
window.sessionStorage.setItem(storageKeyPrefix + group, id);
99+
}
100+
101+
document.addEventListener("DOMContentLoaded", ready, false);

_sphinx_design_static/sphinx-design.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
80.4 KB
Loading

0 commit comments

Comments
 (0)