You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like you're asking for help with setting up a linear equation system in the form ( Ax = b ) using Julia, where ( A ) is a ( 2 \times 3 ) matrix, ( x ) is a ( 3 )-dimensional vector, and ( b ) is a ( 2 )-dimensional vector. Your code snippet is almost correct, but there are a couple of minor adjustments needed for clarity and correctness.
Here's a corrected version of your code:
## Packagesusing Pardiso
using SparseArrays
gpmt =MKLPardisoSolver() # or gpmt = PardisoSolver()## Data
A = [111; 242.0] # Define the matrix A
Acsr =sparse(A)
b = [35; 94.0] # Define the vector b## Solving...set_msglvl!(gpmt, 1)
xsol =solve(gpmt, Acsr , b)
The above gives me that
=== PARDISO is running in In-Core mode, because iparam(60)=0===...2-element Vector{Float64}:23.012.0
But the result has only 2 elements. And i want 3 elements. If i write the code of
## Solving...
xs =zeros(3,1);
solve!(gpmt, xs, Acsr , b)
It gives me errors of
ERROR: DimensionMismatch: solution has (3, 1), RHS has size as (2,).
Although, i know reason from the dims of A{2,3} * x{3,1} = b{2,1}. And I should write code of
## Packagesusing Pardiso
using SparseArrays
gpmt =MKLPardisoSolver() # or gpmt = PardisoSolver()## Data
A = [111; 242.0] # Define the matrix A
Acsr =sparse(A'*A)
b = [35; 94.0] # Define the vector b
brhs =reshape(A'*b,3,1)
## Solving...set_msglvl!(gpmt, 1)
xs =zeros(3,1);
solve!(gpmt, xs, Acsr , brhs)
So that, i want ask a question of Ax = b with A in ( R^{m \times n } ), x in R^{n} and b in R^{m} satisfying m < n. Hence, how to setting for solving this type of A x = b? And i translate Ax = b into A'*A x = A'*b, then solving it by Pardiso?
Sincerely,
Aijunly, Jun Wang.
The text was updated successfully, but these errors were encountered:
Pardiso only works for square systems. In your case what is happening is that it is actually solving the square system containing only first m columns.
Maybe we should update this so that it returns an error when trying to solve a non-square system.
It looks like you're asking for help with setting up a linear equation system in the form ( Ax = b ) using Julia, where ( A ) is a ( 2 \times 3 ) matrix, ( x ) is a ( 3 )-dimensional vector, and ( b ) is a ( 2 )-dimensional vector. Your code snippet is almost correct, but there are a couple of minor adjustments needed for clarity and correctness.
Here's a corrected version of your code:
The above gives me that
But the result has only 2 elements. And i want 3 elements. If i write the code of
It gives me errors of
Although, i know reason from the dims of A{2,3} * x{3,1} = b{2,1}. And I should write code of
So that, i want ask a question of Ax = b with A in ( R^{m \times n } ), x in R^{n} and b in R^{m} satisfying m < n. Hence, how to setting for solving this type of A x = b? And i translate Ax = b into A'*A x = A'*b, then solving it by Pardiso?
Sincerely,
Aijunly, Jun Wang.
The text was updated successfully, but these errors were encountered: