~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/util/%b_triu.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function d=%b_triu(a,k)
2
 
// g_triu - implement triu function for sparse matrix, rationnal matrix ,..
3
 
// Copyright INRIA
4
 
[lhs,rhs]=argn(0)
5
 
if rhs==1 then k=0,end
6
 
 
7
 
[m,n]=size(a)
8
 
if k<=0 then
9
 
  mn=mini(m,n-k)
10
 
else
11
 
  mn=min(m+k,n)
12
 
end
13
 
a=matrix(a,m*n,1)
14
 
i=(1:mn)+((1:mn)+(k-1))*m
15
 
d(m*n,1)=%f
16
 
d(i)=a(i)
17
 
d=matrix(d,m,n)