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

Online Help

All Products    Maple    MapleSim


RTable.copy

create and return a copy of the current RTable

 

Calling Sequence

Description

Examples

Calling Sequence

RTable copy( ) throws MapleException

Description

• 

The copy function creates and returns a new RTable that contains the same data as the current RTable.

• 

As RTables do not have unique representations, the returned copy is a different Maple object from the original.  Changes to the copy do not affect the original.

Examples

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

    public static void main( String notused[] ) throws MapleException

    {

        String[] mapleArgs = { "java" };

        Engine engine = new Engine( mapleArgs, new EngineCallBacksDefault(), null, null );

        RTable a, b;

        int index[];

        Numeric one;

        a = (RTable)engine.evaluate( "Array( 1..3, 1..3, (i,j)->(i*j)+1 ):" );

        b = a.copy();

        index = new int[3];

        one = engine.newNumeric( 1 );

        index[0] = 1;

        index[1] = 1;

        ((AlgebraicRTable)b).assign( index, one );

        index[0] = 2;

        index[1] = 2;

        ((AlgebraicRTable)b).assign( index, one );

        index[0] = 3;

        index[1] = 3;

        ((AlgebraicRTable)b).assign( index, one );

        System.out.println( a );

        System.out.println( b );

    }

}

Executing this code produces the following output.

Array(1..3, 1..3, [[2,3,4],[3,5,7],[4,7,10]], datatype = anything, storage = rectangular, order = Fortran_order)

Array(1..3, 1..3, [[1,3,4],[3,1,7],[4,7,1]], datatype = anything, storage = rectangular, order = Fortran_order)

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/Algebraic/unique

OpenMaple/Java/API

OpenMaple/Java/RTable