-
Notifications
You must be signed in to change notification settings - Fork 0
/
MISCELANEA.fjg
793 lines (543 loc) · 21.5 KB
/
MISCELANEA.fjg
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
* This file contains Rats FUNCTIONs for various things (MISCELANEA)
* WinRATS 9.00
* Paco Goerlich 02/03/2015
********************************************************************************
* %SUMS - Sum the elements of a series
FUNCTION %SUMS X
TYPE REA %SUMS
TYPE SER X
LOCAL REAL A
LOCAL INT I N
INQ(SER=X) * N
COM A = %SUMS = 0, %DO(I,1,N,A = A + X(I)), %SUMS = A
END %SUMS
********************************************************************************
* %BLOCKDIAGSYM - Block diagonal symmetric matrix from a vector of symmetrics
FUNCTION %BLOCKDIAGSYM A
TYPE SYM %BLOCKDIAGSYM
TYPE VEC[SYM] A
LOCA VEC[REC] C
DIM C(%ROWS(A))
EWI C(I) = A(I)
COM %BLOCKDIAGSYM = %BLOCKDIAG(C)
END %BLOCKDIAGSYM
********************************************************************************
* %AGREGA - Convert this PROC into a FUNCTION.
********************************************************************************
* %DUPLICA - Operator to duplicate rows of a matrix.
* To duplicate de columns post-multiply by TR(%DUPLICA(.))
* Also to alter the order of the rows and/or columns of a matrix.
FUNCTION %DUPLICA V
TYPE REC %DUPLICA
TYPE VEC V
DIM %DUPLICA(%ROWS(V),FIX(%MAXVALUE(V)))
EWI %DUPLICA(I,J) = %IF(FIX(V(I))==J,1,0)
END %DUPLICA
********************************************************************************
* %COMPRESSV - Same as %COMPRESS(A,V) but with A type VEC[LAB]
FUNCTION %COMPRESSV A V
TYPE VEC[LAB] %COMPRESSV A
TYPE VEC V
LOCAL INT I J
DIM %COMPRESSV(%ROWS(%COMPRESS(V,V)))
COM I = 1
DO J = 1,%ROWS(V)
IF V(J).NE.0
COM %COMPRESSV(I) = A(J), I = I + 1
END DO J
END %COMPRESSV
********************************************************************************
* %STRCOMPRESSV - Same as %COMPRESSV(A,V) but with A type VEC[STR]
FUNCTION %STRCOMPRESSV A V
TYPE VEC[STR] %STRCOMPRESSV A
TYPE VEC V
LOCAL INT I J
DIM %STRCOMPRESSV(%ROWS(%COMPRESS(V,V)))
COM I = 1
DO J = 1,%ROWS(V)
IF V(J).NE.0
COM %STRCOMPRESSV(I) = A(J), I = I + 1
END DO J
END %STRCOMPRESSV
********************************************************************************
* %CPUTIMEHMS - Same as %CPUTIME() but in h:mm:ss format
FUNCTION %CPUTIMEHMS N
TYPE STR %CPUTIMEHMS
TYPE INT N
COM %CPUTIMEHMS = %STRING(N/3600) + ' h ' + %STRING(%MOD(N,3600)/60) + ' min ' + %STRING(%MOD(%MOD(N,3600),60)) + ' sec'
END %CPUTIMEHMS
********************************************************************************
* %INV - Inverse of a Real Number.
FUNCTION %INV X
TYPE REA %INV X
COM %INV = 1./X
END %INV
********************************************************************************
* %NAN - Number of NA in a Series.
FUNCTION %NAN X
TYPE INT %NAN
TYPE SER X
LOCA INT N1 N2 I
INQ(SER=X) N1 N2
COM %NAN = 0
DO I = N1,N2
IF .NOT.%VALID(X(I))
COM %NAN = %NAN + 1
END DO I
END %NAN
********************************************************************************
* %NEGATIVE - Number of Negative Values in a Series.
FUNCTION %NEGATIVE X
TYPE INT %NEGATIVE
TYPE SER X
LOCA SER Z
SET Z = %IF(X<0,1,0)
COM %NEGATIVE = FIX(%SUM(Z))
CLE Z
END %NEGATIVE
********************************************************************************
* %POSITIVE - Number of Positive Values in a Series.
FUNCTION %POSITIVE X
TYPE INT %POSITIVE
TYPE SER X
LOCA SER Z
SET Z = %IF(X>0,1,0)
COM %POSITIVE = FIX(%SUM(Z))
CLE Z
END %POSITIVE
********************************************************************************
* %NUMVALUE - Number of Values in a Series equal to VALUE.
FUNCTION %NUMVALUE X V
TYPE INT %NUMVALUE
TYPE SER X
TYPE REA V
LOCA SER Z
SET Z = %IF(X==V,1,0)
COM %NUMVALUE = FIX(%SUM(Z))
CLE Z
END %NUMVALUE
********************************************************************************
* %NZEROS - Number of ZERO´s in a Series.
FUNCTION %NZEROS X
TYPE INT %NZEROS
TYPE SER X
COM %NZEROS = %NUMVALUE(X,0)
END %NZEROS
********************************************************************************
* %NONES - Number of ONE´s in a Series.
FUNCTION %NONES X
TYPE INT %NONES
TYPE SER X
COM %NONES = %NUMVALUE(X,1)
END %NONES
********************************************************************************
* %NLT - Number of Values in a Series LOWER THAN to VALUE.
FUNCTION %NLT X V
TYPE INT %NLT
TYPE SER X
TYPE REA V
LOCA SER Z
SET Z = %IF(X<V,1,0)
COM %NLT = FIX(%SUM(Z))
CLE Z
END %NLT
********************************************************************************
* %NLE - Number of Values in a Series LOWER OR EQUAL THAN to VALUE.
FUNCTION %NLE X V
TYPE INT %NLE
TYPE SER X
TYPE REA V
LOCA SER Z
SET Z = %IF(X<=V,1,0)
COM %NLE = FIX(%SUM(Z))
CLE Z
END %NLE
********************************************************************************
* %NGT - Number of Values in a Series GREATER THAN to VALUE.
FUNCTION %NGT X V
TYPE INT %NGT
TYPE SER X
TYPE REA V
LOCA SER Z
SET Z = %IF(X>V,1,0)
COM %NGT = FIX(%SUM(Z))
CLE Z
END %NGT
********************************************************************************
* %NGE - Number of Values in a Series GREATER OR EQUAL THAN to VALUE.
FUNCTION %NGE X V
TYPE INT %NGE
TYPE SER X
TYPE REA V
LOCA SER Z
SET Z = %IF(X>=V,1,0)
COM %NGE = FIX(%SUM(Z))
CLE Z
END %NGE
********************************************************************************
* %NEQV - Number of identical elements in a vector.
FUNCTION %NEQV X V
TYPE INT %NEQV
TYPE VEC X
TYPE REA V
LOCA VEC Z
DIM Z(%ROWS(X))
EWI Z(I) = %IF(X(I)==V,1,0)
COM %NEQV = fix(%SUM(Z))
END %NEQV
********************************************************************************
* %maxindexv - Returns a vector(integer) with the positions of the maximum value of a vector.
* If the maximum value is unique then this is equivalent to %maxindex, type vector
* of dimension 1, otherwise returns a vector of dimension %NEQV(V,%maxvalue(V))
function %maxindexv v
type vec[int] %maxindexv v
type vec v
local int i j
dim %maxindexv(%neqv(v,%maxvalue(v)))
com j = 1
do i = 1,%rows(v)
if v(i)==%maxvalue(v)
com %maxindexv(j) = i, j += 1
end do i
end %maxindexv
********************************************************************************
* %minindexv - Returns a vector(integer) with the positions of the minimum value of a vector.
* If the minimum value is unique then this is equivalent to %minindex, type vector
* of dimension 1, otherwise returns a vector of dimension %NEQV(V,%minvalue(V))
function %minindexv v
type vec[int] %minindexv v
type vec v
local int i j
dim %minindexv(%neqv(v,%minvalue(v)))
com j = 1
do i = 1,%rows(v)
if v(i)==%minvalue(v)
com %minindexv(j) = i, j += 1
end do i
end %minindexv
********************************************************************************
* %INTEGER - If a REAL is an INTEGER, 1, or NOT, 0.
FUNCTION %INTEGER X
TYPE INT %INTEGER
TYPE REAL X
COM %INTEGER = %IF(%FRAC(X)==0,1,0)
END %INTEGER
********************************************************************************
* %IEVEN - If an INTEGER is EVEN, 1, or NOT, 0.
FUNCTION %IEVEN X
TYPE INT %IEVEN X
COM %IEVEN = %IF(%mod(X,2)==0,1,0)
END %IEVEN
********************************************************************************
* %IODD - If an INTEGER is ODD, 1, or NOT, 0.
FUNCTION %IODD X
TYPE INT %IODD X
COM %IODD = 1 - %IEVEN(X)
END %IODD
********************************************************************************
* %EVEN - If a REAL is an EVEN INTEGER, 1, or NOT, 0.
FUNCTION %EVEN X
TYPE REAL %EVEN X
COM %EVEN = %IF(%INTEGER(X),%IEVEN(FIX(X)),%NA)
END %EVEN
********************************************************************************
* %ODD - If a REAL is an ODD INTEGER, 1, or NOT, 0.
FUNCTION %ODD X
TYPE REAL %ODD X
COM %ODD = %IF(%INTEGER(X),1-%EVEN(X),%NA)
END %ODD
********************************************************************************
* %FRACV - %FRAC for vectors.
FUNCTION %FRACV V
TYPE VEC %FRACV V
DIM %FRACV(%ROWS(V))
EWI %FRACV(I) = %FRAC(V(I))
END %FRACV
********************************************************************************
* %FRACM - %FRAC for matrices (rectangular).
FUNCTION %FRACM V
TYPE REC %FRACM V
DIM %FRACM(%ROWS(V),%COLS(V))
EWI %FRACM(I,J) = %FRAC(V(I,J))
END %FRACM
********************************************************************************
* %FIXV - FIX for vectors.
* In fact, it does a TRUNCATION, because returned type is VEC[REAL]
FUNCTION %FIXV V
TYPE VEC %FIXV V
DIM %FIXV(%ROWS(V))
EWI %FIXV(I) = FIX(V(I))
END %FIXV
********************************************************************************
* %FIXM - %FIX for matrices (rectangular).
* In fact, it does a TRUNCATION, because returned type is VEC[REAL]
FUNCTION %FIXM V
TYPE REC %FIXM V
DIM %FIXM(%ROWS(V),%COLS(V))
EWI %FIXM(I,J) = FIX(V(I,J))
END %FIXM
********************************************************************************
* %ROUNDV - %ROUND for vectors.
FUNCTION %ROUNDV V S
TYPE VEC %ROUNDV V
TYPE INT S
LOCA INT I
DIM %ROUNDV(%ROWS(V))
EWI %ROUNDV(I) = %ROUND(V(I),S)
END %ROUNDV
********************************************************************************
* %ROUNDM - %ROUND for matrices (rectangular).
FUNCTION %ROUNDM V S
TYPE REC %ROUNDM V
TYPE INT S
LOCA INT I J
DIM %ROUNDM(%ROWS(V),%COLS(V))
EWI %ROUNDM(I,J) = %ROUND(V(I,J),S)
END %ROUNDM
********************************************************************************
* %UNITM - %UNITV for matrices (rectangular).
FUNCTION %UNITM M N I J
TYPE REC %UNITM
TYPE INT M N I J
COM %UNITM = %ZEROS(M,N), %UNITM(I,J) = 1.
END %UNITM
********************************************************************************
* %ANY - Creates and m x n matrix with all elements equal to a given real, A.
* Same as %CONST(A) without dimensioning the matrix.
FUNCTION %ANY M N A
TYPE REC %ANY
TYPE INT M N
TYPE REA A
DIM %ANY(M,N)
COM %ANY = %CONST(A)
END %ANY
********************************************************************************
* %PROPORTIONAL - Adjust proportionally a vector V to a given quantity, S.
FUNCTION %PROPORTIONAL V S
TYPE VEC %PROPORTIONAL V
TYPE REAL S
COM %PROPORTIONAL = %IF(%MIN(%MINVALUE(V),S)<0,%NA,%IF(%SUM(V)==0.AND.S==0,1,S/%SUM(V)))*V
END %PROPORTIONAL
********************************************************************************
* %IPROPORTIONAL - Integer version of %PROPORTIONAL.
* Rule for integer asiggment 'controled rounding' of Cox (1982-JASA), as implemented in
* Balinski & Rachev (1997-MS,p.-5).
* This is essentially the 'method of greatest remainders'
* After %proportional() adjustment with standard rounding, truncate the vector to integers
* and add 1 at a time to the max fractional of the remaining part.
* In case of max fractional is NOT unique we signal this as a multiple solution, and a
* random choice in made between the max elements. In this case different results for
* the same input is possible, and a global variable, %%Multiple, is set to >= 1.
FUNCTION %IPROPORTIONAL V S
TYPE VEC %IPROPORTIONAL V
TYPE REAL S
loca int i
loca vec Real
* If S in not integer it is rounded to integer using standard rounding.
* Proportional adjustment (Real) and truncation
com Real = %PROPORTIONAL(V,%round(S,0)), %IPROPORTIONAL = %fixv(Real), %%Multiple = 0
* If the sum of integers is < S then iterate until = S
while %sum(%IPROPORTIONAL)<%round(S,0)
{
if %neqv(Real-%IPROPORTIONAL,%maxvalue(Real-%IPROPORTIONAL))==1
com %IPROPORTIONAL(%maxindex(Real-%IPROPORTIONAL)) += 1
else
com i = %raninteger(1,%rows(%maxindexv(Real-%IPROPORTIONAL))), $
%IPROPORTIONAL(%maxindexv(Real-%IPROPORTIONAL)(i)) += 1, %%Multiple = 1
}
end %IPROPORTIONAL
********************************************************************************
* %DivBaseProp - Integer version of %PROPORTIONAL using divisor based methods.
* It implements the algorithm in Dorfleiter & Klein (1999-SP) Section 3,
* with standard rounding.
* After %proportional() adjustment with standard rounding, we enter the discrepancy
* loop and eventually we handle ties (multiple solutions).
* If multiple solutions exist a global variable, %%Multiple, is set to 1.
* The algorithm returns in %DivBaseProp a given solution, which depends on the order of the
* elements in the vector, %%z is the vector of signs to obtain the full set of solutions
* and %%zstr is the short hand for such set. See Dorfleiter & Klein (1999-SP) Section 4.
function %DivBaseProp v s
type vec %DivBaseProp v
type real s
loca real discrepancy max min
loca int i
loca vec Lower Upper
* Globals
dec vec[int] %%z
dec vec[str] %%zstr
dim Lower(%rows(v)) Upper(%rows(v)) %%z(%rows(v)) %%zstr(%rows(v))
* MULTIPLIER STEP: Standard rounding on %proportional()
* If S in not integer it is rounded to integer using standard rounding.
com %DivBaseProp = %roundv(%proportional(v,%round(s,0)),0)
* DISCREPANCY LOOP
com discrepancy = %sum(%DivBaseProp) - %round(s,0)
if discrepancy < 0
com %do(i,1,%rows(v),Upper(i) = (%DivBaseProp(i)+0.5)/v(i)), %DivBaseProp(%minindex(Upper)) += 1
else if discrepancy > 0
com %do(i,1,%rows(v),Lower(i) = (%DivBaseProp(i)-0.5)/v(i)), %DivBaseProp(%maxindex(Lower)) -= 1
* MULTIPLE SOLUTIONS STEP
ewi Lower(i) = (%DivBaseProp(i)-0.5)/v(i); com max = %maxvalue(Lower)
ewi Upper(i) = (%DivBaseProp(i)+0.5)/v(i); com min = %minvalue(Upper)
ewi %%z(i) = 0
if max==min
ewi %%z(i) = %if(Upper(i)==min,1,%if(Lower(i)==max,-1,0))
com %%Multiple = %if(max==min,1,0)
ewi %%zstr(i) = %string(fix(%DivBaseProp(i)))+%if(%%z(i)==1,'+',%if(%%z(i)==-1,'-',''))
end %DivBaseProp
********************************************************************************
* %MAXINDEXROW - %MAXINDEX row for a rectangular matrix.
FUNCTION %MAXINDEXROW V
TYPE INT %MAXINDEXROW
TYPE REC V
COM %MAXINDEXROW = %CLOCK(%MAXINDEX(%VEC(V)),%ROWS(V))
END %MAXINDEXROW
********************************************************************************
* %MININDEXROW - %MININDEX row for a rectangular matrix.
FUNCTION %MININDEXROW V
TYPE INT %MININDEXROW
TYPE REC V
COM %MININDEXROW = %CLOCK(%MININDEX(%VEC(V)),%ROWS(V))
END %MININDEXROW
********************************************************************************
* %MAXINDEXCOL - %MAXINDEX column for a rectangular matrix.
FUNCTION %MAXINDEXCOL V
TYPE INT %MAXINDEXCOL
TYPE REC V
COM %MAXINDEXCOL = %MAXINDEXROW(TR(V))
END %MAXINDEXCOL
********************************************************************************
* %MININDEXCOL - %MININDEX column for a rectangular matrix.
FUNCTION %MININDEXCOL V
TYPE INT %MININDEXCOL
TYPE REC V
COM %MININDEXCOL = %MININDEXROW(TR(V))
END %MININDEXCOL
********************************************************************************
* %BINRIGHT - %BIN with right closed intervals.
* Returns n = %BINRIGHT(x,V) where V(n-1) < x <= V(n)
FUNCTION %BINRIGHT X V
TYPE INT %BINRIGHT
TYPE REA X
TYPE VEC V
COM %BINRIGHT = FIX(%IF(X>%MAXVALUE(V),0,%BIN(X,V)+%IF(X==V(%BIN(X,V)),0,1)))
END %BINRIGHT
********************************************************************************
* %DOMINANCE - Checks the dominance of two curves (series = ordinates).
* 0 No dominance
* 1 if Y1 (strong) dominates Y2
* 2 if Y2 (strong) dominates Y1
* (Strong) dominance is defined as Y1>=Y2, with at least one strict inequality.
FUNCTION %DOMINANCE Y1 Y2
TYPE INT %DOMINANCE
TYPE SER Y1 Y2
LOCA INT N
LOCA SER Z
INQ(REG) * N
# Y1 Y2
SET Z = Y1 - Y2
IF (%POSITIVE(Z)+%NZEROS(Z)==N).AND.%NZEROS(Z)<N; COM %DOMINANCE = 1
ELSE IF (%NEGATIVE(Z)+%NZEROS(Z)==N).AND.%NZEROS(Z)<N; COM %DOMINANCE = 2
ELSE ; COM %DOMINANCE = 0
END %DOMINANCE
********************************************************************************
* %PADDING - Pads an integer with zeros to the left. Type: String
* N is the length of the returned string.
FUNCTION %PADDING N I
TYPE STR %PADDING
TYPE INT N I
COM %PADDING = %STRREP('0',N-%STRLEN(%STRING(I)))+%STRING(I)
END %PADDING
********************************************************************************
* %PROV2CA - Returns, as INTEGER, the CCAA code from a PROVINCIA code
* It is assumed that the order is the one in the EPF's
FUNCTION %PROV2CA P
TYPE INT %PROV2CA P
IF P==4.OR.P==11.OR.P==14.OR.P==18.OR.P==21.OR.P==23.OR.P==29.OR.P==41
COM %PROV2CA = 1
ELSE IF P==22.OR.P==44.OR.P==50
COM %PROV2CA = 2
ELSE IF P==33
COM %PROV2CA = 3
ELSE IF P==7
COM %PROV2CA = 4
ELSE IF P==35.OR.P==38
COM %PROV2CA = 5
ELSE IF P==39
COM %PROV2CA = 6
ELSE IF P==5.OR.P==9.OR.P==24.OR.P==34.OR.P==37.OR.P==40.OR.P==42.OR.P==47.OR.P==49
COM %PROV2CA = 7
ELSE IF P==2.OR.P==13.OR.P==16.OR.P==19.OR.P==45
COM %PROV2CA = 8
ELSE IF P==8.OR.P==17.OR.P==25.OR.P==43
COM %PROV2CA = 9
ELSE IF P==3.OR.P==12.OR.P==46
COM %PROV2CA = 10
ELSE IF P==6.OR.P==10
COM %PROV2CA = 11
ELSE IF P==15.OR.P==27.OR.P==32.OR.P==36
COM %PROV2CA = 12
ELSE IF P==28
COM %PROV2CA = 13
ELSE IF P==30
COM %PROV2CA = 14
ELSE IF P==31
COM %PROV2CA = 15
ELSE IF P==1.OR.P==20.OR.P==48
COM %PROV2CA = 16
ELSE IF P==26
COM %PROV2CA = 17
ELSE IF P==51.OR.P==52
COM %PROV2CA = 18
ELSE
COM %PROV2CA = 0
END %PROV2CA
********************************************************************************
* List of functions
* %SUMS - Sum the elements of a series
* %BLOCKDIAGSYM - Block diagonal symmetric matrix from a vector of symmetrics
* %AGREGA - Convert this PROC into a FUNCTION (pending)
* %DUPLICA - Operator to duplicate rows of a matrix.
* %COMPRESSV - Same as %COMPRESS(A,V) but with A type VEC[LAB]
* %STRCOMPRESSV - Same as %COMPRESSV(A,V) but with A type VEC[STR]
* %CPUTIMEHMS - Same as %CPUTIME() but in h:mm:ss format
* %INV - Inverse of a Real Number.
* %NAN - Number of NA in a Series.
* %NEGATIVE - Number of Negative Values in a Series.
* %POSITIVE - Number of Positive Values in a Series.
* %NUMVALUE - Number of Values in a Series equal to VALUE.
* %NZEROS - Number of ZERO´s in a Series.
* %NONES - Number of ONE´s in a Series.
* %NLT - Number of Values in a Series LOWER THAN to VALUE.
* %NLE - Number of Values in a Series LOWER OR EQUAL THAN to VALUE.
* %NGT - Number of Values in a Series GREATER THAN to VALUE.
* %NGE - Number of Values in a Series GREATER OR EQUAL THAN to VALUE.
* %NEQV - Number of identical elements in a vector.
* %maxindexv - Vector(integer) with the positions of the maximum value of a vector
* %minindexv - Vector(integer) with the positions of the minimum value of a vector
* %INTEGER - If a REAL is an INTEGER, 1, or NOT, 0.
* %IEVEN - If an INTEGER is EVEN, 1, or NOT, 0.
* %IODD - If an INTEGER is ODD, 1, or NOT, 0.
* %EVEN - If a REAL is an EVEN INTEGER, 1, or NOT, 0.
* %ODD - If a REAL is an ODD INTEGER, 1, or NOT, 0.
* %FRACV - %FRAC for vectors.
* %FRACM - %FRAC for matrices (rectangular).
* %FIXV - FIX for vectors.
* %FIXM - FIX for matrices (rectangular).
* %ROUNDV - %ROUND for vectors.
* %ROUNDM - %ROUND for matrices (rectangular).
* %UNITM - %UNITV for matrices (rectangular).
* %ANY - Creates and m x n matrix with all elements equal to a given real, A.
* Same as %CONST(A) without dimensioning the matrix.
* %PROPORTIONAL - Adjust proportionally a vector V to a given quantity, S.
* %IPROPORTIONAL - Integer version of %PROPORTIONAL: 'control rounding'
* %DivBaseProp - Integer version of %PROPORTIONAL: 'divisor based methods'
* %MAXINDEXROW - %MAXINDEX row for a rectangular matrix.
* %MININDEXROW - %MININDEX row for a rectangular matrix.
* %MAXINDEXCOL - %MAXINDEX column for a rectangular matrix.
* %MININDEXCOL - %MININDEX column for a rectangular matrix.
* %BINRIGHT - %BIN with right closed intervals.
* Returns n = %BINRIGHT(X,V) where V(n-1) < x <= V(n)
* %DOMINANCE - Checks the dominance of two curves (series = ordinates).
* %PADDING - Pads an integer with zeros to the left. Type: String
* %PROV2CA - Returns the CCAA code from a PROVINCIA code (EPF´s order)
********************************************************************************