1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include "rb_lapack.h"
extern integer izmax1_(integer* n, doublecomplex* cx, integer* incx);
static VALUE
rblapack_izmax1(int argc, VALUE *argv, VALUE self){
VALUE rblapack_cx;
doublecomplex *cx;
VALUE rblapack_incx;
integer incx;
VALUE rblapack___out__;
integer __out__;
integer n;
VALUE rblapack_options;
if (argc > 0 && TYPE(argv[argc-1]) == T_HASH) {
argc--;
rblapack_options = argv[argc];
if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
printf("%s\n", "USAGE:\n __out__ = NumRu::Lapack.izmax1( cx, incx, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n INTEGER FUNCTION IZMAX1( N, CX, INCX )\n\n* Purpose\n* =======\n*\n* IZMAX1 finds the index of the element whose real part has maximum\n* absolute value.\n*\n* Based on IZAMAX from Level 1 BLAS.\n* The change is to use the 'genuine' absolute value.\n*\n* Contributed by Nick Higham for use with ZLACON.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The number of elements in the vector CX.\n*\n* CX (input) COMPLEX*16 array, dimension (N)\n* The vector whose elements will be summed.\n*\n* INCX (input) INTEGER\n* The spacing between successive values of CX. INCX >= 1.\n*\n\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER I, IX\n DOUBLE PRECISION SMAX\n COMPLEX*16 ZDUM\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC ABS\n* ..\n* .. Statement Functions ..\n DOUBLE PRECISION CABS1\n* ..\n* .. Statement Function definitions ..\n*\n* NEXT LINE IS THE ONLY MODIFICATION.\n CABS1( ZDUM ) = ABS( ZDUM )\n* ..\n\n");
return Qnil;
}
if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
printf("%s\n", "USAGE:\n __out__ = NumRu::Lapack.izmax1( cx, incx, [:usage => usage, :help => help])\n");
return Qnil;
}
} else
rblapack_options = Qnil;
if (argc != 2 && argc != 2)
rb_raise(rb_eArgError,"wrong number of arguments (%d for 2)", argc);
rblapack_cx = argv[0];
rblapack_incx = argv[1];
if (argc == 2) {
} else if (rblapack_options != Qnil) {
} else {
}
if (!NA_IsNArray(rblapack_cx))
rb_raise(rb_eArgError, "cx (1th argument) must be NArray");
if (NA_RANK(rblapack_cx) != 1)
rb_raise(rb_eArgError, "rank of cx (1th argument) must be %d", 1);
n = NA_SHAPE0(rblapack_cx);
if (NA_TYPE(rblapack_cx) != NA_DCOMPLEX)
rblapack_cx = na_change_type(rblapack_cx, NA_DCOMPLEX);
cx = NA_PTR_TYPE(rblapack_cx, doublecomplex*);
incx = NUM2INT(rblapack_incx);
__out__ = izmax1_(&n, cx, &incx);
rblapack___out__ = INT2NUM(__out__);
return rblapack___out__;
}
void
init_lapack_izmax1(VALUE mLapack, VALUE sH, VALUE sU, VALUE zero){
sHelp = sH;
sUsage = sU;
rblapack_ZERO = zero;
rb_define_module_function(mLapack, "izmax1", rblapack_izmax1, -1);
}
|