Re: [petsc-users] Preserving nonzero structure during MatMatMult

2015-09-03 Thread Ghosh, Swarnava
Hi Matt, The motivation is to calculate density matrix in electronic structure calculations. The density matrix can be obtained recursively iterations (known as density matrix purification). An example is X_{n+1} = 3 X_n^2 - 2 X_n^3 Density matrix has property of off diagonal decay.

Re: [petsc-users] Problem installing metis

2015-09-03 Thread Satish Balay
The primary issue is not the include statement - that just gives a different error message: undefined reference to `__pow_finite' vs undefined reference to `pow' The issue is: static void _check_pow() { double x = 0,y ; y = pow(x, x); vs double _check_pow(double x ) { return pow(x, x); i.e 1. re

Re: [petsc-users] Adding rows and columns to a matrix

2015-09-03 Thread David Knezevic
On Thu, Sep 3, 2015 at 8:11 PM, Barry Smith wrote: > > You might also consider the MatNest object. It's job is to help > construct matrices that have a natural set of sub matrices such as yours. > Also look at MatGetLocalSubMat() > OK, thanks for the pointers. Best regards, David > > > O

Re: [petsc-users] Problem installing metis

2015-09-03 Thread Barry Smith
Satish, Well the classic model that Matt inherited from GNU that does not include the appropriate include files but instead makes up some prototype in the test file and looks for symbols in the resulting .o is not IMHO good anyways and I'd like to see it eventually totally eliminated so h

Re: [petsc-users] Problem installing metis

2015-09-03 Thread Satish Balay
Ok - the issue here is:- '-O3 -ffast-math' inlines/optimzies out the math code in configure test [so -lm isn't needed/required here]. But the code in metis [and petsc] library sources isn't inlined out [requiring -lm]. Current configure behavior <<< $ cat conftest.c double p

Re: [petsc-users] Adding rows and columns to a matrix

2015-09-03 Thread Barry Smith
You might also consider the MatNest object. It's job is to help construct matrices that have a natural set of sub matrices such as yours. Also look at MatGetLocalSubMat() Barry > On Sep 3, 2015, at 6:52 PM, David Knezevic wrote: > > I need to add Lagrange multipliers to an existing syst

Re: [petsc-users] Adding rows and columns to a matrix

2015-09-03 Thread Matthew Knepley
On Thu, Sep 3, 2015 at 7:52 PM, David Knezevic wrote: > I need to add Lagrange multipliers to an existing system of equations, > which requires me to expand the matrix. > > I figured I would allocate a new larger matrix with the appropriate > non-zero structure, and then copy the entries from the

Re: [petsc-users] Preserving nonzero structure during MatMatMult

2015-09-03 Thread Matthew Knepley
On Thu, Sep 3, 2015 at 6:55 PM, Ghosh, Swarnava wrote: > Hi, > > I want to do the following: > Matrices DM1, DM2 and DM3 (MPIAIJ type) have the same non zero structure. > I want to multiply DM1*DM2=DM3. BUT the resulting matrix should preserve > the initial non-zero pattern that was set to it.

[petsc-users] Adding rows and columns to a matrix

2015-09-03 Thread David Knezevic
I need to add Lagrange multipliers to an existing system of equations, which requires me to expand the matrix. I figured I would allocate a new larger matrix with the appropriate non-zero structure, and then copy the entries from the smaller matrix over to it. But I was wondering if there might be

[petsc-users] Preserving nonzero structure during MatMatMult

2015-09-03 Thread Ghosh, Swarnava
Hi, I want to do the following: Matrices DM1, DM2 and DM3 (MPIAIJ type) have the same non zero structure. I want to multiply DM1*DM2=DM3. BUT the resulting matrix should preserve the initial non-zero pattern that was set to it. Basically multiplication should not create new non-zero location

Re: [petsc-users] DMCreateMatrix with some dense row

2015-09-03 Thread Barry Smith
Look at DMCreateMatrix_DA_2d_MPIAIJ (or the 3d version if working in 3d) You need to copy this routine and add whatever additional preallocation information you need. Then call DMDASetGetMatrix() so that the DM will use your routine to create the matrix for you. Barry > On Sep

Re: [petsc-users] Problem installing metis

2015-09-03 Thread Satish Balay
Hm - this is weird. >>> TESTING: checkMath from config.libraries(config/BuildSystem/config/libraries.py:251) Check for sin() in libm, the math library Executing: mpicc -o /tmp/petsc-AXFj8c/config.libraries/conftest-Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -

[petsc-users] DMCreateMatrix with some dense row

2015-09-03 Thread Sang pham van
Hi, I am using DMCreateMatrix to create matrix from a existed DM object and defined stencil. In my code, boundary nodes need to involve many inner nodes, thus matrix rows corresponding to boundary nodes are almost dense. How can I tell petsc that those rows need to be preallocated with more entri

Re: [petsc-users] PETSc random number generator

2015-09-03 Thread Barry Smith
> On Sep 3, 2015, at 10:11 AM, Xujun Zhao wrote: > > Hi all, > > I need random Vectors with both Gaussian distribution and uniform > distribution. I notice that PETSc has VecSetRandom() function. I am curious > what types of distribution this function can generate. Thank you for your > answe

[petsc-users] PETSc random number generator

2015-09-03 Thread Xujun Zhao
Hi all, I need random Vectors with both Gaussian distribution and uniform distribution. I notice that PETSc has VecSetRandom() function. I am curious what types of distribution this function can generate. Thank you for your answer. Xujun