Hi Alan,
I'm not sure whether I understand your question correctly. matrix_range
objects operate on the original entries of the full matrix. That is,
whenever you manipulate A, B, C, or D, the entries in the original
matrix are changed as well. This is probably not what you want.
I think that you should instead extract the entries representing A, B,
C, and D into smaller matrix objects (let's call them mA, mB, mC, mD),
then compute the inverse based on the Schur complement according to your
formula, and finally put everything back into the original matrix. This
way you only need matrix_range objects for extracting the entries from
the original matrix to mA, mB, mC, mD, and for writing the entries from
mA, mB, mC, mD back into the original matrix. This is then achieved via
direct assignments from/to matrix_range objects:
mA = A; // extract from original matrix
// compute something
A = mA; // write back to original matrix
Best regards,
Karli
On 06/07/2016 05:40 AM, Alan wrote:
> Hi,
>
> I am inverting a large matrix using partitioning.
> i.e.
>
> [ A B C D ] − 1 = [ A − 1 + A − 1 B ( D − C A − 1 B ) − 1 C A − 1 −
> A − 1 B ( D − C A − 1 B ) − 1 − ( D − C A − 1 B ) − 1 C A − 1 ( D −
> C A − 1 B ) − 1 ] , {\displaystyle {\begin{bmatrix}\mathbf {A}
> &\mathbf {B} \\\mathbf {C} &\mathbf {D}
> \end{bmatrix}}^{-1}={\begin{bmatrix}\mathbf {A} ^{-1}+\mathbf {A}
> ^{-1}\mathbf {B} (\mathbf {D} -\mathbf {CA} ^{-1}\mathbf {B}
> )^{-1}\mathbf {CA} ^{-1}&-\mathbf {A} ^{-1}\mathbf {B} (\mathbf {D}
> -\mathbf {CA} ^{-1}\mathbf {B} )^{-1}\\-(\mathbf {D} -\mathbf {CA}
> ^{-1}\mathbf {B} )^{-1}\mathbf {CA} ^{-1}&(\mathbf {D} -\mathbf {CA}
> ^{-1}\mathbf {B} )^{-1}\end{bmatrix}},}
>
> {\displaystyle \,}
>
>
> I form the submatrices as follows:
> viennacl::range r1(0,partition);
> viennacl::range r2(partition,u);
> viennacl::matrix_range<viennacl::matrix<double>>
> A(viennacl_Norm,r1,r1);
> viennacl::matrix_range<viennacl::matrix<double>>
> B(viennacl_Norm,r1,r2);
> viennacl::matrix_range<viennacl::matrix<double>>
> C(viennacl_Norm,r2,r1);
> viennacl::matrix_range<viennacl::matrix<double>>
> D(viennacl_Norm,r2,r2);
>
> I then manipulate the sub matrices using the above formula (code not shown).
>
> I then wish to recreate the full inverted matrix from its parts.
>
> I currently can only do this using a very inefficient method (element by
> element copy using for loops) which defeats the original reason for
> partitioning.
> for(int i = 0; i < partition;i++)
> for(int k = 0; k < partition;k++)
> viennacl_Norm_i(i,k) = A1(i,k);
> for(int i = 0; i < partition;i++)
> for(int k = 0; k < u-partition;k++)
> viennacl_Norm_i(i,partition+k) = B1(i,k);
> for(int i = 0; i < u-partition;i++)
> for(int k = 0; k < partition;k++)
> viennacl_Norm_i(partition+i,k) = C1(i,k);
> for(int i = 0; i < u-partition;i++)
> for(int k = 0; k < u-partition;k++)
> viennacl_Norm_i(partition+i,partition+k) = D1(i,k);
>
>
> Is there a function that does the reverse of matrix_range class that
> puts sub matrices back into the full matrix ?
>
> Regards,
>
> Alan Buchanan
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
>
>
>
> _______________________________________________
> ViennaCL-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/viennacl-support
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
ViennaCL-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/viennacl-support