<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 11 Mar 2019, at 23:59, Jed Brown via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">One could imagine PETSc written so that all Mat operations like<br class="">
transpose and products return lazy representations, with a method that<br class="">
makes it explicit.  Would eliminate all the Transpose variants in the<br class="">
matrix products, for example, and enable an implementation to choose<br class="">
order of operations for chained products.<br class="">
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>That would be cool!</div>
<div><br class="">
</div>
<div>This would solve e.g. my concerns related to transpose in MatLoad_HDF5 with PETSC_VIEWER_HDF5_MAT and MATLAB engine interface, see</div>
<div><a href="https://bitbucket.org/petsc/petsc/pull-requests/1381/matload_hdf5-w-petsc_viewer_hdf5_mat" class="">https://bitbucket.org/petsc/petsc/pull-requests/1381/matload_hdf5-w-petsc_viewer_hdf5_mat</a></div>
<div><br class="">
</div>
<div>I was thinking about introducing a special MatOption that would say the (non-preallocated) matrix can be replaced by an implicit one. This wouldn't change the API. But what you suggest sounds much more elegant.</div>
<div><br class="">
</div>
<div>Thanks,</div>
<div>Vaclav</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class=""><br class="">
"Smith, Barry F. via petsc-dev" <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> writes:<br class="">
<br class="">
<blockquote type="cite" class="">
<blockquote type="cite" class="">On Mar 11, 2019, at 1:28 PM, Isaac, Tobin G <<a href="mailto:tisaac@cc.gatech.edu" class="">tisaac@cc.gatech.edu</a>> wrote:<br class="">
<br class="">
<br class="">
Okay, but do you have an opinion on the original issue: should we<br class="">
always return a matrix from various matrix-matrix routines, even if it<br class="">
has limited functionality?<br class="">
</blockquote>
<br class="">
  I'm fine with it always returning the composite matrix unless you have a specific use case that would require MAT_INITIAL_MATRIX_GET_VALUES<br class="">
<br class="">
  Barry<br class="">
<br class="">
<blockquote type="cite" class=""><br class="">
On Mon, Mar 11, 2019 at 06:09:55PM +0000, Smith, Barry F. wrote:<br class="">
<blockquote type="cite" class=""><br class="">
 Sounds like overkill on the complexity meter.<br class="">
<br class="">
 Barry<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On Mar 11, 2019, at 6:15 AM, Isaac, Tobin G via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class="">
<br class="">
One thought: we could extend MatReuse with MAT_INITIAL_MATRIX_GET_VALUES to indicate that a matrix that implements MatGetValues() is desired, to allow some user intent.<br class="">
<br class="">
<br class="">
On March 9, 2019 7:44:06 PM EST, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:<br class="">
<blockquote type="cite" class="">On Sat, Mar 9, 2019 at 4:42 PM Isaac, Tobin G via petsc-dev <<br class="">
<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class="">
<br class="">
<blockquote type="cite" class=""><br class="">
Let's say I want to do Newton-Krylov on some DAG of computations.<br class="">
Building the Jacobian is programmatic from the chain rule, requiring<br class="">
just a lot of matrix-matrix multiplications in the correct sequence.<br class="">
<br class="">
If it really is more efficient for two Jacobians to be contracted<br class="">
</blockquote>
into<br class="">
<blockquote type="cite" class="">a matrix with random access, that's great, but if it's not, or if<br class="">
the appropriate implementation of MatMatMult_X_Y does not exist,<br class="">
having a MATCOMPOSITE is better than nothing.<br class="">
<br class="">
So why not make MATCOMPOSITE something that our matrix-matrix<br class="">
multiplication routines return when a specialization isn't found?<br class="">
It moves the "Not Implemented" warning from MatMatMult() to<br class="">
whenever I try to do something other than multiply with the output,<br class="">
but in some situations that's desirable.<br class="">
<br class="">
I'd be interested to hear what people think.<br class="">
<br class="">
</blockquote>
<br class="">
I think this is a good idea. The most important thing is to maintain<br class="">
transparency, so that the output<br class="">
makes this clear in -ksp_view and we are easily able to see what<br class="">
someone<br class="">
has produced.<br class="">
<br class="">
Matt<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">Thanks,<br class="">
Toby<br class="">
<br class="">
<br class="">
<br class="">
</blockquote>
</blockquote>
</blockquote>
<br class="">
</blockquote>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>