7.7.1. IDX of Single Precision Floating Point Numbers
(lsh/libidx/idx-float.lsh)


Basic operations on vectors, matrices, and tensors of floats

7.7.1.0. (idx-f2timesf2 A B C)
(lsh/libidx/idx-float.lsh)


2d x 2d matrix multiply: C = A * B

7.7.1.1. (idx-f1reverse vector)
(lsh/libidx/idx-float.lsh)


Reverses in-place the order of the elements of a vector . not very efficient, but I didn't have time to re-write a faster one.

7.7.1.2. (idx-f1fill m f)
(lsh/libidx/idx-float.lsh)


fill idx1 m with value f

7.7.1.3. (idx-f2fill m f)
(lsh/libidx/idx-float.lsh)


fill idx2 m with value f

7.7.1.4. (idx-f3fill m f)
(lsh/libidx/idx-float.lsh)


fill idx3 m with value f

7.7.1.5. (idx-f1dotc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , put result in q

7.7.1.6. (idx-f2dotc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , put result in q

7.7.1.7. (idx-f3dotc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , put result in q

7.7.1.8. (idx-f1dotcacc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , accumulate result in q

7.7.1.9. (idx-f2dotcacc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , accumulate result in q

7.7.1.10. (idx-f3dotcacc m f q)
(lsh/libidx/idx-float.lsh)


multiply elements of m by float f , accumulate result in q

7.7.1.11. (idx-f1addc m f q)
(lsh/libidx/idx-float.lsh)


add elements of m to float f , put result in q

7.7.1.12. (idx-f2addc m f q)
(lsh/libidx/idx-float.lsh)


add elements of m by float f , put result in q

7.7.1.13. (idx-f3addc m f q)
(lsh/libidx/idx-float.lsh)


add elements of m by float f , put result in q

7.7.1.14. (idx-f1lincomb x cx y cy z)
(lsh/libidx/idx-float.lsh)


performs a linear combination of vectors x and y using coefficients cx and cy . Put result in z .

7.7.1.15. (idx-f1tanh x1 y1)
(lsh/libidx/idx-float.lsh)


Computes the regular tanh of x1 element by element, result in y1 .

7.7.1.16. (idx-f1inv x1 y1)
(lsh/libidx/idx-float.lsh)


puts inverse of each element of x1 into corresponding elements in y1

7.7.1.17. (idx-f1sign x y)
(lsh/libidx/idx-float.lsh)


Elements of y are set to the sgn function of elements of x .

7.7.1.18. (idx-f1clip x y)
(lsh/libidx/idx-float.lsh)




7.7.1.19. (idx-f1sup m)
(lsh/libidx/idx-float.lsh)


returns largest element in m

7.7.1.20. (idx-f1max m [r])
(lsh/libidx/idx-float.lsh)


if r is present, put largest element of idx1 m into idx0 r otherwise returns largest element.

7.7.1.21. (idx-f2max m [r])
(lsh/libidx/idx-float.lsh)


if r is present, put largest element of idx1 m into idx0 r otherwise returns largest element.

7.7.1.22. (idx-f1inf m)
(lsh/libidx/idx-float.lsh)


returns smallest element in m

7.7.1.23. (idx-f1min m [r])
(lsh/libidx/idx-float.lsh)


if r is present, put smallest element of idx1 m into idx0 r otherwise returns smallest element.

7.7.1.24. (idx-f2min m [r])
(lsh/libidx/idx-float.lsh)


if r is present, put smallest element of idx1 m into idx0 r otherwise returns smallest element.

7.7.1.25. (idx-f1indexmax m)
(lsh/libidx/idx-float.lsh)


returns index (int) of largest element in m

7.7.1.26. (idx-f1indexmin m)
(lsh/libidx/idx-float.lsh)


returns index (int) of smallest element in m

7.7.1.27. (index-of-max m)
(lsh/libidx/idx-float.lsh)


return index of largest element in idx1 m

7.7.1.28. (idx-f1fill-with-index m)
(lsh/libidx/idx-float.lsh)


fill the elements of idx1 m with their index.

7.7.1.29. (idx-f1avg vector)
(lsh/libidx/idx-float.lsh)


Returns the average of the numbers in the input vector .

7.7.1.30. (idx-f1prod vec)
(lsh/libidx/idx-float.lsh)


returns the product of the elements of the input vector vec ,

7.7.1.31. (idx-f1logsum m)
(lsh/libidx/idx-float.lsh)


computes a "log-add" of the elements in m , i.e. -log( 1/n Sum_i ( exp( - m_i ) )) where n is the dimension of m . This is the wrong logsum advocated by Yann. Use idx-f1logadd instead.

7.7.1.32. (idx-f2logsum m)
(lsh/libidx/idx-float.lsh)


same as idx-f1logsum, but in 2 dimensions -log( 1/n Sum_ij ( exp( - m_ij ) )) where n is the number of elements in m This is the wrong logsum advocated by Yann. Use idx-f2logadd instead.

7.7.1.33. (idx-f1logadd m)
(lsh/libidx/idx-float.lsh)


computes a "log-add" of the elements in m , i.e. -log( Sum_i ( exp( - m_i ) ))

7.7.1.34. (idx-f2logadd m)
(lsh/libidx/idx-float.lsh)


same as idx-f1logadd, but in 2 dimensions -log( Sum_ij ( exp( - m_ij ) ))

7.7.1.35. (idx-f1logaddb m beta)
(lsh/libidx/idx-float.lsh)


computes a "log-add" with inverse temperature b of the elements in m , i.e. -1/beta log ( Sum_i ( exp( - beta*m_i ) ))

7.7.1.36. (idx-f2logaddb m beta)
(lsh/libidx/idx-float.lsh)


same as idx-f1logaddb, but in 2 dimensions -1/beta log( Sum_ij ( exp( - beta*m_ij ) ))

7.7.1.37. (idx-f1logdotf1 m p)
(lsh/libidx/idx-float.lsh)


computes a "log-add" of term-by-termt products of elements in m and p , i.e. -log( p_i Sum_i ( exp( - m_i ) )) p should be a normalized probability vector for this to be meaningful

7.7.1.38. (idx-f2logdotf2 m)
(lsh/libidx/idx-float.lsh)


same as idx-f1logdotf1, but in 2 dimensions

7.7.1.39. (idx-f1blogdotf1 m p out)
(lsh/libidx/idx-float.lsh)


This is the "bprop" corresponding to idx-f1logdotf1 m is the input (preferably positive costs), p is the prior vector, and on output out is the vector of partial derivatives of (idx1-f1logdotf1 m p ) with respect to each element of m .

7.7.1.40. (idx-f1subextf1 x y z)
(lsh/libidx/idx-float.lsh)


Computes the external subtraction z[i, j] = x[i] - y[j]

7.7.1.41. (idx-f1subf0 x1 y0 z1)
(lsh/libidx/idx-float.lsh)


Substracts ( y0 ) from elements of vector x1 . Results in vector z1 .

7.7.1.42. (idx-f1mulacc x1 y1 z1)
(lsh/libidx/idx-float.lsh)


z1[i] += x1[i] * y1[i]. not efficient. Could be improved a lot.

7.7.1.43. (idx-f1entropy m c)
(lsh/libidx/idx-float.lsh)


computes the entropy of a vector (- sum Pi log Pi ) this does a normalization and adds a constant c to all the elements (so it does not crash of they are 0)

7.7.1.44. (idx-f1subsample-fast in nlin)
(lsh/libidx/idx-float.lsh)


subsamples vector (considered as a signal) by integer factor nlin the returned output is a vector whose size is int(N/ nlin ) where N is the size of in . there is a idx-f1subsample defined in libconvol.sn, it is a little slower and takes 3 parameters.

7.7.1.45. (idx-f4dotf3 x y z)
(lsh/libidx/idx-float.lsh)


z[i] = sum_jkl x[i, j, k, l]*y[j, k, l]

7.7.1.46. (idx-f3extf1 x y z)
(lsh/libidx/idx-float.lsh)


External (or cross-) product of 3d x with 1d y to yield 4d z . z[i, j, k, l] = x[i, j, k]*y[l]

7.7.1.47. (idx-f1extf3 x y z)
(lsh/libidx/idx-float.lsh)


External (or cross-) product of 1d x with 3d y to yield 4d z . z[i, j, k, l] = x[i]*y[j, k, l]

7.7.1.48. (idx-f3dotf3 a b c)
(lsh/libidx/idx-float.lsh)


c is an idx0 which will contain the sum of all the products of elements from a and b . (this redundant with idx-dot).

7.7.1.49. (idx-f3dotf2 x y z)
(lsh/libidx/idx-float.lsh)


z[i] = sum_jk x[i, j, k]*y[j, k]

7.7.1.50. (idx-f4dotf1 x y z)
(lsh/libidx/idx-float.lsh)


z[j, k, l] = sum_i x[i, j, k, l]*y[i]

7.7.1.51. (idx-f4dotf1acc x y z)
(lsh/libidx/idx-float.lsh)


z[j, k, l] += sum_i x[i, j, k, l]*y[i]

7.7.1.52. (idx-f1extf2 x y z)
(lsh/libidx/idx-float.lsh)


External (or cross-) product of 1d x with 2d y to yield 3d z . z[i, j, k] = x[i]*y[j, k]

7.7.1.53. (idx-f3dotf1 x y z)
(lsh/libidx/idx-float.lsh)


z[j, k] = sum_i x[i, j, k]*y[i]

7.7.1.54. (idx-f3dotf1acc x y z)
(lsh/libidx/idx-float.lsh)


z[j, k] += sum_i x[i, j, k]*y[i]

7.7.1.55. (make-f2-place-target n)
(lsh/libidx/idx-float.lsh)


return an n x n matrix with 1s on the diagonal and -1s everywhere else.

7.7.1.56. (idx-f1range n1 n2 delta)
(lsh/libidx/idx-float.lsh)


Returns a vector of all the numbers between n1 and n2 , stepping by delta . Not compilable under current version.