RTable.copy - create and return a copy of the current RTable
|
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[];
|
Engine engine;
|
RTable a, b;
|
int index[];
|
Numeric one;
|
mapleArgs = new String[1];
|
mapleArgs[0] = "java";
|
engine = new Engine( mapleArgs, new EngineCallBacksDefault(),
|
null, null );
|
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)
|
|
|
|
|