BP_LDA.LDA_Learn.SMD_Update C# (CSharp) Method

SMD_Update() public static method

public static SMD_Update ( DenseMatrix X, DenseMatrix Grad, DenseRowVector LearningRatePerCol, float eta ) : float
X LinearAlgebra.DenseMatrix
Grad LinearAlgebra.DenseMatrix
LearningRatePerCol LinearAlgebra.DenseRowVector
eta float
return float
		public static float SMD_Update(DenseMatrix X, DenseMatrix Grad, DenseRowVector LearningRatePerCol, float eta)
		{
			if (X.nCols != Grad.nCols || X.nRows != Grad.nRows)
			{
				throw new Exception("Dimension mismatch.");
			}
			DenseRowVector nLearnLineSearchPerCol = new DenseRowVector(X.nCols, 0.0f);
			DenseMatrix Update = new DenseMatrix(Grad.nRows, Grad.nCols);
			DenseRowVector TmpRowVec = new DenseRowVector(LearningRatePerCol);
			MatrixOperation.ScalarMultiplyVector(TmpRowVec, -1.0f);
			MatrixOperation.bsxfunVectorMultiplyMatrix(Update, Grad, TmpRowVec);
			MatrixOperation.VerticalMaxMatrix(TmpRowVec, Update);
			MatrixOperation.bsxfunMatrixSubtractVector(Update, Update, TmpRowVec);
			MatrixOperation.Exp(Update);
			MatrixOperation.ElementwiseMatrixMultiplyMatrix(X, X, Update);
			MatrixOperation.VerticalSumMatrix(TmpRowVec, X);
			MatrixOperation.bsxfunMatrixRightDivideVector(X, TmpRowVec);

			return 0.0f;
		}