|
53 | 53 | # Type definitions #
|
54 | 54 | ####################
|
55 | 55 |
|
56 |
| -# The three core data types for CHOLMOD: Dense, Sparse and Factor. CHOLMOD manages the memory, so the Julia versions only wrap a pointer to a struct. Therefore finalizers should be registret each time a pointer is returned from CHOLMOD. |
| 56 | +# The three core data types for CHOLMOD: Dense, Sparse and Factor. CHOLMOD |
| 57 | +# manages the memory, so the Julia versions only wrap a pointer to a struct. |
| 58 | +# Therefore finalizers should be registret each time a pointer is returned from |
| 59 | +# CHOLMOD. |
57 | 60 |
|
58 | 61 | # Dense
|
59 | 62 | type C_Dense{T<:VTypes}
|
@@ -89,7 +92,9 @@ type C_Sparse{Tv<:VTypes,Ti<:ITypes}
|
89 | 92 | packed::Cint
|
90 | 93 | end
|
91 | 94 |
|
92 |
| -# Corresponds to the exact definition of cholmod_sparse_struct in the library. Useful when reading matrices of unknown type from files as in cholmod_read_sparse |
| 95 | +# Corresponds to the exact definition of cholmod_sparse_struct in the library. |
| 96 | +# Useful when reading matrices of unknown type from files as in |
| 97 | +# cholmod_read_sparse |
93 | 98 | type C_SparseVoid
|
94 | 99 | nrow::Csize_t
|
95 | 100 | ncol::Csize_t
|
|
187 | 192 | #################
|
188 | 193 |
|
189 | 194 | # Dense wrappers
|
190 |
| -## Note! Integer type defaults to Cint, but this is actually not necessary, but making this a choice would require another type parameter in the Dense type |
| 195 | +## Note! Integer type defaults to Cint, but this is actually not necessary, but |
| 196 | +## making this a choice would require another type parameter in the Dense type |
191 | 197 |
|
192 | 198 | ### cholmod_core_h ###
|
193 | 199 | function allocate_dense(nrow::Integer, ncol::Integer, d::Integer, ::Type{Float64})
|
@@ -558,7 +564,8 @@ for Ti in IndexTypes
|
558 | 564 | end
|
559 | 565 |
|
560 | 566 | # cholmod_cholesky.h
|
561 |
| - # For analyze, factorize and factorize_p, the Common argument must be supplied in order to control if the factorization is LLt or LDLt |
| 567 | + # For analyze, factorize and factorize_p, the Common argument must be |
| 568 | + # supplied in order to control if the factorization is LLt or LDLt |
562 | 569 | function analyze{Tv<:VTypes}(A::Sparse{Tv,$Ti}, cmmn::Vector{UInt8})
|
563 | 570 | f = Factor(ccall((@cholmod_name "analyze" $Ti
|
564 | 571 | ,:libcholmod), Ptr{C_Factor{Tv,$Ti}},
|
@@ -730,7 +737,8 @@ function Sparse(p::Ptr{C_SparseVoid})
|
730 | 737 |
|
731 | 738 | end
|
732 | 739 |
|
733 |
| -Sparse(A::Dense) = dense_to_sparse(A, Cint) # default is Cint which is probably sufficient when converted from dense matrix |
| 740 | +# default is Cint which is probably sufficient when converted from dense matrix |
| 741 | +Sparse(A::Dense) = dense_to_sparse(A, Cint) |
734 | 742 | Sparse(L::Factor) = factor_to_sparse!(copy(L))
|
735 | 743 | function Sparse(filename::ASCIIString)
|
736 | 744 | f = open(filename)
|
@@ -776,7 +784,8 @@ function full(A::Sparse)
|
776 | 784 | end
|
777 | 785 | full(A::Dense) = convert(Matrix, A)
|
778 | 786 |
|
779 |
| -# Calculate the offset into the stype field of the cholmod_sparse_struct and change the value |
| 787 | +# Calculate the offset into the stype field of the cholmod_sparse_struct and |
| 788 | +# change the value |
780 | 789 | function change_stype!(A::Sparse, i::Integer)
|
781 | 790 | offset = fieldoffsets(C_Sparse)[names(C_Sparse) .== :stype][1]
|
782 | 791 | unsafe_store!(convert(Ptr{Cint}, A.p), i, div(offset, 4) + 1)
|
|
0 commit comments