-
Notifications
You must be signed in to change notification settings - Fork 5
/
sylvesterTestOriginal.html
68 lines (59 loc) · 1.92 KB
/
sylvesterTestOriginal.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
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript" src="static/OriginalSylvester.js"> </script>
<script>
function createArrayMatrix(width, height, valueOne, valueTwo){
arrayMatrix = []
row = []
for(i = 0; i < width; ++i){
if(i % 2 == 0)
row[row.length] = valueOne;
if(i % 2 == 1){
if(valueTwo)
row[row.length] = valueTwo;
else
row[row.length] = valueOne;
}
}
for(i = 0; i < height; ++i){
arrayMatrix[arrayMatrix.length] = row.slice();
}
return arrayMatrix;
}
$(document).ready(function(){
$("#execute").click(function(){
var startDate = new Date();
one = $M(createArrayMatrix(1024, 1024, 1, 2));
other = $M(createArrayMatrix(1024, 1024, 1));
two = one.multiply(other);
alert((new Date() - startDate) / 1000.0);
});
$("#executeSample").click(function(){
var one = $M([[1,2], [1, 2 ]]);
var two= $M([[1,2], [1, 2 ]]);
var result = one.multiply(two)
alert(result.elements);
});
});
</script>
</head>
<body>
<div style="padding: 5px; border: 1px solid black; position:relative; width:500px;">
This page includes the original sylvester library. Hit execute to benchmark a multiply of two 1024x1024 matrices. (You will have to hit continue when it asks if you want to stop the long running script.)<br/>
</div>
<input id="execute" type="button" value="execute"><br/><br/>
Open up firebug or the console to test it out <br/>
example code:
<pre>
<code>
var one = $M([[1,2], [1, 2 ]]);
var two= $M([[1,2], [1, 2 ]]);
var result = one.multiply(two)
alert(result.elements);
</code>
</pre>
<input id="executeSample" type="button" value="execute"><br/><br/>
<span><a href="sylvesterTest.html">gpu sylvester</a> <a href="sylvesterTestOriginal.html">original sylvester</a></span>
</body>
</html>