LUApply - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


LinearAlgebra[Modular]

  

LUApply

  

apply PLU Decomposition to a mod m Matrix or Vector

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

LUApply(m, A, pvec, B)

Parameters

m

-

modulus

A

-

mod m Matrix (from LUDecomposition)

pvec

-

permutation vector (from LUDecomposition)

B

-

mod m Matrix or Vector representing right-hand side of problem

Description

• 

The LUApply function applies the permutation pvec and the forward and backward substitutions encoded in A directly to the right-hand side mod m Matrix or Vector B, where pvec and A are the output of the LUDecomposition function.

  

B must have the same number of rows as columns in A.

• 

The function works directly on B, returning the solution in B on successful completion. If the function fails, B can be altered.

• 

LUApply is simply the application of Permute, ForwardSubstitute, and then BackwardSubstitute.

• 

This command is part of the LinearAlgebra[Modular] package, so it can be used in the form LUApply(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][LUApply](..).

Examples

Compute LU decomposition of a random 5 x 5 Matrix, and use LUApply to obtain a solution.

> 

with⁡LinearAlgebraModular:

> 

p≔97

p≔97

(1)
> 

A≔Mod⁡p,Matrix⁡5,5,i,j↦rand⁡,integer:

> 

A

779610865836802244396039431255224714529214873357

(2)
> 

A2≔Copy⁡p,A:

> 

pv≔Vector⁡4:

> 

LUDecomposition⁡p,A2,pv,0:

> 

A2,pv

77961086583720406327946017964295663778625440105,1234

(3)
> 

B≔Mod⁡p,Matrix⁡5,2,i,j↦rand⁡,integer

B≔65169396714470582529

(4)
> 

X≔Copy⁡p,B:

> 

LUApply⁡p,A2,pv,X:

> 

X

1137122057118368111

(5)

Check the solution.

> 

Multiply⁡p,A,X−B

0000000000

(6)

Use float[8] with a nontrivial permutation.

> 

p≔13:

> 

A≔Mod⁡13,0,0,12,12,0,3,1,1,1,float8

A≔0.0.12.12.0.3.1.1.1.

(7)
> 

A2≔Copy⁡p,A:

> 

pv≔Vector⁡2:

> 

LUDecomposition⁡p,A2,pv,0:

> 

A2,pv

12.0.3.12.1.4.0.0.12.,23

(8)

Now apply to a random vector and check it.

> 

B≔Mod⁡p,Vector⁡3,i↦rand⁡,float8

B≔5.3.5.

(9)
> 

X≔Copy⁡p,B:

> 

LUApply⁡p,A2,pv,X:

> 

X

8.2.8.

(10)
> 

Multiply⁡p,A,X−B

0.0.0.

(11)

See Also

LinearAlgebra/Details

LinearAlgebra[Modular]

LinearAlgebra[Modular][BackwardSubstitute]

LinearAlgebra[Modular][Copy]

LinearAlgebra[Modular][ForwardSubstitute]

LinearAlgebra[Modular][LUDecomposition]

LinearAlgebra[Modular][Mod]

LinearAlgebra[Modular][Multiply]

LinearAlgebra[Modular][Permute]