Programmer Guide/SPU Reference/MASKABC: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 19: Line 19:


;Description:
;Description:
If the condition defined by <var>COND</var> is true, <var>C</var><sub>i</sub> is assigned to <var>Y</var><sub>i</sub>, otherwise <var>Y</var><sub>i</sub> is set to <var>A</var><sub>i</sub>. If <var>A</var> is a vector, the inputs <var>B</var> and <var>C</var> can be numbers or vectors with the same length as <var>A</var>.
If the condition defined by <var>COND</var> is true, <var>C</var><sub>i</sub> is assigned to <var>Y</var><sub>i</sub>, otherwise <var>Y</var><sub>i</sub> is set to <var>A</var><sub>i</sub>.  
:{|class="einrahmen"
 
!COND !!Assignment  
If <var>A</var> is a vector, the inputs <var>B</var> and <var>C</var> can be numbers or vectors with the same length as <var>A</var>. The output <var>Y</var> has always the same type as <var>A</var>.
{|class="einrahmen"
!<var>COND</var> !!Assignment  
|-
|-
|<code>0</code> or <code>&lt;</code>  
|<code>0</code> or <code>&lt;</code>  
|<math>Y_i=\begin{cases}  
|<math>Y_i=\begin{cases}  
C_i & \mbox{if }A_i < B_i \\
C_{[i]} & \mbox{if }A_i < B_{[i]} \\
A_i & \mbox{otherwise}  
A_i & \mbox{otherwise}  
\end{cases}
\end{cases}
Line 31: Line 33:
|-
|-
|<code>1</code> or <code>&gt;</code>
|<code>1</code> or <code>&gt;</code>
|<math>Y_i=\begin{cases}
C_{[i]} & \mbox{if }A_i > B_{[i]} \\
A_i & \mbox{otherwise}
\end{cases}
</math>
|-
|-
|<code>2</code> or <code>&le;</code>
|<code>2</code> or <code>&le;</code>
|<math>Y_i=\begin{cases}
C_{[i]} & \mbox{if }A_i \leqslant B_{[i]} \\
A_i & \mbox{otherwise}
\end{cases}
</math>
|-
|-
|<code>3</code> or <code>&ge;</code>
|<code>3</code> or <code>&ge;</code>
|<math>Y_i=\begin{cases}
C_{[i]} & \mbox{if }A_i \geqslant B_{[i]} \\
A_i & \mbox{otherwise}
\end{cases}
</math>
|}
|}
with: 0 &le; i &lt; length of <var>A</var>; [i] means: index is used only if the input is a vector


;See also:
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
<!-- AN, 2.5.2011 -->

Latest revision as of 08:43, 9 May 2011

Data masking / thresholding.

[SPU MASKABC A B SEL OUT Y]

input description data type value type default value
A input data number, vector variable
B masker or threshold number, vector variable
C replacement data number, vector variable
COND condition number (int.), string variable 0
output description data type value type comment
Y masked data same type as A variable
Description

If the condition defined by COND is true, Ci is assigned to Yi, otherwise Yi is set to Ai.

If A is a vector, the inputs B and C can be numbers or vectors with the same length as A. The output Y has always the same type as A.

COND Assignment
0 or < {\displaystyle Y_{i}={\begin{cases}C_{[i]}&{\mbox{if }}A_{i}<B_{[i]}\\A_{i}&{\mbox{otherwise}}\end{cases}}}
1 or > {\displaystyle Y_{i}={\begin{cases}C_{[i]}&{\mbox{if }}A_{i}>B_{[i]}\\A_{i}&{\mbox{otherwise}}\end{cases}}}
2 or {\displaystyle Y_{i}={\begin{cases}C_{[i]}&{\mbox{if }}A_{i}\leqslant B_{[i]}\\A_{i}&{\mbox{otherwise}}\end{cases}}}
3 or {\displaystyle Y_{i}={\begin{cases}C_{[i]}&{\mbox{if }}A_{i}\geqslant B_{[i]}\\A_{i}&{\mbox{otherwise}}\end{cases}}}

with: 0 ≤ i < length of A; [i] means: index is used only if the input is a vector

See also

<SP-atoms>

Navigation menu

Personal tools