1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function d=%sp_triu(a,k)
14
15    [lhs,rhs]=argn(0)
16    if rhs==1 then k=0,end
17
18    [ij,v,sz]=spget(a)
19    m=sz(1);n=sz(2)
20    l=find(ij(:,1)<=(ij(:,2)-k))
21    d=sparse(ij(l,:),v(l),[m,n])
22endfunction
23