Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherzimmerman committed Oct 14, 2019
1 parent 0bdbf6e commit 91e0f74
Show file tree
Hide file tree
Showing 25 changed files with 482 additions and 605 deletions.
1 change: 0 additions & 1 deletion ext/bottle.c

This file was deleted.

Binary file removed ext/bottle.o
Binary file not shown.
Binary file removed ext/bottle.so
Binary file not shown.
36 changes: 0 additions & 36 deletions ext/ma/ma.c

This file was deleted.

2 changes: 2 additions & 0 deletions src/bottle.cr
@@ -1,3 +1,5 @@
require "./vector/*"

module Bottle
VERSION = "0.1.0"
end
2 changes: 1 addition & 1 deletion src/util/exceptions.cr → src/core/exceptions.cr
@@ -1,4 +1,4 @@
module Bottle::Util::Exceptions
module Bottle::Core::Exceptions
class RangeError < Exception
end

Expand Down
19 changes: 19 additions & 0 deletions src/core/matrix/index.cr
@@ -0,0 +1,19 @@
macro matrix_indexing_abstract(type_, dtype, prefix)
module Bottle::Util::Indexing
include Bottle::Util::Exceptions
extend self

def get_matrix_row_at_index(matrix : Pointer({{ type_ }}), index : Int32)
vv = LibGsl.{{ prefix }}_row(matrix, index)
return Vector.new vv.vector, vv.vector.data
end

def get_matrix_col_at_index(matrix : Pointer({{ type_ }}), column : Int32)
vv = LibGsl.{{ prefix }}_column(matrix, column)
return Vector.new vv.vector, vv.vector.data
end
end
end

matrix_indexing_abstract LibGsl::GslMatrix, Float64, gsl_matrix
matrix_indexing_abstract LibGsl::GslMatrixInt, Int32, gsl_matrix_int

0 comments on commit 91e0f74

Please sign in to comment.