Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
04:47 AM

190 Views

Matrix Determinant

Hi,

there is any way to calculate the determinant of a matrix in CSR3AC or COO format?

Thanks.

Link Copied

15 Replies

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
08:55 AM

190 Views

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
09:48 AM

190 Views

The size of the matrix can go from 4x4 to 2000x2000 elements, where about the 20% of the values is diferent from zero.

The matrix will always be square.

Alexander_K_Intel2

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
10:00 AM

190 Views

So you want to getdeterminant of sparse matrix or inverse of it? If you want to get inverse matrix you could obtain it by PARDISO functionality with many rhs.

With best regards,

Alexander Kalinkin

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
10:58 AM

190 Views

mkl_dcsrsm

mkl_dcoosm

where I can assign

I did not know about PARDISO to obtain the inverse. Is this the best option for the type of matrices I am working with?

Thanks

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
12:25 PM

190 Views

Please state what you propose to do with the inverse. Quite often, if the solution of sparse systems of linear equations with multiple right hand sides is needed, that can be obtained without using the inverse. In fact, there are many reasons why the inverse should not be explicitly formed, except in a small number of special cases.

Alexander_K_Intel2

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-07-2011
12:29 PM

190 Views

Please look this topic: (http://software.intel.com/en-us/forums/showthread.php?t=80373), there is a way to compute invert sparse matrix. Using dss_statistics routine (lookIntel Math Kernel Library ReferenceManualfor more details)you could obtain determinant of initial matrix.

With best regards,

Alexander Kalinkin

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2011
01:27 AM

190 Views

M = -inv(A)*B

where A is of size NxN and B is of size NxM. A and B are sparse matrices with less than 20% of elements diferent from zero.

A is a submatrix from a sparse matrix C of size NxK (K>N). WhenA is singular, I have to obtain another submatrix from C, and try again.

Thanks

mecej4

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2011
08:02 AM

190 Views

1. Choose a submatrix of C as A.

2. Attempt the sparse factorization of A.

3. If Step-2 fails,

3a. Go to Step-1, choosing a different submatrix.

else

3b. Solve A X = B using the factors of A formed in Step-2.

-- done --

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-10-2011
02:58 AM

190 Views

Thanks for your response mecej4,

I am testing with pardiso algorithm.

I execute the phases 11, 22, and 33. When the matrix A is singular,

the phase 33 returns the values IND in the array X.

But, how can I know in the phase 22 if the matrix A is singular?

Alexander_K_Intel2

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-10-2011
03:08 AM

190 Views

The simplest way is to use dss interface instead of PARDISO. Then, as I mentioned before, dss_statistics routine could return determinant of initial matrix. To use PARDISO interface i need to know the value of mtype in you program, could you provide it?

With best regards,

Alexander Kalinkin

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-10-2011
03:41 AM

190 Views

Hi Alexander,

the value of mtype is 11.

Thanks.

the value of mtype is 11.

Thanks.

Alexander_K_Intel2

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-10-2011
11:42 AM

190 Views

it is not clear for me whay you got IND values in solution vector. Could you send small testcase and linkline to me to reproduce this problem on my side? By the way, in your term, as I understood you want to find matrix C with nonzero determinant as submatrix A. Could it happened that there is not such submatrix? (rang(A) < min (N,M))

With best regards,

Alexander Kalinkin

JBervel

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-14-2011
01:28 AM

190 Views

this is a code where I obtain the values IND in the solution vector:

[cpp]#include#include using std::cout; using std::endl; int main() { //Solver internal data address pointer int *pt = new int[64]; for(int i=0; i<64; i++) pt = 0; //Maximal number of factors with identical nonzero sparsity structure int maxfct = 1; //Actual matrix for the solution phase: 1 <= mnum <= maxfct int mnum = 1; //Defines the matrix type //11: real and unsymmetric matrix int mtype = 11; //Controls the execution of the solver int phase = 11; //Number of equations int n = 2; //Non-zero values of the coefficient matrix A //3 1 = A //0 0 double *a = new double[3]; a[0] = 3.0; a[1] = 1.0; a[2] = 0.0; //Row Index int *ia = new int[n+1]; ia[0] = 1; ia[1] = 3; ia[2] = 4; //Columns int *ja = new int[2]; ja[0] = 1; ja[1] = 2; ja[2] = 1; //Permutation vector of size n int *perm = new int; for(int i=0; i = 0; //Number of right-hand sides that need to be solved for int nrhs = 2; //Pass parameters to Pardiso int iparm[64]; for(int i=0; i<64; i++) iparm = 0; iparm[0] = 0; // Solver default if iparm[0] = 0 iparm[1] = 2; // Fill-in reordering from METIS // Numbers of processors, value of OMP_NUM_THREADS iparm[2] = 1; // Not in use iparm[3] = 0; // No iterative-direct algorithm iparm[4] = 0; // No user fill-in reducing permutation iparm[5] = 0; // 0: Write solution into x / 1: The solver stores the solution on the righthand side b iparm[6] = 0; // Not in use iparm[7] = 2; // Max numbers of iterative refinement steps iparm[8] = 0; // Not in use iparm[9] = 13; // Perturb the pivot elements with 1E-13 iparm[10] = 1; // Use nonsymmetric permutation and scaling MPS iparm[11] = 0; // Not in use iparm[12] = 1; // Maximum weighted matching algorithm is switched-on (default for non-symmetric) iparm[13] = 0; // Output: Number of perturbed pivots iparm[14] = 0; // Not in use iparm[15] = 0; // Not in use iparm[16] = 0; // Not in use iparm[17] = -1; // Output: Number of nonzeros in the factor LU iparm[18] = -1; // Output: Mflops for LU factorization //iparm[19] = 0; // Output: Numbers of CG Iterations //Message level information //0: Pardiso generates no output / 1: Pardiso prints statistical information to the screen int msglvl = 1; //Right-hand side // 5 = B // 6 double *b = new double[n*nrhs]; for(int i=0; i= 0.0; b[0] = 5.0; b[1] = 6.0; //Output if iparm(6)=0 double *x = new double[n*nrhs]; for(int i=0; i = 0.0; //Error Indicator int error = 0; cout << "PARDISO PHASE: " << phase << endl; pardiso(pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error); cout << "Error = " << error << endl; cout << "b: "; for(int i=0; i << " "; cout << endl; cout << "x: "; for(int i=0; i << " "; cout << endl; phase = 22; cout << "PARDISO PHASE: " << phase << endl; pardiso(pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error); cout << "Error = " << error << endl; cout << "b: "; for(int i=0; i << " "; cout << endl; cout << "x: "; for(int i=0; i << " "; cout << endl; phase = 33; cout << "PARDISO PHASE: " << phase << endl; pardiso(pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja, perm, &nrhs, iparm, &msglvl, b, x, &error); cout << "Error = " << error << endl; cout << "b: "; for(int i=0; i << " "; cout << endl; cout << "x: "; for(int i=0; i << " "; cout << endl; }[/cpp]

The matrix A is singular:

3 1

00

Respect to your question, always exist a submatrix of C that is not singular.

Thanks

Alexander_K_Intel2

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-14-2011
06:29 AM

190 Views

Hi,

I've reproduced your issue, I will try to resolve it asap.

With best regards,

Alexander Kalinkin

Gennady_F_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-07-2011
01:49 AM

190 Views

the fix of this problem available in the latest Update 6. See here the anounce of this release.

Please check the issue and let us know the results.

--Gennady

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.