Boost logo

Ublas :

From: Paul C. Leopardi (paul.leopardi_at_[hidden])
Date: 2007-09-10 10:21:10

On Mon, 10 Sep 2007, Mei, Longyu wrote:
> Hi there,
> I want to do sqrt on matrix. For example if I have a matrix A [4, 9,
> 16], after the sqrt(A), the expected result should be a matrix B [2, 3,
> 4]. Can ublas does this on one function call? Thanks

Hi James,
Please note that for square matrices there are two concepts of a square root.

The first is element by element, as you have described above. This corresponds
to the Matlab sqrt function. I'm not sure if you want a complex element by
element square root, BTW.

The second is a matrix square root, ie. M1 == sqrt(M2) <=> M1 * M1 == M2.
This corresponds to the Matlab sqrtm function.
Best, Paul