Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Java

Idiom #26 Create a 2-dimensional array

Declare and initialize a matrix x having m rows and n columns, containing real numbers.

import java.math.BigDecimal;
BigDecimal x[][] = new BigDecimal[m][n];
double[][] x = new double[m][n];

Initial values are 0.0
m and n need not be known at compile time
X : array (1 .. M, 1 .. N) of Float := (others => (others => 1.0));

New implementation...