Convert_spec.F


c**********************************************************************
#include "author.inc"
c*    $Id: Convert_spec.F,v 1.1 1996/03/20 23:56:18 turner Exp $
c*
c*    Convert matrix from ELL to COO format.
c*
c*    <PARAMETER LIST>
c*
c*     Input:
c*      idim - leading dimension of a
c*      nrows_a - number of rows in actual matrix a
c*      maxnz - maximum number of nonzero elements in any row of a
c*      a - matrix in ELL format
c*      ja - map array for a
c*
c*     Output:
c*      nelem - number of active elements in b
c*      nrows_b - number of rows in actual matrix b
c*      b - matrix in COO format
c*      jb - map array for b
c*      status - return status
c*
c*    <SUBROUTINES REQUIRED>
c*
c*     JT_FillVectorFloat
c*
#include "copyright.inc"
c**********************************************************************
      subroutine JT_ELL2COO (idim, nrows_a, maxnz, a, ja,
     &                       nelem, nrows_b, b, jb, status)
      implicit none
c
c ... Input:
      integer idim, nrows_a, maxnz
      integer ja(idim,maxnz)
      real a(idim,maxnz)
c
c ... Output:
      integer nelem, nrows_b, status
      integer jb(*)
      real b(*)
c
c ... Local:
      integer i, j, index
      real zero
      parameter (zero=0.0d0)
c
c ... Number of rows is the same.
      nrows_b = nrows_a
c
c ... Determine the number of non-zero elements.
      nelem = nrows_a
      index = nrows_a
      do j=2,maxnz
       do i=1,nrows_a
        index = index + 1
        if (a(i,j) .ne. zero) then
         nelem = nelem + 1
        endif
       enddo
      enddo
c
c ... Clear value and map arrays for matrix b.
      call JT_FillVectorFloat (nelem, zero, b, status)
      call JT_FillVectorInt (nelem, 0, jb, status)
c
c ... Store main diagonal elements.
      call JT_y_eq_x (nrows_a, a, b, status)
c
c ... Store remaining non-zero elements and set up map array.
      index = nrows_a
      do i=1,nrows_a
       jb(i) = i
       jb(i+nelem) = i
       do j=2,maxnz
        if (a(i,j) .ne. zero) then
         index = index + 1
         b(index) = a(i,j)
         jb(index) = i
         jb(index+nelem) = ja(i,j)
        endif
       enddo
      enddo
c
      return
      end
c**********************************************************************
#include "author.inc"
c*    $Id: Convert_spec.F,v 1.1 1996/03/20 23:56:18 turner Exp $
c*
c*    Convert matrix from ELL to RSS format.
c*
c*    <PARAMETER LIST>
c*
c*     Input:
c*      idim - leading dimension of a
c*      nrows_a - number of rows in actual matrix a
c*      maxnz - maximum number of nonzero elements in any row of a
c*      a - matrix in ELL format
c*      ja - map array for a
c*
c*     Output:
c*      nelem - number of active elements in b
c*      nrows_b - number of rows in actual matrix b
c*      b - matrix in RSS format
c*      jb - map array for b
c*      status - return status
c*
c*    <SUBROUTINES REQUIRED>
c*
c*     JT_FillVectorFloat
c*
#include "copyright.inc"
c**********************************************************************
      subroutine JT_ELL2RSS (idim, nrows_a, maxnz, a, ja,
     &                       nelem, nrows_b, b, jb, status)
      implicit none
c
c ... Input:
      integer idim, nrows_a, maxnz
      integer ja(idim,maxnz)
      real a(idim,maxnz)
c
c ... Output:
      integer nelem, nrows_b, status
      integer jb(*)
      real b(*)
c
c ... Local:
      integer i, j, index
      real zero
      parameter (zero=0.0d0)
c
c ... Number of rows is the same.
      nrows_b = nrows_a
c
c ... Determine the number of non-zero elements.
      nelem = nrows_a
      index = nrows_a
      do j=2,maxnz
       do i=1,nrows_a
        index = index + 1
        if (a(i,j) .ne. zero) then
         nelem = nelem + 1
        endif
       enddo
      enddo
c
c ... Clear value and map arrays for matrix b.
      call JT_FillVectorFloat (nelem, zero, b, status)
      call JT_FillVectorInt (nelem, 0, jb, status)
c
c ... Store main diagonal elements.
      call JT_y_eq_x (nrows_a, a, b, status)
      do i=1,nrows_b
       jb(i) = (i - 1)*nrows_b + i
      enddo
c
c ... Store remaining non-zero elements and map array elements.
      index = nrows_a
      do i=1,nrows_a
       do j=2,maxnz
        if (a(i,j) .ne. zero) then
         index = index + 1
         b(index) = a(i,j)
         jb(index) = (i - 1)*nrows_b + ja(i,j)
        endif
       enddo
      enddo
c
      return
      end
c**********************************************************************
#include "author.inc"
c*    $Id: Convert_spec.F,v 1.1 1996/03/20 23:56:18 turner Exp $
c*
c*    Convert matrix from ELL to CSS format.
c*
c*    <PARAMETER LIST>
c*
c*     Input:
c*      idim - leading dimension of a
c*      nrows_a - number of rows in actual matrix a
c*      maxnz - maximum number of nonzero elements in any row of a
c*      a - matrix in ELL format
c*      ja - map array for a
c*
c*     Output:
c*      nelem - number of active elements in b
c*      nrows_b - number of rows in actual matrix b
c*      b - matrix in CSS format
c*      jb - map array for b
c*      status - return status
c*
c*    <SUBROUTINES REQUIRED>
c*
c*     JT_FillVectorFloat
c*
#include "copyright.inc"
c**********************************************************************
      subroutine JT_ELL2CSS (idim, nrows_a, maxnz, a, ja,
     &                       nelem, nrows_b, b, jb, status)
      implicit none
c
c ... Input:
      integer idim, nrows_a, maxnz
      integer ja(idim,maxnz)
      real a(idim,maxnz)
c
c ... Output:
      integer nelem, nrows_b, status
      integer jb(*)
      real b(*)
c
c ... Local:
      integer i, j, index
      real zero
      parameter (zero=0.0d0)
c
c ... Number of rows is the same.
      nrows_b = nrows_a
c
c ... Determine the number of non-zero elements.
      nelem = nrows_a
      index = nrows_a
      do j=2,maxnz
       do i=1,nrows_a
        index = index + 1
        if (a(i,j) .ne. zero) then
         nelem = nelem + 1
        endif
       enddo
      enddo
c
c ... Clear value and map arrays for matrix b.
      call JT_FillVectorFloat (nelem, zero, b, status)
      call JT_FillVectorInt (nelem, 0, jb, status)
c
c ... Store main diagonal elements.
      call JT_y_eq_x (nrows_a, a, b, status)
      do i=1,nrows_b
       jb(i) = (i - 1)*nrows_b + i
      enddo
c
c ... Store remaining non-zero elements and map array elements.
      index = nrows_a
      do i=1,nrows_a
       do j=2,maxnz
        if (a(i,j) .ne. zero) then
         index = index + 1
         b(index) = a(i,j)
         jb(index) = (ja(i,j) - 1)*nrows_b + i
        endif
       enddo
      enddo
c
      return
      end