View for hcat(A,b)?

Hi,
some algs like Gaussian elimination or reduced echelon form work on the structure Ab = [A, b].
Is there a way to pass A and b, then work on Ab without allocations, a kind of view()?

Are you looking for an allocation free hcat?
If yes, have a look at LazyArrays.jl:
https://github.com/JuliaArrays/LazyArrays.jl#concatenation

2 Likes

good find - thx!

Note that this is more common in hand calculation than in serious numerics. In practical numerical algorithms, you can generally analyze A first and then b subsequently.

For example, the analogue of Gaussian elimination on [A b] is to do LU factorization of A and then apply the factorization to b with triangular solves. (Julia provides easy, efficient methods for this.) Similarly for other factorization. (Reduced echelon form is not really used in practical numerics.)

1 Like

No doubt for usual numerical work.

My special use case is code generation which actually resembles hand calculation.

Similar for the reduced row echelon form, used to convert MNA matrices from circuit simulation to state-space form.

Since GE does not explicitly calculate and store L, it is faster than LU for a single RHS.
I was still looking for an implementation of GE which works on A, b instead of [A b].
Found it here: https://ww2.odu.edu/~agodunov/computing/programs/book2/Ch06/Gauss_2.f90