// Returns the number of self consistent solutions between left and right
// given the sorted eigenvalues for the problem evaluated at left and right.
int get_num_solutions( const std::vector< double > &left_vals,  double left,
                       const std::vector< double > &right_vals, double right ) {
    boost::tuple< int, int > ab_left  = split_values( left_vals,  left );
    boost::tuple< int, int > ab_right = split_values( right_vals, right );

    int     num_solutions =  ab_right.get<1>() - ab_left.get<1>();
    assert( num_solutions == ab_left.get<0>()  - ab_right.get<0>() );

    return num_solutions; }
Example #2
0
File: shop.c Project: xxx/cdlib
/*
 * Function name: shop_hook_list_object
 * Description:   List an object
 * Arguments:	  ob - The object
 */
void
shop_hook_list_object(object ob, int price)
{
    string str, mess;

    str = sprintf("%-25s", capitalize(LANG_ASHORT(ob)));
    if (mess = text(split_values(price)))
    {
        write(str + mess + ".\n");
    }
    else
    {
	write(str + "That item wouldn't cost you much.\n");
    }
}