View forms of C matrix

!CINV

!CINV t prints the portion of the inverse of the coefficient matrix (C) pertaining to model term t, assumed to be a random term. It is printed to a file with extension .cii. The sparse form of the matrix portion only is printed in the form i j Cij Typically, many cells of the inverse are not reported because they were not formed (corresponding to cells that were zero in C and therefore not needed in the score calculation). Cells present in the whole sparse block are reported if t is not specified.

Example: !CINV grm1(qtl) writes the cells of the sparse C inverse pertaining to grm1(qtl) to basename .cii.

!CMAT, !CPMAT, !CAMAT, !CIPMAT, !CIMAT, !DOUBLE

were added to facilitate research into efficient processing of the C matrix of the mixed model equations. They write five forms of the C matrix as sequential binary Fortran files as follows:
!CMAT writes basename _Cmat.bin, the C matrix in model order,
!CPMAT writes basename _CPmat.bin, the C matrix permuted to analysis order,
!CAMAT writes basename _CAmat.bin, the C matrix absorbed in analysis order,
!CIPMAT writes basename _CIPmat.bin, the sparse inverted C in analysis order,
!CIMAT writes basename _CImat.bin, the sparse inverted C in model order.
!DOUBLE stores the column numbers and matrix values as double precision,
rather than single precision making the resulting file twice as large. The file extension is then .dbin.

All forms are typically sparse and only the known non-zero cells are written. Note in particular that ASReml does not form those cells of the C inverse which are not present in the absorbed matrix since there are often many of them but they are not needed for the AI REML algorithm. The model order can be found in the .asl file (search SUBMOD) and is the order in which fitted effects are reported in the .sln file. The first row/column actually pertains to the response variable cross-products. So called 'hidden equations' have been stripped out. The files can be read back with Fortran statements inter alia like

The files can be read back with Fortran statements inter alia like
    INTEGER  ::  IR, NR, IST, NV
    REAL, ALLOCATABLE : KV(:,:)  ! or
        ! DOUBLE PRECISION, ALLOCATABLE: KV(:,:)
    :
    OPEN (111,File="basename\_CMAT.bin", FORM='UNFORMATTED')
  	Read(111) NR
     	ALLOCATE(KV(2,NR))
  	DO IR=1,NR
  	    READ(111) IST,NV,KV(IST:2,1:NV)
  	    . . .
  	    ENDDO
 	CLOSE (111)
The matrices are written row-wise. If the whole row is present, IST is 2, NV will equal IR and KV(2, 1:IR) will contain all ( IR) values up to the diagonal. Otherwise, IST is 1, NV will be less than IR and specifies how many values are known, non-zero. KV(1, 1:NV) will contain the column numbers for the values in KV(2, 1:NV) in order with KV(1, NV) being equal to IR. Since these matrices are potentially huge, the values are written in single precision (REAL*4), double precision (REAL*8) if !DOUBLE is specified.

A second file, basename _CaEqnOrder.bin, holding the permutated order of the equations is also written with !CAMAT and !CPMAT.
        INTEGER NR, EO(1:100000)
    	OPEN(112,FILE="basename\_CaEqnOrder.bin",FORM="UNFORMATTED")
 	READ(112) NR, EO(1:NR)
        CLOSE(112)

Return to index