Skip to content

Commit 03f64ba

Browse files
committed
use simpler tabulation function
1 parent 50ff257 commit 03f64ba

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pages/tabulation_3dim_triangular.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ speed: 20
66

77
{{> tabulation_libs }}
88

9-
The solution for the subword triple $(i..j,k..l,m..n)$ is stored at $M[adr(i,j),adr(k,l),adr(m,n)]$ where $M$ is a three-dimensional matrix of size $(|w|+1)\cdot(|w|+2) / 2$ in all dimensions, and $adr(i,j) = |w|\cdot i - (i\cdot(i-1)) \div 2 + j$. Similar to the [two-dimensional case](/tabulation_2dim_triangular) space loss is caused by overlapping subwords.
9+
The solution for the subword triple $(i..j,k..l,m..n)$ is stored at $M[adr(i,j),adr(k,l),adr(m,n)]$ where $M$ is a three-dimensional matrix of size $(|w|+1)\cdot(|w|+2) / 2$ in all dimensions, and $adr(i,j) = i + (j\cdot(j+1)) \div 2$. Similar to the [two-dimensional case](/tabulation_2dim_triangular) space loss is caused by overlapping subwords.
1010

1111
**Hint**: Rotate and zoom with your left mouse button and scroll wheel!
1212

@@ -17,8 +17,7 @@ The solution for the subword triple $(i..j,k..l,m..n)$ is stored at $M[adr(i,j),
1717

1818
<script>
1919
Tabulation.prototype.adr = function(i,j) {
20-
//console.log(i + "," + j + " -> " + (this.len*i - Math.floor((i*(i-1)) / 2) + j));
21-
return this.len*i - Math.floor((i*(i-1)) / 2) + j;
20+
return i + Math.floor((j*(j+1)) / 2);
2221
}
2322

2423
Tabulation.prototype.solve = function(x1,x2,x3,x4,x5,x6,c) {
@@ -91,4 +90,4 @@ $(function() {
9190
tab.fill();
9291
window.tab = tab;
9392
});
94-
</script>
93+
</script>

0 commit comments

Comments
 (0)