nmatrix 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/Gemfile +7 -0
- data/History.txt +6 -0
- data/LICENSE.txt +21 -0
- data/Manifest.txt +51 -0
- data/README.rdoc +63 -0
- data/Rakefile +154 -0
- data/ext/nmatrix/cblas.c +150 -0
- data/ext/nmatrix/dense.c +307 -0
- data/ext/nmatrix/dense/blas_header.template.c +52 -0
- data/ext/nmatrix/dense/elementwise.template.c +107 -0
- data/ext/nmatrix/dense/gemm.template.c +159 -0
- data/ext/nmatrix/dense/gemv.template.c +130 -0
- data/ext/nmatrix/dense/rationalmath.template.c +68 -0
- data/ext/nmatrix/depend +18 -0
- data/ext/nmatrix/extconf.rb +143 -0
- data/ext/nmatrix/generator.rb +594 -0
- data/ext/nmatrix/generator/syntax_tree.rb +481 -0
- data/ext/nmatrix/list.c +774 -0
- data/ext/nmatrix/nmatrix.c +1977 -0
- data/ext/nmatrix/nmatrix.h +912 -0
- data/ext/nmatrix/rational.c +98 -0
- data/ext/nmatrix/yale.c +726 -0
- data/ext/nmatrix/yale/complexmath.template.c +71 -0
- data/ext/nmatrix/yale/elementwise.template.c +46 -0
- data/ext/nmatrix/yale/elementwise_op.template.c +73 -0
- data/ext/nmatrix/yale/numbmm.template.c +94 -0
- data/ext/nmatrix/yale/smmp1.template.c +21 -0
- data/ext/nmatrix/yale/smmp1_header.template.c +38 -0
- data/ext/nmatrix/yale/smmp2.template.c +43 -0
- data/ext/nmatrix/yale/smmp2_header.template.c +46 -0
- data/ext/nmatrix/yale/sort_columns.template.c +56 -0
- data/ext/nmatrix/yale/symbmm.template.c +54 -0
- data/ext/nmatrix/yale/transp.template.c +68 -0
- data/lib/array.rb +67 -0
- data/lib/nmatrix.rb +263 -0
- data/lib/string.rb +65 -0
- data/spec/nmatrix_spec.rb +395 -0
- data/spec/nmatrix_yale_spec.rb +239 -0
- data/spec/nvector_spec.rb +43 -0
- data/spec/syntax_tree_spec.rb +46 -0
- metadata +150 -0
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/.gemtest
ADDED
File without changes
|
data/Gemfile
ADDED
data/History.txt
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
This version of SciRuby is licensed under the BSD 2-clause license.
|
2
|
+
|
3
|
+
* http://sciruby.com
|
4
|
+
* http://github.com/sciruby/sciruby/wiki/License
|
5
|
+
|
6
|
+
You *must* read the Contributor Agreement before contributing code to the SciRuby Project. This is available online:
|
7
|
+
|
8
|
+
* http://github.com/sciruby/sciruby/wiki/Contributor-Agreement
|
9
|
+
|
10
|
+
--
|
11
|
+
|
12
|
+
Copyright (c) 2010 - 2011, Ruby Science Foundation
|
13
|
+
All rights reserved.
|
14
|
+
|
15
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
16
|
+
|
17
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
18
|
+
|
19
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
20
|
+
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
.autotest
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.rdoc
|
5
|
+
LICENSE.txt
|
6
|
+
Rakefile
|
7
|
+
Gemfile
|
8
|
+
spec/nmatrix_spec.rb
|
9
|
+
spec/nmatrix_yale_spec.rb
|
10
|
+
spec/nvector_spec.rb
|
11
|
+
spec/syntax_tree_spec.rb
|
12
|
+
lib/array.rb
|
13
|
+
lib/nmatrix.rb
|
14
|
+
lib/string.rb
|
15
|
+
ext/nmatrix/cblas.c
|
16
|
+
ext/nmatrix/dense.c
|
17
|
+
ext/nmatrix/depend
|
18
|
+
ext/nmatrix/extconf.rb
|
19
|
+
ext/nmatrix/generator.rb
|
20
|
+
ext/nmatrix/list.c
|
21
|
+
ext/nmatrix/nmatrix.c
|
22
|
+
ext/nmatrix/nmatrix.h
|
23
|
+
ext/nmatrix/rational.c
|
24
|
+
ext/nmatrix/yale.c
|
25
|
+
ext/nmatrix/generator/syntax_tree.rb
|
26
|
+
ext/nmatrix/dense/blas_header.template.c
|
27
|
+
ext/nmatrix/dense/elementwise.template.c
|
28
|
+
ext/nmatrix/dense/gemm.template.c
|
29
|
+
ext/nmatrix/dense/gemv.template.c
|
30
|
+
ext/nmatrix/dense/rationalmath.template.c
|
31
|
+
ext/nmatrix/yale/smmp1.template.c
|
32
|
+
ext/nmatrix/yale/smmp2.template.c
|
33
|
+
ext/nmatrix/yale/smmp1_header.template.c
|
34
|
+
ext/nmatrix/yale/smmp2_header.template.c
|
35
|
+
ext/nmatrix/yale/sort_columns.template.c
|
36
|
+
ext/nmatrix/yale/symbmm.template.c
|
37
|
+
ext/nmatrix/yale/numbmm.template.c
|
38
|
+
ext/nmatrix/yale/transp.template.c
|
39
|
+
ext/nmatrix/yale/complexmath.template.c
|
40
|
+
ext/nmatrix/yale/elementwise.template.c
|
41
|
+
ext/nmatrix/yale/elementwise_op.template.c
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
= NMatrix
|
2
|
+
|
3
|
+
http://sciruby.com
|
4
|
+
|
5
|
+
* {Project homepage: sciruby.com}[http://sciruby.com]
|
6
|
+
* {SciRuby on Google+}[https://plus.google.com/109304769076178160953/posts]
|
7
|
+
* {Installation guide}[http://sciruby.com/docs#installation]
|
8
|
+
|
9
|
+
== Description
|
10
|
+
|
11
|
+
NMatrix is an experimental linear algebra library for Ruby, written mostly in C. It can be used with or without SciRuby, but is part of the SciRuby project.
|
12
|
+
|
13
|
+
NMatrix was inspired by and based heavily upon {NArray}[http://narray.rubyforge.org], by Masahiro Tanaka.
|
14
|
+
|
15
|
+
{<img src=https://www.pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
|
16
|
+
|
17
|
+
=== WARNING:
|
18
|
+
|
19
|
+
Please be aware that SciRuby and NMatrix are in *PRE-ALPHA* status. If you're thinking of using SciRuby/NMatrix to write mission critical code, such as for driving a car or flying a space shuttle, you may wish to choose other software (for now).
|
20
|
+
|
21
|
+
== Features
|
22
|
+
|
23
|
+
* Matrix storage containers: dense, yale, list (more to come)
|
24
|
+
* Data types: int8, int16, int32, int64, float32, float64, complex64, complex128, rational64, rational128 (incomplete)
|
25
|
+
* Very basic algebra (more to come)
|
26
|
+
|
27
|
+
== SYNOPSIS:
|
28
|
+
|
29
|
+
From the command line,
|
30
|
+
|
31
|
+
git clone git@github.com:mohawkjohn/nmatrix.git
|
32
|
+
cd nmatrix
|
33
|
+
rake console
|
34
|
+
|
35
|
+
Gem coming later.
|
36
|
+
|
37
|
+
== REQUIREMENTS:
|
38
|
+
|
39
|
+
* ATLAS and LAPACK, probably
|
40
|
+
* GCC 4.2
|
41
|
+
* Ruby 1.9
|
42
|
+
|
43
|
+
== INSTALLATION:
|
44
|
+
|
45
|
+
See Synopsis (above) for now. Gem coming later.
|
46
|
+
|
47
|
+
More detailed installation instructions are available at {here}[http://sciruby.com/docs#installation]
|
48
|
+
|
49
|
+
== DEVELOPERS:
|
50
|
+
|
51
|
+
Before commiting any code, you *MUST* read our {Contributor Agreement}[http://github.com/SciRuby/sciruby/wiki/Contributor-Agreement].
|
52
|
+
|
53
|
+
== LICENSE:
|
54
|
+
|
55
|
+
Copyright (c) 2012, The Ruby Science Foundation.
|
56
|
+
|
57
|
+
All rights reserved.
|
58
|
+
|
59
|
+
NMatrix, along with SciRuby, is licensed under the BSD 2-clause license. See {LICENSE.txt}[https://github.com/SciRuby/sciruby/wiki/License] for details.
|
60
|
+
|
61
|
+
== DONATIONS:
|
62
|
+
|
63
|
+
{<img src=https://www.pledgie.com/campaigns/15783.png?skin_name=chrome>}[http://www.pledgie.com/campaigns/15783]
|
data/Rakefile
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
# Fix for problem described here: https://github.com/jbarnette/isolate/pull/39
|
6
|
+
module Gem
|
7
|
+
Deprecate = Module.new do
|
8
|
+
include Deprecate
|
9
|
+
end
|
10
|
+
end
|
11
|
+
require 'isolate/now'
|
12
|
+
# End Fix
|
13
|
+
|
14
|
+
require 'hoe'
|
15
|
+
require 'pathname'
|
16
|
+
require 'rspec/core/rake_task'
|
17
|
+
|
18
|
+
Hoe.plugin :compiler
|
19
|
+
Hoe.plugin :bundler
|
20
|
+
Hoe.plugin :git
|
21
|
+
# Hoe.plugin :compiler
|
22
|
+
# Hoe.plugin :gem_prelude_sucks
|
23
|
+
# Hoe.plugin :inline
|
24
|
+
# Hoe.plugin :racc
|
25
|
+
# Hoe.plugin :rubyforge
|
26
|
+
|
27
|
+
BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
|
28
|
+
SPECDIR = BASEDIR + 'spec'
|
29
|
+
|
30
|
+
VALGRIND_OPTIONS = [
|
31
|
+
"--num-callers=50",
|
32
|
+
"--error-limit=no",
|
33
|
+
"--partial-loads-ok=yes",
|
34
|
+
"--undef-value-errors=no",
|
35
|
+
]
|
36
|
+
VALGRIND_MEMORYFILL_OPTIONS = [
|
37
|
+
"--freelist-vol=100000000",
|
38
|
+
"--malloc-fill=6D",
|
39
|
+
"--free-fill=66 ",
|
40
|
+
]
|
41
|
+
|
42
|
+
GDB_OPTIONS = []
|
43
|
+
|
44
|
+
|
45
|
+
h = Hoe.spec 'nmatrix' do
|
46
|
+
self.require_ruby_version ">=1.9"
|
47
|
+
self.developer('John Woods', 'john.o.woods@gmail.com')
|
48
|
+
self.post_install_message = <<-EOF
|
49
|
+
***********************************************************
|
50
|
+
Welcome to SciRuby: Tools for Scientific Computing in Ruby!
|
51
|
+
|
52
|
+
*** WARNING ***
|
53
|
+
Please be aware that NMatrix is in ALPHA status. If you're
|
54
|
+
thinking of using NMatrix to write mission critical code,
|
55
|
+
such as for driving a car or flying a space shuttle, you
|
56
|
+
may wish to choose other software (for now).
|
57
|
+
|
58
|
+
NMatrix requires a C compiler, and has been tested only
|
59
|
+
with GCC 4.6.1. We are happy to accept contributions
|
60
|
+
which improve the portability of this project.
|
61
|
+
|
62
|
+
Also required is ATLAS. Most Linux distributions and Mac
|
63
|
+
versions include ATLAS, but you may wish to compile it
|
64
|
+
yourself.
|
65
|
+
|
66
|
+
More explicit instructions for NMatrix and SciRuby should
|
67
|
+
be available on the SciRuby website, sciruby.com, or
|
68
|
+
through our mailing list (which can be found on our web-
|
69
|
+
site).
|
70
|
+
|
71
|
+
Thanks for trying out NMatrix! Happy coding!
|
72
|
+
|
73
|
+
***********************************************************
|
74
|
+
EOF
|
75
|
+
#self.need_rdoc = false
|
76
|
+
self.readme_file = 'README.rdoc'
|
77
|
+
# self.rubyforge_name = 'nmatrixx' # if different than 'nmatrix'
|
78
|
+
end
|
79
|
+
|
80
|
+
RSpec::Core::RakeTask.new(:spec)
|
81
|
+
|
82
|
+
task :console do |task|
|
83
|
+
cmd = [ 'irb', "-r './lib/nmatrix.rb'" ]
|
84
|
+
run *cmd
|
85
|
+
end
|
86
|
+
|
87
|
+
#namespace :console do
|
88
|
+
# CONSOLE_CMD = ['irb', "-r './lib/nmatrix.rb'"]
|
89
|
+
# desc "Run console under GDB."
|
90
|
+
# task :gdb => [ :compile ] do |task|
|
91
|
+
# cmd = [ 'gdb' ] + GDB_OPTIONS
|
92
|
+
# cmd += [ '--args' ]
|
93
|
+
# cmd += CONSOLE_CMD
|
94
|
+
# run( *cmd )
|
95
|
+
# end
|
96
|
+
#
|
97
|
+
# desc "Run console under Valgrind."
|
98
|
+
# task :valgrind => [ :compile ] do |task|
|
99
|
+
# cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
|
100
|
+
# cmd += CONSOLE_CMD
|
101
|
+
# run( *cmd )
|
102
|
+
# end
|
103
|
+
#end
|
104
|
+
|
105
|
+
task :default => :spec
|
106
|
+
|
107
|
+
def run *cmd
|
108
|
+
sh(cmd.join(" "))
|
109
|
+
end
|
110
|
+
|
111
|
+
namespace :spec do
|
112
|
+
# partial-loads-ok and undef-value-errors necessary to ignore
|
113
|
+
# spurious (and eminently ignorable) warnings from the ruby
|
114
|
+
# interpreter
|
115
|
+
|
116
|
+
RSPEC_CMD = [ 'ruby', '-S', 'rspec', '-Ilib:ext', SPECDIR ]
|
117
|
+
|
118
|
+
#desc "Run the spec for generator.rb"
|
119
|
+
#task :generator do |task|
|
120
|
+
# run 'rspec spec/generator_spec.rb'
|
121
|
+
#end
|
122
|
+
|
123
|
+
desc "Run specs under GDB."
|
124
|
+
task :gdb => [ :compile ] do |task|
|
125
|
+
cmd = [ 'gdb' ] + GDB_OPTIONS
|
126
|
+
cmd += [ '--args' ]
|
127
|
+
cmd += RSPEC_CMD
|
128
|
+
run( *cmd )
|
129
|
+
end
|
130
|
+
|
131
|
+
desc "Run specs under Valgrind."
|
132
|
+
task :valgrind => [ :compile ] do |task|
|
133
|
+
cmd = [ 'valgrind' ] + VALGRIND_OPTIONS
|
134
|
+
cmd += RSPEC_CMD
|
135
|
+
run( *cmd )
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
namespace :clean do
|
141
|
+
task :so do |task|
|
142
|
+
tmp_path = "tmp/#{RUBY_PLATFORM}/nmatrix/#{RUBY_VERSION}"
|
143
|
+
chdir tmp_path do
|
144
|
+
if RUBY_PLATFORM =~ /mswin/
|
145
|
+
`nmake soclean`
|
146
|
+
else
|
147
|
+
mkcmd = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v >> /dev/null 2>&1") }
|
148
|
+
`#{mkcmd} soclean`
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
# vim: syntax=ruby
|
data/ext/nmatrix/cblas.c
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
/////////////////////////////////////////////////////////////////////
|
2
|
+
// = NMatrix
|
3
|
+
//
|
4
|
+
// A linear algebra library for scientific computation in Ruby.
|
5
|
+
// NMatrix is part of SciRuby.
|
6
|
+
//
|
7
|
+
// NMatrix was originally inspired by and derived from NArray, by
|
8
|
+
// Masahiro Tanaka: http://narray.rubyforge.org
|
9
|
+
//
|
10
|
+
// == Copyright Information
|
11
|
+
//
|
12
|
+
// SciRuby is Copyright (c) 2010 - 2012, Ruby Science Foundation
|
13
|
+
// NMatrix is Copyright (c) 2012, Ruby Science Foundation
|
14
|
+
//
|
15
|
+
// Please see LICENSE.txt for additional copyright notices.
|
16
|
+
//
|
17
|
+
// == Contributing
|
18
|
+
//
|
19
|
+
// By contributing source code to SciRuby, you agree to be bound by
|
20
|
+
// our Contributor Agreement:
|
21
|
+
//
|
22
|
+
// * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
|
23
|
+
//
|
24
|
+
// == cblas.c
|
25
|
+
//
|
26
|
+
// Functions in this file allow us to call CBLAS functions using
|
27
|
+
// arrays of function pointers, by ensuring that each has the same
|
28
|
+
// signature.
|
29
|
+
|
30
|
+
#ifndef CBLAS_C
|
31
|
+
# define CBLAS_C
|
32
|
+
|
33
|
+
#include <cblas.h>
|
34
|
+
#include "nmatrix.h"
|
35
|
+
|
36
|
+
//extern const enum CBLAS_ORDER;
|
37
|
+
//extern const enum CBLAS_TRANSPOSE;
|
38
|
+
|
39
|
+
|
40
|
+
inline void cblas_r32gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
41
|
+
if (Order == CblasColMajor) r32gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.r[0], p.A, p.lda, p.B, p.ldb, p.beta.r[0], p.C, p.ldc);
|
42
|
+
else r32gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.r[0], p.B, p.ldb, p.A, p.lda, p.beta.r[0], p.C, p.ldc);
|
43
|
+
}
|
44
|
+
|
45
|
+
inline void cblas_r32gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
46
|
+
r32gemv(TransA, p.M, p.N, p.alpha.r[0], p.A, p.lda, p.B, p.ldb, p.beta.r[0], p.C, p.ldc);
|
47
|
+
}
|
48
|
+
|
49
|
+
inline void cblas_r64gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
50
|
+
if (Order == CblasColMajor) r64gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.ra[0], p.A, p.lda, p.B, p.ldb, p.beta.ra[0], p.C, p.ldc);
|
51
|
+
else r64gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.ra[0], p.B, p.ldb, p.A, p.lda, p.beta.ra[0], p.C, p.ldc);
|
52
|
+
}
|
53
|
+
|
54
|
+
inline void cblas_r64gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
55
|
+
r64gemv(TransA, p.M, p.N, p.alpha.ra[0], p.A, p.lda, p.B, p.ldb, p.beta.ra[0], p.C, p.ldc);
|
56
|
+
}
|
57
|
+
|
58
|
+
inline void cblas_r128gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
59
|
+
if (Order == CblasColMajor) r128gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.rat, p.A, p.lda, p.B, p.ldb, p.beta.rat, p.C, p.ldc);
|
60
|
+
else r128gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.rat, p.B, p.ldb, p.A, p.lda, p.beta.rat, p.C, p.ldc);
|
61
|
+
}
|
62
|
+
|
63
|
+
inline void cblas_r128gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
64
|
+
r128gemv(TransA, p.M, p.N, p.alpha.rat, p.A, p.lda, p.B, p.ldb, p.beta.rat, p.C, p.ldc);
|
65
|
+
}
|
66
|
+
|
67
|
+
inline void cblas_bgemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
68
|
+
bgemv(TransA, p.M, p.N, p.alpha.b[0], p.A, p.lda, p.B, p.ldb, p.beta.b[0], p.C, p.ldc);
|
69
|
+
}
|
70
|
+
|
71
|
+
inline void cblas_bgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
72
|
+
if (Order == CblasColMajor) bgemm(TransA, TransB, p.M, p.N, p.K, p.alpha.b[0], p.A, p.lda, p.B, p.ldb, p.beta.b[0], p.C, p.ldc);
|
73
|
+
else bgemm(TransB, TransA, p.N, p.M, p.K, p.alpha.b[0], p.B, p.ldb, p.A, p.lda, p.beta.b[0], p.C, p.ldc);
|
74
|
+
}
|
75
|
+
|
76
|
+
inline void cblas_i8gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
77
|
+
i8gemv(TransA, p.M, p.N, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
78
|
+
}
|
79
|
+
|
80
|
+
inline void cblas_i8gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
81
|
+
if (Order == CblasColMajor) i8gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
82
|
+
else i8gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.i[0], p.B, p.ldb, p.A, p.lda, p.beta.i[0], p.C, p.ldc);
|
83
|
+
}
|
84
|
+
|
85
|
+
inline void cblas_i16gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
86
|
+
i16gemv(TransA, p.M, p.N, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
87
|
+
}
|
88
|
+
|
89
|
+
inline void cblas_i16gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
90
|
+
if (Order == CblasColMajor) i16gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
91
|
+
else i16gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.i[0], p.B, p.ldb, p.A, p.lda, p.beta.i[0], p.C, p.ldc);
|
92
|
+
}
|
93
|
+
|
94
|
+
inline void cblas_i32gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
95
|
+
i32gemv(TransA, p.M, p.N, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
96
|
+
}
|
97
|
+
|
98
|
+
inline void cblas_i32gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
99
|
+
if (Order == CblasColMajor) i32gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
100
|
+
else i32gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.i[0], p.B, p.ldb, p.A, p.lda, p.beta.i[0], p.C, p.ldc);
|
101
|
+
}
|
102
|
+
|
103
|
+
inline void cblas_i64gemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
104
|
+
i64gemv(TransA, p.M, p.N, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
105
|
+
}
|
106
|
+
|
107
|
+
inline void cblas_i64gemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
108
|
+
if (Order == CblasColMajor) i64gemm(TransA, TransB, p.M, p.N, p.K, p.alpha.i[0], p.A, p.lda, p.B, p.ldb, p.beta.i[0], p.C, p.ldc);
|
109
|
+
else i64gemm(TransB, TransA, p.N, p.M, p.K, p.alpha.i[0], p.B, p.ldb, p.A, p.lda, p.beta.i[0], p.C, p.ldc);
|
110
|
+
}
|
111
|
+
|
112
|
+
inline void cblas_vgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
113
|
+
if (Order == CblasColMajor) vgemm(TransA, TransB, p.M, p.N, p.K, p.alpha.v[0], p.A, p.lda, p.B, p.ldb, p.beta.v[0], p.C, p.ldc);
|
114
|
+
else vgemm(TransB, TransA, p.N, p.M, p.K, p.alpha.v[0], p.B, p.ldb, p.A, p.lda, p.beta.v[0], p.C, p.ldc);
|
115
|
+
}
|
116
|
+
|
117
|
+
inline void cblas_sgemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
118
|
+
cblas_sgemv(Order, TransA, p.M, p.N, p.alpha.d[0], p.A, p.lda, p.B, p.ldb, p.beta.d[0], p.C, p.ldc);
|
119
|
+
}
|
120
|
+
|
121
|
+
inline void cblas_sgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
122
|
+
cblas_sgemm(Order, TransA, TransB, p.M, p.N, p.K, p.alpha.d[0], p.A, p.lda, p.B, p.ldb, p.beta.d[0], p.C, p.ldc);
|
123
|
+
}
|
124
|
+
|
125
|
+
inline void cblas_dgemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
126
|
+
cblas_dgemv(Order, TransA, p.M, p.N, p.alpha.d[0], p.A, p.lda, p.B, p.ldb, p.beta.d[0], p.C, p.ldc);
|
127
|
+
}
|
128
|
+
|
129
|
+
inline void cblas_dgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
130
|
+
cblas_dgemm(Order, TransA, TransB, p.M, p.N, p.K, p.alpha.d[0], p.A, p.lda, p.B, p.ldb, p.beta.d[0], p.C, p.ldc);
|
131
|
+
}
|
132
|
+
|
133
|
+
inline void cblas_cgemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
134
|
+
cblas_cgemv(Order, TransA, p.M, p.N, &(p.alpha.c), p.A, p.lda, p.B, p.ldb, &(p.beta.c), p.C, p.ldc);
|
135
|
+
}
|
136
|
+
|
137
|
+
inline void cblas_cgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
138
|
+
cblas_cgemm(Order, TransA, TransB, p.M, p.N, p.K, &(p.alpha.c), p.A, p.lda, p.B, p.ldb, &(p.beta.c), p.C, p.ldc);
|
139
|
+
}
|
140
|
+
|
141
|
+
inline void cblas_zgemv_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, DENSE_PARAM p) {
|
142
|
+
cblas_zgemv(Order, TransA, p.M, p.N, &(p.alpha.z), p.A, p.lda, p.B, p.ldb, &(p.beta.z), p.C, p.ldc);
|
143
|
+
}
|
144
|
+
|
145
|
+
inline void cblas_zgemm_(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, DENSE_PARAM p) {
|
146
|
+
cblas_zgemm(Order, TransA, TransB, p.M, p.N, p.K, &(p.alpha.z), p.A, p.lda, p.B, p.ldb, &(p.beta.z), p.C, p.ldc);
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
#endif
|