Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Remove unneeded stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Jan 26, 2015
1 parent 5e3d524 commit 5cc5d22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
20 changes: 1 addition & 19 deletions src/sage/data_structures/binary_matrix.pxd
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
include 'sage/ext/stdsage.pxi'
include 'sage/ext/cdefs.pxi'

from sage.data_structures.bitset cimport bitset_t

cdef extern from *:
int __builtin_popcountl(unsigned long)
void *memset(void *, int, size_t)

# Constants from bitset.pxd
cdef extern from *:
int index_shift "(sizeof(unsigned long)==8 ? 6 : 5)"
unsigned long offset_mask "(sizeof(unsigned long)==8 ? 0x3F : 0x1F)"


cdef struct binary_matrix_s:
long n_cols
long n_rows

# Number of "unsigned long" per row
long width

bitset_t * rows
bitset_t* rows

ctypedef binary_matrix_s[1] binary_matrix_t

7 changes: 2 additions & 5 deletions src/sage/data_structures/binary_matrix.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ a ``binary_matrix_t`` structure contains :
containing the bits of row `i`.
"""

from sage.data_structures.binary_matrix cimport *
include 'sage/data_structures/bitset.pxi'


cdef inline binary_matrix_init(binary_matrix_t m, long n_rows, long n_cols):
r"""
Allocates the binary matrix.
Expand All @@ -28,7 +30,6 @@ cdef inline binary_matrix_init(binary_matrix_t m, long n_rows, long n_cols):

m.n_cols = n_cols
m.n_rows = n_rows
m.width = (n_cols - 1)/(8*sizeof(unsigned long)) + 1
m.rows = <bitset_t *>sage_malloc(n_rows * sizeof(bitset_t))
if m.rows == NULL:
raise MemoryError
Expand Down Expand Up @@ -101,10 +102,6 @@ cdef inline binary_matrix_print(binary_matrix_t m):
cdef int i,j
import sys
for i from 0 <= i < m.n_rows:
# If you want to print the *whole* matrix, including the useless bits,
# use the following line instead
#
# for j in (m.width*8*sizeof(unsigned long)):
for j from 0 <= j < m.n_cols:
sys.stdout.write("1" if binary_matrix_get(m, i, j) else ".",)
print ""

0 comments on commit 5cc5d22

Please sign in to comment.