Thread: square root of a matrix

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    16

    square root of a matrix

    Hi,
    I want to find the square root of a matrix in C. I know there is command like "dpotrf" in C to find the cholesky decomposition, which gives us X, where XX' = A. But this method fails when A is positive semidefinite or negative definite. However, there is a command "sqrtm" in MATLAB which gives the square root of even a positive semidefinite or negative definite matrix such that YY = A, where Y is the square root of matrix A. Is there any thing similar to "sqrtm" in C???

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Once you write it, there will be.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I know there is command like "dpotrf" in C to find the cholesky decomposition
    No there isn't.
    What there is is a library with a 'C' interface you can call from your C programs,

    > However, there is a command "sqrtm" in MATLAB
    So use a matlab C library binding then
    matlab c api - Google Search
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Square Root ?!?
    By Tm687 in forum C++ Programming
    Replies: 1
    Last Post: 02-29-2004, 04:38 PM
  2. Square Root
    By Kyoto Oshiro in forum C++ Programming
    Replies: 5
    Last Post: 09-05-2002, 01:22 AM
  3. Square root
    By Unregistered in forum C Programming
    Replies: 8
    Last Post: 07-05-2002, 06:35 AM
  4. Square Root??
    By Dangerous Dave in forum C Programming
    Replies: 5
    Last Post: 10-18-2001, 10:34 PM
  5. square root
    By help in forum C Programming
    Replies: 5
    Last Post: 08-29-2001, 05:46 AM