summaryrefslogtreecommitdiff
path: root/modules/polynomials/src/fortran/dmp2pm.f
blob: 03311535d71f7563ece1af081488cea44141f338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
c Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
c Copyright (C) 1988-2008 - INRIA - Serge STEER
c
c This file must be used under the terms of the CeCILL.
c This source file is licensed as described in the file COPYING, which
c you should have received as part of this distribution.  The terms
c are also available at
c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
C/MEMBR ADD NAME=DMP2PM,SSI=0
c     Copyright INRIA
      subroutine dmp2pm(mp,d,nl,pm,deg,m,n)
c!but
c Le sous programme dmptopm convertit la matrice de polynomes
c definie par mp,d,nl en un polynome matriciel pm
c!liste d'appel
c     double precision mp(*),pm(m,n*(deg+1))
c     integer d(nl*n+1),nl,m,n,deg
c
c     mp: tableau contenant les coefficients des polynomes,
c           le coefficient de degre k du polynome mp(i,j) est range
c           dans mp( d(i + (j-1)*nl + k) )
c           mp doit etre de taille au moins d(nl*n+1)-d(1)
c     d : tableau entier de taille nl*n+1,  si k=i+(j-1)*nl alors
c          d(k)) contient  l'adresse dans pm du coeff de degre 0
c          du polynome mp(i,j). Le degre du polynome mp(i,j) vaut:
c          d(k+1)-d(k) -1
c     nl : entier definissant le rangement dans d
c     pm : tableau contenant les matrices coefficients du polynomes
c          matriciel :soit mp_i la matrice formee des coefficients
c          de degre i de mp, alors
c          pm=[mp_0,.....mp_deg]
c          si deg >max(degre(mp(i,j))) les termes non presents dans mp
c          sont supposes nuls
c     deg: degre maxi des coefficients du polynome matriciel a extraire
c     m : nombre de ligne de la matrice polynomiale
c     n : nombre de colonnes de la matrice polynomiale
c
c!
      double precision mp(*),pm(*)
      integer d(*),nl,m,n,deg
c
      mn=m*n
      call dset(mn*(deg+1),0.0d+0,pm,1)
c
      imp=-nl
      ipm=-m
      do 20 k=1,n
      imp=imp+nl
      ipm=ipm+m
      do 10 l=1,m
      kij=min(deg+1,d(imp+l+1)-d(imp+l))
      call dcopy(kij,mp(d(imp+l)),1,pm(l+ipm),mn)
 10   continue
 20   continue
      return
      end