% Huan Mei Chen
% 502-772-876
% CS 170A
% --------------------------------- HW 3 ----------------------------------

% Problem 1

% ------------------------------- Matrix C --------------------------------
C = hadamard(8)
[CU,CS,CV] = svd(C)

% Hermitian?
C_H=(conj(C))'
if (C==C_H)
    C_Hermitian = 1
else
    C_Hermitian = 0
end

% Unitary?
C_U=C*C_H
if ((C*C_H)==eye(8))
    C_Unitary = 1
else
    C_Unitary = 0
end

% Invertible?
C_I = inv(C)
if (CI*C==eye(8) & C*CI==eye(8))
    C_Invertible = 1
else
    C_Invertible = 0
end

% Ill-condtioned?
C_K=cond(C)

% Positive Definite?
C_E=eig(C)

% ------------------------------- Matrix D --------------------------------

% Matrix D
D = dingdong(8)
[DU,DS,DV] = svd(C)

% Hermitian?
D_H=(conj(D))'
if (D==D_H)
    D_Hermitian = 1
else
    D_Hermitian = 0
end

% Unitary?
D_U=D*D_H
if ((D*D_H)==eye(8))
    D_Unitary = 1
else
    D_Unitary = 0
end

% Invertible?
D_I = inv(D)
if (DI*D==eye(8) & D*DI==eye(8))
    D_Invertible = 1
else
    D_Invertible = 0
end

% Ill-condtioned?
D_K=cond(D)

% Positive Definite?
D_E=eig(D)

% ------------------------------- Matrix E --------------------------------

% Matrix E
E = pascal(8)
[EU,ES,EV] = svd(C)

% Hermitian?
E_H=(conj(E))'
if (E==E_H)
    E_Hermitian = 1
else
    E_Hermitian = 0
end

% Unitary?
E_U=E*E_H
if ((E*E_H)==eye(8))
    E_Unitary = 1
else
    E_Unitary = 0
end

% Invertible?
E_I = inv(E)
if (EI*E==eye(8) & E*EI==eye(8))
    E_Invertible = 1
else
    E_Invertible = 0
end

% Ill-condtioned?
E_K=cond(E)

% Positive Definite?
E_E=eig(E)