Skip to content

Commit aeeab41

Browse files
author
Sébastien Loisel
committed
Tentatively 1.0.0
1 parent 16e6d6d commit aeeab41

16 files changed

+82
-58
lines changed

benchmark.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</ul>
1919
<ul class="nav">
2020
<li class="sep">DOWNLOADS:</li>
21-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
22-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
21+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
22+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
2323
</ul>
2424
</table>
2525

@@ -146,13 +146,13 @@
146146
],
147147
[
148148
'Sparse Laplacian LU', [3,5,10,15,20],
149-
function(n) { var A = sparse.scatter(coord.delsq(coord.grid(n))); return bench(function() { sparse.LUP(A); }); },
149+
function(n) { var A = numeric.sscatter(numeric.cdelsq(numeric.cgrid(n))); return bench(function() { numeric.sLUP(A); }); },
150150
function(n) { return 0; },
151151
function(n) { return 0; }
152152
],
153153
[
154154
'Banded Laplacian LU', [3,5,10,20,30],
155-
function(n) { var A = coord.delsq(coord.grid(n)); return bench(function() { coord.LU(A); }); },
155+
function(n) { var A = numeric.cdelsq(numeric.cgrid(n)); return bench(function() { numeric.cLU(A); }); },
156156
function(n) { return 0; },
157157
function(n) { return 0; }
158158
]

demo.html

+15-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<li class="nav"><a id = "linkdoc" class="nav" href="documentation.html">DOCUMENTATION</a></li>
1717
</ul>
1818
<ul class="nav">
19-
<li class="sep">DOWNLOADS:</li>
20-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
21-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
19+
<li class="sep">DOWNLOADS:</li>
20+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
21+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
2222
</ul>
2323
</table>
2424

@@ -34,6 +34,18 @@
3434
Numeric Workshop</a>
3535
</div>
3636

37+
<h1>Examples</h1>
38+
39+
Each of these examples runs in the <a href="workshop.php">Workshop</a>.
40+
<ul>
41+
<li> <a href="workshop.php?link=e59a653a5dacc4d07ba621997af8db88d3f9823560634d9a77fd721ca21a94bf">Linear algebra</a>
42+
<li> <a href="workshop.php?link=1f7f8d27dd34a7da5d3c5f8d85d04da39c7bb0cce445a516c8caf70e793718ed">Complex numbers</a>
43+
<li> <a href="workshop.php?link=4996ea0eba234054d4d9733ec94ce35d290ea027d6e77a72b2fba7d3fe25c852">Splines</a>
44+
<li> <a href="workshop.php?link=b61a0e9354e4f8199bcb0024ac2c7e905a476b6d28bac77ecbde3934b59b2566">ODE solver</a>
45+
<li> <a href="workshop.php?link=24e1118d5466a7db4d089d84f95691a7d1350d76a93663c5030a6700a387c0ec">Unconstrained optimization</a>
46+
<li> <a href="workshop.php?link=1a153efe9d69637aac68630f06a5cf7c0b574d11a8ef23cf8604aa7962070e6f">PDE and sparse linear algebra</a>
47+
</ul>
48+
3749
<h1>Workshop</h1>
3850

3951
The <a href="workshop.php">Workshop</a> is a Javascript console that can be used to experiment with

documentation.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ul>
1818
<ul class="nav">
1919
<li class="sep">DOWNLOADS:</li>
20-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
21-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
20+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
21+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
2222
</ul>
2323
</table>
2424
<!--
@@ -594,7 +594,7 @@ <h1>Singular value decomposition (Shanti Rao)</h1>
594594
-->
595595

596596
<h1>Sparse linear algebra</h1>
597-
Sparse linear algebra is available in the sparse module:
597+
Sparse linear algebra:
598598
<pre>
599599
> numeric.sidentity(3)
600600
[[1],
@@ -650,8 +650,8 @@ <h1>Sparse linear algebra</h1>
650650

651651
<h1>Coordinate matrices</h1>
652652

653-
Sparse matrices can be very slow in certain browsers. The <tt>coord</tt> module provides functions that
654-
work with matrices in the coordinate encoding using band strategies that often execute faster if
653+
Sparse matrices can be very slow in certain browsers. Functions that
654+
work with matrices in the coordinate encoding using band strategies may execute faster if
655655
your matrices happen to be banded.<br><br>
656656

657657
LU decomposition:

index.html

+15-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<li class="nav"><a id = "linkdoc" class="nav" href="documentation.html">DOCUMENTATION</a></li>
1717
</ul>
1818
<ul class="nav">
19-
<li class="sep">DOWNLOADS:</li>
20-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
21-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
19+
<li class="sep">DOWNLOADS:</li>
20+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
21+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
2222
</ul>
2323
</table>
2424

@@ -34,6 +34,18 @@
3434
Numeric Workshop</a>
3535
</div>
3636

37+
<h1>Examples</h1>
38+
39+
Each of these examples runs in the <a href="workshop.php">Workshop</a>.
40+
<ul>
41+
<li> <a href="workshop.php?link=bf9eb195e289cf58fe226b11ff9e70d3360865f1aa1565d23990ad12673fd7de">Linear algebra</a>
42+
<li> <a href="workshop.php?link=ca14363bad73fd337ba4e8ba6ff48b282894946396d845450e4d885cb04701c9">Complex numbers</a>
43+
<li> <a href="workshop.php?link=4689eae867086683d4def5c7101c75596452906b7198984a1bcfa24d0fef7f99">Splines</a>
44+
<li> <a href="workshop.php?link=fdd38094da018f6071cb2d51d47c7fb3de869cb5dd0b4f3b677b480ce7ffbd31">ODE solver</a>
45+
<li> <a href="workshop.php?link=4d89edb9e548da48eaf09578f5b3a3aa215b18e3933141ff643b9b0e4865d27f">Unconstrained optimization</a>
46+
<li> <a href="workshop.php?link=10db8ddaa8499c109058efe8aabd7b418e62b2ec5e0cfa368b9832f83b5b4166">PDE and sparse linear algebra</a>
47+
</ul>
48+
3749
<h1>Workshop</h1>
3850

3951
The <a href="workshop.php">Workshop</a> is a Javascript console that can be used to experiment with

resources/style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ background-color:#0000ff;
7272
a:link.dl,a:visited.dl
7373
{
7474
display:block;
75-
width:120px;
75+
width:175px;
7676
font-family:courier;
7777
font-size:12px;
7878
font-weight:bold;

src/documentation.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ul>
1818
<ul class="nav">
1919
<li class="sep">DOWNLOADS:</li>
20-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
21-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
20+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
21+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
2222
</ul>
2323
</table>
2424
<!--
@@ -594,7 +594,7 @@ <h1>Singular value decomposition (Shanti Rao)</h1>
594594
-->
595595

596596
<h1>Sparse linear algebra</h1>
597-
Sparse linear algebra is available in the sparse module:
597+
Sparse linear algebra:
598598
<pre>
599599
> numeric.sidentity(3)
600600
[[1],
@@ -650,8 +650,8 @@ <h1>Sparse linear algebra</h1>
650650

651651
<h1>Coordinate matrices</h1>
652652

653-
Sparse matrices can be very slow in certain browsers. The <tt>coord</tt> module provides functions that
654-
work with matrices in the coordinate encoding using band strategies that often execute faster if
653+
Sparse matrices can be very slow in certain browsers. Functions that
654+
work with matrices in the coordinate encoding using band strategies may execute faster if
655655
your matrices happen to be banded.<br><br>
656656

657657
LU decomposition:

src/numeric.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
"use strict";
2-
31
var numeric = (typeof exports === "undefined")?(function numeric() {}):(exports);
42

5-
numeric.version = "0.9.0";
3+
numeric.version = "1.0.0";
64

75
// 1. Utility functions
86
numeric.bench = function bench (f,interval) {
@@ -898,6 +896,7 @@ numeric.tensor = function tensor(x,y) {
898896

899897
// 3. The Tensor type T
900898
numeric.T = function T(x,y) { this.x = x; this.y = y; }
899+
numeric.t = function t(x,y) { return new numeric.T(x,y); }
901900

902901
numeric.Tbinop = function Tbinop(rr,rc,cr,cc,setup) {
903902
var io = numeric.indexOf;
@@ -2266,7 +2265,6 @@ numeric.Dopri = function Dopri(x,y,f,ymid,iterations,msg,events) {
22662265
numeric.Dopri.prototype._at = function _at(xi,j) {
22672266
function sqr(x) { return x*x; }
22682267
var sol = this;
2269-
var k,l, m = x.length;
22702268
var xs = sol.x;
22712269
var ys = sol.y;
22722270
var k1 = sol.f;

tools/build.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ if [ -f nodepid.log ]; then
1010
kill -9 $nodepid || true
1111
rm -f nodepid.log
1212
fi
13-
cat ../src/numeric.js ../src/seedrandom.js ../src/quadprog.js ../src/svd.js > ../lib/numeric.js
14-
uglifyjs ../lib/numeric.js > ../lib/numeric-min.js
13+
ver=`grep 'numeric.version.*=.*"' ../src/numeric.js | sed 's/numeric.version[ =]*"\([0-9.]*\)".*/\1/'`
14+
echo "Version is $ver"
15+
cat ../src/numeric.js ../src/seedrandom.js ../src/quadprog.js ../src/svd.js > ../lib/numeric-$ver.js
16+
uglifyjs ../lib/numeric-$ver.js > ../lib/numeric-$ver.min.js
1517
cat jquery-1.7.1.min.js jquery.flot.min.js 'Crypto-JS v2.4.0/crypto/crypto-min.js' 'Crypto-JS v2.4.0/crypto-sha256/crypto-sha256.js' json2.js > megalib.js
16-
echo "" | cat closurelib.js sylvester.js - ../lib/numeric-min.js jquery-1.7.1.min.js jquery.flot.min.js > benchlib.js
18+
echo "" | cat closurelib.js sylvester.js - ../lib/numeric-$ver.min.js jquery-1.7.1.min.js jquery.flot.min.js > benchlib.js
1719
cp ../src/documentation.html ..
18-
php mkdb.php noversion
20+
rm -f ../workshop.php
21+
sed -e '/WORKSHOPHTML/r workshop.html' -e 's/WORKSHOPHTML//' -e "s/VERSIONSTRING/$ver/" workshop_in.php > ../workshop.php
1922
cd ..
2023
runjs=`which d8 || which jsdb`
2124
echo Using $runjs

tools/deploy/report.html

+7-7
Large diffs are not rendered by default.

tools/deploy/stage.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@ cd `dirname $0`
55
rm -f version.txt
66
echo $version > version.txt
77
source config.sh
8-
cd ..
9-
echo "stage.sh: making db"
10-
php ./mkdb.php $version
11-
echo "stage.sh: making demo"
12-
python ./make_demo.py
13-
cd ../..
8+
cd ../../..
149
rm -f numeric.tar.gz
1510
echo "stage.sh: preparing tarball"
1611
tar cvfz numeric.tar.gz numeric
1712
echo "stage.sh: uploading tarball"
1813
scp numeric.tar.gz $user@$server:./
1914
echo "stage.sh: linking staging to v$version on $server"
20-
ssh $server -l $user "( tar xvfz numeric.tar.gz && mv numeric $webroot/v$version && cd $webroot && rm -f staging && ln -s v$version staging && cd staging/tools && php mkdb.php $version && deploy/clean.sh && echo Staging successful. ) || echo FAIL: Staging."
15+
ssh $server -l $user "tar xvfz numeric.tar.gz && mv numeric $webroot/v$version && cd $webroot && rm -f staging && ln -s v$version staging && cd staging/tools && deploy/clean.sh && echo Staging successful."
2116
echo "stage.sh: done"

tools/deploy/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2012-02-02_15-10-40
1+
2012-02-02_22-41-58

tools/selenium_links.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test(links,driver):
4444
mainlinks = [("linkhome","library for numerical computations"),
4545
("linkworkshop","IN"),
4646
("linkdoc","vectors and matrices"),
47-
("linklib","use strict"),
47+
("linklib","var numeric"),
4848
("linklibmin","var numeric="),]
4949
driver=0
5050
print "Link testing."

tools/unit2.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ function XMLHttpRequest() {
2020
var foo;
2121
if(typeof system !== "undefined") { foo = new Stream('./documentation.html').readFile(); }
2222
else { foo = read('./documentation.html'); }
23+
var baz;
24+
if(typeof system !== "undefined") { baz = new Stream('./src/numeric.js').readFile(); }
25+
else { baz = read('./src/numeric.js'); }
26+
var ver = baz.match(/numeric.version[ =]*"([0-9.]*)".*/)[1]
2327
var bar = foo.match(/<pre>[\s\S]*?(?=<\/pre>)/g).join('\n').replace(/<pre>/g,'').split('\n> ')
2428
var baz = [];
2529
var k,k0=0;
@@ -28,7 +32,7 @@ for(k=0;k<bar.length;k++) {
2832
if(j>0) { baz[k0] = [bar[k].substring(0,j),bar[k].substring(j+1)]; k0++; }
2933
}
3034

31-
load('./lib/numeric.js');
35+
load('./lib/numeric-'+ver+'.js');
3236
if(typeof numeric === "undefined") { throw new Error("Could not load numeric.js"); }
3337
var unit_pass = 0, unit_fail = 0;
3438
var a,b,msg;

tools/workshop.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
</ul>
2727
<ul class="nav">
2828
<li class="sep">DOWNLOADS:</li>
29-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
30-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
29+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
30+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
3131
</ul>
3232
</table>
3333

tools/workshop_in.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function con() {
3737
$foo = json_decode($restore,true) or die("json error");
3838
$incs = $foo['scripts'];
3939
if(is_null($incs)) {
40-
$incs = array(1 => '/scripts/numeric.js?key=NUMERICJSHASH');
40+
$incs = array(1 => 'lib/numeric-VERSIONSTRING.js');
4141
}
4242
echo <<<EOT
4343
workshop._restore = $restore;
@@ -47,13 +47,13 @@ function con() {
4747
workshop._restore = ((typeof localStorage.savedata === "string")?
4848
(JSON.parse(localStorage.savedata)):
4949
{inputs: [], outputs: [],
50-
scripts: ["/scripts/numeric.js?key=NUMERICJSHASH"] });
50+
scripts: ["lib/numeric-VERSIONSTRING.js"] });
5151
EOT;
5252
}
5353
?>
5454

5555
workshop.version = "VERSIONSTRING";
56-
workshop.updateVersion = "/scripts/numeric.js?key=NUMERICJSHASH";
56+
workshop.updateVersion = "lib/numeric-VERSIONSTRING.js";
5757
workshop.preload(workshop._restore);
5858
</script>
5959

workshop.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function con() {
2121
}
2222
?>
2323

24+
2425
<html>
2526
<head>
2627
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -49,8 +50,8 @@ function con() {
4950
</ul>
5051
<ul class="nav">
5152
<li class="sep">DOWNLOADS:</li>
52-
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric.js">numeric.js</a></li>
53-
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-min.js">numeric-min.js</a></li>
53+
<li class="nav"><a id = "linklib" class="dl" href="lib/numeric-1.0.0.js">numeric-1.0.0.js</a></li>
54+
<li class="nav"><a id = "linklibmin" class="dl" href="lib/numeric-1.0.0.min.js">numeric-1.0.0.min.js</a></li>
5455
</ul>
5556
</table>
5657

@@ -390,7 +391,6 @@ function submit() {
390391
<br><br><br>
391392

392393

393-
394394
<script>
395395
<?php
396396
$incs = NULL;
@@ -405,7 +405,7 @@ function submit() {
405405
$foo = json_decode($restore,true) or die("json error");
406406
$incs = $foo['scripts'];
407407
if(is_null($incs)) {
408-
$incs = array(1 => '/scripts/numeric.js?key=709eb0c78c0bfcf40eeee9b10f4be6919eb3a6271c38003e93ad62bafd07cfc6');
408+
$incs = array(1 => 'lib/numeric-1.0.0.js');
409409
}
410410
echo <<<EOT
411411
workshop._restore = $restore;
@@ -415,13 +415,13 @@ function submit() {
415415
workshop._restore = ((typeof localStorage.savedata === "string")?
416416
(JSON.parse(localStorage.savedata)):
417417
{inputs: [], outputs: [],
418-
scripts: ["/scripts/numeric.js?key=709eb0c78c0bfcf40eeee9b10f4be6919eb3a6271c38003e93ad62bafd07cfc6"] });
418+
scripts: ["lib/numeric-1.0.0.js"] });
419419
EOT;
420420
}
421421
?>
422422

423-
workshop.version = "noversion";
424-
workshop.updateVersion = "/scripts/numeric.js?key=709eb0c78c0bfcf40eeee9b10f4be6919eb3a6271c38003e93ad62bafd07cfc6";
423+
workshop.version = "1.0.0";
424+
workshop.updateVersion = "lib/numeric-1.0.0.js";
425425
workshop.preload(workshop._restore);
426426
</script>
427427

0 commit comments

Comments
 (0)