-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Small feature request: hvec function #37768
Labels
domain:arrays
[a, r, r, a, y, s]
Comments
That function seems reasonable.
This won't happen, it was decided a while ago that this syntax ( As a sidenote, be careful with the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I know you guys have a vec function that essentially works like this
vec(a::AbstractArray) = reshape(a,length(a))
vec(a::AbstractVector) = a
I find myself having to write an hvec function to create horizontal vectors out of arrays for convenience.
hvec(x::AbstractArray) = reshape(x, 1, :)
Using something like vec(x)' only works if x is numeric. When trying to broadcast an operation to operate on every pair of elements in x and y to form a matrix, it's very helpful to be able to quickly construct a vertical vector for x and a horizontal one for y.
M = some_scalar_operation.( vec(x), hvec(y) )
Do you think it would be reasonable to put hvec into base or make vec(x)' work for vectors of all types?
The text was updated successfully, but these errors were encountered: