wgblas 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +11 -12
  2. package/dist/wgblas.browser.js +1078 -37
  3. package/index.d.mts +6 -0
  4. package/index.mjs +6 -0
  5. package/package.json +32 -1
  6. package/src/classes/GpuMatrix.d.mts +85 -0
  7. package/src/classes/GpuMatrix.mjs +91 -0
  8. package/src/classes/GpuVector.d.mts +11 -7
  9. package/src/classes/GpuVector.mjs +31 -5
  10. package/src/dasum/dasum.d.mts +48 -0
  11. package/src/dasum/dasum.mjs +121 -0
  12. package/src/init.mjs +3 -1
  13. package/src/isamax/isamax.mjs +66 -67
  14. package/src/random/random.d.mts +37 -0
  15. package/src/random/random.mjs +17 -0
  16. package/src/sasum/sasum.mjs +55 -51
  17. package/src/saxpy/saxpy.mjs +48 -35
  18. package/src/scopy/scopy.mjs +43 -32
  19. package/src/sdot/sdot.mjs +60 -55
  20. package/src/sgemv/sgemv.d.mts +118 -0
  21. package/src/sgemv/sgemv.mjs +141 -0
  22. package/src/shaders/browser-shaders.mjs +20 -0
  23. package/src/shaders/dasum.wgsl +98 -0
  24. package/src/shaders/f64add.wgsl +281 -0
  25. package/src/shaders/isamax.wgsl +32 -9
  26. package/src/shaders/reduction/sumF64.wgsl +49 -0
  27. package/src/shaders/sasum.wgsl +18 -4
  28. package/src/shaders/sdot.wgsl +18 -4
  29. package/src/shaders/sgemv_n.wgsl +75 -0
  30. package/src/shaders/sgemv_t.wgsl +65 -0
  31. package/src/shaders/snrm2.wgsl +22 -4
  32. package/src/shaders/ssymv.wgsl +69 -0
  33. package/src/shaders/strmv.wgsl +103 -0
  34. package/src/shaders/strsv_apply_inverse.wgsl +47 -0
  35. package/src/shaders/strsv_invert_block.wgsl +109 -0
  36. package/src/shaders/strsv_update.wgsl +75 -0
  37. package/src/snrm2/snrm2.mjs +56 -52
  38. package/src/srot/srot.mjs +57 -41
  39. package/src/srotm/srotm.mjs +54 -38
  40. package/src/sscal/sscal.mjs +43 -32
  41. package/src/sswap/sswap.mjs +49 -34
  42. package/src/ssymv/ssymv.d.mts +109 -0
  43. package/src/ssymv/ssymv.mjs +130 -0
  44. package/src/strmv/strmv.d.mts +109 -0
  45. package/src/strmv/strmv.mjs +132 -0
  46. package/src/strsv/strsv.d.mts +98 -0
  47. package/src/strsv/strsv.mjs +212 -0
  48. package/src/util/benchmark.mjs +1 -1
  49. package/src/util/bindgroup.mjs +14 -10
  50. package/src/util/buffer.mjs +7 -2
  51. package/src/util/compute.mjs +41 -15
  52. package/src/util/f64pack.mjs +152 -0
  53. package/src/util/pipeline.mjs +32 -17
  54. package/src/util/result.mjs +8 -4
  55. package/src/util/workgroup.mjs +10 -10
package/README.md CHANGED
@@ -14,6 +14,9 @@
14
14
  - [isamax](https://manit2004.github.io/wgblas/functions/docs.isamax.html)
15
15
  - [srot](https://manit2004.github.io/wgblas/functions/docs.srot.html)
16
16
  - [srotm](https://manit2004.github.io/wgblas/functions/docs.srotm.html)
17
+ - [sgemv](https://manit2004.github.io/wgblas/functions/docs.sgemv.html)
18
+ - [ssymv](https://manit2004.github.io/wgblas/functions/docs.ssymv.html)
19
+ - [strmv](https://manit2004.github.io/wgblas/functions/docs.strmv.html)
17
20
 
18
21
  ## Browser Support
19
22
 
@@ -51,24 +54,21 @@ Restart Firefox after making changes.
51
54
 
52
55
  ## Requirements
53
56
 
54
- - Node.js 18+
57
+ - Node.js 22+
55
58
 
56
- ## Example usage
57
-
58
- This package is not yet published to npm. Clone the repo and install it locally in your project:
59
+ ## Installation
59
60
 
60
61
  ```sh
61
- git clone https://github.com/manit2004/wgblas.git
62
- cd your-project
63
- npm install /path/to/wgblas
62
+ npm install wgblas
64
63
  ```
65
64
 
65
+ ## Example usage
66
+
66
67
  ### Example Code Snippet
67
68
 
68
69
  ```js
69
- import { init, cleanup } from "wgblas";
70
+ import { init, cleanup, randomFloat32Array } from "wgblas";
70
71
  import { sscal } from "wgblas/sscal";
71
- import { randomFloat32Array } from "wgblas/util/random";
72
72
 
73
73
  const device = await init();
74
74
 
@@ -92,7 +92,7 @@ No bundler needed. Load the pre-built browser bundle from the CDN and use `windo
92
92
  <head>
93
93
  <meta charset="UTF-8" />
94
94
  <title>sscal — wgblas browser example</title>
95
- <script src="https://manit2004.github.io/wgblas/wgblas.browser.js"></script>
95
+ <script src="https://unpkg.com/wgblas/dist/wgblas.browser.js"></script>
96
96
  </head>
97
97
  <body>
98
98
  <pre id="out">Running…</pre>
@@ -126,11 +126,10 @@ No bundler needed. Load the pre-built browser bundle from the CDN and use `windo
126
126
  `GpuVector` keeps data resident on the GPU between operations — upload once, chain any number of operations, read back once. This eliminates the redundant uploads and readbacks between steps, which are often more expensive than the compute itself.
127
127
 
128
128
  ```js
129
- import { init, cleanup } from "wgblas";
129
+ import { init, cleanup, randomFloat32Array } from "wgblas";
130
130
  import { saxpy } from "wgblas/saxpy";
131
131
  import { sscal } from "wgblas/sscal";
132
132
  import { GpuVector } from "wgblas/classes/GpuVector";
133
- import { randomFloat32Array } from "wgblas/util/random";
134
133
 
135
134
  const device = await init();
136
135