1

I am trying working with transition matricies in clojure. In converting say an annual bond rating transition matrix to quarterly, I need 0.25 power of a square matrix.

In python, we have the fractional_matrix_power from scipy as:

>>> from scipy.linalg import fractional_matrix_power
>>> a = np.array([[1.0, 3.0], [1.0, 4.0]])
>>> b = fractional_matrix_power(a, 0.5)
>>> b
array([[ 0.75592895,  1.13389342],
       [ 0.37796447,  1.88982237]])

In searching Incanter and Parallel Colt I have yet to find anything. Wading through javadocs and google searches have not helped but maybe "matrix" and "power" are too generic to drill down to what I am looking for.

I do I really need to transcode a python or R function or is there some cool colt doc site I'm missing?

Phil Cooper
  • 5,747
  • 1
  • 25
  • 41
  • 1
    You're asking for an existing off-site JVM implementation of fractional matrix power, correct? In that case, I believe this question is off-topic. In any case, from the small bit of research I've done, it looks like you will indeed need to transcode from a non-JVM implementation. – Sam Estep Apr 01 '17 at 17:36

1 Answers1

1

You may have already seen the core.matrix library for Clojure. It is focused on basic linear algebra and does not have (yet!) a matrix exponent function as you are describing.

However, if you did transcode the above algorithm from Python to Clojure, I am sure it would be a welcome addition to core.matrix.

You should also look into the Neanderthal project, which is focused on using the GPU for matrix operations.

Alan Thompson
  • 29,276
  • 6
  • 41
  • 48
  • 1
    Thanks Alan. I started to transcode but hit pause when the algos called for Schur decomposition. There is one in Apache.commons math3 but is is not public so I couldn't get to it from clojure. Neanderthal is interesting because the mkl libraries have schur but is is not currently exposed to clojure. I would move more confidently if I knew where some of the algorythmic code should live. Incanter, Neanderthal, core.matrix, apache.commons... clojure, java, c...? In python, scipy is the answer but in clojure, I'm not sure. – Phil Cooper Apr 03 '17 at 16:33