Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export transpose! and ctranspose! #7814

Merged
merged 2 commits into from
Nov 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ export
cond,
condskeel,
cross,
ctranspose!,
ctranspose,
det,
diag,
Expand Down Expand Up @@ -692,6 +693,7 @@ export
svdvals,
sylvester,
trace,
transpose!,
transpose,
tril!,
tril,
Expand Down
1 change: 1 addition & 0 deletions base/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module SparseMatrix

importall Base
import Base.NonTupleType, Base.float, Base.Order, Base.Sort.Forward
import Base.transpose!, Base.ctranspose!

export SparseMatrixCSC,
blkdiag, dense, diag, diagm, droptol!, dropzeros!, etree, full,
Expand Down
8 changes: 4 additions & 4 deletions base/sparse/csparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ end
# Based on Direct Methods for Sparse Linear Systems, T. A. Davis, SIAM, Philadelphia, Sept. 2006.
# Section 2.5: Transpose
# http://www.cise.ufl.edu/research/sparse/CSparse/
function transpose!{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, T::SparseMatrixCSC{Tv,Ti})
function transpose!{Tv,Ti}(T::SparseMatrixCSC{Tv,Ti}, S::SparseMatrixCSC{Tv,Ti})
(mS, nS) = size(S)
nnzS = nnz(S)
colptr_S = S.colptr
Expand Down Expand Up @@ -162,10 +162,10 @@ function transpose{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti})
nzval_T = Array(Tv, nnzS)

T = SparseMatrixCSC(mT, nT, colptr_T, rowval_T, nzval_T)
return transpose!(S, T)
return transpose!(T, S)
end

function ctranspose!{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti}, T::SparseMatrixCSC{Tv,Ti})
function ctranspose!{Tv,Ti}(T::SparseMatrixCSC{Tv,Ti}, S::SparseMatrixCSC{Tv,Ti})
(mS, nS) = size(S)
nnzS = nnz(S)
colptr_S = S.colptr
Expand Down Expand Up @@ -204,7 +204,7 @@ function ctranspose{Tv,Ti}(S::SparseMatrixCSC{Tv,Ti})
nzval_T = Array(Tv, nnzS)

T = SparseMatrixCSC(mT, nT, colptr_T, rowval_T, nzval_T)
return ctranspose!(S, T)
return ctranspose!(T, S)
end

# Compute the elimination tree of A using triu(A) returning the parent vector.
Expand Down
2 changes: 1 addition & 1 deletion base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2067,8 +2067,8 @@ function sortSparseMatrixCSC!{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}; sortindices::Sym
if sortindices == :doubletranspose
nB, mB = size(A)
B = SparseMatrixCSC(mB, nB, Array(Ti, nB+1), similar(A.rowval), similar(A.nzval))
transpose!(A, B)
transpose!(B, A)
transpose!(A, B)
return A
end

Expand Down
4 changes: 4 additions & 0 deletions doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4313,6 +4313,10 @@ Indexing, Assignment, and Concatenation

Like :func:`permutedims`, except the inverse of the given permutation is applied.

.. function:: permutedims!(dest,src,perm)

Permute the dimensions of array ``src`` and store the result in the array ``dest``. ``perm`` is a vector specifying a permutation of length ``ndims(src)``. The preallocated array ``dest`` should have ``size(dest)=size(src)[perm]`` and is completely overwritten. No in-place permutation is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions.

.. function:: squeeze(A, dims)

Remove the dimensions specified by ``dims`` from array ``A``
Expand Down
8 changes: 8 additions & 0 deletions doc/stdlib/linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,18 @@ Linear algebra functions in Julia are largely implemented by calling functions f

The transposition operator (``.'``).

.. function:: transpose!(dest,src)

Transpose array ``src`` and store the result in the preallocated array ``dest``, which should have a size corresponding to ``(size(src,2),size(src,1))``. No in-place transposition is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions.

.. function:: ctranspose(A)

The conjugate transposition operator (``'``).

.. function:: ctranspose!(dest,src)

Conjugate transpose array ``src`` and store the result in the preallocated array ``dest``, which should have a size corresponding to ``(size(src,2),size(src,1))``. No in-place transposition is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions.

.. function:: eigs(A, [B,]; nev=6, which="LM", tol=0.0, maxiter=1000, sigma=nothing, ritzvec=true, v0=zeros((0,))) -> (d,[v,],nconv,niter,nmult,resid)

``eigs`` computes eigenvalues ``d`` of ``A`` using Lanczos or Arnoldi iterations for real symmetric or general nonsymmetric matrices respectively. If ``B`` is provided, the generalized eigen-problem is solved. The following keyword arguments are supported:
Expand Down