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

add sparse constructors for special matrices #10843

Merged

Conversation

bnels
Copy link
Contributor

@bnels bnels commented Apr 16, 2015

Added sparse constructors for SymTridiagonal, Tridiagonal, and Bidiagonal matrices
Added tests to sparse test file
Tests work.

@@ -309,6 +309,28 @@ sparse(I,J,V::AbstractVector{Bool},m,n) = sparse(I, J, V, Int(m), Int(n), OrFun(

sparse(I,J,v::Number,m,n,combine::Union(Function,Func)) = sparse(I, J, fill(v,length(I)), Int(m), Int(n), combine)

function sparse(T::SymTridiagonal)
m = length(T.dv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use spaces, not tabs

@bnels
Copy link
Contributor Author

bnels commented Apr 16, 2015

Fixes issue #10837

@ViralBShah ViralBShah added the sparse Sparse arrays label Apr 16, 2015
ViralBShah added a commit that referenced this pull request Apr 16, 2015
…ial_matrices

add sparse constructors for special matrices
@ViralBShah ViralBShah merged commit 2a3a217 into JuliaLang:master Apr 16, 2015
@bnels bnels deleted the add_sparse_constructors_for_special_matrices branch April 16, 2015 06:05
@andreasnoack
Copy link
Member

@bnels Thanks

@tkelman
Copy link
Contributor

tkelman commented Apr 16, 2015

This should really not use the sparse constructor if it doesn't have to, it would be considerably faster to construct colptr, rowval, and nzval in CSC sorted order directly since that's straightforward to do for these cases.

@ViralBShah
Copy link
Member

That will certainly be faster.

@ViralBShah
Copy link
Member

It may be useful to have some helper functions to help create/modify CSC data structures that do some error checking and such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sparse Sparse arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants