Phil Cooper
Phil Cooper

Reputation: 5877

Fractional Matrix Power in Clojure

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?

Upvotes: 1

Views: 205

Answers (1)

Alan Thompson
Alan Thompson

Reputation: 29984

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.

Upvotes: 1

Related Questions