Turn on thread page Beta
    • Thread Starter
    Offline

    10
    ReputationRep:
    I'm writing a computer program which involves using real random, symmetric positive definite matrices.

    An SPD matrix M is symmetric and satisfies x^T M x >0 for all non-zero vectors z with real entries.

    Can someone explain how I can generate these matrices?
    Offline

    15
    ReputationRep:
    I don't know if there's a more standard way to do it, but all SPD matrices are orthogonally diagonalizable with positive eigenvalues.

    You could randomly choose a set of positive entries in a diagonal matrix D, take a random matrix X (which would almost always be invertible) and use Gram-Schmidt to turn it into an orthogonal matrix P. It would then be the case that P^T D P would be an SPD matrix.

    What sort of distribution, though, are you looking to have on your SPD matrices?
    • Thread Starter
    Offline

    10
    ReputationRep:
    (Original post by RichE)
    What sort of distribution, though, are you looking to have on your SPD matrices?
    Uniform.
    Offline

    15
    ReputationRep:
    (Original post by 0-))
    Uniform.
    Think that will be impossible - it's like asking for a uniform distribution on the real line
    • Thread Starter
    Offline

    10
    ReputationRep:
    (Original post by RichE)
    Think that will be impossible - it's like asking for a uniform distribution on the real line
    I don't think I meant uniform. I just need any random SPD matrices formed from a matrix formed using a random number generator.
    Offline

    15
    ReputationRep:
    (Original post by 0-))
    I don't think I meant uniform. I just need any random SPD matrices formed from a matrix formed using a random number generator.
    In that case you could do what I suggested in my first post - but to what end are you producing these SPDs? Surely you care about their distribution if they're to serve some purpose.
    • Thread Starter
    Offline

    10
    ReputationRep:
    (Original post by RichE)
    In that case you could do what I suggested in my first post - but to what end are you producing these SPDs? Surely you care about their distribution if they're to serve some purpose.
    I'm trying to generate random SPD matrices to test my conjugate gradient method program.
    Offline

    15
    ReputationRep:
    (Original post by 0-))
    I'm trying to generate random SPD matrices to test my conjugate gradient method program.
    In that case it would probably be enough to take a fixed orthogonal matrix P and use your random number generator to populate a diagonal matrix with positive entries.

    P^T D P would then be an SPD matrix.
 
 
 

University open days

  1. University of Bradford
    University-wide Postgraduate
    Wed, 25 Jul '18
  2. University of Buckingham
    Psychology Taster Tutorial Undergraduate
    Wed, 25 Jul '18
  3. Bournemouth University
    Clearing Campus Visit Undergraduate
    Wed, 1 Aug '18
Poll
How are you feeling in the run-up to Results Day 2018?
Useful resources

Make your revision easier

Maths

Maths Forum posting guidelines

Not sure where to post? Read the updated guidelines here

Equations

How to use LaTex

Writing equations the easy way

Student revising

Study habits of A* students

Top tips from students who have already aced their exams

Study Planner

Create your own Study Planner

Never miss a deadline again

Polling station sign

Thinking about a maths degree?

Chat with other maths applicants

Can you help? Study help unanswered threads

Groups associated with this forum:

View associated groups

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.