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 will be performed on only the number of elements in the shorter of the two sequences.

The function signatures are of 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 in the Analytics Functions page and operation is one of the following. Please use the links below to view descriptions and examples of the individual functions:

mco_seq_add_TYPE()

Add elements in left and right

mco_seq_sub_TYPE() Subtract elements in right from left
mco_seq_mul_TYPE() Multiply elements in left and right
mco_seq_div_TYPE() Divide elements in left by right
mco_seq_mod_TYPE() Modulo of elements in left by elements in right
mco_seq_max_TYPE() Maximum of the corresponding elements in left and right
mco_seq_min_TYPE() 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);
            
            ...
        }
        ...
    }