Hello, I need to do an exercice based on matrices on octave with the glpk function. Unfortunately octave returns me a matrix of NA surely due to a mistake in my code (there’s no NA in initial matrices). Here’s the code and some explanations:

The matrix M is a float matrix of size 100x1089

The matrix U is a float matrix of size 100x8

The matrix c represents the objective

The matrix rhs represents the right hand side of the constraints

ConstrCoef represents the left side of the constraints

The problem is surely in the lin_ls function

Here is the code:

```
1; % Script
% Vous devez implémenter ici votre méthode pour résoudre le problème
%
% min_{V >= 0} M - U*V _1 tel que
function V = votre_methodelinsn(M,U);
[m,n] = size(M);
[m,r] = size(U);
% Résoudre le problème pour chaque pixel: pour tout j,
% min{V(:,j) >= 0} M(:,j) - U*V(:,j) _1
for j = 1 : n
V(:,j) = lin_ls(M(:,j),U);
endfor
endfunction
% Résoudre les sous problèmes du type
%
% min{x} A*x - b _1
%
% tel que x >= 0.
function x = lin_ls(b,A);
[m,n] = size(A);
c = [1; 1; 1; 1; 1; 1; 1; 1];
s = ones(100,1);
rhs = [b;s];
for j = 1 : n
ConstrCoef(:,j) = [A(:,j);s];
endfor
% Formuler et résoudre le problème avec glpk
x = glpk(c,ConstrCoef,rhs);
endfunction
M = rand (100, 1089);
U = rand (100, 8);
V = votre_methodelinsn (M, U);
```