RationalDenseNullSpace - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


SolveTools[LinearSolvers]

  

RationalDenseNullSpace

  

fast nullspace computation over the field of rational numbers

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

RationalDenseNullSpace(M)

RationalDenseNullSpace(M, skiptest)

Parameters

M

-

a Matrix of rational numbers

Description

• 

The RationalDenseNullSpace command computes the nullspace of the input Matrix. It does this by computing nullspaces modulo primes (see LinearAlgebra:-Modular:-RowReduce) followed by rational reconstruction (see iratrecon). Bad primes are discarded in the same way as in the modular gcd algorithm. The algorithm is output sensitive: the CPU time depends not only on the size of the input, but also on the output. Specifically, the number of primes that are used depends on the largest entry in the output. If its size is well below the theoretical upper bound, which is usually the case, then the algorithm will be very efficient. By default, it does not return an answer unless a correctness test is passed. If the test does not pass, an additional prime is used to update the answer and the test is run again (and so on, until the test passes).

• 

To ensure that the algorithm returns the correct answer, it checks that M times the output is zero. However, this multiplication can cost more CPU time than the rest of the computation combined. If the option skiptest is given, that correctness check is skipped. This is most useful in code where the correctness of the answer can be verified more efficiently later.

Examples

withSolveToolsLinearSolvers:

Time comparison with LinearAlgebra:-NullSpace

N200:n100:rrand1000..1000:

MMatrixN+n,N:

foritoN+ndoforjfrommax1,intoNdoMi,jrenddoenddo:

V1M·Vectorseqr,i=1..N:

V2M·Vectorseqr,i=1..N:

MV1|V2|M:

This is the general purpose way to compute nullspaces in Maple

CodeTools:-UsageLinearAlgebra:-NullSpaceM:

memory used=11.36GiB, alloc change=333.86MiB, cpu time=80.69s, real time=72.35s, gc time=12.41s

This command gives a significant speedup, but requires advance knowledge that the matrix M is dense and rational.

CodeTools:-UsageRationalDenseNullSpaceM:

memory used=21.30MiB, alloc change=484.00KiB, cpu time=98.00ms, real time=98.00ms, gc time=0ns

If the correctness check is skipped, it is much faster

CodeTools:-UsageRationalDenseNullSpaceM,skiptest:

memory used=1.84MiB, alloc change=476.00KiB, cpu time=51.00ms, real time=51.00ms, gc time=0ns

See Also

LinearAlgebra:-NullSpace

SolveTools:-LinearSolvers:-RationalDense