Tuesday, 15 April 2014

lapack - addressing for fully packed rectangular format -



lapack - addressing for fully packed rectangular format -

i utilize lapack routines factorisation , inversion of matrices using packed rectangular format, requires n(n+1)/2 elements stored symmetric nxn matrix. far, setting matrix in 'packed' format , transform calling routine dtpttf. however, requires sec array. build matrix directly in packed rectangular format (to save on space) - there 'addressing' function give me position of i,j-th element? or point me relevant formula?

to partly reply own question: inspecting source code of dtpttf , illustration given therein, i've worked out adress 1 of 4 possible constellations (the 1 need), namely uplo ='l' , trans ='n'. below fortran function:

! ==================================== ! returns address rfp format integer function ijfprf( ii, jj, n ) ! row jj , column ii ! ==================================== ! uplo = 'l' , transr = 'n' only! implicit none integer, intent(in) :: ii, jj, n integer :: i, j, k, n1, k1 if( ii <= jj ) = ii; j = jj else = jj; j = ii end if k = n/2 if( mod(n,2) == 0 ) ! n n1 = n + 1 if( <= k ) ijfprf = 1 + (i - 1) * n1 + j else ijfprf = ( j - k - 1 ) * n1 + - k end if else ! n odd k1 = k + 1 if( > k1 ) ijfprf = ( j - k1 ) * n + - k1 else ijfprf = ( - 1 ) * n + j end if end if homecoming end function ijfprf

lapack

No comments:

Post a Comment