This file is indexed.

/usr/share/gnudatalanguage/lib/diag_matrix.pro is in libgnudatalanguage0 0.9.7-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
;+
;
; please report problems / examples / extensions
;
; NAME:      DIAG_MATRIX
;
; PURPOSE:   1/ returning the diagonal of the input matrix
;            2/ generating a square matrix with a given diagonal.
;
; CATEGORY:   Matrix utilities
;
; CALLING SEQUENCE:
;  - case 1:  my_diagonal=DIAG_MATRIX(matrix)
;  - case 2:  matrix=DIAG_MATRIX(a_diag_vector, an_offset)
;
; INPUTS:
;  - case 1:  a matrix (square or not)
;  - case 2:  a vector (might be a singleton)
;
; OPTIONAL INPUTS: 
;  - case 1:  none
;  - case 2:  an offset
;
; KEYWORD PARAMETERS:
;
; OUTPUTS:
;  - case 1: a vector, the diagonal
;  - case 2: a square matrix
;
; OPTIONAL OUTPUTS: none
;
; COMMON BLOCKS: none
;
; SIDE EFFECTS: none
;
; RESTRICTIONS: none known !
;
; PROCEDURE: straightforward
;
; EXAMPLE:
;
; - case 1: print, DIAG_MATRIX(DIST(10))
;
; - case 2:
; ** generating a NxN rotation matrix:
;           matrix=DIAG_MATRIX(REPLICATE(1.,nbp-1),1)
;           matrix[0,nbp-1]=1.
; ** generating a IDENTITY matrix (equal to: identity=IDENTITY(nbp)
;           identity=DIAG_MATRIX(REPLICATE(1.,nbp))
;
; MODIFICATION HISTORY:
;
; * 23-JAN-2012: initial version by Alain C.
;
; * 11-APR-2013: - in fact, when creating the output matrix,
;                  we have to derive the type from the input diagonal !
;                - more documentation 
;
;-
; LICENCE:  Copyright (C) 2012, 2013, Alain Coulais, under GNU GPL v2 or later
;
; This program is free software; you can redistribute it and/or modify  
; it under the terms of the GNU General Public License as published by  
; the Free Software Foundation; either version 2 of the License, or     
; (at your option) any later version.
;-
;
function DIAG_MATRIX, input, position, $
                      debug=debug, help=help, test=test
;
if N_PARAMS() EQ 0 then MESSAGE, 'Incorrect number of arguments.'
;
if KEYWORD_SET(help) then begin
    print, 'function DIAG_MATRIX, input, position, $'
    print, '                      debug=debug, help=help, test=test'
    return, -1
endif
;
if SIZE(input,/n_dim) GT 2 then begin
    MESSAGE, 'Only 1 or 2 dimensions allowed '+input
endif
;
; case 1, first usage: returning the diagonal
;
if (SIZE(input,/n_dim) EQ 2) then begin
    if N_PARAMS() EQ 1 then position=0
    info_size=SIZE(input,/dim)
    x=info_size[0]
    y=info_size[1]
    ;;   
    diag=INDGEN(MIN([x,y]))
    ;;
    if (position EQ 0) then begin
        xx=diag
        yy=diag
    endif
    ;;
    txt='% Specified offset to array is out of range: '
    ;;
    if (position GT 0) then begin
        if (position GE x) then begin
            MESSAGE, txt+STRING(position)+' versus: '+STRING(x)
        endif
        xx=diag+position
        xx=xx[WHERE(xx LT x)]
        yy=diag[0:N_ELEMENTS(xx)-1]
    endif  
    if (position LT 0) then begin
        if (ABS(position) GE y) then begin
            MESSAGE, txt+STRING(position)+' versus: '+STRING(y)
        endif
        yy=diag+ABS(position)
        yy=yy[WHERE(yy LT y)]
        xx=diag[0:N_ELEMENTS(yy)-1]
    endif
    resu=REFORM(input[xx,yy])
    if KEYWORD_SET(debug) then begin
        print, '-----------------------'
        print, 'x :', x, ', y :', y, ', Position indice: ', position
        print, 'input matrix :'
        print, input
        print, 'position XX :', xx
        print, 'position YY :', yy
        print, 'extracted vector :', resu
    endif
endif
;
; case 2: second usage: generating a square matrix populated
; by "diagonals" passed by argument, with a given "offset".
;
if (SIZE(input,/n_dim) LE 1) then begin
    ;; determining the size of the output matrix
    if N_PARAMS() EQ 1 then position=0
    nbp=N_ELEMENTS(input)+ABS(position)
    ;; creating wthe output matrix with adequate type
    type=SIZE(input,/type)
    resu=MAKE_ARRAY(nbp,nbp, type=type)
    ;;
    diag=INDGEN(nbp)
    if (position EQ 0) then begin
        resu[diag,diag]=input
        xx=diag
        yy=diag
    endif
    if (position GT 0) then begin
        xx=diag+position
        xx=xx[WHERE(xx LT nbp)]
        yy=diag[0:N_ELEMENTS(xx)-1]
        resu[xx,yy]=input
    endif
    if (position LT 0) then begin
        yy=diag+ABS(position)
        yy=yy[WHERE(yy LT nbp)]
        xx=diag[0:N_ELEMENTS(yy)-1]
        resu[xx,yy]=input
    endif
    if KEYWORD_SET(debug) then begin
        print, '-----------------------'
        print, 'Position indice: ', position
        print, 'input vector :', input
        print, 'position XX :', xx
        print, 'position YY :', yy
        print, 'computed matrix :'
        print, resu
    endif      
endif
;
if KEYWORD_SET(test) then STOP
;
return, resu
;
end