---
sympy/core/basic.py | 2 +-
sympy/matrices/matrices.py | 20 ++++++++++----------
sympy/physics/matrices.py | 4 ++--
sympy/physics/paulialgebra.py | 2 +-
sympy/series/gruntz.py | 2 +-
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/sympy/core/basic.py b/sympy/core/basic.py
index 1cd9c2a..5a2de01 100644
--- a/sympy/core/basic.py
+++ b/sympy/core/basic.py
@@ -381,7 +381,7 @@ class Basic(AssumeMeths):
# new-style classes + __getattr__ is *very* slow!
# def __getattr__(self, name):
- # raise 'no way, *all* attribute access will be 2.5x slower'
+ # raise Exception('no way, *all* attribute access will be 2.5x slower')
# here is what we do instead:
for k in AssumeMeths._assume_defined:
diff --git a/sympy/matrices/matrices.py b/sympy/matrices/matrices.py
index ad7c980..1af4e36 100644
--- a/sympy/matrices/matrices.py
+++ b/sympy/matrices/matrices.py
@@ -508,7 +508,7 @@ class Matrix(object):
elif method == "ADJ":
return self.inverse_ADJ()
else:
- raise Exception("Inversion method unrecognized")
+ raise ValueError("Inversion method unrecognized")
def __mathml__(self):
@@ -835,7 +835,7 @@ class Matrix(object):
if pivot == -1 and not iszerofunc(A[i,j]):
pivot = i
if pivot < 0:
- raise "Error: non-invertible matrix passed to
LUdecomposition_Simple()"
+ raise ValueError("Error: non-invertible matrix passed to
LUdecomposition_Simple()")
if pivot != j: # row must be swapped
A.row_swap(pivot,j)
p.append([pivot,j])
@@ -867,7 +867,7 @@ class Matrix(object):
else:
kpivot = kpivot + 1
if kpivot == n+1:
- raise "Matrix is not full rank"
+ raise ValueError("Matrix is not full rank")
else:
swap = U[k, k:]
U[k,k:] = U[kpivot,k:]
@@ -988,7 +988,7 @@ class Matrix(object):
self.lines == 3 and self.cols == 1 ) and \
(b.lines == 1 and b.cols == 3 or \
b.lines == 3 and b.cols == 1):
- raise "Dimensions incorrect for cross product"
+ raise ValueError("Dimensions incorrect for cross product")
else:
return Matrix(1,3,((self[1]*b[2] - self[2]*b[1]),
(self[2]*b[0] - self[0]*b[2]),
@@ -1107,7 +1107,7 @@ class Matrix(object):
elif method == "berkowitz":
return self.berkowitz_det()
else:
- raise Exception("Determinant method unrecognized")
+ raise ValueError("Determinant method unrecognized")
def det_bareis(self):
"""Compute matrix determinant using Bareis' fraction-free
@@ -1312,7 +1312,7 @@ class Matrix(object):
"""
if not self.is_square:
- raise MatrixError
+ raise NonSquareMatrixException()
A, N = self, self.lines
transforms = [0] * (N-1)
@@ -1488,12 +1488,12 @@ def hessian(f, varlist):
m = varlist.cols
assert varlist.lines == 1
else:
- raise "Improper variable list in hessian function"
+ raise ValueError("Improper variable list in hessian function")
assert m > 0
try:
f.diff(varlist[0]) # check differentiability
except AttributeError:
- raise "Function %d is not differentiable" % i
+ raise ValueError("Function %d is not differentiable" % i)
out = zeros(m)
for i in range(m):
for j in range(i,m):
@@ -1511,7 +1511,7 @@ def GramSchmidt(vlist, orthog=False):
for j in range(i):
tmp -= vlist[i].project(out[j])
if tmp == Matrix([[0,0,0]]):
- raise "GramSchmidt: vector set not linearly independent"
+ raise ValueError("GramSchmidt: vector set not linearly
independent")
out.append(tmp)
if orthog:
for i in range(len(out)):
@@ -1763,7 +1763,7 @@ class SMatrix(Matrix):
self.lines == 3 and self.cols == 1 ) and \
(b.lines == 1 and b.cols == 3 or \
b.lines == 3 and b.cols == 1):
- raise "Dimensions incorrect for cross product"
+ raise ValueError("Dimensions incorrect for cross product")
else:
return SMatrix(1,3,((self[1]*b[2] - self[2]*b[1]),
(self[2]*b[0] - self[0]*b[2]),
diff --git a/sympy/physics/matrices.py b/sympy/physics/matrices.py
index d0b864f..69f05db 100644
--- a/sympy/physics/matrices.py
+++ b/sympy/physics/matrices.py
@@ -23,7 +23,7 @@ def msigma(i):
(0, -1)
) )
else:
- raise "Invalid Pauli index"
+ raise IndexError("Invalid Pauli index")
return Matrix(mat)
def mgamma(mu,lower=False):
@@ -43,7 +43,7 @@ def mgamma(mu,lower=False):
"""
if not mu in [0,1,2,3,5]:
- raise "Invalid Dirac index"
+ raise IndexError("Invalid Dirac index")
if mu == 0:
mat = (
(1,0,0,0),
diff --git a/sympy/physics/paulialgebra.py b/sympy/physics/paulialgebra.py
index b4ca01b..ba53a92 100644
--- a/sympy/physics/paulialgebra.py
+++ b/sympy/physics/paulialgebra.py
@@ -43,7 +43,7 @@ class Pauli(Symbol):
def __new__(cls, i):
if not i in [1,2,3]:
- raise "Invalid Pauli index"
+ raise IndexError("Invalid Pauli index")
obj = Symbol.__new__(cls, "sigma%d"%i, commutative=False)
obj.i=i
return obj
diff --git a/sympy/series/gruntz.py b/sympy/series/gruntz.py
index 9a3503f..bf5d82c 100644
--- a/sympy/series/gruntz.py
+++ b/sympy/series/gruntz.py
@@ -321,7 +321,7 @@ def sign(e, x):
return sign(e.args[0] -1, x)
elif e.is_Add:
return sign(limitinf(e, x), x)
- raise "cannot determine the sign of %s"%e
+ raise ValueError("Cannot determine the sign of %s" % e)
@debug
def limitinf(e, x):
--
1.5.6.5
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-patches" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sympy-patches?hl=en
-~----------~----~----~----~------~----~------~--~---