Skip to content

Commit 90c3a5d

Browse files
committed
Added demo
1 parent 57d2c6e commit 90c3a5d

17 files changed

Lines changed: 295 additions & 5 deletions

File tree

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
.mocharc.json
55
tsconfig.json
66
webpack.config.js
7+
test
8+
asconfig.json
9+
src

demo/node/.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# These are some examples of commonly ignored file patterns.
2+
# You should customize this list as applicable to your project.
3+
# Learn more about .gitignore:
4+
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
5+
6+
# Node artifact files
7+
node_modules/
8+
dist/
9+
10+
# Compiled Java class files
11+
*.class
12+
13+
# Compiled Python bytecode
14+
*.py[cod]
15+
16+
# Log files
17+
*.log
18+
19+
# Package files
20+
*.jar
21+
22+
# Maven
23+
target/
24+
25+
# JetBrains IDE
26+
.idea/
27+
28+
# Unit test reports
29+
TEST*.xml
30+
31+
# Generated by MacOS
32+
.DS_Store
33+
34+
# Generated by Windows
35+
Thumbs.db
36+
37+
# Applications
38+
*.app
39+
*.exe
40+
*.war
41+
42+
# Large media files
43+
*.mp4
44+
*.tiff
45+
*.avi
46+
*.flv
47+
*.mov
48+
*.wmv
49+
50+
# ENV files
51+
52+
package-lock.json

demo/node/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# numts demo node

demo/node/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "numts-demo-node",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"start": "ts-node src/index.ts"
7+
},
8+
"dependencies": {
9+
"numts": "file:../../"
10+
},
11+
"devDependencies": {
12+
"@types/node": "^18.13.0",
13+
"typescript": "^4.9.5",
14+
"ts-node": "^10.9.1"
15+
}
16+
}

demo/node/src/index.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {NdArray} from "numts";
2+
3+
async function main() {
4+
const a = await NdArray.From([1, 2, 3, 4, 5, 6, 7, 8], [2, 4], "i8", "wasm");
5+
const b = await NdArray.From([-1, -2, -3, -4, -5, -6, -7, -8], [2, 4], "i8", "wasm");
6+
console.log(a.getData());
7+
a.add(b);
8+
console.log(a.getData());
9+
10+
const a1 = await NdArray.From([1, 2, 3, 4, 5, 6, 7, 8], [2, 4], "i8", "js");
11+
const b1 = await NdArray.From([-1, -2, -3, -4, -5, -6, -7, -8], [2, 4], "i8", "js");
12+
console.log(a1.getData());
13+
a1.add(b1);
14+
console.log(a1.getData());
15+
}
16+
17+
(async () => {
18+
await main();
19+
})();

demo/node/tsconfig.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"include": ["src"],
3+
"exclude": ["node_modules", "dist"],
4+
"compilerOptions": {
5+
"module": "es2020",
6+
"target": "es2020",
7+
"moduleResolution": "node",
8+
"declaration": true,
9+
"outDir": "dist",
10+
"strict": true,
11+
"esModuleInterop": true,
12+
"baseUrl": ".",
13+
},
14+
"ts-node": {
15+
"esm": true,
16+
"experimentalSpecifierResolution": "node"
17+
}
18+
}

demo/web/.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# These are some examples of commonly ignored file patterns.
2+
# You should customize this list as applicable to your project.
3+
# Learn more about .gitignore:
4+
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
5+
6+
# Node artifact files
7+
node_modules/
8+
dist/
9+
10+
# Compiled Java class files
11+
*.class
12+
13+
# Compiled Python bytecode
14+
*.py[cod]
15+
16+
# Log files
17+
*.log
18+
19+
# Package files
20+
*.jar
21+
22+
# Maven
23+
target/
24+
25+
# JetBrains IDE
26+
.idea/
27+
28+
# Unit test reports
29+
TEST*.xml
30+
31+
# Generated by MacOS
32+
.DS_Store
33+
34+
# Generated by Windows
35+
Thumbs.db
36+
37+
# Applications
38+
*.app
39+
*.exe
40+
*.war
41+
42+
# Large media files
43+
*.mp4
44+
*.tiff
45+
*.avi
46+
*.flv
47+
*.mov
48+
*.wmv
49+
50+
# ENV files
51+
52+
package-lock.json

demo/web/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# numts demo web

demo/web/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "numts-demo-web",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"start:prod": "webpack serve --mode production",
7+
"build:prod": "webpack --target web --mode production"
8+
},
9+
"dependencies": {
10+
"numts": "file:../../"
11+
},
12+
"devDependencies": {
13+
"html-loader": "^4.2.0",
14+
"html-webpack-plugin": "^5.5.0",
15+
"ts-loader": "^9.4.2",
16+
"typescript": "^4.9.5",
17+
"webpack": "^5.75.0",
18+
"webpack-cli": "^5.0.1",
19+
"webpack-dev-server": "^4.11.1",
20+
"ts-node": "^10.9.1"
21+
}
22+
}

0 commit comments

Comments
 (0)