Returns the index to a queried block, given a real (stored) row and column
Type  Intent  Optional  Attributes  Name  

type(dbcsr_type),  intent(in)  ::  matrix 
bcsr matrix 

integer,  intent(in)  ::  row 
input is logical row, output is lookup row input is logical column, output is lookup column 

integer,  intent(in)  ::  column 
input is logical row, output is lookup row input is logical column, output is lookup column 

logical,  intent(out)  ::  found 
whether the block was found 

integer,  intent(out)  ::  block_number 
returns the block number of the row and column 

integer,  intent(inout),  optional,  DIMENSION(2)  ::  lb_row_col  
integer,  intent(out),  optional  ::  data_offset 
data offset for the block; 0 if nonexistent 

logical,  intent(out),  optional  ::  transposed 
whether the block is stored transposed according to its position 
PURE SUBROUTINE dbcsr_get_stored_block_info(matrix, row, column, &
found, block_number, lb_row_col, data_offset, transposed)
!! Returns the index to a queried block, given a real (stored) row and
!! column
TYPE(dbcsr_type), INTENT(IN) :: matrix
!! bcsr matrix
INTEGER, INTENT(IN) :: row, column
!! input is logical row, output is lookup row
!! input is logical column, output is lookup column
LOGICAL, INTENT(OUT) :: found
!! whether the block was found
INTEGER, INTENT(OUT) :: block_number
!! returns the block number of the row and column
INTEGER, DIMENSION(2), INTENT(INOUT), OPTIONAL :: lb_row_col
INTEGER, INTENT(OUT), OPTIONAL :: data_offset
!! data offset for the block; 0 if nonexistent
LOGICAL, INTENT(OUT), OPTIONAL :: transposed
!! whether the block is stored transposed according to its position
INTEGER :: blk_last, blk_offset, offset
! 
IF (ASSOCIATED(matrix%row_p)) THEN
blk_last = matrix%row_p(row + 1)
blk_offset = 0
IF (blk_last .GT. 0) THEN
IF (PRESENT(lb_row_col)) THEN
IF (lb_row_col(1) .EQ. row) THEN
blk_offset = lb_row_col(2)
END IF
END IF
CALL dbcsr_find_column(column, matrix%row_p(row) + blk_offset + 1, blk_last, &
matrix%col_i, matrix%blk_p, &
block_number, found)
blk_offset = block_number  matrix%row_p(row)
ELSE
found = .FALSE.
END IF
IF (PRESENT(lb_row_col)) THEN
lb_row_col(1) = row
lb_row_col(2) = blk_offset
END IF
ELSE
found = .FALSE.
END IF
IF (found) THEN
IF (PRESENT(data_offset) .OR. PRESENT(transposed)) THEN
offset = matrix%blk_p(block_number)
END IF
IF (PRESENT(data_offset)) THEN
data_offset = ABS(offset)
END IF
IF (PRESENT(transposed)) THEN
transposed = offset .LT. 0
END IF
ELSE
IF (PRESENT(data_offset)) THEN
data_offset = 0
END IF
IF (PRESENT(transposed)) THEN
transposed = .FALSE.
END IF
END IF
END SUBROUTINE dbcsr_get_stored_block_info