public static void construct_column ( int k , int [ ] Ap , int [ ] Ai , double [ ] Ax , int [ ] Q , double [ ] X , int k1 , int [ ] PSinv , double [ ] Rs , int scale , int [ ] Offp , int [ ] Offi , double [ ] Offx ) { double aik ; int i , p , pend , oldcol , kglobal , poff , oldrow ; /* ---------------------------------------------------------------------- */ /* Scale and scatter the column into X. */ /* ---------------------------------------------------------------------- */ kglobal = k + k1 ; /* column k of the block is col kglobal of A */ poff = Offp [ kglobal ] ; /* start of off-diagonal column */ oldcol = Q [ kglobal ] ; pend = Ap [ oldcol + 1 ] ; if ( scale <= 0 ) { /* no scaling */ for ( p = Ap [ oldcol ] ; p < pend ; p ++ ) { oldrow = Ai [ p ] ; i = PSinv [ oldrow ] - k1 ; aik = Ax [ p ] ; if ( i < 0 ) { /* this is an entry in the off-diagonal part */ Offi [ poff ] = oldrow ; Offx [ poff ] = aik ; poff ++ ; } else { /* (i,k) is an entry in the block. scatter into X */ X [ i ] = aik ; } } } else { /* row scaling */ for ( p = Ap [ oldcol ] ; p < pend ; p ++ ) { oldrow = Ai [ p ] ; i = PSinv [ oldrow ] - k1 ; aik = Ax [ p ] ; aik = SCALE_DIV ( aik , Rs [ oldrow ] ) ; if ( i < 0 ) { /* this is an entry in the off-diagonal part */ Offi [ poff ] = oldrow ; Offx [ poff ] = aik ; poff ++ ; } else { /* (i,k) is an entry in the block. scatter into X */ X [ i ] = aik ; } } } Offp [ kglobal + 1 ] = poff ; /* start of the next col of off-diag part */ }
Construct the kth column of A and the off - diagonal part if requested . Scatter the numerical values into the workspace X and construct the corresponding column of the off - diagonal matrix .