MVLib - Short Writeup - Version 4.0
Routines for vectors manipulation - Last update February, 13 2013
Source code available for local users only
iexchange(a,b) S Exchange the values of two integer variables a and b.
rexchange(a,b) S Exchange the values of two real variables a and b.
sexchange(a,b) S Exchange the values of two string variables a and b.
vsomma(v,i1,i2) R A real function giving as output the sum of the components of vector v from index i1 to index i2.
indexmin(v,i1,i2) I An integer function giving as output the index corresponding to the minimum value of vector v from index i1 to index i2.
indexmax(v,i1,i2) I An integer function giving as output the index corresponding to the maximum value of vector v from index i1 to index i2.
indexrange(n,n1,n2) L A logical funcion returning .true. if the index passed as first argument is included between n1 and n2.
vec_min(v,i1,i2) or
vecmin(v,n)
R A real function giving back the minimum value of vector v in the range of components (i1,i2) or in the first n components.
vec_max(v,i1,i2) or
vecmax(v,n)
R A real function giving back the maximum value of vector v in the range of components (i1,i2) or in the first n components.
vec_ordinac(v,i1,i2) S Allows to order the components of real vecor v in the range of components (i1,i2) from the lower to the higher value.
vec_ordinad(v,i1,i2) S Same as vec_ordinac but the vector is ordered from the higher to the lower value.
convert2hourlyres(y,isen) S This routine allows to convert a year timeseries with 15 minutes of time resolution to a 1-hour time resolution series. Each component is recalculated as the average of the four correspondig components or (if isen=1) as the accumlated value of the four correspondig components. On output the first 8784 components of input vecor y are rewritten.
hourly2daily(x,y,n) S This routine allows to convert the hourly time series passed as first in a daily average time series returned in the second argument, the average is carried out for n days.
bitsfrominteger (int,n,bits) S Extract from the the integer passed as first arguments the first n bits; the bits are stored in the output integer vector bits. As an example, the call
	call bitsfrominteger(10,8,bits)
   
will return in the vector bits the following values:
	0 1 0 1 0 0 0 0
   
Namely the number 10 is the sum of the second bit (2) and the fourth bit (8). The subroutine is based on arithmetic algorithm and therefore it is not platform dependent.
Most of the routines for vectors manipulation listed hereafter are now totally obsolete using fortran 90 compilers, but I still maintain them for hystorical and back-compatibility reasons.
vec_add(v1,v2,v3,i1,i2,ishift) or
vecadd(v1,v2,v3,n)
S Somma i due vettori v1 e v2 tra le componenti i1 e i2, restituendo il risultato nel vettore v3 (che può essere, nella chiamata, lo stesso di uno dei primi due). Il parametro ishift, qui e nelle successive routines serve ai bravi programmatori a manipolare agevolmente matrici e/o vettori di dimensioni diverse. Se non siete bravi programmatori lasciate perdere e passate ishift=0. La chiamata a vecadd equivale a vec_add(v1,v2,v3,1,n,0)
vec_sub(v1,v2,v3,i1,i2,ishift) or
vecsub(v1,v2,v3,n)
S Sottrae i due vettori v1 e v2 tra le componenti i1 e i2, restituendo il risultato nel vettore v3 (che può essere, nella chiamata, lo stesso di uno dei primi due). Per il parametro ishift vedi la descrizione della subroutine vec_add. La chiamata a vecsub equivale a vec_sub(v1,v2,v3,1,n,0)
vec_mul(v1,v2,v3,i1,i2,ishift) or
vecmul(v1,v2,v3,n)
S Moltiplica i due vettori v1 e v2 tra le componenti i1 e i2, restituendo il risultato nel vettore v3 (che può essere, nella chiamata, lo stesso di uno dei primi due). Per il parametro ishift vedi la descrizione della subroutine vec_add. La chiamata a vecmul equivale a vec_mul(v1,v2,v3,1,n,0)
vec_div(v1,v2,v3,i1,i2,ishift) or
vecdiv(v1,v2,v3,n)
S Divide i due vettori v1 e v2 tra le componenti i1 e i2, restituendo il risultato nel vettore v3 (che può essere, nella chiamata, lo stesso di uno dei primi due). Se il divisore e' zero, il risultato viene posto anch'esso a zero. Per il parametro ishift vedi la descrizione della subroutine vec_add. La chiamata a vecdiv equivale a vec_div(v1,v2,v3,1,n,0)
vec_equ(v1,v2,i1,i2,ishift) or
vecequ(v1,v2,n)
S Eguaglia il vettore v2 al vettore v1 tra le componenti i1 e i2. Per il parametro ishift vedi la descrizione della subroutine vec_add. La chiamata a vecequ equivale a vec_equ(v1,v2,1,n,0)
vec_cos(v,c,i1,i2) or
veccos(v,c,n)
S Assegna alle componenti tra i1 e i2 del vettore v il valore costante c. La chiamata a veccos equivale a vec_cos(v,c,1,n)
vec_cml(v1,c,v2,i1,i2) S Moltiplica il vettore v1 per il valore costante c restituendo il risultato nel vettore v2. L'operazione viene fatta tra gli indici i1 ed i2
matmax(m,n1,n2,max,i,j) S Restituisce il valore massimo (max) e gli indici corrispondenti (i e j) della matrice reale m dimensionata n1, n2.
kfromij(i,j,ixm) I Dati gli indici i,j di una certa matrice, la cui prima dimensione è ixm, restituisce un intero corrispondente all'indice equivalente di un vettore dimesionato come la matrice ovvero messo in equivalence con questa. L'utilizzo di queste funzioni è consigliato ai soli programmatori bravi.
ifromk(k,ixm) I Funzione inversa di kfromij (vedi)
jfromk(k,ixm) I Funzione inversa di kfromij (vedi)
matxprod(a,b,n,m,k,c)
By E.Coppola
S Effettua il prodotto matriciale tra le matrici a e b restituendo il risultato nella matrice c. Le matrici sono dimensionate: real a(n,m),b(m,k),c(n,k).
MVLib documentation by Marco Verdecchia This document has been updated on October 22, 2020 h: 09:49