% [G,E] = linfgd(X,Y,Xv,Yv,eta,maxit,g0)
% Train linear function y = f(x) = W.x+w with gradient descent
%
% In:
%   X: NxL matrix, N L-dim data points rowwise, training set inputs.
%   Y: NxD matrix, N D-dim data points rowwise, training set outputs.
%   Xv: MxL matrix, M L-dim data points rowwise, validation set inputs.
%   Yv: MxD matrix, M D-dim data points rowwise, validation set outputs.
%   eta: positive scalar, the learning rate (step size).
%   maxit: number of iterations to run.
%   g0: (struct) initial linear function (see definition in linf.m).
% Out:
%   G: 1x(maxit+1) cell array where G{i} is a struct containing the linear
%      function at iteration i-1 (see struct definition in linf.m).
%   E: 2x(maxit+1) array where E(1,i) and E(2,i) contain the training and
%      validation error at iteration i-1.

function [G,E] = linfgd(X,Y,Xv,Yv,eta,maxit,g0)

