You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lansvd_d1.m
    path of file: ./repos/lrslibrary/libs/SVD
    
    the code of the file until where you have to start completion: %this is a simplified version of lansvd that is specialized to compute
%the 
    
function [S1] = lansvd_d1(A)

[m, n] = size(A);
K = min([m n 10]);
K0 = K;

stop = 0;
nrestart = 0;
p_j1 = rand(m,1) - 0.5;

while ~stop
    beta_j = sqrt(p_j1'*p_j1);
    u_j = p_j1/beta_j;
    v_j1 = zeros(n,1);

    j = 1;
    U = u_j;
    V = [];
    alpha = zeros(K + 1, 1);
    beta = zeros(K + 1, 1);
    beta(1) = beta_j;
    while j <= K %Lanczos bi-diagonalizaion
        r_j = A'*u_j - beta_j*v_j1;
    
%         for i = 1:j - 1 %full-orthogonalization for r_j
%             v_i = V(:,i);
%             t = v_i'*r_j;
%             r_j = r_j - t*v_i;
%         end