DoubleRTable.assign
assign a double into an element of the DoubleRTable
Calling Sequence
Parameters
Description
Examples
void assign( int index[], double val ) throws MapleException
index
-
index of the entry to assign
val
value to assign into the list
The assign function assigns the Java double val into the element of the DoubleRTable indexed by index.
The index parameter is an array of integers, one for each dimension of the DoubleRTable. Each integer must be within the bounds determined by lowerBound and upperBound. The index for dimension i is stored in the array at position i−1.
As RTables do not have unique representations, elements of an RTable can be assigned to at any time.
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 );
DoubleRTable rt = (DoubleRTable)engine.evaluate( "Array( 1..2, 1..2, evalf( [[1/3, 1/4],[1/5,1/6]] ), datatype=float[8] ):" );
int[] index = new int[2];
index[0] = 1;
index[1] = 1;
rt.assign( index, 2./3 );
index[1] = 2;
rt.assign( index, 2./4 );
index[0] = 2;
rt.assign( index, 2./5 );
rt.assign( index, 2./6 );
System.out.println( rt );
}
Executing this code produces the following output.
Array(1..2, 1..2, [[.666666666666666630,.500000000000000000],[.400000000000000022,.333333333333333315]], datatype = float[8], storage = rectangular, order = Fortran_order)
See Also
ExternalCalling/Java/MapleException
OpenMaple
OpenMaple/Java/API
OpenMaple/Java/DoubleRTable
OpenMaple/Java/DoubleRTable/select
OpenMaple/Java/RTable
OpenMaple/Java/RTable/lowerBound
OpenMaple/Java/RTable/upperBound
Download Help Document