[petsc-users] Tensor product as matrix free method

Mathis Friesdorf mathisfriesdorf at gmail.com
Tue Apr 1 05:37:08 CDT 2014


Thanks for the helpful comments. Apparently my first mail was a bit
unclear. I have already implemented it as a matrix-free method using
MatShell, but currently it is written with a bunch of for loops and is
horribly inefficient and in fact a lot slower than my python implementation
with numpy. I am quite sure that using TAIJ matrices would be the solution,
but I am unsure on how to do it precisely, since there is so little
documentation available.

Thanks again and all the best, Mathis


On Mon, Mar 31, 2014 at 7:10 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Mar 31, 2014 at 11:49 AM, Mathis Friesdorf <
> mathisfriesdorf at gmail.com> wrote:
>
>> Hello everybody,
>>
>> for my Ph.D. in theoretical quantum mechanics, I am currently trying to
>> integrate the Schroedinger equation (a linear partial differential
>> equation). In my field, we are working with so called local spin chains,
>> which mathematically speaking are described by tensor products of small
>> vector spaces over several systems (let's say 20). The matrix corresponding
>> to the differential equation is called Hamiltonian and can for typical
>> systems be written as a sum over tensor products where it acts as the
>> identity on most systems. It normally has the form
>>
>> *\sum Id \otimes Id ... Id \otimes M \otimes Id \otimes ...*
>>
>> where M takes different positions.I know how to explicitly construct the
>> full matrix and insert it into Petsc, but for the interesting applications
>> it is too large to be stored in the RAM. I would therefore like to
>> implement it as a matrix free version.
>> This should be possible using MatCreateMAIJ() and VecGetArray(), as the
>> following very useful post points out
>> http://lists.mcs.anl.gov/pipermail/petsc-users/2011-September/009992.html.
>> I was wondering whether anybody already made progress with this, as I am
>> still a bit lost on how to precisely proceed. These systems really are
>> ubiquitous in theoretical quantum mechanics and I am sure it would be
>> helpful to quite a lot of people who still shy away a bit from Petsc.
>>
>> Thanks already for your help and all the best, Mathis
>>
>
> 1) The first thing you could try is MatShell(). However, you would have to
> handle all the parallelism, which might be onerous.
>
> 2) An alternative is to explore the new TAIJ matrices. This is definitely
> not for novice programmers, but it is a direct representation
>     of a Kronecker product, and in addition is vectorized. Jed is the lead
> there, so maybe he can comment.
>
>   Thanks,
>
>       Matt
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140401/329caa12/attachment.html>


More information about the petsc-users mailing list