%%%%%

TOOLBOX FOR COMPUTING THE KARCHER MEAN THROUGH RIEMANNIAN OPTIMIZATION ALGORITHMS

%%%%%

Reference: Ben Jeuris, Raf Vandebril and Bart Vandereycken, A survey and 
	   comparison of contemporary algorithms for computing the matrix 
	   geometric mean. Submitted to ETNA.

Version 0.1, March 30, 2012

To use the methods in this toolbox, first run the file startup.m. 
In all the functions, there is the distinction between the algorithms 
resulting from the either the inner product trace(A*X^(-1)*B*X^(-1)) 
(indicated by spd) and inner product trace(A*B) (indicated by symm).
For more thorough explanation, see the paper. 

An example of each of the functions is provided in the file example.m.

The following functions are presented in the toolbox:

   - karcher_sd_spd/karcher_sd_symm: The steepest descent method.
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive 
		      definite matrix.
		- retraction: a string indicating the desired retraction
			      (see the function retr for the possibilities).
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.



   - karcher_cg_spd/karcher_cg_symm: The conjugate gradient method.
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive 
		      definite matrix.
		- retraction: a string indicating the desired retraction
			      (see the function retr for the possibilities).
		- beta_type: a string indicating the desired beta type
			     (see the function cg_beta_spd/cg_beta_symm for 
			     the possibilities).
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.



   - karcher_rbfgs_spd/karcher_rbfgs_symm: The Riemannian BFGS method
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive
		      definite matrix.
		- B0: an initial approximation of the Hessian as a linear 
		      operator, an (n*(n+1)/2 x n*(n+1)/2) matrix, where 
		      n is the size of the matrices.
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.


   - karcher_tr_spd/karcher_tr_symm: The trust region method
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive
		      definite matrix.
		- initstep: the initial stepsize. 
		- maxstep: the largest allowed stepsize.
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.


   - karcher_tr_spd_approx/karcher_tr_symm_approx: The trust region
		method using an approximated Hessian
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive
		      definite matrix.
		- initstep: the initial stepsize. 
		- maxstep: the largest allowed stepsize.
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.


   - karcher_tr_spd_decomp: The trust region method using a 
		decomposition to compute the (exact) Hessian.
	  input arguments (in order):
		- X0: the starting point of the algorithm, a positive
		      definite matrix.
		- initstep: the initial stepsize. 
		- maxstep: the largest allowed stepsize.
		- matrices: a cell array containing the positive definite 
			    matrices of the mean.

	  output arguments (in order): 
		- karch: the Karcher mean of the given matrices, a positive
			 definite matrix.
		- iter: the number of iteration the algorithm required.
        - cflag: 0 when the algorithm converges and -1 if it does not.





