Copy - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


LinearAlgebra[Modular]

  

Copy

  

copy mod m Matrix or Vector to a new or already existing mod m Matrix or Vector

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Copy(m, ctype, A, B, order)

Parameters

m

-

modulus

A

-

input object (copy from), including subspec

B

-

(optional) output object (copy to), including subspec

order

-

(optional) ordering of output object

ctype

-

(optional) copy type; lower, upper, uppernodiag, or lowernodiag

Description

• 

The Copy function copies data from one mod m Matrix or Vector to another, or to a new Matrix or Vector.

  

If B or order are not specified, a new output object with the same ordering as the input object A is returned. If B is not specified, the returned object has the specified ordering either C_order or Fortran_order.

  

If order is not specified, the copy is performed into the output object B and NULL is returned. Note that the dimensions of the object specified for A must match those specified for B.

  

In all cases, the datatype of the output object must match the datatype of the input object.

• 

The ctype parameter is used to specify the type of copy to be performed. Valid options are upper for the upper triangular part of a Matrix, lower for the lower triangular part of a Matrix, and uppernodiag and lowernodiag for the corresponding copy operation without the diagonal.

  

Note: These copy types are only valid for square Matrices.

• 

The Copy function allows the use of sub-Matrix and sub-Vector specifications for both input and output. For example, the function can be used to copy a row of a Matrix to a row of another Matrix, or convert a Matrix into a Vector.

  

Note: If A and B overlap, the behavior of Copy is undefined.

• 

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

Examples

withLinearAlgebraModular:

AMod13,Matrix4,4,i,jrand,integer

A10081226011921174111211

(1)

Copy entire Matrix.

Copy13,A

10081226011921174111211

(2)

Copy row 3 to row Vector.

MCopy13,A,3

M92117

(3)

whattypeM

Vectorrow

(4)

Copy column 2 to column Vector.

NCopy13,A,1..1,2

N06211

(5)

whattypeN

Vectorcolumn

(6)

Copy column 2 to a 4x1 Matrix.

LCopy13,A,1..1,2..2

L06211

(7)

whattypeL

Matrix

(8)

Copy row 3,2 of A to row 2,3 of B.

BCreate13,4,4,integer

B0000000000000000

(9)

Copy13,A,3,B,2:

Copy13,A,2,B,3:

A,B

10081226011921174111211,000092117260110000

(10)

This is an error, as B is too small.

BCreate13,4,3,integer

B000000000000

(11)

Copy13,A,3,B,2:

Error, (in LinearAlgebra:-Modular:-Copy) argument 4 has a different number of columns than required by prior arguments

This example results in an error, as datatypes cannot be mixed.

BCreate13,4,4,float8

B0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.

(12)

Copy13,A,3,B,2:

Error, (in LinearAlgebra:-Modular:-Copy) argument 4 has incorrect datatype

An example of upper and lower copy.

Copy13,upper,A

100812060110011700011

(13)

BCreate13,4,4,integer:

Copy13,lowernodiag,A,B:

B

000020009200411120

(14)

See Also

LinearAlgebra/Details

LinearAlgebra[Modular]

LinearAlgebra[Modular][Create]

LinearAlgebra[Modular][Fill]

LinearAlgebra[Modular][subspec]

LinearAlgebra[Modular][Swap]