generated from metachris/typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbrowser-test.html
70 lines (61 loc) · 2.17 KB
/
browser-test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<script src="./dist/esbuild/tensor-diagrams.js"></script>
<link rel='stylesheet' href='./src/diagram.css'>
</head>
<body>
<div id="simpler" class="equation"></div>
<div id="simpler-formula" class="equation"></div>
<div id="trAB" class="equation"></div>
<div id="tensorLabel" class="equation"></div>
<div id="implicitdots" class="equation"></div>
<div id="dl-data" class="equation"></div>
<div id="dl-avgs" class="equation"></div>
<script>
TensorDiagram.new()
.addTensor("x", "start", [], ["i"], [], [], { labelPos: 'down' })
.addTensor("A", "right", ["i"], ["j"], [], [], { showLabel: false, size: 40 })
.addTensor("B", "right", ["j"], ["k"], [], [], { shape: 'triangleLeft', color: 'white' })
.addContraction(0, 1, "i")
.addContraction(1, 2, "j")
.setSize(220, 120)
.draw("#simpler-formula", true, [
{ name: "", label: "= ∑_ij" },
{ name: "x", label: "x_i" },
{ name: "A", label: "A_ij" },
{ name: "B", label: "B_jk" },
]);
TensorDiagram.new()
.addTensor("A", { x: 1, y: 0 }, ["i"], ["j"])
.addTensor("B", "right", ["j"], ["i"])
.addContraction(0, 1, "i", "down")
.addContraction(0, 1, "j")
.setSize(220, 120)
.draw("#trAB");
TensorDiagram.new()
.addTensor("A", { x: 1, y: 0 }, [], [], [], [], { labelPos: 'up left' })
.setSize(140, 120)
.draw("#tensorLabel");
TensorDiagram.new()
.addTensor("x", "start", [], ["i"])
.addTensor("A", "right", ["i"], ["j"])
.addTensor("B", { x: 3, y: 0 }, ["j"], ["k"])
.addTensor("C", { x: 2, y: 1 }, [], [], ["j"], ["l"], { labelPos: "center" })
.addSummation("i")
.addSummation("j", { x: 2, y: 0 })
.addSummation("k")
.setSize(300, 200)
.draw("#implicitdots");
TensorDiagram.new()
.addTensor("X", "start", [], ["n", "c", "x", "y"], [], [])
.setSize(160, 300)
.draw("#dl-data");
TensorDiagram.new()
.addTensor("X", "start", [], ["n", "c", "x", "y"], [], [], { shape: "rectangle" })
.addSummation("n")
.addSummation("x")
.setSize(160, 300)
.draw("#dl-avgs");
</script>
</body>
</html>