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 8614733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:11:27+00:00 2026-06-12T05:11:27+00:00

I have done a program to calculate a determinant of a matrix. My program

  • 0

I have done a program to calculate a determinant of a matrix. My program works, but the problem is that it takes long time to calculate, especially for big matrix. Could you tell me how can a perform my program in order to calculate the determinant in the shortest possible time?

    double Matrice::Determinant(int n)
{
   cout<<"n = "<<n<<endl;
   int i,j,j1,j2;
   double det = 0;
   Matrice tmp(n,n);
   if (n < 1) 
   {
   } 
   else if (n == 1) 
   { 
      det = this->get_el(0,0);
   } else if (n == 2) {
      det = this->get_el(0,0) * this->get_el(1,1) - this->get_el(1,0) * this->get_el(0,1);
   } else {
      det = 0;
      for (j1=0;j1<n;j1++) {
         for (i=1;i<n;i++) {
            j2 = 0;
            for (j=0;j<n;j++) {
               if (j == j1)
                  continue;
               tmp.set_el(i-1,j2,get_el(i,j));
               j2++;
            }
         }
         det += pow(-1.0,1.0+j1+1.0) * get_el(0,j1) * tmp.Determinant(n-1);
      }
   }
   return det;
}
  • 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-06-12T05:11:28+00:00Added an answer on June 12, 2026 at 5:11 am

    Your algorithm, which looks like a straight-forward implementation of the definition formula, is in O(n!).

    A standard algorithm in O(n^3) consists in first transforming it into a triangular matrix using Gauss elimination. Once you have done this, the determinant is the product of the diagonal elements.

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

Sidebar

Related Questions

I have done one program that allow user can listen to the music via
I have done a homework assignment, here is the problem statement: Your program should
I have this java program which calculates the time that the person took to
I have done one program in android using xml parsing but there is an
Basically, i have done my program so that it will display differences in strings
Have you ever done any .net programming? Yes? Good, here's a massive broken program,
I have a program and as it's done now, it has a data directory
I almost done my coding for a specific program i have. I just need
Have done some research and found some stuff that may be helpful. I would
I have a program that loads a file (anywhere from 10MB to 5GB) a

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.