/*
 *
 * call-seq: [](row, column)
 *
 * Element read.  Column vectors are permitted to omit the +column+ index.
 *
 */
VALUE rb_dmatrix_bracket_get(int argc, VALUE* argv, VALUE self)
{
    VALUE ri ;
    VALUE rj ;
    int i = 0 ;
    int j = 0 ;
    DMatrix* a ;
    get_dmatrix(a, self) ;

    if( rb_scan_args(argc, argv, "11", &ri, &rj) == 1 )
    {
        if( a->hsize == 1 )
        {
            i = NUM2INT(ri) ;
            j = 0 ;
        }
        else
        {
            rb_raise(rb_eArgError, "") ;
        }
    }
    else
    {
        i = NUM2INT(ri) ;
        j = NUM2INT(rj) ;
    }
                        
    if( i < 0 || i >= a->vsize ||
        j < 0 || j >= a->hsize )
    {
        raise_index_error() ;
    }

    return rb_float_new(a->data[i + j*a->vsize]) ;
}