[petsc-users] Creating random matrices and doing Least squares in PETSc

Barry Smith bsmith at mcs.anl.gov
Sun Jan 16 18:27:39 CST 2011


On Jan 16, 2011, at 6:23 PM, Gaurish Telang wrote:

> Hi, this might be a vague question but is it possible to create a random rectangular matrix in PETSc of arbitrary specified dimension? More specifically,  I would like the rectangular matrix to be sparse and have 1.14% non-zeros in the matrix. 
>  
> If there is no such direct way,  is there a way for MATLAB to do this and then possibly output it to a text file so that it could be fed to PETSc?  

  use $PETSC_DIR/bin/matlab/PetscBinaryWrite.m  to save the matrix to a fast binary format then use MatLoad() to load it into PETSc 

   Barry

>  
> The thing is I want to know how fast PETSc does least squares problems |Ax-b| for matrices A of dimensions like 2683x1274 where A is sparse with about 1.14% non-zeros.
>  
> If you have any kind of timing studies / weblinks describing how fast PETSc does least square problems that would be really helpful.
>  
> Sincere thanks,
>  
> Gaurish.



More information about the petsc-users mailing list