3.20.0. Operations on Lists of Numbers


These are functions that operate on list of numbers interpreted as vectors of real numbers. They are provided mostly for convenience (and for historical reasons), but are largely obsolete. Serious vector computation should be performed using the much more powerful matrix/tensor engine, rather than with these list functions.



3.20.0.0. (add-lists l1 l2)
[DX]


Return the list of the sums term by term of the elements of lists l1 and l2 . This function is equivalent to:
(mapcar '+ l1 l2)



3.20.0.1. (diff-lists l1 l2)
[DX]


Return the list of the differences term by term of the elements of lists l1 and l2 . This function is equivalent to:
(mapcar '- l1 l2)



3.20.0.2. (abs-dist l1 [l2])
[DX]


Returns the absolute (L1) distance between the lists of numbers l1 and l2 . The absolute distance is the sum of the absolutes differences between the elements of l1 and l2 .

If argument l2 is omitted, a lists of zeros is assummed.

Example:

? (abs-dist (range 1 10))
= 55



3.20.0.3. (sqr-dist l1 [l2])
[DX]


Returns the squared (L2) distance between the lists of numbers l1 and l2 . The squared distance is the sum of the squares of the differences between the elements of l1 and l2 .

If argument l2 is omitted, a lists of zeros is assummed.



3.20.0.4. (sup-dist l1 [l2])
[DX]


Returns the supremum (L_infinity) distance between the lists of numbers l1 and l2 . The supremum distance is the largest absolute difference between elements of l1 and l2 .

If argument l2 is omitted, a lists of zeros is assummed.



3.20.0.5. (mean-abs-dist l1 [l2])
[DE] (sysenv.lsh)


See: (abs-dist l1 [ l2 ])


Returns the average absolute distance between elements of l1 and l2 . This is defined as the absolute distance divided by the number of elements in lists l1 and l2 .



3.20.0.6. (mean-sqr-dist l1 [l2])
[DE] (sysenv.lsh)


See: (sqr-dist l1 [ l2 ])
Returns the average squared distance between elements of l1 and l2 . This is defined as the squared distance divided by the number of elements in lists l1 and l2 .



3.20.0.7. (mean-sup-dist l1 [l2])
[DE] (sysenv.lsh)


See: (sup-dist l1 [ l2 ])
Returns the average supremum distance between elements of l1 and l2 . This is defined as the supremum distance divided by the number of elements in lists l1 and l2 .



3.20.0.8. (hamming-dist [margin] l1 [l2])
[DX]


Returns the number of elements of l1 and l2 whose absolute difference is greater than margin .

If argument l2 is omitted, a list of zeroes is assumed.

The default value for margin is 0 . In this case hamming-dist returns the number of elements strictly different in l1 and l2 .



3.20.0.9. (quadrant-dist l1 l2)
[DX]


Returns the number of elements of l1 and l2 whose sign is different.



3.20.0.10. (mean-hamming-dist [margin] l1 [l2])
[DE] (sysenv.lsh)


See: (hamming-dist [ margin ] l1 [ l2 ])
Returns the averaged hamming distance between lists l1 and l2 . The maximal result thus is 1.



3.20.0.11. (mean-quadrant-dist l1 l2)
[DE] (sysenv.lsh)


See: (quadrant-dist l1 l2 )
Returns the averaged quadrant distance between lists l1 and l2 . The maximal result thus is 1.



3.20.1. Statistical Functions on Lists of Numbers


These are functions that operate on list of numbers. They are provided mostly for convenience (and for historical reasons) and are largely obsolete. Serious statistical computation should be performed using the much more powerful matrix/tensor engine, rather than with these list functions.



3.20.1.0. (sup l)
[DX]


Return the largest element of the list l .

Example:

? (sup (range 1 10))
= 10



3.20.1.1. (inf l)
[DX]


Return the smallest element of the list l .

Example:

? (inf (range 1 10))
= 1



3.20.1.2. (rank list target [width])
[DX]


Returns the list of the indices of the elements of list whose distance to target is smaller or equal than width . If argument width is omitted, 0 is assumed.

Example:

? (de rank-of-max(l)
      (car (rank l (sup l))) )
= rank-of-max
? (rank-of-max '(2 1 4 5 -4 -3 -2) )
= 3



3.20.1.3. (mean l)
[DX]


Returns the average of the elements of list l .

Example:

? (mean (range 1 10))
= 5.5



3.20.1.4. (median l)
[DX]


Returns the median of the elements of list l .

Example:

? (median (append (range 5 30 2) (range 1 10)))
= 9



3.20.1.5. (ksmallest l k)
[DX]


Returns the k -th smallest elements of list l . Argument k must be an integer between 1 and the size of the list l .

Example:

? (ksmallest (append (range 5 30 2) (range 1 10)) 10)
= 8



3.20.1.6. (quantile l f)
[DX]


Returns the f -th quantile of the elements of list l . Argument f must be a number between 0 and 1.

Example:

? (quantile (append (range 5 30 2) (range 1 10)) 0.9)
= 25



3.20.1.7. (sdev l)
[DX]


Returns the standard deviation of the elements of list l .

Example:

? (sdev (range 1 100))
= 28.8661



3.20.1.8. (cov ly lx)
[DX]


Returns the covariance of the elements of list lx versus the elements of list ly .

Example:

? (cov (range 1 10) (range 11 30 2))
= 16.5



3.20.1.9. (regression lx ly)
[DX]


Simple monovariate linear regression.

Arguments lx and ly are two lists of numbers. Function regression returns a list of the form (A B R) .

Example:

? (regression (range 1 10) (range 11 30 2))
= (2 9 1)



3.20.1.10. (x-estimate lr y)
[DE] (sysenv.lsh)


See: (regression lx ly )
Given the result list lr of the regression , returns a linear estimation of x given y .



3.20.1.11. (y-estimate lr x)
[DE] (sysenv.lsh)


See: (regression lx ly )
Given the result list lr of the regression , returns a linear estimation of y given x .



3.20.1.12. (sum l)
[DX]


Returns the sum of the elements of the list l .

Example:

? (sum (range 1 10))
= 55