[Jama] Matrix square root

37 views
Skip to first unread message

Cleve Moler

unread,
Jun 19, 2018, 6:44:32 PM6/19/18
to ja...@list.nist.gov
Hello -

Jama does not have a function for computing the square root of a matrix.

If you have Google search for "Matrix square root" you will find several relevant articles.

If you have MATLAB, use "sqrtm".

Good luck.

-- Cleve Moler


_______________________________________

Sir, I am using Jama Matrix in my Project. In a stage of my project I need to find out the Square Root of a Jama matrix. How could I do this?

Thank you Sir

Your Sincerely,

Saswati Bhattacharjee

David Galea

unread,
Jun 19, 2018, 8:40:50 PM6/19/18
to ja...@list.nist.gov
Cleve,
To find the sqrt of a matrix A, compute the Eigenvalue decomposition using the attached and then

sqrt(A) = V * sqrt(D) * V^(-1)

Where sqrt(D) = [ sqrt(Di) ]

Please advise if you don't know how to proceed.

Kind Regards,
David G


https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html

Class EigenvalueDecomposition - NIST<https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html>
math.nist.gov
public class EigenvalueDecomposition extends Object implements Serializable. Eigenvalues and eigenvectors of a real matrix. If A is symmetric, then A = V*D*V' where the eig


________________________________
From: jama-bounces at nist.gov <jama-bounces at nist.gov> on behalf of Cleve Moler <Cleve.Moler at mathworks.com>
Sent: Wednesday, 20 June 2018 8:44:32 AM
To: csesaswati at gmail.com
Cc: ronald.boisvert at nist.gov; Jama users discussion list
Subject: [Jama] Matrix square root


Hello ?

Jama does not have a function for computing the square root of a matrix.

If you have Google search for ?Matrix square root? you will find several relevant articles.

If you have MATLAB, use ?sqrtm?.

David Galea

unread,
Jun 19, 2018, 8:42:38 PM6/19/18
to ja...@list.nist.gov
Cleve,
In fact to compute g(A) you take the exact same procedure, i.e.

g(A) = V * g(D) * V^(-1)

Where g(D) = [ g(Di) ]

Kind Regards,
David G

________________________________
From: jama-bounces at nist.gov <jama-bounces at nist.gov> on behalf of Cleve Moler <Cleve.Moler at mathworks.com>
Sent: Wednesday, 20 June 2018 8:44:32 AM
To: csesaswati at gmail.com
Cc: ronald.boisvert at nist.gov; Jama users discussion list
Subject: [Jama] Matrix square root


Hello ?

Jama does not have a function for computing the square root of a matrix.

If you have Google search for ?Matrix square root? you will find several relevant articles.

If you have MATLAB, use ?sqrtm?.

Cleve Moler

unread,
Jun 22, 2018, 5:25:45 PM6/22/18
to ja...@list.nist.gov
David -

That doesn't work if V doesn't exist, i.e. A does not have a full set of linearly independent eigenvectors.
For example, A = [0 1; 0 0].
And it is a bad idea if V is nearly singular, i.e. if A is close to a matrix that does not have a full set of eigenvectors.

-- Cleve

From: jama-bounces at nist.gov [mailto:jama-bounces at nist.gov] On Behalf Of David Galea
Sent: Tuesday, June 19, 2018 5:41 PM
To: csesaswati at gmail.com; Jama users discussion list <ja...@list.nist.gov>
Cc: ronald.boisvert at nist.gov
Subject: Re: [Jama] Matrix square root


Cleve,
To find the sqrt of a matrix A, compute the Eigenvalue decomposition using the attached and then

sqrt(A) = V * sqrt(D) * V^(-1)

Where sqrt(D) = [ sqrt(Di) ]

Please advise if you don't know how to proceed.

Kind Regards,
David G


https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html<https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html>


Class EigenvalueDecomposition - NIST<https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html>
math.nist.gov
public class EigenvalueDecomposition extends Object implements Serializable. Eigenvalues and eigenvectors of a real matrix. If A is symmetric, then A = V*D*V' where the eig


________________________________
From: jama-bounces at nist.gov<mailto:jama-bounces at nist.gov> <jama-bounces at nist.gov<mailto:jama-bounces at nist.gov>> on behalf of Cleve Moler <Cleve.Moler at mathworks.com<mailto:Cleve.Moler at mathworks.com>>


Sent: Wednesday, 20 June 2018 8:44:32 AM

To: csesaswati at gmail.com<mailto:csesaswati at gmail.com>
Cc: ronald.boisvert at nist.gov<mailto:ronald.boisvert at nist.gov>; Jama users discussion list


Subject: [Jama] Matrix square root


Hello -

Jama does not have a function for computing the square root of a matrix.

If you have Google search for "Matrix square root" you will find several relevant articles.

If you have MATLAB, use "sqrtm".

David Galea

unread,
Jun 25, 2018, 6:54:52 PM6/25/18
to ja...@list.nist.gov
Hi Cleve,
Yes indeed. I should have stipulated that in my previous email.
There are other decompositions you can employ and some iterative methods as outlined in the attached.
This may assist in the case of near singularity.

I had a quick look and the Matlab documentation states that it uses the 'Blocked Schur Algorithms' to compute the square root. I have attached the article. It seems to be a fairly simple algorithm to implement. I would be happy to do so if people would like this done.

Kind Regards

<https://link.springer.com/chapter/10.1007/978-3-642-36803-5_12>https://repositorium.sdum.uminho.pt/bitstream/1822/23671/1/edvin_nick_rui.pdf


https://en.wikipedia.org/wiki/Square_root_of_a_matrix

Square root of a matrix - Wikipedia<https://en.wikipedia.org/wiki/Square_root_of_a_matrix>
en.wikipedia.org
In mathematics, the square root of a matrix extends the notion of square root from numbers to matrices.. Matrix B is said to be a square root of A if the matrix product B B is equal to A.


________________________________
From: Cleve Moler <Cleve.Moler at mathworks.com>
Sent: Saturday, 23 June 2018 7:25:45 AM
To: David Galea; ja...@list.nist.gov; csesaswati at gmail.com
Subject: RE: Matrix square root


David ?

That doesn?t work if V doesn?t exist, i.e. A does not have a full set of linearly independent eigenvectors.

For example, A = [0 1; 0 0].

And it is a bad idea if V is nearly singular, i.e. if A is close to a matrix that does not have a full set of eigenvectors.

-- Cleve

From: jama-bounces at nist.gov [mailto:jama-bounces at nist.gov] On Behalf Of David Galea
Sent: Tuesday, June 19, 2018 5:41 PM
To: csesaswati at gmail.com; Jama users discussion list <ja...@list.nist.gov>
Cc: ronald.boisvert at nist.gov
Subject: Re: [Jama] Matrix square root

Cleve,
To find the sqrt of a matrix A, compute the Eigenvalue decomposition using the attached and then

sqrt(A) = V * sqrt(D) * V^(-1)

Where sqrt(D) = [ sqrt(Di) ]

Please advise if you don't know how to proceed.

Kind Regards,
David G


https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html

Class EigenvalueDecomposition - NIST<https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html>


math.nist.gov
public class EigenvalueDecomposition extends Object implements Serializable. Eigenvalues and eigenvectors of a real matrix. If A is symmetric, then A = V*D*V' where the eig

math.nist.gov

public class EigenvalueDecomposition extends Object implements Serializable. Eigenvalues and eigenvectors of a real matrix. If A is symmetric, then A = V*D*V' where the eig


________________________________

From: jama-bounces at nist.gov<mailto:jama-bounces at nist.gov> <jama-bounces at nist.gov<mailto:jama-bounces at nist.gov>> on behalf of Cleve Moler <Cleve.Moler at mathworks.com<mailto:Cleve.Moler at mathworks.com>>
Sent: Wednesday, 20 June 2018 8:44:32 AM
To: csesaswati at gmail.com<mailto:csesaswati at gmail.com>
Cc: ronald.boisvert at nist.gov<mailto:ronald.boisvert at nist.gov>; Jama users discussion list
Subject: [Jama] Matrix square root

Hello ?

Jama does not have a function for computing the square root of a matrix.

If you have Google search for ?Matrix square root? you will find several relevant articles.

If you have MATLAB, use ?sqrtm?.

Reply all
Reply to author
Forward
0 new messages