xen-dev-utils
Version:
Utility functions used by the Scale Workshop ecosystem
89 lines • 2.62 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const hnf_1 = require("../hnf");
(0, vitest_1.describe)('Hermite normal form', () => {
(0, vitest_1.it)('works on a small matrix', () => {
const A = [
[],
[],
[],
];
const H = (0, hnf_1.hnf)(A);
(0, vitest_1.expect)(H).toEqual([
[],
[],
[],
]);
});
(0, vitest_1.it)('works on a small matrix (bigint)', () => {
const A = [
[],
[],
[],
];
const H = (0, hnf_1.hnf)(A);
(0, vitest_1.expect)(H).toEqual([
[],
[],
[],
]);
});
});
(0, vitest_1.describe)('Integer determinant', () => {
(0, vitest_1.it)('works on a small matrix', () => {
const mat = [
[-2, -1, 2],
[],
[-3, 3, -1],
];
const determinant = (0, hnf_1.integerDet)(mat);
(0, vitest_1.expect)(determinant).toBe(54);
});
(0, vitest_1.it)('works on a small matrix (bigint)', () => {
const mat = [
[-2n, -1n, 2n],
[],
[-3n, 3n, -1n],
];
const determinant = (0, hnf_1.integerDet)(mat);
(0, vitest_1.expect)(determinant).toBe(54n);
});
});
(0, vitest_1.describe)('Transpose', () => {
(0, vitest_1.it)('transposes a 3x2 matrix', () => {
const mat = [[1, 2], [3], [4, 5]];
(0, vitest_1.expect)((0, hnf_1.transpose)(mat)).toEqual([
[],
[],
]);
});
});
(0, vitest_1.describe)('Anti-transpose', () => {
(0, vitest_1.it)('anti-transposes a 3x2 matrix', () => {
const mat = [
[],
[],
[],
];
(0, vitest_1.expect)((0, hnf_1.antitranspose)(mat)).toEqual([
[],
[],
]);
});
});
(0, vitest_1.describe)('Preimage', () => {
(0, vitest_1.it)('obtains the preimage associated with 5-limit meantone', () => {
const map = [
[],
[],
];
const gensT = (0, hnf_1.preimage)(map);
(0, vitest_1.expect)(gensT).toEqual([
[],
[],
[],
]);
});
});
//# sourceMappingURL=hnf.spec.js.map