vopr

Functions

int main(int argc, char *argv[])

vopr [ option ] [ infile ] [ file1 ] > stdout

  • -l int

    • length of vector \((1 \le L)\)

  • -n int

    • order of vector \((0 \le L - 1)\)

  • -q int

    • input format

      • 0 naive

      • 1 recursive

      • 2 interleaved

  • -a

    • addition

  • -s

    • subtraction

  • -m

    • multiplication

  • -d

    • division

  • -ATAN

    • arctangent

  • -QM

    • quadratic mean

  • -AM

    • arithmetric mean

  • -GM

    • geometric mean

  • -HM

    • harmonic mean

  • -MIN

    • minimum

  • -MAX

    • maximum

  • -EQ

    • equal to

  • -NE

    • not equal to

  • -LT

    • less than

  • -LE

    • less than or equal to

  • -GT

    • greater than

  • -GE

    • greater than or equal to

  • infile str

    • double-type data sequence

  • file1 str

    • double-type data sequence

  • stdout

    • double-type data sequence after operation

This command performs vector operations between two sequences.

The inputs are

\[ \begin{array}{ccc} \boldsymbol{a}_{0}, & \boldsymbol{a}_{1}, & \ldots, \end{array} \]
and
\[ \begin{array}{ccc} \boldsymbol{b}_{0}, & \boldsymbol{b}_{1}, & \ldots, \end{array} \]
where \(\boldsymbol{a}_t\) and \(\boldsymbol{b}_t\) are \(L\)-length vectors. The output is
\[ \begin{array}{ccc} \boldsymbol{y}_{0}, & \boldsymbol{y}_{1}, & \ldots, \end{array} \]
where
\[ \boldsymbol{y}_{t} = f(\boldsymbol{a}_{t}, \boldsymbol{b}_{t}) \]
and \(f(\cdot)\) is a function which returns an \(L\)-length vector.

There are three kinds of input formats.

  • Case -q0

    \[\begin{split} \left\{ \begin{array}{ll} \boldsymbol{a}_0, \boldsymbol{a}_1, \ldots, & (\mbox{infile}) \\ \boldsymbol{b}_0, \boldsymbol{b}_1, \ldots, & (\mbox{file1}) \end{array} \right. \end{split}\]

  • Case -q1

    \[\begin{split} \left\{ \begin{array}{ll} \boldsymbol{a}_0, \boldsymbol{a}_1, \ldots, & (\mbox{infile}) \\ \boldsymbol{b}, & (\mbox{file1}) \end{array} \right. \end{split}\]
    where \(\boldsymbol{b}_t=\boldsymbol{b}\) for any \(t\).

  • Case -q2

    \[\begin{split} \left\{ \begin{array}{ll} \boldsymbol{a}_0, \boldsymbol{b}_0, \boldsymbol{a}_1, \boldsymbol{b}_1, \ldots, & (\mbox{infile}) \\ \end{array} \right. \end{split}\]

echo 1 2 3 4 5 6 | x2x +ad > data.a
echo 3 2 1 0 5 6 | x2x +ad > data.b

vopr -GT data.a data.b | x2x +da
# 0, 0, 1, 1, 0, 0
vopr -q 0 -l 3 -s data.a data.b | x2x +da
# -2, 0, 2, 4, 0, 0
vopr -q 1 -l 3 -s data.a data.b | x2x +da
# -2, 0, 2, 1, 3, 5
vopr -q 2 -l 3 -s data.a | x2x +da
# -3, -3, -3
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

sopr