ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
inv.m File Reference

Go to the source code of this file.

Functions

function inv (in cholow)
 Generate and return the inverse of a positive-definite matrix whose Lower-triangular Cholesky factorization is given as input.
More...
 

Function Documentation

◆ inv()

function inv ( in  cholow)

Generate and return the inverse of a positive-definite matrix whose Lower-triangular Cholesky factorization is given as input.

Parameters
[in]cholow: The input square matrix representing the lower-triangular Cholesky factorization whose inverse must be computed.
Returns
invmat : The output square positive-definite matrix, representing the inverse of the matrix whose lower-triangular Cholesky factorization is given as input.


Possible calling interfaces

invmat = pm.matrix.inv(cholow);
See also
See Matrix Inversion Using Cholesky Decomposition, Aravindh Krishnamoorthy, Deepak Menon, (arXiv:1111.4144).


Example usage

1cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
2addpath('../../../'); % Add the ParaMonte library root directory to the search path.
3
4pm.matlab.show()
5pm.matlab.show('covmat = pm.stats.dist.cov.getRand(3)')
6 covmat = pm.stats.dist.cov.getRand(3)
7pm.matlab.show('cholow = chol(covmat, "lower")')
8 cholow = chol(covmat, "lower")
9pm.matlab.show('invmat = pm.matrix.inv(cholow)')
10 invmat = pm.matrix.inv(cholow)
11pm.matlab.show('invmat - inv(covmat)')
12 invmat - inv(covmat)
13assert(all(all(abs(invmat - inv(covmat)) < 1.e-12)));
function abs(in path, in style)
Return the Get absolute canonical path of a file or folder.
function inv(in cholow)
Generate and return the inverse of a positive-definite matrix whose Lower-triangular Cholesky factori...
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.
function show(in obj, in name, in hidden)
Display the components of an input MATLAB variable on MATLAB Console recursively.

Example output
1
2covmat = pm.stats.dist.cov.getRand(3)
3covmat =
4 1.000000000000000 0.077052548809473 -0.727777315590733
5 0.077052548809473 1.000000000000000 -0.154680741941813
6 -0.727777315590733 -0.154680741941813 1.000000000000000
7cholow = chol(covmat, "lower")
8cholow =
9 1.000000000000000 0 0
10 0.077052548809473 0.997027033094872 0
11 -0.727777315590733 -0.098897664292768 0.678645290935539
12invmat = pm.matrix.inv(cholow)
13invmat =
14 2.131980059345103 0.077585502735575 1.563607707610218
15 0.077585502735575 1.027336060669866 0.215374072997648
16 1.563607707610218 0.215374072997648 2.171272441487850
17invmat - inv(covmat)
18ans =
19 1.0e-15 *
20 -0.888178419700125 0 -0.222044604925031
21 0 0 0.027755575615629
22 -0.222044604925031 0.027755575615629 0


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

This function builds upon the work of Aravindh Krishnamoorthy (2024). Matrix Inversion using Cholesky Decomposition, MATLAB Central File Exchange.

Author:
Joshua Alexander Osborne, May 21 2024, 12:06 AM, University of Texas at Arlington
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin