summaryrefslogtreecommitdiff
path: root/scipy/base/matrix.py
diff options
context:
space:
mode:
Diffstat (limited to 'scipy/base/matrix.py')
-rw-r--r--scipy/base/matrix.py22
1 files changed, 2 insertions, 20 deletions
diff --git a/scipy/base/matrix.py b/scipy/base/matrix.py
index 3710dc4da..34a4673c8 100644
--- a/scipy/base/matrix.py
+++ b/scipy/base/matrix.py
@@ -1,6 +1,7 @@
import numeric as N
from numeric import ArrayType, concatenate
+from function_base import binary_repr
import types
import string as str_
@@ -41,25 +42,6 @@ def _convert_from_string(data):
newdata.append(newrow)
return newdata
-_lkup = {'0':'000',
- '1':'001',
- '2':'010',
- '3':'011',
- '4':'100',
- '5':'101',
- '6':'110',
- '7':'111'}
-
-def _binary(num):
- ostr = oct(num)
- bin = ''
- for ch in ostr[1:]:
- bin += _lkup[ch]
- ind = 0
- while bin[ind] == '0':
- ind += 1
- return bin[ind:]
-
class matrix(N.ndarray):
__array_priority__ = 10.0
@@ -163,7 +145,7 @@ class matrix(N.ndarray):
return result
# binary decomposition to reduce the number of Matrix
# Multiplies for other > 3.
- beta = _binary(other)
+ beta = binary_repr(other)
t = len(beta)
Z,q = x.copy(),0
while beta[t-q-1] == '0':