Plan for special array types (RowVector, Fill, Identity)?

283 views
Skip to first unread message

Sheehan Olver

unread,
Sep 28, 2016, 10:14:51 PM9/28/16
to julia-dev

Is there a plan to eventually add special types for any of the following:

1) RowVector: represent a row vector, with the property that RowVector([1,2,3])*[1,2,3] = 14  
2) Fill(x,n,m): represent an n x m matrix of all entries equal to x in O(1) memory. 
3) Identity(T,n,m): represent an n x m identity matrix in O(1) memory.  (Probably better as UniformScalingMatrix to support constants other than 1)

I think I will need these to handle matrices of operators in ApproxFun efficiently, but wanted to know whether to hold off for 0.6 or start rolling this on my own.  One option would be to put together a package with these special types, say JuliaMatrices/StructuredMatrices.jl, which could eventually be merged into Base.

Andy Ferris

unread,
Sep 29, 2016, 12:28:19 AM9/29/16
to julia-dev
Of course, there is the "taking vector transposes seriously" issue for the RowVector. 

Fill and Identity (with size) seem like good additions, but there's no harm in adding such things outside of Base unless they might be good replacement return types for some functions already in Base (I understand LinAlg might even be spun off to a "standard library" package with a more compact "Base" module),

David P. Sanders

unread,
Sep 30, 2016, 1:51:55 PM9/30/16
to julia-dev


El jueves, 29 de septiembre de 2016, 4:14:51 (UTC+2), Sheehan Olver escribió:

Is there a plan to eventually add special types for any of the following:

1) RowVector: represent a row vector, with the property that RowVector([1,2,3])*[1,2,3] = 14  
2) Fill(x,n,m): represent an n x m matrix of all entries equal to x in O(1) memory. 
3) Identity(T,n,m): represent an n x m identity matrix in O(1) memory.  (Probably better as UniformScalingMatrix to support constants other than 1)

UniformScaling already exists (with that name).
Could you explain the purpose of Fill? 

Tim Holy

unread,
Sep 30, 2016, 2:29:03 PM9/30/16
to Julia Dev
We already have (unexported) PermutedDimsArray, so your RowVector already exists.

Best,
--Tim

Andy Ferris

unread,
Sep 30, 2016, 5:15:13 PM9/30/16
to julia-dev
Does a PermutedDimsArray-style RowVector really behave like a RowVector? Specifically product with a normal vector to a scalar?

Tim Holy

unread,
Sep 30, 2016, 5:39:10 PM9/30/16
to Julia Dev
It behaves like "regular" 1xn arrays, meaning the result of that multiplication will be a 1x1 Array, not a scalar.

Sheehan Olver

unread,
Sep 30, 2016, 7:17:29 PM9/30/16
to julia-dev
UniformScaling doesn't include the dimension of the matrix.

Andreas Noack

unread,
Oct 3, 2016, 11:21:09 AM10/3/16
to juli...@googlegroups.com
Can you give an example of where you need the dimension of the UniformScaling?
Reply all
Reply to author
Forward
0 new messages