┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 10.5.beta1, Release Date: 2024-08-03 │ │ Using Python 3.12.4. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Warning: this is a prerelease version, and it may be unstable. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ sage: n = 8 sage: A = matrix.random(QQ, n, n) sage: A [ 0 1 0 1/2 -2 -1 0 -1] [ 0 -1/2 -2 2 1 0 0 2] [ 0 1 1/2 1 0 0 0 0] [ 1/2 2 0 -1 2 0 1 2] [ -1 -1 1 -1 1 -1/2 -2 1] [ 2 -1 1 0 0 -1/2 0 -1] [ 2 -1 0 0 1 0 0 -2] [ 2 0 0 -2 -2 1 1 2] sage: A.inverse() [ 1764/11299 1336/11299 3112/11299 574/11299 1448/11299 -332/11299 4240/11299 2322/11299] [ 3032/11299 -522/11299 5144/11299 1704/11299 1464/11299 -5080/11299 4162/11299 1224/11299] [-3520/11299 -2256/11299 3270/11299 -428/11299 -686/11299 5838/11299 -5130/11299 -944/11299] [-1272/11299 1650/11299 4520/11299 -1490/11299 -1121/11299 2161/11299 -1597/11299 -752/11299] [-1738/11299 16/11299 -504/11299 1766/11299 85/11299 199/11299 998/11299 -1596/11299] [-4806/11299 -1334/11299 8124/11299 -3178/11299 -25/11299 -6705/11299 4359/11299 3128/11299] [-3500/11299 -1216/11299 -6892/11299 1372/11299 -6460/11299 7474/11299 -8054/11299 -2993/11299] [ -621/11299 1605/11299 288/11299 605/11299 1517/22598 4615/22598 -5983/22598 912/11299] sage: A.det() 11299/16 sage: v = Matrix.random(QQ, n, 1) sage: v [-1] [ 0] [ 1] [-1] [ 1] [ 0] [-1] [-1] sage: A.solve_right(v) [-4340/11299] [-3514/11299] [12606/11299] [ 8510/11299] [ 151/11299] [ 8596/11299] [ -177/11299] [ 3142/11299] sage: A.rref() [1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0] [0 0 1 0 0 0 0 0] [0 0 0 1 0 0 0 0] [0 0 0 0 1 0 0 0] [0 0 0 0 0 1 0 0] [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 1] sage: A = matrix.random(QQ, n, n) sage: A.rref() [1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0] [0 0 1 0 0 0 0 0] [0 0 0 1 0 0 0 0] [0 0 0 0 1 0 0 0] [0 0 0 0 0 1 0 0] [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 1] sage: A = matrix.random(QQ, n, n) sage: A.rref() [1 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0] [0 0 1 0 0 0 0 0] [0 0 0 1 0 0 0 0] [0 0 0 0 1 0 0 0] [0 0 0 0 0 1 0 0] [0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 1] sage: A = matrix.random(GF(2), n, n) sage: A.rref() [1 0 0 0 1 0 0 1] [0 1 0 0 1 0 0 0] [0 0 1 0 0 0 0 1] [0 0 0 1 0 0 0 1] [0 0 0 0 0 1 0 1] [0 0 0 0 0 0 1 1] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] sage: reset() sage: field = GF(next_prime(2**21)) sage: field Finite Field of size 2097169 sage: mat1 = matrix.random(field, 2000, 2000) sage: mat2 = matrix.random(field, 2000, 2000) sage: %time mat = mat1 * mat2 CPU times: user 2.24 s, sys: 475 ms, total: 2.71 s Wall time: 2.69 s sage: mat1 = matrix.random(field, 4000, 4000) sage: mat2 = matrix.random(field, 4000, 4000) sage: %time mat = mat1 * mat2 CPU times: user 14.6 s, sys: 1.61 s, total: 16.2 s Wall time: 16 s