Skip to content

Commit 423fa53

Browse files
author
Jessica Shi
committed
tweak format names, add CSC/DCSC
1 parent a209ddc commit 423fa53

File tree

10 files changed

+52
-41
lines changed

10 files changed

+52
-41
lines changed

codegen.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ <h6 style="margin-bottom: 0px; margin-top: 18px">Input a tensor algebra expressi
8787
<tr>
8888
<th class="mdl-data-table__cell--non-numeric" width="100">
8989
<div align="center" style="position:relative"><big>Tensor</big></div></th>
90-
<th class="mdl-data-table__cell--non-numeric" width="120px"
90+
<th class="mdl-data-table__cell--non-numeric" width="175px"
9191
style="padding-left: 0px">
9292
<div style="display:inline"><big>Format&nbsp;</big></div>
9393
</th>
@@ -101,15 +101,15 @@ <h6 style="margin-bottom: 0px; margin-top: 18px">Input a tensor algebra expressi
101101
<div id="helpMenu" class="help-menu mdl-menu mdl-js-menu mdl-js-ripple-effect" for="btnHelp">
102102
<p>
103103
<strong>Dense</strong> levels store the size of the dimension $(N)$ and encode the coordinates in the interval $[0, N)$.
104-
<img src="images/dense.png" class="centered-img" style="height: 35px">
104+
<img src="images/dense-arrays.jpg" class="centered-img" style="height: 25px; padding-top:10px">
105105
</p>
106106
<p>
107107
<strong>Sparse</strong> levels store coordinates in a segment of the $\texttt{crd}$ array, with segment bounds stored in the $\texttt{pos}$ array.
108-
<img src="images/sparse.png" class="centered-img" style="height: 60px">
108+
<img src="images/compressed-arrays.jpg" class="centered-img" style="height: 50px; padding-top:10px">
109109
</p>
110110
<p>
111111
<strong>Singleton</strong> levels store individual coordinates (with no siblings) in the $\texttt{crd}$ array.
112-
<img src="images/singleton.png" class="centered-img" style="height: 40px">
112+
<img src="images/singleton-arrays.jpg" class="centered-img" style="height: 25px; padding-top:10px">
113113
</p>
114114
<p>
115115
A level is <strong>unique (U)</strong> if no collection of coordinates that share the same ancestors contains duplicates, and it is <strong>not unique (&not;U)</strong> otherwise.

images/compressed-arrays.jpg

17.4 KB
Loading

images/dense-arrays.jpg

2.31 KB
Loading

images/dense.png

-6.53 KB
Binary file not shown.

images/singleton-arrays.jpg

8.98 KB
Loading

images/singleton.png

-9.23 KB
Binary file not shown.

images/sparse.png

-19 KB
Binary file not shown.

javascripts/demo.js

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -136,42 +136,57 @@ function demo() {
136136
return { formats: formats, ordering: ordering };
137137
},
138138
createEntryFromName: function(name, order) {
139-
var rules = {
140-
"Dense": function(i) { return 'd'; },
141-
"Sparse": function(i) { return 's'; },
142-
"CSR": function(i) { return (i == 0) ? 'd' : 's'; },
143-
"COO": function(i) {
144-
if (i == 0) {
145-
return 'u';
146-
} else if (i < order - 1) {
147-
return 'c';
148-
} else {
149-
return 'q';
150-
}
151-
}
152-
};
153-
rules["DCSR"] = rules["CSF"] = rules["Sparse"];
154-
155139
var formats = [];
156140
var ordering = [];
157141

158-
var rule = rules[name];
142+
var rule = tblFormatsView.getFormatNameRule(name, order);
159143
for (var i = 0; i < order; ++i) {
160144
formats.push(rule(i));
161-
ordering.push(i);
145+
if (name == "CSC" || name == "DCSC") {
146+
ordering.push(order - i - 1);
147+
} else {
148+
ordering.push(i);
149+
}
162150
}
163151

164152
return { formats: formats, ordering: ordering };
165153
},
154+
getFormatNameRule : function(name, order) {
155+
switch (name) {
156+
case "Sparse array":
157+
case "DCSR":
158+
case "DCSC":
159+
case "CSF":
160+
return function(i) { return 's'; };
161+
case "CSR":
162+
case "CSC":
163+
return function(i) { return (i == 0) ? 'd' : 's'; };
164+
case "COO":
165+
return function(i) {
166+
if (i == 0) {
167+
return 'u';
168+
} else if (i < order - 1) {
169+
return 'c';
170+
} else {
171+
return 'q';
172+
}
173+
};
174+
case "Dense array":
175+
default:
176+
return function(i) { return 'd'; };
177+
}
178+
},
166179
getFormatNamesList : function(order) {
167-
var names = ["Dense"];
180+
var names = ["Dense array"];
168181

169182
if (order == 1) {
170-
names.push("Sparse");
183+
names.push("Sparse array");
171184
} else if (order == 2) {
172185
names.push("COO");
173186
names.push("CSR");
187+
names.push("CSC");
174188
names.push("DCSR");
189+
names.push("DCSC");
175190
} else if (order >= 3) {
176191
names.push("COO");
177192
names.push("CSF");
@@ -193,9 +208,9 @@ function demo() {
193208
case 'd':
194209
return "Dense";
195210
case 's':
196-
return "Sparse (U)";
211+
return "Compressed (U)";
197212
case 'u':
198-
return "Sparse (&not;U)"
213+
return "Compressed (&not;U)"
199214
case 'q':
200215
return "Singleton (U)";
201216
case 'c':
@@ -233,7 +248,7 @@ function demo() {
233248
listTensorsBody += "style=\"padding: 0px\">";
234249
listTensorsBody += "<div class=\"dropdown mdl-textfield mdl-js-textfield ";
235250
listTensorsBody += "mdl-textfield--floating-label getmdl-select\" ";
236-
listTensorsBody += "style=\"width: 100px; cursor: move\">";
251+
listTensorsBody += "style=\"width: 155px; cursor: move\">";
237252
listTensorsBody += "<input class=\"mdl-textfield__input\" ";
238253
listTensorsBody += "data-toggle=\"dropdown\" id=\"";
239254
listTensorsBody += formatNameId;
@@ -297,7 +312,7 @@ function demo() {
297312
listTensorsBody += "\"><li class =\"dense\"><a data-val=\""
298313
listTensorsBody += "d\">Dense</a></li>";
299314
listTensorsBody += "<li class=\"sparse dropdown-submenu\">";
300-
listTensorsBody += "<a>Sparse";
315+
listTensorsBody += "<a>Compressed";
301316
listTensorsBody += "<i class=\"material-icons\" style=\"float:right\">";
302317
listTensorsBody += "keyboard_arrow_right</i></a>";
303318
listTensorsBody += "<ul class=\"level-formats dropdown-menu\">";
@@ -533,9 +548,9 @@ function demo() {
533548
spmv: { name: "SpMV",
534549
code: "y(i) = A(i,j) * x(j)",
535550
formats: {
536-
y: { name: "Dense", levels: { formats: ["d"], ordering: [0] } },
551+
y: { name: "Dense array", levels: { formats: ["d"], ordering: [0] } },
537552
A: { name: "CSR", levels: { formats: ["d", "s"], ordering: [0, 1] } },
538-
x: { name: "Dense", levels: { formats: ["d"], ordering: [0] } }
553+
x: { name: "Dense array", levels: { formats: ["d"], ordering: [0] } }
539554
}
540555
},
541556
add: { name: "Sparse matrix addition",
@@ -551,16 +566,16 @@ function demo() {
551566
formats: {
552567
A: { name: "DCSR", levels: { formats: ["s", "s"], ordering: [0, 1] } },
553568
B: { name: "CSF", levels: { formats: ["s", "s", "s"], ordering: [0, 1, 2] } },
554-
c: { name: "Dense", levels: { formats: ["d"], ordering: [0] } },
569+
c: { name: "Dense array", levels: { formats: ["d"], ordering: [0] } },
555570
}
556571
},
557572
mttkrp: { name: "MTTKRP",
558573
code: "A(i,j) = B(i,k,l) * C(k,j) * D(l,j)",
559574
formats: {
560-
A: { name: "Dense", levels: { formats: ["d", "d"], ordering: [0, 1] } },
575+
A: { name: "Dense array", levels: { formats: ["d", "d"], ordering: [0, 1] } },
561576
B: { name: "CSF", levels: { formats: ["s", "s", "s"], ordering: [0, 1, 2] } },
562-
C: { name: "Dense", levels: { formats: ["d", "d"], ordering: [0, 1] } },
563-
D: { name: "Dense", levels: { formats: ["d", "d"], ordering: [0, 1] } },
577+
C: { name: "Dense array", levels: { formats: ["d", "d"], ordering: [0, 1] } },
578+
D: { name: "Dense array", levels: { formats: ["d", "d"], ordering: [0, 1] } },
564579
}
565580
}
566581
};

stylesheets/dropdown.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,16 @@
55
margin: 0;
66
}
77

8-
.formats {
9-
width: 100px;
10-
}
11-
128
.formats li {
13-
width: 100px;
9+
width: 155px;
1410
}
1511

1612
.level-formats {
1713
padding-top: 0px;
1814
}
1915

2016
.level-formats li {
21-
width: 140px;
17+
width: 155px;
2218
}
2319

2420
.dropdown li {

stylesheets/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ a{
138138

139139
.sortable li {
140140
float: left;
141-
width: 140px;
141+
width: 155px;
142142
padding: 0.5em;
143143
padding-top: 0px;
144144
padding-bottom: 0px;

0 commit comments

Comments
 (0)