question: public Zdiagmat ( Zmat A , int k ) throws JampackException { Parameters . BaseIndexNotChangeable = true ; basex = Parameters . BaseIndex ; if ( k >= 0 ) { if ( k >= A . ncol ) { throw new JampackException ( "Diagonal out of range." ) ; } order = Math . min ( A . nrow , A . ncol - k ) ; re = new double [ order ] ; im = new double [ order ] ; for ( int i = 0 ; i < order ; i ++ ) { re [ i ] = A . re [ i ] [ i + k ] ; im [ i ] = A . im [ i ] [ i + k ] ; } } else { k = - k ; if ( k >= A . nrow ) { throw new JampackException ( "Diagonal out of range." ) ; } order = Math . min ( A . nrow - k , A . ncol ) ; re = new double [ order ] ; im = new double [ order ] ; for ( int i = 0 ; i < order ; i ++ ) { re [ i ] = A . re [ i + k ] [ i ] ; im [ i ] = A . im [ i + k ] [ i ] ; } } getProperties ( ) ; }
target:  Constructs a Zdiagmat and initializes it to the diagonal of a Zmat.