Distance matrix: Can I do the 'Singleton expansion with a custom function' from http://www.mathworks.com/help/matlab/ref/bsxfun.html in breeze? Something like bsxfun in octave?

38 views
Skip to first unread message

Daniel Korzekwa

unread,
Sep 9, 2015, 1:44:07 AM9/9/15
to jblas-users
Hello,

I need computing distance matrix for a given vector, something which in octave is very quick with  bsxfun(@minus,x',x). 

Does jBlas or other java/scala library provide some functions similar to bsxfun for singleton expansion?





Mikio Braun

unread,
Sep 9, 2015, 4:25:41 AM9/9/15
to jblas...@googlegroups.com
Hi Daniel,

jblas has overloaded versions to subtract a scalar value from a
vector. There are also functions like addColumnVector, addRowVector
etc. to work with a vector vs. a matrix. Was that the use case you
looked for? What are the dimensions of x' and x?

-M
> --
> You received this message because you are subscribed to the Google Groups
> "jblas-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jblas-users...@googlegroups.com.
> To post to this group, send email to jblas...@googlegroups.com.
> Visit this group at http://groups.google.com/group/jblas-users.
> For more options, visit https://groups.google.com/d/optout.



--
Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun

Daniel Korzekwa

unread,
Sep 9, 2015, 5:33:56 AM9/9/15
to jblas-users
x - covariance matrix used by stochastic inference for multi output Gaussian process (https://github.com/danielkorzekwa/bayes-scala-gp/blob/master/doc/cogp/cogp.md)

x: [M x D] - M number of training points < 500, D - number of predictor features (a few)

covMatrix: [M x M], is computed many (hundreds) times. The most time consuming operation is computing squared distance matrix.
Reply all
Reply to author
Forward
0 new messages