Example: Print a Complex Matrix

A Complex matrix is initialized and printed.
import com.imsl.math.*;

public class  ComplexMatrixEx1 {
    public static void main(String args[]) {
        Complex a[][] = {
            {new Complex(1,3), new Complex(3,5), new Complex(7,9)},
            {new Complex(8,7), new Complex(9,5), new Complex(1,9)},
            {new Complex(2,9), new Complex(6,9), new Complex(7,3)},
            {new Complex(5,4), new Complex(8,4), new Complex(5,9)}
        };
        
        //	Construct a PrintMatrix object with a title
        PrintMatrix p = new PrintMatrix("A Complex Matrix");
        
        //	Print the matrix
        p.print(a);
    }
}

Output

  A Complex Matrix
    0     1     2    
0  1+3i  3+5i  7+9i  
1  8+7i  9+5i  1+9i  
2  2+9i  6+9i  7+3i  
3  5+4i  8+4i  5+9i  

Link to Java source.