Binary C Sequence Functions

The following binary C API functions take two input sequences, left and right, and produce the result sequence of the same type.

The two input sequences must be of the same type. If the two input sequences are of different lengths, the operation is performed on only the number of elements in the shorter of the two sequences.

The function signatures have the following form:

    MCO_RET mco_seq_operation_TYPE(mco_seq_iterator_h result,
            mco_seq_iterator_h left,
            mco_seq_iterator_h right);

where TYPE is one of the types listed on the Analytics Functions page and operation is one of the following. Use the links below to view descriptions and examples of the individual functions:

mco_seq_add_TYPE()
Adds elements in left and right.
mco_seq_sub_TYPE()
Subtracts elements in right from left.
mco_seq_mul_TYPE()
Multiplies elements in left and right.
mco_seq_div_TYPE()
Divides elements in left by right.
mco_seq_mod_TYPE()
Calculates the modulo of elements in left by elements in right.
mco_seq_max_TYPE()
Returns the maximum of the corresponding elements in left and right.
mco_seq_min_TYPE()
Returns the minimum of the corresponding elements in left and right.

Example

Following is an example code snippet demonstrating a binary function:

    {
        mco_trans_h trans;
        mco_cursor_t quote_cursor;
        Quote quote;
        mco_seq_iterator_t high_iterator, low_iterator, result_iterator;
        MCO_RET rc;
        ...

        for (rc = mco_cursor_first(trans, &quote_cursor);
            rc != MCO_S_CURSOR_END;
            rc = mco_cursor_next(trans, &quote_cursor))
        {
            Quote_from_cursor(trans, &quote_cursor, &quote);
            Quote_high_iterator(&quote, &high_iterator);
            Quote_low_iterator(&quote, &low_iterator);
            ...
            rc = mco_seq_div_float(&result_iterator, &low_iterator, &high_iterator);

            ...
        }
        ...
    }