ParJacS
Location: ..\cubatch\Model_PARAFAC\private\ParJacS.m

function [JTJ,Gr] = ParJacS (Fac,X,Cols);
Description:
Calculates the JTJ matrix and the gradient of the loss function given the loading matrices for a PARAFAC model and the original array. It differs from PARJac.m as it is less memory demanding and can be used on relatively larger arrays. The largest mode must be the second.
The use of sparse arrays slows the execution and the use of ParJac.m is suggested whenever it is compatible with the memory availability.
Inputs:
Fac: cell array containing in each element a loading matrix, e.g. {A,B,C}
X: three way array on which the model has to be fitted
Cols: logical vector defining the non constant parameters in the vector defined as [A(:);B(:);C(:)].

Outputs:
JTJ: JTJ, where J is the Jacobian matrix of the loss function with respect to the model's parameters
Gr: gradient of the loss function with respect to the parameters

Called by:
Model_PARAFAC\GNParafac
Subroutines:
Internal: None
External: kr

Author:
Giorgio Tomasi
Royal Agricultural and Veterinary University
MLI, LMT, Chemometrics group
Rolighedsvej 30
DK-1958 Frederiksberg C
Danmark
Last modified: 24-Jan-2002 08:36:36
Contact: Giorgio Tomasi, gt@kvl.dk
References