1.0.0 • Published 11 months ago
@cpp.js/sample-lib-prebuilt-matrix v1.0.0
@cpp.js/sample-lib-prebuilt-matrix
Simple matrix multiplier
Integration
Start by installing these package with the following command:
npm install @cpp.js/sample-lib-prebuilt-matrixTo enable the library, modify the cppjs.config.js file as shown below.
+import matrix from '@cpp.js/sample-lib-prebuilt-matrix/cppjs.config.js';
export default {
dependencies: [
+ matrix
]
paths: {
config: import.meta.url,
},
};Usage
Below are the steps to use the Simple Matrix Multiplier in your C++ or JavaScript code.
Usage in C++ Code
+#include <Matrix.h>
std::string Native::sample() {
+ auto firstMatrix = std::make_shared<Matrix>(9, 1);
+ auto secondMatrix = std::make_shared<Matrix>(9, 2);
+ auto resultStr = std::to_string(firstMatrix->multiple(secondMatrix)->get(0));
+ return "J₃ * (2*J₃) = " + resultStr + "*J₃";
}Usage in JavaScript Code (web, with plugin)
import { initCppJs, Matrix } from '@cpp.js/sample-lib-prebuilt-matrix/Matrix.h';
await initCppJs();
const a = new Matrix(1210000, 1);
const b = new Matrix(1210000, 2);
const result = a.multiple(b);
console.log(result.get(0));Usage in JavaScript Code (web, without plugin)
import 'node_modules/@cpp.js/sample-lib-prebuilt-matrix/dist/cppjs-sample-lib-prebuilt-matrix.browser.js';
initCppJs({ path: 'node_modules/@cpp.js/sample-lib-prebuilt-matrix/dist' }).then(({ Matrix }) => {
const a = new Matrix(1210000, 1);
const b = new Matrix(1210000, 2);
const result = a.multiple(b);
console.log(result.get(0));
});Usage in JavaScript Code (node.js)
import 'node_modules/@cpp.js/sample-lib-prebuilt-matrix/dist/cppjs-sample-lib-prebuilt-matrix.node.js';
initCppJs().then(({ Matrix }) => {
const a = new Matrix(1210000, 1);
const b = new Matrix(1210000, 2);
const result = a.multiple(b);
console.log(result.get(0));
});1.0.0
11 months ago
1.0.0-beta.22
1 year ago
1.0.0-beta.23
1 year ago
1.0.0-beta.31
12 months ago
1.0.0-beta.20
1 year ago
1.0.0-beta.32
11 months ago
1.0.0-beta.21
1 year ago
1.0.0-beta.30
12 months ago
1.0.0-beta.28
12 months ago
1.0.0-beta.29
12 months ago
1.0.0-beta.26
12 months ago
1.0.0-beta.27
12 months ago
1.0.0-beta.24
1 year ago
1.0.0-beta.25
1 year ago
1.0.0-beta.9
1 year ago
1.0.0-beta.8
1 year ago