@@ -3,6 +3,17 @@ using ParallelDataTransfer
33using ProgressMeter
44using SharedArrays
55
6+ """
7+ basis_size(model)
8+
9+ Return the length of the basis, assuming that `model` is a linear model, or
10+ when interpreted as a linear model. The returned integer must match the
11+ size of the feature matrix that will be assembled for the given model.
12+
13+ It defaults to `Base.length` but can be overloaded if needed.
14+ """
15+ basis_size (model) = Base. length (model)
16+
617struct DataPacket{T <: AbstractData }
718 rows:: UnitRange
819 data:: T
@@ -23,8 +34,8 @@ function assemble(data::AbstractVector{<:AbstractData}, basis)
2334 packets = DataPacket .(rows, data)
2435 sort! (packets, by = length, rev = true )
2536 (nprocs () > 1 ) && sendto (workers (), basis = basis)
26- @info " - Creating feature matrix with size ($(rows[end ][end ]) , $(length (basis)) )."
27- A = SharedArray (zeros (rows[end ][end ], length (basis)))
37+ @info " - Creating feature matrix with size ($(rows[end ][end ]) , $(basis_size (basis)) )."
38+ A = SharedArray (zeros (rows[end ][end ], basis_size (basis)))
2839 Y = SharedArray (zeros (size (A, 1 )))
2940 @info " - Beginning assembly with processor count: $(nprocs ()) ."
3041 @showprogress pmap (packets) do p
0 commit comments