Deconvolution/1D: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added the REXX computer programming language.) |
m (→{{header|REXX}}: simplified the REXX program, used (more) unique variables.) |
||
Line 1,105: | Line 1,105: | ||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
deco@: parse arg $1,$2,$ |
deco@: parse arg $1,$2,$r; b=@.$2.# + 1; a=@.$1.# + 1 /*get sizes of array 1&2*/ |
||
@.$r.#=a - b /*size of return array. */ |
|||
do n=0 to a-b /*define return array. */ |
|||
@.$r.n=@.$1.n /*define RETURN element.*/ |
|||
if n<b then L=0 /*define the variable L.*/ |
|||
else L=n - b + 1 /* " " " " */ |
|||
if n>0 then do j=L to n-1; _=n-j /*define elements > 0. */ |
|||
@.$r.n=@.$r.n - @.$r.j * @.$2._ /*compute " " " */ |
|||
end /*j*/ /* [↑] subtract product.*/ |
|||
@.$r.n=@.$r.n / @.$2.0 /*divide array element. */ |
|||
end /*n*/; return |
|||
end /*n*/; return |
|||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
make@: parse arg $,z; @.$. |
make@: parse arg $,z; @.$.#=words(z) - 1 /*obtain args; set size.*/ |
||
do |
do k=0 to @.$.#; @.$.k=word(z,k+1) /*define array element. */ |
||
end /* |
end /*k*/; return /*array starts at unity.*/ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
show@: parse arg $,z,_; do |
show@: parse arg $,z,_; do s=0 to @.$.#; _=strip(_ @.$.s) /*obtain the arguments. */ |
||
end /*s*/ /* [↑] build the list. */ |
|||
say 'array' $": "_; return /*show the list; return*/ |
|||
say 'array' $": "_; return /*show the list; return*/ |
|||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
test@: parse arg $1,$2; do |
test@: parse arg $1,$2; do t=0 to max(@.$1.#, @.$2.#) /*obtain the arguments. */ |
||
if @.$1. |
if @.$1.t=@.$2.t then iterate /*create array list. */ |
||
say "***error*** arrays" $1 ' and ' $2 "aren't equal." |
say "***error*** arrays" $1 ' and ' $2 "aren't equal." |
||
end /* |
end /*t*/; return /* [↑] build the list. */</lang> |
||
{{out|output|text= when using the default internal inputs:}} |
{{out|output|text= when using the default internal inputs:}} |
||
<pre> |
<pre> |