mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark results
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const calculateDeterminant = async (matrix) => {
|
||||
const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@11.11.0/+esm');
|
||||
const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs@11/+esm');
|
||||
return det(matrix);
|
||||
};
|
||||
export default calculateDeterminant;
|
||||
@@ -0,0 +1,5 @@
|
||||
const calculateDeterminant = async m => {
|
||||
const { det } = await import('https://cdn.jsdelivr.net/npm/mathjs/+esm')
|
||||
return det(m)
|
||||
}
|
||||
export default calculateDeterminant;
|
||||
@@ -1,5 +0,0 @@
|
||||
const calculateDeterminant = async m => {
|
||||
const { det } = await import('https://esm.sh/mathjs')
|
||||
return det(m)
|
||||
}
|
||||
export default calculateDeterminant;
|
||||
@@ -1,13 +1,11 @@
|
||||
const URL = 'https://cdn.jsdelivr.net/npm/mathjs@11.11.0/+esm';
|
||||
let det;
|
||||
let mathLib;
|
||||
|
||||
async function calculateDeterminant(m) {
|
||||
const v = Array.isArray(m) && m.length && m.every(r => Array.isArray(r) && r.length === m.length);
|
||||
if (!v) throw new TypeError('Invalid matrix');
|
||||
if (!Array.isArray(m) || !m.length || m.some(r => !Array.isArray(r) || r.length !== m.length)) {
|
||||
throw new TypeError('Invalid square matrix');
|
||||
}
|
||||
|
||||
det ||= await import(URL).then(m => m.det).catch(() => { throw new Error('Load failed'); });
|
||||
|
||||
try { return det(m); }
|
||||
catch { throw new Error('Calc failed'); }
|
||||
const {det} = await (mathLib ||= import('https://cdn.jsdelivr.net/npm/mathjs@11.11.0/lib/browser/math.js'));
|
||||
return det(m);
|
||||
}
|
||||
export default calculateDeterminant;
|
||||
@@ -1,5 +1,3 @@
|
||||
async function calculateDeterminant(m){
|
||||
const {det}=await import('https://cdn.jsdelivr.net/npm/mathjs@11.11.1/+esm')
|
||||
return det(m)
|
||||
}
|
||||
let d
|
||||
const calculateDeterminant=async m=> (await (d??=import('https://cdn.jsdelivr.net/npm/mathjs@11.11.0/+esm'))).det(m)
|
||||
export default calculateDeterminant;
|
||||
@@ -1,2 +1,2 @@
|
||||
async function calculateDeterminant(matrix){const math=await import('https://esm.sh/mathjs');return math.det(matrix);}
|
||||
async function calculateDeterminant(m){const{det}=await import('https://esm.sh/mathjs');return det(m);}
|
||||
export default calculateDeterminant;
|
||||
Reference in New Issue
Block a user