Re: [deal.II] Condition number and Eigen Values of a Matrix

2020-12-04 Thread Reza Rastak
Thank you so much Jean-Paul. I was able to use 
SolverCG::connect_condition_number_slot() successfully in my code.

Best,
Reza

On Thursday, December 3, 2020 at 10:57:23 AM UTC-8 Jean-Paul Pelteret wrote:

> If it's of any help, our CG and GMRES solvers (and maybe some of the 
> others?) can return the estimated condition number during / after a call 
> to solve().
>
> https://dealii.org/developer/doxygen/deal.II/classSolverCG.html#a52f1fd3d41765ec06d2d0add1a74a37c
>  
> <
> https://dealii.org/developer/doxygen/deal.II/classSolverCG.html#a52f1fd3d41765ec06d2d0add1a74a37c
> >
>
> https://dealii.org/developer/doxygen/deal.II/classSolverGMRES.html#a3025d81c3d7db3e1a1b0114bef794202
>  
> <
> https://dealii.org/developer/doxygen/deal.II/classSolverGMRES.html#a3025d81c3d7db3e1a1b0114bef794202
> >
>
> Jean-Paul
>
> On 03.12.20 05:46, Wolfgang Bangerth wrote:
> > On 12/2/20 9:30 PM, Reza Rastak wrote:
> >>
> >> I am trying to calculate the condition number of a Trilinos Block 
> >> Sparse matrix. Is there an example of that in the documentation that 
> >> you can point me to?
> >
> > No, and that's actually a quite difficult task because you have to 
> > estimate eigenvalues. The easiest way is probably to use the power 
> > iteration and inverse power iteration to estimate largest and smallest 
> > eigenvalues -- see the EigenPower and EigenInverse classes.
> >
> > Best
> >  W.
> >
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/9f45c49f-19e4-4a06-85d6-a187e1a9033en%40googlegroups.com.


Re: [deal.II] Condition number and Eigen Values of a Matrix

2020-12-03 Thread Jean-Paul Pelteret
If it's of any help, our CG and GMRES solvers (and maybe some of the 
others?) can return the estimated condition number during / after a call 
to solve().
https://dealii.org/developer/doxygen/deal.II/classSolverCG.html#a52f1fd3d41765ec06d2d0add1a74a37c 

https://dealii.org/developer/doxygen/deal.II/classSolverGMRES.html#a3025d81c3d7db3e1a1b0114bef794202 



Jean-Paul

On 03.12.20 05:46, Wolfgang Bangerth wrote:

On 12/2/20 9:30 PM, Reza Rastak wrote:


I am trying to calculate the condition number of a Trilinos Block 
Sparse matrix. Is there an example of that in the documentation that 
you can point me to?


No, and that's actually a quite difficult task because you have to 
estimate eigenvalues. The easiest way is probably to use the power 
iteration and inverse power iteration to estimate largest and smallest 
eigenvalues -- see the EigenPower and EigenInverse classes.


Best
 W.



--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/85c9726c-da34-1979-e0c1-5ae555c1659d%40gmail.com.


Re: [deal.II] Condition number and Eigen Values of a Matrix

2020-12-02 Thread Wolfgang Bangerth

On 12/2/20 9:30 PM, Reza Rastak wrote:


I am trying to calculate the condition number of a Trilinos Block Sparse 
matrix. Is there an example of that in the documentation that you can point me to?


No, and that's actually a quite difficult task because you have to estimate 
eigenvalues. The easiest way is probably to use the power iteration and 
inverse power iteration to estimate largest and smallest eigenvalues -- see 
the EigenPower and EigenInverse classes.


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/84fb3511-05d2-3a78-1c59-b2bb6347eccf%40colostate.edu.


Re: [deal.II] Condition number and Eigen Values of a Matrix

2020-12-02 Thread Reza Rastak
Dear Wolfgang,

I am trying to calculate the condition number of a Trilinos Block Sparse 
matrix. Is there an example of that in the documentation that you can point 
me to?

Thank you,

Reza

On Sunday, January 31, 2016 at 5:23:31 PM UTC-8 Wolfgang Bangerth wrote:

> On 01/31/2016 12:18 PM, Mohammad Sabawi wrote:
> > **
> >
> > *How to compute the condition number and eigen values of a matrix I use 
> it in
> > my code in deal.II not in Trillions or PETSc? Is there any difference if 
> is
> > it a block or non block matrix?*
>
> deal.II doesn't currently provide a way to compute eigenvalues of sparse 
> matrices other than through Trilinos and PETSc/Slepc (unless you're only 
> interested in the largest/smallest eigenvector, for which you can use the 
> EigenPower/EigenInverse classes).
>
> But you could output the matrix in text format and input it into matlab, 
> for 
> example, if you just want to experiment a bit.
>
> Best
> W.
>
>
> -- 
> 
> Wolfgang Bangerth email: bang...@math.tamu.edu
> www: http://www.math.tamu.edu/~bangerth/
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a67abf41-aed4-49a5-9e01-2aa1eb5186b5n%40googlegroups.com.


Re: [deal.II] condition number

2016-11-15 Thread Wolfgang Bangerth


Anup,


I wanted to know the condition number of my system_matrix and hence I have
used the line in blue (below) in my CG solve function.
It shows the condition number. But in the documentation the definition of this
is not mentioned.


You mean the documentation is missing a definition of what the condition 
number is?




I mean when I store
my system matrix and calculate its max and min eigenvalues in matlab and then
calculate the condition number as their ratio
(i.e, max_eigen_val/ min_eigen_val), this does not match with the one
calculated by connect_condition_number_slot.
The quantities differ by two order of magnitudes.


Which norm does Matlab use to define the condition number? And are you using a 
preconditioner when calling CG?


What CG can only provide you with is an *estimate* of the condition number of 
the (preconditioned) matrix. It does not actually compute the min and max 
eigenvalues, but gets the estimate for the condition number by computing the 
eigenvalues of the subspace in which it finds the current approximation. These 
estimates converge to the true condition number if you just take enough 
iterations, but you may also be stopping the iteration too quickly.


Best
 Wolfgang

--

Wolfgang Bangerth  email: bange...@colostate.edu
   www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] condition number

2016-11-15 Thread Anup Basak
Hello all,

I wanted to know the condition number of my system_matrix and hence I have 
used the line in blue (below) in my CG solve function.
It shows the condition number. But in the documentation the definition of 
this is not mentioned. I mean when I store
my system matrix and calculate its max and min eigenvalues in matlab and 
then calculate the condition number as their ratio 
(i.e, max_eigen_val/ min_eigen_val), this does not match with the one 
calculated by connect_condition_number_slot.
The quantities differ by two order of magnitudes. 

I shall be thankful if someone puts some light on this.

   cg.connect_condition_number_slot(std_cxx11::bind(::print_cond, 
this, std_cxx11::_1));

Thanks,
Anup.

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.