mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
7 lines
341 B
JavaScript
7 lines
341 B
JavaScript
async function calculateDeterminant(m){
|
|
if(!Array.isArray(m)||!m.length||!m.every(r=>Array.isArray(r)&&r.length===m.length))throw new Error('Matrix must be square')
|
|
const {create,all} = await import('https://cdn.jsdelivr.net/npm/mathjs@11.11.0/+esm')
|
|
const math = create(all)
|
|
return math.det(m)
|
|
}
|
|
export default calculateDeterminant; |