You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mike Zhou <mi...@interpss.org> on 2010/12/08 22:49:16 UTC

[MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Hi,

I am trying to use common math library to solve large-scale liner equation
with sparse structure. Use the SpareRealMatrix interface
and OpenMapRealMatrix implementation, I defined my matrix. Then using the LU
decomposition,

new LUDecompositionImpl(A).getSolver().solve(B)

I could find the solution. However, the LU based solution seems to be very
slow. I guess, it solves the sparse matrix as a full matrix.

Question

- Does the LUComposition implementation take full advantage of the sparse
matrix structure
- If yes, where I might be wrong?

I am using common math lib 2.1.

Thanks, Mike Zhou

Re: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Posted by Mike Zhou <mi...@interpss.org>.
Certainly, first I do not want to maintain the code. Also, I am not trained
as a mathematician. Therefore, I do not think my code is bullet-prove and
the best-possible solution.

So what is the process to contribute?

Mike

On Wed, Dec 8, 2010 at 5:24 PM, Haswell, Joe <jo...@hp.com>wrote:

> You're right. Would you consider integrating and contributing your sparse
> solver?
>
> Joe H. | HP Software
>
> -----Original Message-----
> From: Mike Zhou [mailto:mike.zhou@interpss.org]
> Sent: Wednesday, December 08, 2010 3:14 PM
> To: Commons Users List
> Subject: Re: [MATH] Linear equation [A] [X] = [B] solution using Sparse
> Matrix
>
> Joe,
>
> It could be 50K x 50K, however, with only less than 1% non-zero elements.
> For example, for a 2500x2500 sparse matrix, the following are my test
> results:
>
> - Common math LU decomposition 54 sec
> - My own sparse matrix routine (Pure Java) 0.2 sec
>
> Clearly, common math lib solves the matrix as a full matrix.
>
> Thx, Mike
>
> On Wed, Dec 8, 2010 at 4:50 PM, Haswell, Joe <josiah.d.haswell@hp.com
> >wrote:
>
> > How large?  It's likely one of those pesky time-complexity things you run
> > into sometimes =(
> >
> > Joe H.  | HP Software
> >
> > -----Original Message-----
> > From: Mike Zhou [mailto:mike.zhou@interpss.org]
> > Sent: Wednesday, December 08, 2010 2:49 PM
> > To: Commons Users List
> > Subject: [MATH] Linear equation [A] [X] = [B] solution using Sparse
> Matrix
> >
> > Hi,
> >
> > I am trying to use common math library to solve large-scale liner
> equation
> > with sparse structure. Use the SpareRealMatrix interface
> > and OpenMapRealMatrix implementation, I defined my matrix. Then using the
> > LU
> > decomposition,
> >
> > new LUDecompositionImpl(A).getSolver().solve(B)
> >
> > I could find the solution. However, the LU based solution seems to be
> very
> > slow. I guess, it solves the sparse matrix as a full matrix.
> >
> > Question
> >
> > - Does the LUComposition implementation take full advantage of the sparse
> > matrix structure
> > - If yes, where I might be wrong?
> >
> > I am using common math lib 2.1.
> >
> > Thanks, Mike Zhou
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

RE: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Posted by "Haswell, Joe" <jo...@hp.com>.
You're right. Would you consider integrating and contributing your sparse solver?

Joe H. | HP Software

-----Original Message-----
From: Mike Zhou [mailto:mike.zhou@interpss.org] 
Sent: Wednesday, December 08, 2010 3:14 PM
To: Commons Users List
Subject: Re: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Joe,

It could be 50K x 50K, however, with only less than 1% non-zero elements.
For example, for a 2500x2500 sparse matrix, the following are my test
results:

- Common math LU decomposition 54 sec
- My own sparse matrix routine (Pure Java) 0.2 sec

Clearly, common math lib solves the matrix as a full matrix.

Thx, Mike

On Wed, Dec 8, 2010 at 4:50 PM, Haswell, Joe <jo...@hp.com>wrote:

> How large?  It's likely one of those pesky time-complexity things you run
> into sometimes =(
>
> Joe H.  | HP Software
>
> -----Original Message-----
> From: Mike Zhou [mailto:mike.zhou@interpss.org]
> Sent: Wednesday, December 08, 2010 2:49 PM
> To: Commons Users List
> Subject: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix
>
> Hi,
>
> I am trying to use common math library to solve large-scale liner equation
> with sparse structure. Use the SpareRealMatrix interface
> and OpenMapRealMatrix implementation, I defined my matrix. Then using the
> LU
> decomposition,
>
> new LUDecompositionImpl(A).getSolver().solve(B)
>
> I could find the solution. However, the LU based solution seems to be very
> slow. I guess, it solves the sparse matrix as a full matrix.
>
> Question
>
> - Does the LUComposition implementation take full advantage of the sparse
> matrix structure
> - If yes, where I might be wrong?
>
> I am using common math lib 2.1.
>
> Thanks, Mike Zhou
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Posted by Mike Zhou <mi...@interpss.org>.
Joe,

It could be 50K x 50K, however, with only less than 1% non-zero elements.
For example, for a 2500x2500 sparse matrix, the following are my test
results:

- Common math LU decomposition 54 sec
- My own sparse matrix routine (Pure Java) 0.2 sec

Clearly, common math lib solves the matrix as a full matrix.

Thx, Mike

On Wed, Dec 8, 2010 at 4:50 PM, Haswell, Joe <jo...@hp.com>wrote:

> How large?  It's likely one of those pesky time-complexity things you run
> into sometimes =(
>
> Joe H.  | HP Software
>
> -----Original Message-----
> From: Mike Zhou [mailto:mike.zhou@interpss.org]
> Sent: Wednesday, December 08, 2010 2:49 PM
> To: Commons Users List
> Subject: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix
>
> Hi,
>
> I am trying to use common math library to solve large-scale liner equation
> with sparse structure. Use the SpareRealMatrix interface
> and OpenMapRealMatrix implementation, I defined my matrix. Then using the
> LU
> decomposition,
>
> new LUDecompositionImpl(A).getSolver().solve(B)
>
> I could find the solution. However, the LU based solution seems to be very
> slow. I guess, it solves the sparse matrix as a full matrix.
>
> Question
>
> - Does the LUComposition implementation take full advantage of the sparse
> matrix structure
> - If yes, where I might be wrong?
>
> I am using common math lib 2.1.
>
> Thanks, Mike Zhou
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

RE: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Posted by "Haswell, Joe" <jo...@hp.com>.
How large?  It's likely one of those pesky time-complexity things you run into sometimes =(

Joe H.  | HP Software

-----Original Message-----
From: Mike Zhou [mailto:mike.zhou@interpss.org] 
Sent: Wednesday, December 08, 2010 2:49 PM
To: Commons Users List
Subject: [MATH] Linear equation [A] [X] = [B] solution using Sparse Matrix

Hi,

I am trying to use common math library to solve large-scale liner equation
with sparse structure. Use the SpareRealMatrix interface
and OpenMapRealMatrix implementation, I defined my matrix. Then using the LU
decomposition,

new LUDecompositionImpl(A).getSolver().solve(B)

I could find the solution. However, the LU based solution seems to be very
slow. I guess, it solves the sparse matrix as a full matrix.

Question

- Does the LUComposition implementation take full advantage of the sparse
matrix structure
- If yes, where I might be wrong?

I am using common math lib 2.1.

Thanks, Mike Zhou

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org