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

« back to all changes in this revision

Viewing changes to macros/elem/or.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 [x]=or(a,flag)
2
 
// or(a) returns the logical OR
3
 
// for scalar matrices, an entry is TRUE if it is not zero.
4
 
//!
5
 
// Copyright INRIA
6
 
[lhs,rhs]=argn(0)
7
 
if rhs==1 then flag='*',end
8
 
if flag=='*' then
9
 
  select type(a)
10
 
  case 1 then
11
 
    k=find(abs(a)>0)
12
 
  case 4 then
13
 
    k=find(a)
14
 
  case 6 then
15
 
    k=find(a)
16
 
  else
17
 
    error('argument must be a boolean or a real matrix!')
18
 
  end
19
 
  x=k<>[]
20
 
else
21
 
  a=bool2s(a)
22
 
  x=sum(a,flag)>=1
23
 
end
24