Permalink
Browse files

Make two-argument linspace() MATLAB-compatible.

The two-argument linspace() using a stride of 1 doesn't seem terribly useful, and doesn't include both endpoints if either is a non-integral float, so it's not semantically the same as the three-argument form. The patch also replaces the only two-arg linspace() in the standard library so its implementation is unchanged.
  • Loading branch information...
pao committed Mar 4, 2012
1 parent 827847d commit 2b23004eed17ffa914215b8b8a085cdd03ce7a41
Showing with 2 additions and 2 deletions.
  1. +1 −1 jl/array.jl
  2. +1 −1 jl/linalg_lapack.jl
View
@@ -145,7 +145,7 @@ function linspace(start::Real, stop::Real, n::Integer)
a
end
-linspace(start::Real, stop::Real) = [ i | i=start:stop ]
+linspace(start::Real, stop::Real) = linspace(start, stop, 100)
## Conversions ##
View
@@ -102,7 +102,7 @@ function lu!{T<:Union(Float32,Float64,Complex64,Complex128)}(A::StridedMatrix{T}
info = _jl_lapack_getrf(m, n, A, stride(A,2), ipiv)
if info > 0; error("matrix is singular"); end
- P = linspace(1, m)
+ P = [i | i = 1:m]
for i=1:min(m,n)
t = P[i]
P[i] = P[ipiv[i]]

0 comments on commit 2b23004

Please sign in to comment.