% Script C1
% Checks PropSprod..

clc
randn('seed',0)

%Example 1
n = 100;
k = 1;
P = randn(n,k); Q = randn(n,k); d = randn(n,1); x = randn(n,1);
A0 = tril(Q*P',-1) + diag(d) + triu(P*Q',1);
y0 = A0*x;
y = PropSProd(P,Q,d,x);
err1 = norm(y-y0)

% Example 2
n = 937;
k = 10;
P = randn(n,k); Q = randn(n,k); d = randn(n,1); x = randn(n,1);
A0 = tril(Q*P',-1) + diag(d) + triu(P*Q',1);
y0 = A0*x;
y = PropSProd(P,Q,d,x);
err2 = norm(y-y0)

% Example 3
n = 10000;
k = 3;
P = randn(n,k); Q = randn(n,k); d = randn(n,1); x = randn(n,1);
y = PropSProd(P,Q,d,x);
Snapshot = y(1:1000:10000)
