apply Garner's algorithm to reconstruct from mod m Matrix or Vector images - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Modular Subpackage : LinearAlgebra/Modular/ChineseRemainder

LinearAlgebra[Modular][ChineseRemainder] - apply Garner's algorithm to reconstruct from mod m Matrix or Vector images

Calling Sequence

ChineseRemainder(A, m, img, prm, sto)

Parameters

A

-

current reconstruction

m

-

assigned name for prime product for reconstruction

img

-

new image, or list of new images, mod m Matrices or Vectors)

prm

-

new prime or list of primes

sto

-

(optional) temporary storage (efficiency)

Description

• 

The ChineseRemainder function applies an incremental version of Garner's algorithm, updating the current image A and modulus m with the image or images specified by img and prm.

  

Upon successful completion, the reconstructed image is returned, and m which must be a name, is updated.

• 

The A and m parameters represent the current reconstruction, and name corresponding to the current prime product.

  

If no reconstruction has been performed, that is, this is the first call to ChineseRemainder for this reconstruction, A and m have the values A=0 and m='n', where n is assigned the value 1.

  

If the current reconstruction is to be updated with new images, A should be the Matrix or Vector returned from the prior call to ChineseRemainder, and m should be the name used in the prior call.

  

In all cases the reconstruction is returned, even though for updates to the reconstruction ChineseRemainder works on A in-place.

• 

The img and prm parameters represent the new images to be used to update the reconstruction, and the corresponding primes. For updating with a single image, these can be specified as the image and prime. For updating with multiple images, these are specified as a list of the images, and a list of the corresponding primes.

• 

Regardless of the datatype of the image, the output is always datatype 'integer'.

  

Note: The reconstructed image is not a mod m Matrix or Vector, as it stores the entries in the symmetric range, while the input images from img are mod m Matrices or Vectors with entries in the positive range.

• 

The ChineseRemainder command requires additional storage when reconstructing a result with multiple images. The ability to pre-allocate this storage and utilize it in ChineseRemainder is made available by the optional fifth argument sto. If specified, sto must be a mod m Matrix or Vector with the same datatype and dimensions as the images from img.

• 

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

Examples

Apply Chinese remainder algorithm to a Matrix, one step at a time.

withLinearAlgebra[Modular]:

A:=Matrix3,4,i,j→rand

A:=39571886053419313981641522424170465800187484459427552056869842622684442412286285840996417214180386408307450694607189265773012980023730616292946

(1)

Now reconstruct A from images.

p1:=ithprime4600

p1:=44201

(2)

I1:=Modp1,A,integer[]

I1:=374221083530743292802716515012439083831527179107263443818340

(3)

m:=1

m:=1

(4)

A2:=ChineseRemainder0,'m',I1,p1

A2:=6779108351345814921170361501229358861702210726976318340

(5)

p2:=prevprimep1

p2:=44189

(6)

I2:=Modp2,A,integer[]

I2:=231837641205253670417510971943555276372734533131438976791

(7)

ChineseRemainderA2,'m',I2,p2

780331233226784496938992586623691031198302722794351183161510161286239790324894372731294819453423621120245060

(8)

p3:=prevprimep2

p3:=44179

(9)

I3:=Modp3,A,integer[]

I3:=2925809114540299332081019225381572789141554343092839727923

(10)

ChineseRemainderA2,'m',I3,p3

39571886053419313981641522424170465800187484459427552056869842622684442412286285840996417214180386408307450694607189265773012980023730616292946

(11)

A2A,m

000000000000,86290333956031

(12)

You can do the reconstruction all at once.

m:=1

m:=1

(13)

A2:=ChineseRemainder0,'m',I1,I2,I3,p1,p2,p3

A2:=39571886053419313981641522424170465800187484459427552056869842622684442412286285840996417214180386408307450694607189265773012980023730616292946

(14)

A2A,m

000000000000,86290333956031

(15)

Incremental reconstruction with storage (not required for first step).

m:=1

m:=1

(16)

p1:=prevprime2251

p1:=33554393

(17)

I1:=Modp1,A,float8

I1:=1.19038851077.303071059.8359411061.58745881071.9812631064.7674261063.4590491061.95140451072.94720551073.12541651072.04284821072.939764106

(18)

A2:=ChineseRemainder0,'m',I1,p1

A2:=119038857303079835941158745881981263476742634590491404034840823382300228131259112939764

(19)

Now use I1 as temp storage.

p2:=prevprimep1

p2:=33554383

(20)

I2:=Modp2,A,float8

I2:=1.20218151077.878671059.8426211061.61130581072.1086831065.0185461063.5819191061.98109951072.95872051073.14611651072.06588521073.157504106

(21)

ChineseRemainderA2,'m',I2,p2,I1

39571886053419313981641522424170465800187484459427552056869842622684442412286285840996417214180386408307450694607189265773012980023730616292946

(22)

A2A,m

000000000000,1125896954054519

(23)

See Also

LinearAlgebra/Details, LinearAlgebra[Modular], LinearAlgebra[Modular][Mod]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam