liblinear-ruby-swig 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS ADDED
@@ -0,0 +1,2 @@
1
+ Tom Zeng <tom.z.zeng@gmail.com> (Ruby SWIG interface to LIBLINEAR)
2
+ Chih-Jen Lin <cjlin@csie.ntu.edu.tw> and Machine Learning Group at National Taiwan University (developers of LIBLINEAR)
data/COPYING ADDED
@@ -0,0 +1,24 @@
1
+ == LICENSE:
2
+
3
+ (The MIT License)
4
+
5
+ Copyright (c) 2009 Tom Zeng
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ 'Software'), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ 2009-05-10 Tom Zeng (tom.z.zeng@gmail.com)
2
+ * initial check-in into github
3
+
4
+ 2009-07-10 Tom Zeng (tom.z.zeng@gmail.com)
5
+ * incorporated the _convert_to_feature_node_array fix from the LIBSVM development group
data/Manifest.txt ADDED
@@ -0,0 +1,20 @@
1
+ History.txt
2
+ COPYING
3
+ AUTHORS
4
+ Manifest.txt
5
+ README.rdoc
6
+ Rakefile
7
+ lib/linear.rb
8
+ lib/linear_cv.rb
9
+ ext/liblinear_wrap.cxx
10
+ ext/linear.cpp
11
+ ext/linear.h
12
+ ext/tron.h
13
+ ext/tron.cpp
14
+ ext/extconf.rb
15
+ ext/blas.h
16
+ ext/blasp.h
17
+ ext/daxpy.c
18
+ ext/ddot.c
19
+ ext/dnrm2.c
20
+ ext/dscal.c
data/README.rdoc ADDED
@@ -0,0 +1,79 @@
1
+ = liblinear-ruby-swig
2
+
3
+ * Ruby interface to LIBLINEAR (using SWIG)
4
+ * http://www.tomzconsulting.com
5
+ * http://tweetsentiments.com
6
+
7
+ == DESCRIPTION:
8
+
9
+ This is the Ruby LIBLINEAR SWIG (Simplified Wrapper and Interface Generator)
10
+ interface. LIBLINEAR is a high performance machine learning library for large
11
+ scale text mining(http://www.csie.ntu.edu.tw/~cjlin/liblinear).
12
+
13
+ A slightly modified version of LIBLINEAR 1.51 is included which allows turning
14
+ on/off the default debuging/logging messages. You don't need your own copy of
15
+ SWIG to use this library - all needed files are generated using SWIG already.
16
+
17
+ The Ruby LIBLINEAR interface was used to build a decent sized text classification
18
+ model(with 10 classes and 10000 features) using 100,000 text records (through
19
+ ActiveRecord in a Rails app) as training data, the recall rate is 99% and
20
+ predication rate is around 90% on 2000 test records. The same model was tried
21
+ with arbitrary and web page texts with pretty good results.
22
+
23
+ LIBLINEAR is in use at http://tweetsentiments.com - A Twitter / Tweet sentiment
24
+ analysis application
25
+
26
+ == INSTALL:
27
+
28
+ Currently the gem is available on linux only(tested on Ubuntu 8-9 and Fedora 9-12,
29
+ and should work on OS X), and you will need g++ installed to compile the native
30
+ code.
31
+
32
+ sudo gem sources -a http://gems.github.com (you only have to do this once)
33
+ sudo gem install tomz-liblinear-ruby-swig
34
+
35
+ == SYNOPSIS:
36
+
37
+ Try the following multiclass problem in irb:
38
+
39
+ irb(main):001:0> require 'rubygems'
40
+ irb(main):002:0> require 'linear'
41
+ irb(main):003:0> pa = LParameter.new
42
+ irb(main):004:0> pa.solver_type = L2LOSS_SVM_DUAL
43
+ irb(main):005:0> pa.eps = 0.1
44
+ irb(main):006:0> bias = 1
45
+ irb(main):007:0> labels = [1, 2, 1, 2, 3]
46
+ irb(main):008:0> samples = [
47
+ irb(main):009:1* {1=>0,2=>0.1,3=>0.2,4=>0,5=>0},
48
+ irb(main):010:1* {1=>0,2=>0.1,3=>0.3,4=>-1.2,5=>0},
49
+ irb(main):011:1* {1=>0.4,2=>0,3=>0,4=>0,5=>0},
50
+ irb(main):012:1* {1=>0,2=>0.1,3=>0,4=>1.4,5=>0.5},
51
+ irb(main):013:1* {1=>-0.1,2=>-0.2,3=>0.1,4=>1.1,5=>0.1}
52
+ irb(main):014:1> ]
53
+ irb(main):015:0> pa.solver_type = MCSVM_CS
54
+ irb(main):016:0> sp = LProblem.new(labels,samples,bias)
55
+ irb(main):017:0> m = LModel.new(sp, pa)
56
+ irb(main):018:0> pred = m.predict({1=>1,2=>0.1,3=>0.2,4=>0,5=>0})
57
+ => 1
58
+ irb(main):019:0> pred = m.predict({1=>0,2=>0.1,3=>0.2,4=>0,5=>0})
59
+ => 2
60
+ irb(main):020:0> pred = m.predict({1=>0,2=>0.1,3=>0.2,4=>0,5=>0})
61
+ => 2
62
+ irb(main):025:0> pred = m.predict({1=>0.4,2=>0,3=>0,4=>0,5=>0})
63
+ => 1
64
+ irb(main):021:0> pred = m.predict({1=>-0.1,2=>-0.2,3=>0.1,4=>1.1,5=>0.1})
65
+ => 3
66
+ irb(main):022:0> m.save("test.model")
67
+ irb(main):023:0> "your imagination " * 10
68
+
69
+
70
+ For more examples see test*.rb in the liblinear-ruby-swig/liblinear-1.51/ruby
71
+ directory
72
+
73
+ == AUTHOR:
74
+
75
+ Tom Zeng
76
+ - http://twitter.com/tomzeng
77
+ - http://www.tomzconsulting.com
78
+ - http://www.linkedin.com/in/tomzeng
79
+ - tom.z.zeng _at_ gmail _dot_ com
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>=1.8.3','<= 1.12.2'
3
+ require 'hoe'
4
+
5
+
6
+ task :default => ["sync_files","make_gem"]
7
+
8
+ EXT = "ext/liblinear?.#{Hoe::DLEXT}"
9
+
10
+ Hoe.new('liblinear-ruby-swig', '0.2.0') do |p|
11
+ p.author = 'Tom Zeng'
12
+ p.email = 'tom.z.zeng@gmail.com'
13
+ p.url = 'http://www.tomzconsulting.com'
14
+ p.summary = 'Ruby wrapper of LIBLINEAR using SWIG'
15
+ p.description = 'Ruby wrapper of LIBLINEAR using SWIG'
16
+
17
+ p.spec_extras[:extensions] = "ext/extconf.rb"
18
+ p.clean_globs << EXT << "ext/*.o" << "ext/Makefile"
19
+ end
20
+
21
+ task :make_gem => EXT
22
+
23
+ file EXT => ["ext/extconf.rb", "ext/liblinear_wrap.cxx", "ext/linear.cpp", "ext/linear.h", "ext/tron.h", "ext/tron.cpp", "ext/blas.h", "ext/blasp.h", "ext/dscal.c", "ext/dnrm2.c", "ext/ddot.c", "ext/daxpy.c"] do
24
+ Dir.chdir "ext" do
25
+ ruby "extconf.rb"
26
+ sh "make"
27
+ end
28
+ end
29
+
30
+ task :sync_files do
31
+ cp "liblinear-1.51/linear.h","ext/"
32
+ cp "liblinear-1.51/linear.cpp","ext/"
33
+ cp "liblinear-1.51/tron.h","ext/"
34
+ cp "liblinear-1.51/tron.cpp","ext/"
35
+ cp "liblinear-1.51/ruby/liblinear_wrap.cxx","ext/"
36
+ cp "liblinear-1.51/blas/blas.h","ext/"
37
+ cp "liblinear-1.51/blas/blasp.h","ext/"
38
+ cp "liblinear-1.51/blas/dscal.c","ext/"
39
+ cp "liblinear-1.51/blas/dnrm2.c","ext/"
40
+ cp "liblinear-1.51/blas/ddot.c","ext/"
41
+ cp "liblinear-1.51/blas/daxpy.c","ext/"
42
+ cp "liblinear-1.51/ruby/linear.rb","lib/"
43
+ cp "liblinear-1.51/ruby/linear_cv.rb","lib/"
44
+ end
45
+
46
+ task :test do
47
+ puts "done"
48
+ end
data/ext/blas.h ADDED
@@ -0,0 +1,25 @@
1
+ /* blas.h -- C header file for BLAS Ver 1.0 */
2
+ /* Jesse Bennett March 23, 2000 */
3
+
4
+ /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed."
5
+
6
+ - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */
7
+
8
+ #ifndef BLAS_INCLUDE
9
+ #define BLAS_INCLUDE
10
+
11
+ /* Data types specific to BLAS implementation */
12
+ typedef struct { float r, i; } fcomplex;
13
+ typedef struct { double r, i; } dcomplex;
14
+ typedef int blasbool;
15
+
16
+ #include "blasp.h" /* Prototypes for all BLAS functions */
17
+
18
+ #define FALSE 0
19
+ #define TRUE 1
20
+
21
+ /* Macro functions */
22
+ #define MIN(a,b) ((a) <= (b) ? (a) : (b))
23
+ #define MAX(a,b) ((a) >= (b) ? (a) : (b))
24
+
25
+ #endif
data/ext/blasp.h ADDED
@@ -0,0 +1,430 @@
1
+ /* blasp.h -- C prototypes for BLAS Ver 1.0 */
2
+ /* Jesse Bennett March 23, 2000 */
3
+
4
+ /* Functions listed in alphabetical order */
5
+
6
+ #ifdef F2C_COMPAT
7
+
8
+ void cdotc_(fcomplex *dotval, int *n, fcomplex *cx, int *incx,
9
+ fcomplex *cy, int *incy);
10
+
11
+ void cdotu_(fcomplex *dotval, int *n, fcomplex *cx, int *incx,
12
+ fcomplex *cy, int *incy);
13
+
14
+ double sasum_(int *n, float *sx, int *incx);
15
+
16
+ double scasum_(int *n, fcomplex *cx, int *incx);
17
+
18
+ double scnrm2_(int *n, fcomplex *x, int *incx);
19
+
20
+ double sdot_(int *n, float *sx, int *incx, float *sy, int *incy);
21
+
22
+ double snrm2_(int *n, float *x, int *incx);
23
+
24
+ void zdotc_(dcomplex *dotval, int *n, dcomplex *cx, int *incx,
25
+ dcomplex *cy, int *incy);
26
+
27
+ void zdotu_(dcomplex *dotval, int *n, dcomplex *cx, int *incx,
28
+ dcomplex *cy, int *incy);
29
+
30
+ #else
31
+
32
+ fcomplex cdotc_(int *n, fcomplex *cx, int *incx, fcomplex *cy, int *incy);
33
+
34
+ fcomplex cdotu_(int *n, fcomplex *cx, int *incx, fcomplex *cy, int *incy);
35
+
36
+ float sasum_(int *n, float *sx, int *incx);
37
+
38
+ float scasum_(int *n, fcomplex *cx, int *incx);
39
+
40
+ float scnrm2_(int *n, fcomplex *x, int *incx);
41
+
42
+ float sdot_(int *n, float *sx, int *incx, float *sy, int *incy);
43
+
44
+ float snrm2_(int *n, float *x, int *incx);
45
+
46
+ dcomplex zdotc_(int *n, dcomplex *cx, int *incx, dcomplex *cy, int *incy);
47
+
48
+ dcomplex zdotu_(int *n, dcomplex *cx, int *incx, dcomplex *cy, int *incy);
49
+
50
+ #endif
51
+
52
+ /* Remaining functions listed in alphabetical order */
53
+
54
+ int caxpy_(int *n, fcomplex *ca, fcomplex *cx, int *incx, fcomplex *cy,
55
+ int *incy);
56
+
57
+ int ccopy_(int *n, fcomplex *cx, int *incx, fcomplex *cy, int *incy);
58
+
59
+ int cgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
60
+ fcomplex *alpha, fcomplex *a, int *lda, fcomplex *x, int *incx,
61
+ fcomplex *beta, fcomplex *y, int *incy);
62
+
63
+ int cgemm_(char *transa, char *transb, int *m, int *n, int *k,
64
+ fcomplex *alpha, fcomplex *a, int *lda, fcomplex *b, int *ldb,
65
+ fcomplex *beta, fcomplex *c, int *ldc);
66
+
67
+ int cgemv_(char *trans, int *m, int *n, fcomplex *alpha, fcomplex *a,
68
+ int *lda, fcomplex *x, int *incx, fcomplex *beta, fcomplex *y,
69
+ int *incy);
70
+
71
+ int cgerc_(int *m, int *n, fcomplex *alpha, fcomplex *x, int *incx,
72
+ fcomplex *y, int *incy, fcomplex *a, int *lda);
73
+
74
+ int cgeru_(int *m, int *n, fcomplex *alpha, fcomplex *x, int *incx,
75
+ fcomplex *y, int *incy, fcomplex *a, int *lda);
76
+
77
+ int chbmv_(char *uplo, int *n, int *k, fcomplex *alpha, fcomplex *a,
78
+ int *lda, fcomplex *x, int *incx, fcomplex *beta, fcomplex *y,
79
+ int *incy);
80
+
81
+ int chemm_(char *side, char *uplo, int *m, int *n, fcomplex *alpha,
82
+ fcomplex *a, int *lda, fcomplex *b, int *ldb, fcomplex *beta,
83
+ fcomplex *c, int *ldc);
84
+
85
+ int chemv_(char *uplo, int *n, fcomplex *alpha, fcomplex *a, int *lda,
86
+ fcomplex *x, int *incx, fcomplex *beta, fcomplex *y, int *incy);
87
+
88
+ int cher_(char *uplo, int *n, float *alpha, fcomplex *x, int *incx,
89
+ fcomplex *a, int *lda);
90
+
91
+ int cher2_(char *uplo, int *n, fcomplex *alpha, fcomplex *x, int *incx,
92
+ fcomplex *y, int *incy, fcomplex *a, int *lda);
93
+
94
+ int cher2k_(char *uplo, char *trans, int *n, int *k, fcomplex *alpha,
95
+ fcomplex *a, int *lda, fcomplex *b, int *ldb, float *beta,
96
+ fcomplex *c, int *ldc);
97
+
98
+ int cherk_(char *uplo, char *trans, int *n, int *k, float *alpha,
99
+ fcomplex *a, int *lda, float *beta, fcomplex *c, int *ldc);
100
+
101
+ int chpmv_(char *uplo, int *n, fcomplex *alpha, fcomplex *ap, fcomplex *x,
102
+ int *incx, fcomplex *beta, fcomplex *y, int *incy);
103
+
104
+ int chpr_(char *uplo, int *n, float *alpha, fcomplex *x, int *incx,
105
+ fcomplex *ap);
106
+
107
+ int chpr2_(char *uplo, int *n, fcomplex *alpha, fcomplex *x, int *incx,
108
+ fcomplex *y, int *incy, fcomplex *ap);
109
+
110
+ int crotg_(fcomplex *ca, fcomplex *cb, float *c, fcomplex *s);
111
+
112
+ int cscal_(int *n, fcomplex *ca, fcomplex *cx, int *incx);
113
+
114
+ int csscal_(int *n, float *sa, fcomplex *cx, int *incx);
115
+
116
+ int cswap_(int *n, fcomplex *cx, int *incx, fcomplex *cy, int *incy);
117
+
118
+ int csymm_(char *side, char *uplo, int *m, int *n, fcomplex *alpha,
119
+ fcomplex *a, int *lda, fcomplex *b, int *ldb, fcomplex *beta,
120
+ fcomplex *c, int *ldc);
121
+
122
+ int csyr2k_(char *uplo, char *trans, int *n, int *k, fcomplex *alpha,
123
+ fcomplex *a, int *lda, fcomplex *b, int *ldb, fcomplex *beta,
124
+ fcomplex *c, int *ldc);
125
+
126
+ int csyrk_(char *uplo, char *trans, int *n, int *k, fcomplex *alpha,
127
+ fcomplex *a, int *lda, fcomplex *beta, fcomplex *c, int *ldc);
128
+
129
+ int ctbmv_(char *uplo, char *trans, char *diag, int *n, int *k,
130
+ fcomplex *a, int *lda, fcomplex *x, int *incx);
131
+
132
+ int ctbsv_(char *uplo, char *trans, char *diag, int *n, int *k,
133
+ fcomplex *a, int *lda, fcomplex *x, int *incx);
134
+
135
+ int ctpmv_(char *uplo, char *trans, char *diag, int *n, fcomplex *ap,
136
+ fcomplex *x, int *incx);
137
+
138
+ int ctpsv_(char *uplo, char *trans, char *diag, int *n, fcomplex *ap,
139
+ fcomplex *x, int *incx);
140
+
141
+ int ctrmm_(char *side, char *uplo, char *transa, char *diag, int *m,
142
+ int *n, fcomplex *alpha, fcomplex *a, int *lda, fcomplex *b,
143
+ int *ldb);
144
+
145
+ int ctrmv_(char *uplo, char *trans, char *diag, int *n, fcomplex *a,
146
+ int *lda, fcomplex *x, int *incx);
147
+
148
+ int ctrsm_(char *side, char *uplo, char *transa, char *diag, int *m,
149
+ int *n, fcomplex *alpha, fcomplex *a, int *lda, fcomplex *b,
150
+ int *ldb);
151
+
152
+ int ctrsv_(char *uplo, char *trans, char *diag, int *n, fcomplex *a,
153
+ int *lda, fcomplex *x, int *incx);
154
+
155
+ int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy,
156
+ int *incy);
157
+
158
+ int dcopy_(int *n, double *sx, int *incx, double *sy, int *incy);
159
+
160
+ int dgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
161
+ double *alpha, double *a, int *lda, double *x, int *incx,
162
+ double *beta, double *y, int *incy);
163
+
164
+ int dgemm_(char *transa, char *transb, int *m, int *n, int *k,
165
+ double *alpha, double *a, int *lda, double *b, int *ldb,
166
+ double *beta, double *c, int *ldc);
167
+
168
+ int dgemv_(char *trans, int *m, int *n, double *alpha, double *a,
169
+ int *lda, double *x, int *incx, double *beta, double *y,
170
+ int *incy);
171
+
172
+ int dger_(int *m, int *n, double *alpha, double *x, int *incx,
173
+ double *y, int *incy, double *a, int *lda);
174
+
175
+ int drot_(int *n, double *sx, int *incx, double *sy, int *incy,
176
+ double *c, double *s);
177
+
178
+ int drotg_(double *sa, double *sb, double *c, double *s);
179
+
180
+ int dsbmv_(char *uplo, int *n, int *k, double *alpha, double *a,
181
+ int *lda, double *x, int *incx, double *beta, double *y,
182
+ int *incy);
183
+
184
+ int dscal_(int *n, double *sa, double *sx, int *incx);
185
+
186
+ int dspmv_(char *uplo, int *n, double *alpha, double *ap, double *x,
187
+ int *incx, double *beta, double *y, int *incy);
188
+
189
+ int dspr_(char *uplo, int *n, double *alpha, double *x, int *incx,
190
+ double *ap);
191
+
192
+ int dspr2_(char *uplo, int *n, double *alpha, double *x, int *incx,
193
+ double *y, int *incy, double *ap);
194
+
195
+ int dswap_(int *n, double *sx, int *incx, double *sy, int *incy);
196
+
197
+ int dsymm_(char *side, char *uplo, int *m, int *n, double *alpha,
198
+ double *a, int *lda, double *b, int *ldb, double *beta,
199
+ double *c, int *ldc);
200
+
201
+ int dsymv_(char *uplo, int *n, double *alpha, double *a, int *lda,
202
+ double *x, int *incx, double *beta, double *y, int *incy);
203
+
204
+ int dsyr_(char *uplo, int *n, double *alpha, double *x, int *incx,
205
+ double *a, int *lda);
206
+
207
+ int dsyr2_(char *uplo, int *n, double *alpha, double *x, int *incx,
208
+ double *y, int *incy, double *a, int *lda);
209
+
210
+ int dsyr2k_(char *uplo, char *trans, int *n, int *k, double *alpha,
211
+ double *a, int *lda, double *b, int *ldb, double *beta,
212
+ double *c, int *ldc);
213
+
214
+ int dsyrk_(char *uplo, char *trans, int *n, int *k, double *alpha,
215
+ double *a, int *lda, double *beta, double *c, int *ldc);
216
+
217
+ int dtbmv_(char *uplo, char *trans, char *diag, int *n, int *k,
218
+ double *a, int *lda, double *x, int *incx);
219
+
220
+ int dtbsv_(char *uplo, char *trans, char *diag, int *n, int *k,
221
+ double *a, int *lda, double *x, int *incx);
222
+
223
+ int dtpmv_(char *uplo, char *trans, char *diag, int *n, double *ap,
224
+ double *x, int *incx);
225
+
226
+ int dtpsv_(char *uplo, char *trans, char *diag, int *n, double *ap,
227
+ double *x, int *incx);
228
+
229
+ int dtrmm_(char *side, char *uplo, char *transa, char *diag, int *m,
230
+ int *n, double *alpha, double *a, int *lda, double *b,
231
+ int *ldb);
232
+
233
+ int dtrmv_(char *uplo, char *trans, char *diag, int *n, double *a,
234
+ int *lda, double *x, int *incx);
235
+
236
+ int dtrsm_(char *side, char *uplo, char *transa, char *diag, int *m,
237
+ int *n, double *alpha, double *a, int *lda, double *b,
238
+ int *ldb);
239
+
240
+ int dtrsv_(char *uplo, char *trans, char *diag, int *n, double *a,
241
+ int *lda, double *x, int *incx);
242
+
243
+
244
+ int saxpy_(int *n, float *sa, float *sx, int *incx, float *sy, int *incy);
245
+
246
+ int scopy_(int *n, float *sx, int *incx, float *sy, int *incy);
247
+
248
+ int sgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
249
+ float *alpha, float *a, int *lda, float *x, int *incx,
250
+ float *beta, float *y, int *incy);
251
+
252
+ int sgemm_(char *transa, char *transb, int *m, int *n, int *k,
253
+ float *alpha, float *a, int *lda, float *b, int *ldb,
254
+ float *beta, float *c, int *ldc);
255
+
256
+ int sgemv_(char *trans, int *m, int *n, float *alpha, float *a,
257
+ int *lda, float *x, int *incx, float *beta, float *y,
258
+ int *incy);
259
+
260
+ int sger_(int *m, int *n, float *alpha, float *x, int *incx,
261
+ float *y, int *incy, float *a, int *lda);
262
+
263
+ int srot_(int *n, float *sx, int *incx, float *sy, int *incy,
264
+ float *c, float *s);
265
+
266
+ int srotg_(float *sa, float *sb, float *c, float *s);
267
+
268
+ int ssbmv_(char *uplo, int *n, int *k, float *alpha, float *a,
269
+ int *lda, float *x, int *incx, float *beta, float *y,
270
+ int *incy);
271
+
272
+ int sscal_(int *n, float *sa, float *sx, int *incx);
273
+
274
+ int sspmv_(char *uplo, int *n, float *alpha, float *ap, float *x,
275
+ int *incx, float *beta, float *y, int *incy);
276
+
277
+ int sspr_(char *uplo, int *n, float *alpha, float *x, int *incx,
278
+ float *ap);
279
+
280
+ int sspr2_(char *uplo, int *n, float *alpha, float *x, int *incx,
281
+ float *y, int *incy, float *ap);
282
+
283
+ int sswap_(int *n, float *sx, int *incx, float *sy, int *incy);
284
+
285
+ int ssymm_(char *side, char *uplo, int *m, int *n, float *alpha,
286
+ float *a, int *lda, float *b, int *ldb, float *beta,
287
+ float *c, int *ldc);
288
+
289
+ int ssymv_(char *uplo, int *n, float *alpha, float *a, int *lda,
290
+ float *x, int *incx, float *beta, float *y, int *incy);
291
+
292
+ int ssyr_(char *uplo, int *n, float *alpha, float *x, int *incx,
293
+ float *a, int *lda);
294
+
295
+ int ssyr2_(char *uplo, int *n, float *alpha, float *x, int *incx,
296
+ float *y, int *incy, float *a, int *lda);
297
+
298
+ int ssyr2k_(char *uplo, char *trans, int *n, int *k, float *alpha,
299
+ float *a, int *lda, float *b, int *ldb, float *beta,
300
+ float *c, int *ldc);
301
+
302
+ int ssyrk_(char *uplo, char *trans, int *n, int *k, float *alpha,
303
+ float *a, int *lda, float *beta, float *c, int *ldc);
304
+
305
+ int stbmv_(char *uplo, char *trans, char *diag, int *n, int *k,
306
+ float *a, int *lda, float *x, int *incx);
307
+
308
+ int stbsv_(char *uplo, char *trans, char *diag, int *n, int *k,
309
+ float *a, int *lda, float *x, int *incx);
310
+
311
+ int stpmv_(char *uplo, char *trans, char *diag, int *n, float *ap,
312
+ float *x, int *incx);
313
+
314
+ int stpsv_(char *uplo, char *trans, char *diag, int *n, float *ap,
315
+ float *x, int *incx);
316
+
317
+ int strmm_(char *side, char *uplo, char *transa, char *diag, int *m,
318
+ int *n, float *alpha, float *a, int *lda, float *b,
319
+ int *ldb);
320
+
321
+ int strmv_(char *uplo, char *trans, char *diag, int *n, float *a,
322
+ int *lda, float *x, int *incx);
323
+
324
+ int strsm_(char *side, char *uplo, char *transa, char *diag, int *m,
325
+ int *n, float *alpha, float *a, int *lda, float *b,
326
+ int *ldb);
327
+
328
+ int strsv_(char *uplo, char *trans, char *diag, int *n, float *a,
329
+ int *lda, float *x, int *incx);
330
+
331
+ int zaxpy_(int *n, dcomplex *ca, dcomplex *cx, int *incx, dcomplex *cy,
332
+ int *incy);
333
+
334
+ int zcopy_(int *n, dcomplex *cx, int *incx, dcomplex *cy, int *incy);
335
+
336
+ int zdscal_(int *n, double *sa, dcomplex *cx, int *incx);
337
+
338
+ int zgbmv_(char *trans, int *m, int *n, int *kl, int *ku,
339
+ dcomplex *alpha, dcomplex *a, int *lda, dcomplex *x, int *incx,
340
+ dcomplex *beta, dcomplex *y, int *incy);
341
+
342
+ int zgemm_(char *transa, char *transb, int *m, int *n, int *k,
343
+ dcomplex *alpha, dcomplex *a, int *lda, dcomplex *b, int *ldb,
344
+ dcomplex *beta, dcomplex *c, int *ldc);
345
+
346
+ int zgemv_(char *trans, int *m, int *n, dcomplex *alpha, dcomplex *a,
347
+ int *lda, dcomplex *x, int *incx, dcomplex *beta, dcomplex *y,
348
+ int *incy);
349
+
350
+ int zgerc_(int *m, int *n, dcomplex *alpha, dcomplex *x, int *incx,
351
+ dcomplex *y, int *incy, dcomplex *a, int *lda);
352
+
353
+ int zgeru_(int *m, int *n, dcomplex *alpha, dcomplex *x, int *incx,
354
+ dcomplex *y, int *incy, dcomplex *a, int *lda);
355
+
356
+ int zhbmv_(char *uplo, int *n, int *k, dcomplex *alpha, dcomplex *a,
357
+ int *lda, dcomplex *x, int *incx, dcomplex *beta, dcomplex *y,
358
+ int *incy);
359
+
360
+ int zhemm_(char *side, char *uplo, int *m, int *n, dcomplex *alpha,
361
+ dcomplex *a, int *lda, dcomplex *b, int *ldb, dcomplex *beta,
362
+ dcomplex *c, int *ldc);
363
+
364
+ int zhemv_(char *uplo, int *n, dcomplex *alpha, dcomplex *a, int *lda,
365
+ dcomplex *x, int *incx, dcomplex *beta, dcomplex *y, int *incy);
366
+
367
+ int zher_(char *uplo, int *n, double *alpha, dcomplex *x, int *incx,
368
+ dcomplex *a, int *lda);
369
+
370
+ int zher2_(char *uplo, int *n, dcomplex *alpha, dcomplex *x, int *incx,
371
+ dcomplex *y, int *incy, dcomplex *a, int *lda);
372
+
373
+ int zher2k_(char *uplo, char *trans, int *n, int *k, dcomplex *alpha,
374
+ dcomplex *a, int *lda, dcomplex *b, int *ldb, double *beta,
375
+ dcomplex *c, int *ldc);
376
+
377
+ int zherk_(char *uplo, char *trans, int *n, int *k, double *alpha,
378
+ dcomplex *a, int *lda, double *beta, dcomplex *c, int *ldc);
379
+
380
+ int zhpmv_(char *uplo, int *n, dcomplex *alpha, dcomplex *ap, dcomplex *x,
381
+ int *incx, dcomplex *beta, dcomplex *y, int *incy);
382
+
383
+ int zhpr_(char *uplo, int *n, double *alpha, dcomplex *x, int *incx,
384
+ dcomplex *ap);
385
+
386
+ int zhpr2_(char *uplo, int *n, dcomplex *alpha, dcomplex *x, int *incx,
387
+ dcomplex *y, int *incy, dcomplex *ap);
388
+
389
+ int zrotg_(dcomplex *ca, dcomplex *cb, double *c, dcomplex *s);
390
+
391
+ int zscal_(int *n, dcomplex *ca, dcomplex *cx, int *incx);
392
+
393
+ int zswap_(int *n, dcomplex *cx, int *incx, dcomplex *cy, int *incy);
394
+
395
+ int zsymm_(char *side, char *uplo, int *m, int *n, dcomplex *alpha,
396
+ dcomplex *a, int *lda, dcomplex *b, int *ldb, dcomplex *beta,
397
+ dcomplex *c, int *ldc);
398
+
399
+ int zsyr2k_(char *uplo, char *trans, int *n, int *k, dcomplex *alpha,
400
+ dcomplex *a, int *lda, dcomplex *b, int *ldb, dcomplex *beta,
401
+ dcomplex *c, int *ldc);
402
+
403
+ int zsyrk_(char *uplo, char *trans, int *n, int *k, dcomplex *alpha,
404
+ dcomplex *a, int *lda, dcomplex *beta, dcomplex *c, int *ldc);
405
+
406
+ int ztbmv_(char *uplo, char *trans, char *diag, int *n, int *k,
407
+ dcomplex *a, int *lda, dcomplex *x, int *incx);
408
+
409
+ int ztbsv_(char *uplo, char *trans, char *diag, int *n, int *k,
410
+ dcomplex *a, int *lda, dcomplex *x, int *incx);
411
+
412
+ int ztpmv_(char *uplo, char *trans, char *diag, int *n, dcomplex *ap,
413
+ dcomplex *x, int *incx);
414
+
415
+ int ztpsv_(char *uplo, char *trans, char *diag, int *n, dcomplex *ap,
416
+ dcomplex *x, int *incx);
417
+
418
+ int ztrmm_(char *side, char *uplo, char *transa, char *diag, int *m,
419
+ int *n, dcomplex *alpha, dcomplex *a, int *lda, dcomplex *b,
420
+ int *ldb);
421
+
422
+ int ztrmv_(char *uplo, char *trans, char *diag, int *n, dcomplex *a,
423
+ int *lda, dcomplex *x, int *incx);
424
+
425
+ int ztrsm_(char *side, char *uplo, char *transa, char *diag, int *m,
426
+ int *n, dcomplex *alpha, dcomplex *a, int *lda, dcomplex *b,
427
+ int *ldb);
428
+
429
+ int ztrsv_(char *uplo, char *trans, char *diag, int *n, dcomplex *a,
430
+ int *lda, dcomplex *x, int *incx);
data/ext/daxpy.c ADDED
@@ -0,0 +1,49 @@
1
+ #include "blas.h"
2
+
3
+ int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy,
4
+ int *incy)
5
+ {
6
+ long int i, m, ix, iy, nn, iincx, iincy;
7
+ register double ssa;
8
+
9
+ /* constant times a vector plus a vector.
10
+ uses unrolled loop for increments equal to one.
11
+ jack dongarra, linpack, 3/11/78.
12
+ modified 12/3/93, array(1) declarations changed to array(*) */
13
+
14
+ /* Dereference inputs */
15
+ nn = *n;
16
+ ssa = *sa;
17
+ iincx = *incx;
18
+ iincy = *incy;
19
+
20
+ if( nn > 0 && ssa != 0.0 )
21
+ {
22
+ if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */
23
+ {
24
+ m = nn-3;
25
+ for (i = 0; i < m; i += 4)
26
+ {
27
+ sy[i] += ssa * sx[i];
28
+ sy[i+1] += ssa * sx[i+1];
29
+ sy[i+2] += ssa * sx[i+2];
30
+ sy[i+3] += ssa * sx[i+3];
31
+ }
32
+ for ( ; i < nn; ++i) /* clean-up loop */
33
+ sy[i] += ssa * sx[i];
34
+ }
35
+ else /* code for unequal increments or equal increments not equal to 1 */
36
+ {
37
+ ix = iincx >= 0 ? 0 : (1 - nn) * iincx;
38
+ iy = iincy >= 0 ? 0 : (1 - nn) * iincy;
39
+ for (i = 0; i < nn; i++)
40
+ {
41
+ sy[iy] += ssa * sx[ix];
42
+ ix += iincx;
43
+ iy += iincy;
44
+ }
45
+ }
46
+ }
47
+
48
+ return 0;
49
+ } /* daxpy_ */