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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#include "rb_lapack.h"
extern real cla_rpvgrw_(integer* n, integer* ncols, complex* a, integer* lda, complex* af, integer* ldaf);
static VALUE
rblapack_cla_rpvgrw(int argc, VALUE *argv, VALUE self){
#ifdef USEXBLAS
VALUE rblapack_ncols;
integer ncols;
VALUE rblapack_a;
complex *a;
VALUE rblapack_af;
complex *af;
VALUE rblapack___out__;
real __out__;
integer lda;
integer n;
integer ldaf;
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.cla_rpvgrw( ncols, a, af, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n REAL FUNCTION CLA_RPVGRW( N, NCOLS, A, LDA, AF, LDAF )\n\n* Purpose\n* =======\n* \n* CLA_RPVGRW computes the reciprocal pivot growth factor\n* norm(A)/norm(U). The \"max absolute element\" norm is used. If this is\n* much less than 1, the stability of the LU factorization of the\n* (equilibrated) matrix A could be poor. This also means that the\n* solution X, estimated condition numbers, and error bounds could be\n* unreliable.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The number of linear equations, i.e., the order of the\n* matrix A. N >= 0.\n*\n* NCOLS (input) INTEGER\n* The number of columns of the matrix A. NCOLS >= 0.\n*\n* A (input) COMPLEX array, dimension (LDA,N)\n* On entry, the N-by-N matrix A.\n*\n* LDA (input) INTEGER\n* The leading dimension of the array A. LDA >= max(1,N).\n*\n* AF (input) COMPLEX array, dimension (LDAF,N)\n* The factors L and U from the factorization\n* A = P*L*U as computed by CGETRF.\n*\n* LDAF (input) INTEGER\n* The leading dimension of the array AF. LDAF >= max(1,N).\n*\n\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER I, J\n REAL AMAX, UMAX, RPVGRW\n COMPLEX ZDUM\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC MAX, MIN, ABS, REAL, AIMAG\n* ..\n* .. Statement Functions ..\n REAL CABS1\n* ..\n* .. Statement Function Definitions ..\n CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )\n* ..\n\n");
return Qnil;
}
if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
printf("%s\n", "USAGE:\n __out__ = NumRu::Lapack.cla_rpvgrw( ncols, a, af, [:usage => usage, :help => help])\n");
return Qnil;
}
} else
rblapack_options = Qnil;
if (argc != 3 && argc != 3)
rb_raise(rb_eArgError,"wrong number of arguments (%d for 3)", argc);
rblapack_ncols = argv[0];
rblapack_a = argv[1];
rblapack_af = argv[2];
if (argc == 3) {
} else if (rblapack_options != Qnil) {
} else {
}
ncols = NUM2INT(rblapack_ncols);
if (!NA_IsNArray(rblapack_af))
rb_raise(rb_eArgError, "af (3th argument) must be NArray");
if (NA_RANK(rblapack_af) != 2)
rb_raise(rb_eArgError, "rank of af (3th argument) must be %d", 2);
ldaf = NA_SHAPE0(rblapack_af);
n = NA_SHAPE1(rblapack_af);
if (NA_TYPE(rblapack_af) != NA_SCOMPLEX)
rblapack_af = na_change_type(rblapack_af, NA_SCOMPLEX);
af = NA_PTR_TYPE(rblapack_af, complex*);
if (!NA_IsNArray(rblapack_a))
rb_raise(rb_eArgError, "a (2th argument) must be NArray");
if (NA_RANK(rblapack_a) != 2)
rb_raise(rb_eArgError, "rank of a (2th argument) must be %d", 2);
lda = NA_SHAPE0(rblapack_a);
if (NA_SHAPE1(rblapack_a) != n)
rb_raise(rb_eRuntimeError, "shape 1 of a must be the same as shape 1 of af");
if (NA_TYPE(rblapack_a) != NA_SCOMPLEX)
rblapack_a = na_change_type(rblapack_a, NA_SCOMPLEX);
a = NA_PTR_TYPE(rblapack_a, complex*);
__out__ = cla_rpvgrw_(&n, &ncols, a, &lda, af, &ldaf);
rblapack___out__ = rb_float_new((double)__out__);
return rblapack___out__;
#else
return Qnil;
#endif
}
void
init_lapack_cla_rpvgrw(VALUE mLapack, VALUE sH, VALUE sU, VALUE zero){
sHelp = sH;
sUsage = sU;
rblapack_ZERO = zero;
rb_define_module_function(mLapack, "cla_rpvgrw", rblapack_cla_rpvgrw, -1);
}
|