kmat 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitattributes +3 -0
- data/.gitignore +15 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +4 -0
- data/LICENSE.md +675 -0
- data/README.md +224 -0
- data/Rakefile +26 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/kmat/arith/binary.c +1121 -0
- data/ext/kmat/arith/logical.c +332 -0
- data/ext/kmat/arith/math.c +34 -0
- data/ext/kmat/arith/statistics.c +173 -0
- data/ext/kmat/arith/unary.c +165 -0
- data/ext/kmat/auto_collect.rb +118 -0
- data/ext/kmat/elementwise_function.rb +149 -0
- data/ext/kmat/extconf.rb +75 -0
- data/ext/kmat/id.txt +80 -0
- data/ext/kmat/id_sym.rb +40 -0
- data/ext/kmat/km_util.h +97 -0
- data/ext/kmat/kmat.h +96 -0
- data/ext/kmat/lapack_headers/blas.h +354 -0
- data/ext/kmat/lapack_headers/lapacke.h +19455 -0
- data/ext/kmat/lapack_headers/lapacke_config.h +119 -0
- data/ext/kmat/lapack_headers/lapacke_mangling.h +17 -0
- data/ext/kmat/lapack_headers/lapacke_utils.h +579 -0
- data/ext/kmat/linalg/dla.c +1629 -0
- data/ext/kmat/linalg/linalg.c +267 -0
- data/ext/kmat/linalg/norm.c +727 -0
- data/ext/kmat/linalg/vla.c +102 -0
- data/ext/kmat/linalg/working.c +240 -0
- data/ext/kmat/main.c +95 -0
- data/ext/kmat/smat/accessor.c +719 -0
- data/ext/kmat/smat/array.c +108 -0
- data/ext/kmat/smat/boxmuller.c +72 -0
- data/ext/kmat/smat/constructer.c +302 -0
- data/ext/kmat/smat/convert.c +375 -0
- data/ext/kmat/smat/elem.c +171 -0
- data/ext/kmat/smat/fund.c +702 -0
- data/ext/kmat/smat/share.c +427 -0
- data/ext/kmat/smat/smat.c +530 -0
- data/ext/kmat/smat/sort.c +1156 -0
- data/ext/kmat/sym.txt +34 -0
- data/kmat.gemspec +46 -0
- data/lib/kmat.rb +20 -0
- data/lib/kmat/accessor.rb +164 -0
- data/lib/kmat/arith.rb +189 -0
- data/lib/kmat/linalg.rb +279 -0
- data/lib/kmat/logical.rb +150 -0
- data/lib/kmat/misc.rb +122 -0
- data/lib/kmat/random.rb +106 -0
- data/lib/kmat/statistics.rb +98 -0
- data/lib/kmat/version.rb +3 -0
- metadata +156 -0
data/ext/kmat/id.txt
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
_define_dup_escaped_method
|
2
|
+
_kmat_rand_b
|
3
|
+
_kmat_rand_d
|
4
|
+
_kmat_rand_i
|
5
|
+
_kmat_rand_v
|
6
|
+
_kmat_rand_z
|
7
|
+
abs
|
8
|
+
all_p all?
|
9
|
+
any_p any?
|
10
|
+
conj
|
11
|
+
deep_freeze
|
12
|
+
DEFAULT
|
13
|
+
DomainError
|
14
|
+
dup
|
15
|
+
each
|
16
|
+
exclude_end_p exclude_end?
|
17
|
+
fill
|
18
|
+
first
|
19
|
+
imag
|
20
|
+
inspect
|
21
|
+
iv_kmat_stored @kmat_stored
|
22
|
+
iv_kmat_stored_value @kmat_stored_value
|
23
|
+
hypot
|
24
|
+
join
|
25
|
+
last
|
26
|
+
near_p near?
|
27
|
+
new
|
28
|
+
op_comp <=>
|
29
|
+
op_div /
|
30
|
+
op_eq ==
|
31
|
+
op_ge >=
|
32
|
+
op_gt >
|
33
|
+
op_le <=
|
34
|
+
op_lt <
|
35
|
+
op_minus -
|
36
|
+
op_mul *
|
37
|
+
op_ne !=
|
38
|
+
op_percent %
|
39
|
+
op_plus +
|
40
|
+
op_pow **
|
41
|
+
op_uminus -@
|
42
|
+
quo
|
43
|
+
rand
|
44
|
+
real
|
45
|
+
to_c
|
46
|
+
to_s
|
47
|
+
to_sym
|
48
|
+
|
49
|
+
sin
|
50
|
+
cos
|
51
|
+
tan
|
52
|
+
asin
|
53
|
+
acos
|
54
|
+
atan
|
55
|
+
sinh
|
56
|
+
cosh
|
57
|
+
tanh
|
58
|
+
asinh
|
59
|
+
acosh
|
60
|
+
atanh
|
61
|
+
exp
|
62
|
+
log
|
63
|
+
sqrt
|
64
|
+
exp2
|
65
|
+
expm1
|
66
|
+
log10
|
67
|
+
log1p
|
68
|
+
log2
|
69
|
+
logb
|
70
|
+
cbrt
|
71
|
+
erf
|
72
|
+
erfc
|
73
|
+
lgamma
|
74
|
+
tgamma
|
75
|
+
ceil
|
76
|
+
floor
|
77
|
+
round
|
78
|
+
trunc
|
79
|
+
sign
|
80
|
+
arg
|
data/ext/kmat/id_sym.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
id_list, sym_list = Hash.new, Hash.new
|
2
|
+
[['id', id_list], ['sym', sym_list]].each do |is, list|
|
3
|
+
File.foreach("#{__dir__}/#{is}.txt").with_index do |line, i|
|
4
|
+
ary = line.chomp.split(' ')
|
5
|
+
case ary.size
|
6
|
+
when 0
|
7
|
+
nil
|
8
|
+
when 1
|
9
|
+
list.store(ary[0], ary[0])
|
10
|
+
when 2
|
11
|
+
list.store(ary[0], ary[1])
|
12
|
+
else
|
13
|
+
raise "Line #{i+1} in #{is}.txt cannot be recognized"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
File.open('id_sym.c', 'w') do |f|
|
19
|
+
[['id', id_list, 'ID', ''], ['sym', sym_list, 'VALUE', 'rb_id2sym']].each do |is, list, iv, func|
|
20
|
+
list.each_key do |key|
|
21
|
+
f.puts "#{iv} #{is}_#{key};"
|
22
|
+
end
|
23
|
+
f.puts ''
|
24
|
+
f.puts "void\nkm_init_#{is}(void)\n{"
|
25
|
+
list.each do |key, value|
|
26
|
+
f.puts "\t#{is}_#{key} = #{func}(rb_intern(#{value.inspect}));"
|
27
|
+
end
|
28
|
+
f.puts '}'
|
29
|
+
f.puts ''
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
File.open('id_sym.h', 'w') do |f|
|
34
|
+
[['id', id_list, 'ID'], ['sym', sym_list, 'VALUE']].each do |is, list, iv|
|
35
|
+
list.each_key do |key|
|
36
|
+
f.puts "extern #{iv} #{is}_#{key};"
|
37
|
+
end
|
38
|
+
f.puts ''
|
39
|
+
end
|
40
|
+
end
|
data/ext/kmat/km_util.h
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
static inline size_t
|
2
|
+
int2size_t(int i)
|
3
|
+
{
|
4
|
+
return (size_t)i;
|
5
|
+
}
|
6
|
+
|
7
|
+
static inline void
|
8
|
+
km_check_frozen(VALUE obj)
|
9
|
+
{
|
10
|
+
if ( OBJ_FROZEN(obj) ) {
|
11
|
+
rb_raise(rb_eFrozenError, "can't modify frozen %s", rb_obj_classname(obj));
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
static inline void
|
16
|
+
km_infect_frozen(VALUE src, VALUE dest)
|
17
|
+
{
|
18
|
+
if ( OBJ_FROZEN(src) ) {
|
19
|
+
rb_obj_freeze(dest);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
static inline void
|
24
|
+
km_check_positive(int m, int n)
|
25
|
+
{
|
26
|
+
if ( m < 0 || n < 0 ) {
|
27
|
+
rb_raise(km_eDim, "matrix size must not be negative");
|
28
|
+
} else if ( ((long long)m)*((long long)n) != (long long)(m*n) ) {
|
29
|
+
rb_raise(km_eDim, "matrix length must be within int range");
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
#define TODO rb_raise(km_eNotImp, "comming soon")
|
34
|
+
#define TF2V(p) ( (p) ? Qtrue : Qfalse )
|
35
|
+
#define ITSELF(x) (x)
|
36
|
+
#define SWAP(type, a, b) do { type __temp__swap__=a; a=b; b=__temp__swap__; } while (0)
|
37
|
+
#define SAME(a, b) ( (a) == (b) )
|
38
|
+
#define XOR(p, q) ( ( (p)&&(!(q)) ) || ( (!(p))&&(q) ) )
|
39
|
+
|
40
|
+
#define KALLOC(val, n) val = ruby_xcalloc(int2size_t(n), sizeof(*(val)))
|
41
|
+
#define KALLOCc(work, smat) work = km_alloc_and_copy(smat)
|
42
|
+
#define KALLOCn(work, smat) km_alloc_and_copy_if_needed(smat, &(work))
|
43
|
+
#define KALLOCz(work, smat) km_alloc_if_needed_and_0clear(smat, &(work))
|
44
|
+
|
45
|
+
#define INDEX(smat, i, j) ( (smat)->trans ? ((j)+(i)*(smat)->ld) : ((i)+(j)*(smat)->ld) )
|
46
|
+
#define ENTITYd0(smat, id, idx) ( ((smat)->id##body)[idx] )
|
47
|
+
#define ENTITYr0(smat, id, idx) ( *( ((smat)->id##pbody)[idx] ) )
|
48
|
+
#define ENTITY(smat, id, i, j) ( ( (smat)->stype==ST_RSUB ) ? ENTITYr0(smat, id, INDEX(smat, i, j)) : ENTITYd0(smat, id, INDEX(smat, i, j)) )
|
49
|
+
|
50
|
+
#define LENGTH(smat) ( (smat)->m*(smat)->n )
|
51
|
+
#define LENGTHs(smat) int2size_t( (smat)->m*(smat)->n )
|
52
|
+
#define VECTOR_P(smat) ( (smat)->m==1 || (smat)->n==1 )
|
53
|
+
#define SAME_SIZE(sa, sb) ( ( (sa)->m==(sb)->m ) && ( (sa)->n==(sb)->n ) )
|
54
|
+
#define CHECK_SAME_SIZE(sa, sb) do { if ( !SAME_SIZE(sa, sb) ) { rb_raise(km_eDim, "sizes must be the same, (%d, %d) != (%d, %d)", (sa)->m, (sa)->n, (sb)->m, (sb)->n); } } while (0)
|
55
|
+
|
56
|
+
#define VT_SWITCH(vt_, dstate, zstate, istate, bstate, vstate) do { \
|
57
|
+
VTYPE __vt__ = (vt_); \
|
58
|
+
if ( __vt__ == VT_DOUBLE ) { dstate } \
|
59
|
+
else if ( __vt__ == VT_COMPLEX ) { zstate } \
|
60
|
+
else if ( __vt__ == VT_INT ) { istate } \
|
61
|
+
else if ( __vt__ == VT_BOOL ) { bstate } \
|
62
|
+
else if ( __vt__ == VT_VALUE ) { vstate } \
|
63
|
+
else { rb_raise(km_eInternal, "unknown value type"); } \
|
64
|
+
} while (0)
|
65
|
+
|
66
|
+
// definition is macro within smat/smat.c
|
67
|
+
void km_smat_each_d(SMAT *smat, void (*func)(double *, void *), void *data);
|
68
|
+
void km_smat_each_z(SMAT *smat, void (*func)(COMPLEX *, void *), void *data);
|
69
|
+
void km_smat_each_i(SMAT *smat, void (*func)(int *, void *), void *data);
|
70
|
+
void km_smat_each_b(SMAT *smat, void (*func)(bool *, void *), void *data);
|
71
|
+
void km_smat_each_v(SMAT *smat, void (*func)(VALUE *, void *), void *data);
|
72
|
+
void km_smat_each_with_index_d(SMAT *smat, void (*func)(double *, int, int, void *), void *data);
|
73
|
+
void km_smat_each_with_index_z(SMAT *smat, void (*func)(COMPLEX *, int, int, void *), void *data);
|
74
|
+
void km_smat_each_with_index_i(SMAT *smat, void (*func)(int *, int, int, void *), void *data);
|
75
|
+
void km_smat_each_with_index_b(SMAT *smat, void (*func)(bool *, int, int, void *), void *data);
|
76
|
+
void km_smat_each_with_index_v(SMAT *smat, void (*func)(VALUE *, int, int, void *), void *data);
|
77
|
+
void km_smat_each2_d(SMAT *sa, SMAT *sb, void (*func)(double *, double *, void *), void *data);
|
78
|
+
void km_smat_each2_z(SMAT *sa, SMAT *sb, void (*func)(COMPLEX *, COMPLEX *, void *), void *data);
|
79
|
+
void km_smat_each2_i(SMAT *sa, SMAT *sb, void (*func)(int *, int *, void *), void *data);
|
80
|
+
void km_smat_each2_b(SMAT *sa, SMAT *sb, void (*func)(bool *, bool *, void *), void *data);
|
81
|
+
void km_smat_each2_v(SMAT *sa, SMAT *sb, void (*func)(VALUE *, VALUE *, void *), void *data);
|
82
|
+
void km_smat_each2_dcd(SMAT *sa, const SMAT *sb, void (*func)(double *, const double *, void *), void *data);
|
83
|
+
void km_smat_each2_zcz(SMAT *sa, const SMAT *sb, void (*func)(COMPLEX *, const COMPLEX *, void *), void *data);
|
84
|
+
void km_smat_each2_ici(SMAT *sa, const SMAT *sb, void (*func)(int *, const int *, void *), void *data);
|
85
|
+
void km_smat_each2_bcb(SMAT *sa, const SMAT *sb, void (*func)(bool *, const bool *, void *), void *data);
|
86
|
+
void km_smat_each2_vcv(SMAT *sa, const SMAT *sb, void (*func)(VALUE *, const VALUE *, void *), void *data);
|
87
|
+
void km_smat_each2_dcb(SMAT *sa, const SMAT *sb, void (*func)(double *, const bool *, void *), void *data);
|
88
|
+
void km_smat_each2_zcb(SMAT *sa, const SMAT *sb, void (*func)(COMPLEX *, const bool *, void *), void *data);
|
89
|
+
void km_smat_each2_icb(SMAT *sa, const SMAT *sb, void (*func)(int *, const bool *, void *), void *data);
|
90
|
+
void km_smat_each2_vcb(SMAT *sa, const SMAT *sb, void (*func)(VALUE *, const bool *, void *), void *data);
|
91
|
+
void km_smat_each2_dcz(SMAT *sa, const SMAT *sb, void (*func)(double *, const COMPLEX *, void *), void *data);
|
92
|
+
void km_smat_each3_zcdcd(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(COMPLEX *, const double *, const double *, void *), void *data);
|
93
|
+
void km_smat_each3_bcdcd(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(bool *, const double *, const double *, void *), void *data);
|
94
|
+
void km_smat_each3_bczcz(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(bool *, const COMPLEX *, const COMPLEX *, void *), void *data);
|
95
|
+
void km_smat_each3_bcici(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(bool *, const int *, const int *, void *), void *data);
|
96
|
+
void km_smat_each3_bcbcb(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(bool *, const bool *, const bool *, void *), void *data);
|
97
|
+
void km_smat_each3_bcvcv(SMAT *sa, const SMAT *sb, const SMAT *sc, void (*func)(bool *, const VALUE *, const VALUE *, void *), void *data);
|
data/ext/kmat/kmat.h
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
#ifndef KMAT_H
|
2
|
+
#define KMAT_H 1
|
3
|
+
|
4
|
+
#include <stdlib.h>
|
5
|
+
#include <float.h>
|
6
|
+
#include <limits.h>
|
7
|
+
#include <math.h>
|
8
|
+
#include <stdbool.h>
|
9
|
+
#include <ruby.h>
|
10
|
+
#include "lapack_headers/blas.h"
|
11
|
+
#include "lapack_headers/lapacke.h"
|
12
|
+
#include "lapack_headers/lapacke_utils.h"
|
13
|
+
|
14
|
+
#ifndef M_PI
|
15
|
+
#define M_PI 3.14159265358979323846
|
16
|
+
#endif
|
17
|
+
#define M_2PI 6.28318530717958647692
|
18
|
+
#define COMPLEX double _Complex
|
19
|
+
#ifdef CMPLX /* C11 macro is available */
|
20
|
+
# define cpack(x,y) CMPLX(x,y)
|
21
|
+
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__INTEL_COMPILER)
|
22
|
+
# define cpack(x,y) __builtin_complex((double) (x), (double) (y))
|
23
|
+
#else
|
24
|
+
# define cpack(x,y) ((double)(x)+I*(double)(y))
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#ifndef __GNUC__
|
28
|
+
# define __attribute__(x)
|
29
|
+
#endif
|
30
|
+
|
31
|
+
typedef enum {
|
32
|
+
VT_DOUBLE,
|
33
|
+
VT_COMPLEX,
|
34
|
+
VT_INT,
|
35
|
+
VT_BOOL,
|
36
|
+
VT_VALUE,
|
37
|
+
VT_END
|
38
|
+
} VTYPE;
|
39
|
+
typedef enum {
|
40
|
+
ST_FULL,
|
41
|
+
ST_SSUB,
|
42
|
+
ST_RSUB,
|
43
|
+
ST_END
|
44
|
+
} STYPE;
|
45
|
+
typedef struct {
|
46
|
+
union {
|
47
|
+
void *body;
|
48
|
+
double *dbody;
|
49
|
+
COMPLEX *zbody;
|
50
|
+
int *ibody;
|
51
|
+
bool *bbody;
|
52
|
+
VALUE *vbody;
|
53
|
+
void **pbody;
|
54
|
+
double **dpbody;
|
55
|
+
COMPLEX **zpbody;
|
56
|
+
int **ipbody;
|
57
|
+
bool **bpbody;
|
58
|
+
VALUE **vpbody;
|
59
|
+
};
|
60
|
+
int ld, m, n;
|
61
|
+
VTYPE vtype;
|
62
|
+
STYPE stype;
|
63
|
+
bool trans, may_have_sub;
|
64
|
+
VALUE parent;
|
65
|
+
} SMAT;
|
66
|
+
typedef union {
|
67
|
+
double d;
|
68
|
+
COMPLEX z;
|
69
|
+
int i;
|
70
|
+
bool b;
|
71
|
+
VALUE v;
|
72
|
+
} ELEMENT;
|
73
|
+
typedef struct {
|
74
|
+
union {
|
75
|
+
void *body;
|
76
|
+
double *d;
|
77
|
+
COMPLEX *z;
|
78
|
+
int *i;
|
79
|
+
bool *b;
|
80
|
+
VALUE *v;
|
81
|
+
};
|
82
|
+
int ld;
|
83
|
+
bool need_to_free;
|
84
|
+
} LAWORK;
|
85
|
+
|
86
|
+
#include "id_sym.h"
|
87
|
+
#include "global_variables.h"
|
88
|
+
extern const rb_data_type_t km_mat_data_type;
|
89
|
+
extern VALUE kmgv_mat_random;
|
90
|
+
|
91
|
+
#include "km_util.h"
|
92
|
+
|
93
|
+
#include "auto_collected.h"
|
94
|
+
#include "elementwise_function.h"
|
95
|
+
|
96
|
+
#endif /* KMAT_H */
|
@@ -0,0 +1,354 @@
|
|
1
|
+
// The original version of this header file has been written by Azalea Clive.
|
2
|
+
// The download link is available at <http://azalea.s35.xrea.com/blas/sample.html>.
|
3
|
+
|
4
|
+
// The following modification has been made by cycloawaodorin.
|
5
|
+
// * Use complex.h as structs for complex.
|
6
|
+
// * Add const modifer for appropriate arguments.
|
7
|
+
|
8
|
+
#include <complex.h>
|
9
|
+
|
10
|
+
#ifndef BLAS_INTERFACE_HEADER
|
11
|
+
#define BLAS_INTERFACE_HEADER
|
12
|
+
|
13
|
+
#ifdef __cplusplus
|
14
|
+
extern "C"{
|
15
|
+
#endif
|
16
|
+
|
17
|
+
//Structs
|
18
|
+
#undef complex
|
19
|
+
#define complex float _Complex
|
20
|
+
#define doublecomplex double _Complex
|
21
|
+
|
22
|
+
//int xrebla_(char *srname, int *info);
|
23
|
+
|
24
|
+
//Level1
|
25
|
+
|
26
|
+
//AXPY
|
27
|
+
void saxpy_(const int *n, const float *alpha, const float *x, const int *incx, float *y, const int *incy);
|
28
|
+
void daxpy_(const int *n, const double *alpha, const double *x, const int *incx, double *y, const int *incy);
|
29
|
+
void caxpy_(const int *n, const complex *alpha, const complex *x, const int *incx, complex *y, const int *incy);
|
30
|
+
void zaxpy_(const int *n, const doublecomplex *alpha, const doublecomplex *x, const int *incx, doublecomplex *y, const int *incy);
|
31
|
+
|
32
|
+
//SUM
|
33
|
+
float sasum_(const int *n, const float *x, const int *incx);
|
34
|
+
float scasum_(const int *n, const complex *x, const int *incx);
|
35
|
+
double dasum_(const int *n, const double *x, const int *incx);
|
36
|
+
double dzasum_(const int *n, const doublecomplex *x, const int *incx);
|
37
|
+
|
38
|
+
//COPY
|
39
|
+
void scopy_(const int *n, const float *x, const int *incx, float *y, const int *incy);
|
40
|
+
void dcopy_(const int *n, const double *x, const int *incx, double *y, const int *incy);
|
41
|
+
void ccopy_(const int *n, const complex *x, const int *incx, complex *y, const int *incy);
|
42
|
+
void zcopy_(const int *n, const doublecomplex *x, const int *incx, doublecomplex *y, const int *incy);
|
43
|
+
|
44
|
+
//DOT
|
45
|
+
float sdot_(const int *n, const float *x, const int *incx, const float *y, const int *incy);
|
46
|
+
double ddot_(const int *n, const double *x, const int *incx, const double *y, const int *incy);
|
47
|
+
|
48
|
+
//DOTC
|
49
|
+
complex cdotc_(const int *n, const complex *x, const int *incx, const complex *y, const int *incy);
|
50
|
+
doublecomplex zdotc_(const int *n, const doublecomplex *x, const int *incx, const doublecomplex *y, const int *incy);
|
51
|
+
|
52
|
+
//DOTU
|
53
|
+
complex cdotu_(const int *n, const complex *x, const int *incx, const complex *y, const int *incy);
|
54
|
+
doublecomplex zdotu_(const int *n, const doublecomplex *x, const int *incx, const doublecomplex *y, const int *incy);
|
55
|
+
|
56
|
+
//NRM2
|
57
|
+
float snrm2_(const int *n, const float *x, const int *incx);
|
58
|
+
double dnrm2_(const int *n, const double *x, const int *incx);
|
59
|
+
float scnrm2_(const int *n, const complex *x, const int *incx);
|
60
|
+
double dznrm2_(const int *n, const doublecomplex *x, const int *incx);
|
61
|
+
|
62
|
+
//ROT
|
63
|
+
void srot_(const int *n, float *x, const int *incx, float *y, const int *incy, const float *c, const float *s);
|
64
|
+
void drot_(const int *n, double *x, const int *incx, double *y, const int *incy, const double *c, const double *s);
|
65
|
+
void csrot_(const int *n, complex *x, const int *incx, complex *y, const int *incy, const float *c, const float *s);
|
66
|
+
void zdrot_(const int *n, doublecomplex *x, const int *incx, doublecomplex *y, const int *incy, const double *c, const double *s);
|
67
|
+
|
68
|
+
//ROTG
|
69
|
+
void srotg_(float *a,float *b, float *c, float *s);
|
70
|
+
void drotg_(double *a,double *b, double *c, double *s);
|
71
|
+
void crotg_(complex *a,complex *b, float *c, float *s);
|
72
|
+
void zrotg_(doublecomplex *a,doublecomplex *b, double *c, double *s);
|
73
|
+
|
74
|
+
//Stub
|
75
|
+
//ROTMG
|
76
|
+
//ROTM
|
77
|
+
|
78
|
+
|
79
|
+
//SCAL
|
80
|
+
void sscal_(const int *n, const float *a, float *x, const int *incx);
|
81
|
+
void dscal_(const int *n, const double *a, double *x, const int *incx);
|
82
|
+
void cscal_(const int *n, const complex *a, complex *x, const int *incx);
|
83
|
+
void zscal_(const int *n, const doublecomplex *a, doublecomplex *x, const int *incx);
|
84
|
+
void csscal_(const int *n, const float *a, complex *x, const int *incx);
|
85
|
+
void zdscal_(const int *n, const double *a, doublecomplex *x, const int *incx);
|
86
|
+
|
87
|
+
//SWAP
|
88
|
+
void sswap_(const int *n, float *x, const int *incx, float *y, const int *incy);
|
89
|
+
void dswap_(const int *n, double *x, const int *incx, double *y, const int *incy);
|
90
|
+
void cswap_(const int *n, complex *x, const int *incx, complex *y, const int *incy);
|
91
|
+
void zswap_(const int *n, doublecomplex *x, const int *incx, doublecomplex *y, const int *incy);
|
92
|
+
|
93
|
+
//IAMAX
|
94
|
+
int isamax_(const int *n, const float *x, const int *incx);
|
95
|
+
int idamax_(const int *n, const double *x, const int *incx);
|
96
|
+
int icamax_(const int *n, const complex *x, const int *incx);
|
97
|
+
int izamax_(const int *n, const doublecomplex *x, const int *incx);
|
98
|
+
|
99
|
+
//IAMIN
|
100
|
+
int isamin_(const int *n, const float *x, const int *incx);
|
101
|
+
int idamin_(const int *n, const double *x, const int *incx);
|
102
|
+
int icamin_(const int *n, const complex *x, const int *incx);
|
103
|
+
int izamin_(const int *n, const doublecomplex *x, const int *incx);
|
104
|
+
|
105
|
+
//IMAX
|
106
|
+
int ismax_(const int *n, const float *x, const int *incx);
|
107
|
+
int idmax_(const int *n, const double *x, const int *incx);
|
108
|
+
|
109
|
+
//IMIN
|
110
|
+
int ismin_(const int *n, const float *x, const int *incx);
|
111
|
+
int idmin_(const int *n, const double *x, const int *incx);
|
112
|
+
|
113
|
+
//Level2
|
114
|
+
|
115
|
+
//GBMV
|
116
|
+
void sgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
|
117
|
+
float *alpha, float *A, int *ldA, float *x, int *incx,
|
118
|
+
float *beta , float *y, int *incy);
|
119
|
+
void dgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
|
120
|
+
double *alpha, double *A, int *ldA, double *x, int *incx,
|
121
|
+
double *beta , double *y, int *incy);
|
122
|
+
void cgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
|
123
|
+
complex *alpha, complex *A, int *ldA, complex *x, int *incx,
|
124
|
+
complex *beta , complex *y, int *incy);
|
125
|
+
void zgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
|
126
|
+
doublecomplex *alpha, doublecomplex *A, int *ldA, doublecomplex *x, int *incx,
|
127
|
+
doublecomplex *beta , doublecomplex *y, int *incy);
|
128
|
+
|
129
|
+
//GEMV
|
130
|
+
void sgemv_(char *trans, int *m, int *n,
|
131
|
+
float *alpha, float *A, int *ldA, float *x, int *incx,
|
132
|
+
float *beta , float *y, int *incy);
|
133
|
+
void dgemv_(char *trans, int *m, int *n,
|
134
|
+
double *alpha, double *A, int *ldA, double *x, int *incx,
|
135
|
+
double *beta , double *y, int *incy);
|
136
|
+
void cgemv_(char *trans, int *m, int *n,
|
137
|
+
complex *alpha, complex *A, int *ldA, complex *x, int *incx,
|
138
|
+
complex *beta , complex *y, int *incy);
|
139
|
+
void zgemv_(char *trans, int *m, int *n,
|
140
|
+
doublecomplex *alpha, doublecomplex *A, int *ldA, doublecomplex *x, int *incx,
|
141
|
+
doublecomplex *beta , doublecomplex *y, int *incy);
|
142
|
+
|
143
|
+
//GER
|
144
|
+
void sger_(int *m, int *n, float *alpha, float *x, int *incx, float *y, int *incy, float *A, int *ldA);
|
145
|
+
void dger_(int *m, int *n, double *alpha, double *x, int *incx, double *y, int *incy, double *A, int *ldA);
|
146
|
+
|
147
|
+
//GERC
|
148
|
+
void cgerc_(int *m, int *n, complex *alpha, complex *x, int *incx,
|
149
|
+
complex *y, int *incy, complex *A, int *ldA);
|
150
|
+
void zgerc_(int *m, int *n, doublecomplex *alpha, doublecomplex *x, int *incx,
|
151
|
+
doublecomplex *y, int *incy, doublecomplex *A, int *ldA);
|
152
|
+
|
153
|
+
//GREU
|
154
|
+
void cgeru_(int *m, int *n, complex *alpha, complex *x, int *incx,
|
155
|
+
complex *y, int *incy, complex *A, int *ldA);
|
156
|
+
void zgeru_(int *m, int *n, doublecomplex *alpha, doublecomplex *x, int *incx,
|
157
|
+
doublecomplex *y, int *incy, doublecomplex *A, int *ldA);
|
158
|
+
|
159
|
+
//HBMV
|
160
|
+
void chbmv_(char *uplo, int *n, int *k, complex *alpha, complex *A, int *ldA,
|
161
|
+
complex *x, int *incx, complex *beta, complex *y, int *incy);
|
162
|
+
void zhbmv_(char *uplo, int *n, int *k, doublecomplex *alpha, doublecomplex *A, int *ldA,
|
163
|
+
doublecomplex *x, int *incx, doublecomplex *beta, doublecomplex *y, int *incy);
|
164
|
+
|
165
|
+
//HEMV
|
166
|
+
void chemv_(char *uplo, int *n, complex *alpha, complex *A, int *ldA,
|
167
|
+
complex *x, int *incx, complex *beta, complex *y, int *incy);
|
168
|
+
void zhemv_(char *uplo, int *n, doublecomplex *alpha, doublecomplex *A, int *ldA,
|
169
|
+
doublecomplex *x, int *incx, doublecomplex *beta, doublecomplex *y, int *incy);
|
170
|
+
|
171
|
+
//HER
|
172
|
+
void cher_(char *uplo, int *n, float *alpha, complex *x, int *incx, complex *A, int *ldA);
|
173
|
+
void zher_(char *uplo, int *n, double *alpha, doublecomplex *x, int *incx, doublecomplex *A, int *ldA);
|
174
|
+
|
175
|
+
//Stub
|
176
|
+
//HER2
|
177
|
+
|
178
|
+
//HPMV
|
179
|
+
void chpmv_(char *uplo, int *n, complex *alpha, complex *A,
|
180
|
+
complex *x, int *incx, complex *beta, complex *y, int *incy);
|
181
|
+
void zhpmv_(char *uplo, int *n, doublecomplex *alpha, doublecomplex *A,
|
182
|
+
doublecomplex *x, int *incx, doublecomplex *beta, doublecomplex *y, int *incy);
|
183
|
+
|
184
|
+
//HPR
|
185
|
+
void chpr_ (char *uplo, int *n, float *alpha, complex *x, int *incx, complex *A);
|
186
|
+
void zhpr_ (char *uplo, int *n, double *alpha, doublecomplex *x, int *incx, doublecomplex *A);
|
187
|
+
|
188
|
+
//Stub
|
189
|
+
//HPR2
|
190
|
+
|
191
|
+
//SBMV
|
192
|
+
void ssbmv_(char *uplo, int *n, int *k, float *alpha, float *A, int *ldA,
|
193
|
+
float *x, int *incx, float *beta, float *y, int *incy);
|
194
|
+
void dsbmv_(char *uplo, int *n, int *k, double *alpha, double *A, int *ldA,
|
195
|
+
double *x, int *incx, double *beta, double *y, int *incy);
|
196
|
+
|
197
|
+
//SPMV
|
198
|
+
void sspmv_(char *uplo, int *n, float *alpha, float *A, float *x, int *incx, float *beta, float *y, int *incy);
|
199
|
+
void dspmv_(char *uplo, int *n, double *alpha, double *A, double *x, int *incx, double *beta, double *y, int *incy);
|
200
|
+
|
201
|
+
//SPR
|
202
|
+
void sspr_(char *uplo, int *n, float *alpha, float *x, int *incx, float *A);
|
203
|
+
void dspr_(char *uplo, int *n, double *alpha, double *x, int *incx, double *A);
|
204
|
+
|
205
|
+
//Stub
|
206
|
+
//SPR2
|
207
|
+
|
208
|
+
//SYMV
|
209
|
+
void ssymv_(char *uplo, int *n, float *alpha, float *A, int *ldA,
|
210
|
+
float *x, int *incx, float *beta, float *y, int *incy);
|
211
|
+
void dsymv_(char *uplo, int *n, double *alpha, double *A, int *ldA,
|
212
|
+
double *x, int *incx, double *beta, double *y, int *incy);
|
213
|
+
|
214
|
+
//SYR
|
215
|
+
void ssyr_(char *uplo, int *n, float *alpha, float *x, int *incx, float *A, int *ldA);
|
216
|
+
void dsyr_(char *uplo, int *n, double *alpha, double *x, int *incx, double *A, int *ldA);
|
217
|
+
|
218
|
+
//Stub
|
219
|
+
//SYR2
|
220
|
+
|
221
|
+
//TBMV
|
222
|
+
void stbmv_(char *uplo, char *trans, char *diag, int *n, int *k, float *A, int *ldA, float *x, int *incx);
|
223
|
+
void dtbmv_(char *uplo, char *trans, char *diag, int *n, int *k, double *A, int *ldA, double *x, int *incx);
|
224
|
+
void ctbmv_(char *uplo, char *trans, char *diag, int *n, int *k, complex *A, int *ldA, complex *x, int *incx);
|
225
|
+
void ztbmv_(char *uplo, char *trans, char *diag, int *n, int *k, doublecomplex *A, int *ldA, doublecomplex *x, int *incx);
|
226
|
+
|
227
|
+
//TBSV
|
228
|
+
void stbsv_(char *uplo, char *trans, char *diag, int *n, int *k, float *A, int *ldA, float *x, int *incx);
|
229
|
+
void dtbsv_(char *uplo, char *trans, char *diag, int *n, int *k, double *A, int *ldA, double *x, int *incx);
|
230
|
+
void ctbsv_(char *uplo, char *trans, char *diag, int *n, int *k, complex *A, int *ldA, complex *x, int *incx);
|
231
|
+
void ztbsv_(char *uplo, char *trans, char *diag, int *n, int *k, doublecomplex *A, int *ldA, doublecomplex *x, int *incx);
|
232
|
+
|
233
|
+
//TPMV
|
234
|
+
void stpmv_(char *uplo, char *trans, char *diag, int *n, float *A, float *x, int *incx);
|
235
|
+
void dtpmv_(char *uplo, char *trans, char *diag, int *n, double *A, double *x, int *incx);
|
236
|
+
void ctpmv_(char *uplo, char *trans, char *diag, int *n, complex *A, complex *x, int *incx);
|
237
|
+
void ztpmv_(char *uplo, char *trans, char *diag, int *n, doublecomplex *A, doublecomplex *x, int *incx);
|
238
|
+
|
239
|
+
//TPSV
|
240
|
+
void stpsv_(char *uplo, char *trans, char *diag, int *n, float *A, float *x, int *incx);
|
241
|
+
void dtpsv_(char *uplo, char *trans, char *diag, int *n, double *A, double *x, int *incx);
|
242
|
+
void ctpsv_(char *uplo, char *trans, char *diag, int *n, complex *A, complex *x, int *incx);
|
243
|
+
void ztpsv_(char *uplo, char *trans, char *diag, int *n, doublecomplex *A, doublecomplex *x, int *incx);
|
244
|
+
|
245
|
+
//TRSV
|
246
|
+
void strsv_(char *uplo, char *trans, char *diag, int *n, float *A, int *ldA, float *x, int *incx);
|
247
|
+
void dtrsv_(char *uplo, char *trans, char *diag, int *n, double *A, int *ldA, double *x, int *incx);
|
248
|
+
void ctrsv_(char *uplo, char *trans, char *diag, int *n, complex *A, int *ldA, complex *x, int *incx);
|
249
|
+
void ztrsv_(char *uplo, char *trans, char *diag, int *n, doublecomplex *A, int *ldA, doublecomplex *x, int *incx);
|
250
|
+
|
251
|
+
//TRMV
|
252
|
+
void strmv_(char *uplo, char *trans, char *diag, int *n, float *A, int *ldA, float *x, int *incx);
|
253
|
+
void dtrmv_(char *uplo, char *trans, char *diag, int *n, double *A, int *ldA, double *x, int *incx);
|
254
|
+
void ctrmv_(char *uplo, char *trans, char *diag, int *n, complex *A, int *ldA, complex *x, int *incx);
|
255
|
+
void ztrmv_(char *uplo, char *trans, char *diag, int *n, doublecomplex *A, int *ldA, doublecomplex *x, int *incx);
|
256
|
+
|
257
|
+
//Level3
|
258
|
+
|
259
|
+
//GEMM
|
260
|
+
void sgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k,
|
261
|
+
const float *alpha, const float *A, const int *ldA, const float *B, const int *ldB,
|
262
|
+
const float *beta , float *C, const int *ldC);
|
263
|
+
void dgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k,
|
264
|
+
const double *alpha, const double *A, const int *ldA, const double *B, const int *ldB,
|
265
|
+
const double *beta , double *C, const int *ldC);
|
266
|
+
void cgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k,
|
267
|
+
const complex *alpha, const complex *A, const int *ldA, const complex *B, const int *ldB,
|
268
|
+
const complex *beta , complex *C, const int *ldC);
|
269
|
+
void zgemm_(const char *transa, const char *transb, const int *m, const int *n, const int *k,
|
270
|
+
const doublecomplex *alpha, const doublecomplex *A, const int *ldA, const doublecomplex *B, const int *ldB,
|
271
|
+
const doublecomplex *beta , doublecomplex *C, const int *ldC);
|
272
|
+
|
273
|
+
//HEMM
|
274
|
+
void chemm_(char *side, char *uplo, int *m, int *n, complex *alpha, complex *A, int *ldA,
|
275
|
+
complex *B, int *ldB, complex *beta, complex *C, int *ldC);
|
276
|
+
void zhemm_(char *side, char *uplo, int *m, int *n, doublecomplex *alpha, doublecomplex *A, int *ldA,
|
277
|
+
doublecomplex *B, int *ldB, doublecomplex *beta, doublecomplex *C, int *ldC);
|
278
|
+
|
279
|
+
//HERK
|
280
|
+
void cherk_(char *uplo, char *trans, int *n, int *k, float *alpha, complex *A, int *ldA,
|
281
|
+
float *beta , complex *C, int *ldC);
|
282
|
+
void zherk_(char *uplo, char *trans, int *n, int *k, double *aplha, doublecomplex *A, int *ldA,
|
283
|
+
double *beta , doublecomplex *C, int *ldC);
|
284
|
+
|
285
|
+
//HERK2
|
286
|
+
void cher2k_(char *uplo, char *trans, int *n, int *k, complex *alpha, complex *A, int *ldA,
|
287
|
+
complex *B, int *ldB,float *beta, complex *C, int *ldC);
|
288
|
+
void zher2k_(char *uplo, char *trans, int *n, int *k, doublecomplex *alpha, doublecomplex *A, int *ldA,
|
289
|
+
doublecomplex *B, int *ldB,double *beta, doublecomplex *C, int *ldC);
|
290
|
+
|
291
|
+
//SYMM
|
292
|
+
void ssymm_(char *side, char *uplo, int *m, int *n,
|
293
|
+
float *alpha, float *A, int *ldA, float *B, int *ldB,
|
294
|
+
float *beta , float *C, int *ldC);
|
295
|
+
void dsymm_(char *side, char *uplo, int *m, int *n,
|
296
|
+
double *alpha, double *A, int *ldA, double *B, int *ldB,
|
297
|
+
double *beta , double *C, int *ldC);
|
298
|
+
void csymm_(char *side, char *uplo, int *m, int *n,
|
299
|
+
complex *alpha, complex *A, int *ldA, complex *B, int *ldB,
|
300
|
+
complex *beta , complex *C, int *ldC);
|
301
|
+
void zsymm_(char *side, char *uplo, int *m, int *n,
|
302
|
+
doublecomplex *alpha, doublecomplex *A, int *ldA, doublecomplex *B, int *ldB,
|
303
|
+
doublecomplex *beta , doublecomplex *C, int *ldC);
|
304
|
+
|
305
|
+
//SYRK
|
306
|
+
void ssyrk_(char *uplo, char *trans, int *n, int *k, float *alpha, float *A, int *ldA,
|
307
|
+
float *beta , float *C, int *ldC);
|
308
|
+
void dsyrk_(char *uplo, char *trans, int *n, int *k, double *alpha, double *A, int *ldA,
|
309
|
+
double *beta , double *C, int *ldC);
|
310
|
+
void csyrk_(char *uplo, char *trans, int *n, int *k, float *alpha, complex *A, int *ldA,
|
311
|
+
float *beta , complex *C, int *ldC);
|
312
|
+
void zsyrk_(char *uplo, char *trans, int *n, int *k, double *aplha, doublecomplex *A, int *ldA,
|
313
|
+
double *beta , doublecomplex *C, int *ldC);
|
314
|
+
|
315
|
+
//SYR2K
|
316
|
+
void ssyr2k_(char *uplo, char *trans, int *n, int *k, float *alpha, float *A, int *ldA, float *B, int *ldB,
|
317
|
+
float *beta , float *C, int *ldC);
|
318
|
+
void dsyr2k_(char *uplo, char *trans, int *n, int *k, double *alpha, double *A, int *ldA, double *B, int *ldB,
|
319
|
+
double *beta , double *C, int *ldC);
|
320
|
+
void csyr2k_(char *uplo, char *trans, int *n, int *k, float *alpha, complex *A, int *ldA, complex *B, int *ldB,
|
321
|
+
float *beta , complex *C, int *ldC);
|
322
|
+
void zsyr2k_(char *uplo, char *trans, int *n, int *k, double *aplha, doublecomplex *A, int *ldA, doublecomplex *B, int *ldB,
|
323
|
+
double *beta , doublecomplex *C, int *ldC);
|
324
|
+
|
325
|
+
//TRMM
|
326
|
+
void strmm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
327
|
+
float *alpha, float *A, int *ldA, float *B, int *ldB);
|
328
|
+
void dtrmm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
329
|
+
double *alpha, double *A, int *ldA, double *B, int *ldB);
|
330
|
+
void ctrmm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
331
|
+
complex *alpha, complex *A, int *ldA, complex *B, int *ldB);
|
332
|
+
void ztrmm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
333
|
+
doublecomplex *alpha, doublecomplex *A, int *ldA, doublecomplex *B, int *ldB);
|
334
|
+
|
335
|
+
//TRSM
|
336
|
+
void strsm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
337
|
+
float *alpha, float *A, int *ldA, float *B, int *ldB);
|
338
|
+
void dtrsm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
339
|
+
double *alpha, double *A, int *ldA, double *B, int *ldB);
|
340
|
+
void ctrsm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
341
|
+
complex *alpha, complex *A, int *ldA, complex *B, int *ldB);
|
342
|
+
void ztrsm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n,
|
343
|
+
doublecomplex *alpha, doublecomplex *A, int *ldA, doublecomplex *B, int *ldB);
|
344
|
+
|
345
|
+
#undef complex
|
346
|
+
#undef doublecomplex
|
347
|
+
#define complex _Complex
|
348
|
+
|
349
|
+
#ifdef __cplusplus
|
350
|
+
}
|
351
|
+
#endif
|
352
|
+
|
353
|
+
#endif
|
354
|
+
|