/*
 * call-seq: postmul!(b)
 *
 * In-place multiply
 *
 *   c = a * b
 *
 * is equivalent to
 *
 *   c = a.postmul!(b)
 *
 * with
 *
 *   a.object_id == c.object_id
 *
 * Note this implies +b+ must be square.  +DimensionError+ is raised
 * otherwise.
 *
 */
VALUE rb_dmatrix_postmul_inplace(VALUE self, VALUE rb)
{
    DMatrix* a ;
    get_dmatrix(a, self) ;

    if( rb_obj_is_kind_of(rb, rb_cDMatrix) )
    {
        DMatrix* b ;
        DMatrix* c ;
        
        get_dmatrix(b, rb) ;
        
        if( a->hsize != b->vsize ||
            b->vsize != b->hsize )
        {
            raise_dim_error() ;
        }
        
        c = DMatrix_new(a->vsize, b->hsize) ;
        DMatrix_mul(c, a, b) ;
        DMatrix_swap(a, c) ;
        DMatrix_free(c) ;
    }
    else
    {
        DMatrix_mul_scalar(a, NUM2DBL(rb)) ;
    }

    return self ;
}