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

change output types in ExponentialMap #304

Merged
merged 1 commit into from
Mar 27, 2018
Merged
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
14 changes: 7 additions & 7 deletions src/ExponentialMap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,41 @@ function get_column(spmexp::SparseMatrixExp{N}, j::Int)::Vector{N} where {N}
end

function get_columns(spmexp::SparseMatrixExp{N},
J::AbstractArray)::SparseMatrixCSC{N, Int} where {N}
J::AbstractArray)::Matrix{N} where {N}
n = size(spmexp, 1)
aux = zeros(N, n)
ans = spzeros(N, n, length(J))
ans = zeros(N, n, length(J))
count = 1
one_N = one(N)
zero_N = zero(N)
@inbounds for j in J
aux[j] = one_N
ans[:, count] = sparse(expmv(one_N, spmexp.M, aux))
ans[:, count] = expmv(one_N, spmexp.M, aux)
aux[j] = zero_N
count += 1
end
return ans
end

function get_row(spmexp::SparseMatrixExp{N}, i::Int)::Matrix{N} where {N}
function get_row(spmexp::SparseMatrixExp{N}, i::Int)::RowVector{N} where {N}
n = size(spmexp, 1)
aux = zeros(N, n)
aux[i] = one(N)
return transpose(expmv(one(N), spmexp.M.', aux))
end

function get_rows(spmexp::SparseMatrixExp{N},
I::AbstractArray{Int})::SparseMatrixCSC{N, Int} where {N}
I::AbstractArray{Int})::Matrix{N} where {N}
n = size(spmexp, 1)
aux = zeros(N, n)
ans = spzeros(N, length(I), n)
ans = zeros(N, length(I), n)
Mtranspose = spmexp.M.'
count = 1
one_N = one(N)
zero_N = zero(N)
@inbounds for i in I
aux[i] = one_N
ans[count, :] = sparse(expmv(one_N, Mtranspose, aux))
ans[count, :] = expmv(one_N, Mtranspose, aux)
aux[i] = zero_N
count += 1
end
Expand Down