<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dense <span class="">matrix is stored in column-major order, so you might want to use </span><span class="">MatGetColumnVector() to access columns of the matrix instead of the rows. For instance, you can get the n-th column out of the matrix and place it into
a vector that shares the same parallel layout as the matrix with the following: <br class="">
<br class="">
<div class=""> MatDenseGetColumn(J,n,&xarr);</div>
<div class=""> VecPlaceArray(vec,xarr);</div>
<div class=""> ...</div>
<div class=""> VecResetArray(vec);</div>
<div class=""> MatDenseRestoreColumn(J,&xarr);</div>
<div class=""><br class="">
</div>
<div class="">Hong (Mr.)</div>
<div class=""><br class="">
</div>
<blockquote type="cite" class="">On Jun 10, 2020, at 8:08 AM, Eda Oktay <<a href="mailto:eda.oktay@metu.edu.tr" class="">eda.oktay@metu.edu.tr</a>> wrote:<br class="">
<br class="">
Dear Matt,<br class="">
<br class="">
Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>>, 10 Haz 2020 Çar, 16:03 tarihinde<br class="">
şunu yazdı:<br class="">
<blockquote type="cite" style="font-family: Verdana; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="">
On Wed, Jun 10, 2020 at 8:56 AM Eda Oktay <eda.oktay@metu.edu.tr> wrote:<br class="">
<blockquote type="cite" class=""><br class="">
Hi all,<br class="">
<br class="">
I am trying to get all the rows of a parallel matrix as individual<br class="">
vectors. For instance, if I have 72*4 matrix, I want to get 72<br class="">
different vectors having size 4.<br class="">
<br class="">
As far as I understood, MatGetRow is only for local rows, so<br class="">
MatGetOwnershipRange is used, however, when I tried this one, I<br class="">
couldn't get the whole and desired row vectors.<br class="">
<br class="">
In MatGetRow explanation, it is written that I should use<br class="">
MatCreateSubMatrices first, then use MatGetRow. But I couldn't<br class="">
understand to which extent I should create submatrices. I just need to<br class="">
have all 72 rows as 72 different vectors each having 4 elements.<br class="">
</blockquote>
<br class="">
<br class="">
1) For sparse matrices, the storage is always divided by row, so that values can only be retrieved for local rows with MatGetRow()<br class="">
<br class="">
2) Is this matrix sparse? It sounds like it is dense.<br class="">
</blockquote>
<br class="">
Matrix is dense.<br class="">
<br class="">
<blockquote type="cite" style="font-family: Verdana; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="">
3) Are you asking to get all matrix values on all processes? If so, I think the easiest thing to do is first wrap a Vec around the<br class="">
values, then use VecScatterToAll(), then wrap each one in a MatDense again.<br class="">
</blockquote>
<br class="">
Yes, I want all row vectors on all processes. In a dense matrix,<br class="">
should I still wrap a Vec around the values? I know I should use<br class="">
scatter but I couldn't even wrap a Vec around them.<br class="">
<br class="">
Thanks so much!<br class="">
<br class="">
Eda<br class="">
<br class="">
<blockquote type="cite" style="font-family: Verdana; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="">
Thanks,<br class="">
<br class="">
Matt<br class="">
<br class="">
<blockquote type="cite" class=""><br class="">
Thanks!<br class="">
<br class="">
Eda<br class="">
</blockquote>
<br class="">
<br class="">
<br class="">
--<br class="">
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener<br class="">
<br class="">
https://www.cse.buffalo.edu/~knepley/<br class="">
</blockquote>
</blockquote>
</span><br class="">
</body>
</html>