Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1033399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:13:37+00:00 2026-05-16T14:13:37+00:00

Assume that I have an affinity matrix A and a diagonal matrix D. How

  • 0

Assume that I have an affinity matrix A and a diagonal matrix D. How can I compute the Laplacian matrix in Python with nympy?

L = D^(-1/2) A D^(1/2)

Currently, I use L = D**(-1/2) * A * D**(1/2). Is this a right way?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:13:37+00:00Added an answer on May 16, 2026 at 2:13 pm

    Numpy allows you to exponentiate a diagonal "matrix" with positive elements and a positive exponent directly:

    m = diag(range(1, 11))
    print m**0.5
    

    The result is what you expect in this case because NumPy actually applies the exponentiation to each element of the NumPy array individually.

    However, it indeed does not allow you to exponentiate any NumPy matrix directly:

    m = matrix([[1, 1], [1, 2]])
    print m**0.5
    

    produces the TypeError that you have observed (the exception says that the exponent must be an integer–even for matrices that can be diagonalized with positive coefficients).

    So, as long as your matrix D is diagonal and your exponent is positive, you should be able to directly use your formula.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have this piece of code: @interface Foo : NSObject { Bar
Assume that we have multiple arrays of integers. You can consider each array as
I am currently implementing a method that accepts two bitmap objects. We can assume
Assume that I have some array of data (a vector to be specific). Can
Assume that I have an appstore. developers submit their application in this store. My
Assume that we have this SQL statement: UPDATE article SET saison='12E', mode='ECH', client='SAS', WHERE
Assume I have a UIMA toolchain that does something like this: tokenize -> POS
Assume that we have N erlang nodes, running same application. I want to share
Assume that you have a running SQL Server Express instance named (local)\SQLEXPRESS. Its database
Assume that I have the ItemSource bound and i am getting the data. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.