/usr/share/axiom-20170501/src/algebra/LINDEP.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | )abbrev package LINDEP LinearDependence
++ Author: Manuel Bronstein
++ Date Last Updated: 14 May 1991
++ Description:
++ Test for linear dependence.
LinearDependence(S, R) : SIG == CODE where
S : IntegralDomain
R : LinearlyExplicitRingOver S
Q ==> Fraction S
SIG ==> with
linearlyDependent? : Vector R -> Boolean
++ \spad{linearlyDependent?([v1,...,vn])} returns true if
++ the vi's are linearly dependent over S, false otherwise.
linearDependence : Vector R -> Union(Vector S, "failed")
++ \spad{linearDependence([v1,...,vn])} returns \spad{[c1,...,cn]} if
++ \spad{c1*v1 + ... + cn*vn = 0} and not all the ci's are 0,
++ "failed" if the vi's are linearly independent over S.
if S has Field then
solveLinear : (Vector R, R) -> Union(Vector S, "failed")
++ \spad{solveLinear([v1,...,vn], u)} returns \spad{[c1,...,cn]}
++ such that \spad{c1*v1 + ... + cn*vn = u},
++ "failed" if no such ci's exist in S.
else
solveLinear : (Vector R, R) -> Union(Vector Q, "failed")
++ \spad{solveLinear([v1,...,vn], u)} returns \spad{[c1,...,cn]}
++ such that \spad{c1*v1 + ... + cn*vn = u},
++ "failed" if no such ci's exist in the quotient field of S.
CODE ==> add
aNonZeroSolution: Matrix S -> Union(Vector S, "failed")
aNonZeroSolution m ==
every?(zero?, v := first nullSpace m) => "failed"
v
linearlyDependent? v ==
zero?(n := #v) => true
(n = 1) => zero?(v(minIndex v))
positive? nullity reducedSystem transpose v
linearDependence v ==
zero?(n := #v) => empty()
(n = 1) =>
zero?(v(minIndex v)) => new(1, 1)
"failed"
aNonZeroSolution reducedSystem transpose v
if S has Field then
solveLinear(v:Vector R, c:R):Union(Vector S, "failed") ==
zero? c => new(#v, 0)
empty? v => "failed"
sys := reducedSystem(transpose v, new(1, c))
particularSolution(sys.mat, sys.vec)$LinearSystemMatrixPackage(S,
Vector S, Vector S, Matrix S)
else
solveLinear(v:Vector R, c:R):Union(Vector Q, "failed") ==
zero? c => new(#v, 0)
empty? v => "failed"
sys := reducedSystem(transpose v, new(1, c))
particularSolution(map((z:S):Q+->z::Q, sys.mat)_
$MatrixCategoryFunctions2(S,
Vector S,Vector S,Matrix S,Q,Vector Q,Vector Q,Matrix Q),
map((z1:S):Q+->z1::Q, sys.vec)$VectorFunctions2(S, Q)
)$LinearSystemMatrixPackage(Q,
Vector Q, Vector Q, Matrix Q)
|