Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Implemented LQ facotrization, questions about API #8

Merged
merged 3 commits into from
Jan 19, 2014

Conversation

dane-unltd
Copy link

I implemented the LQ factorization and the minimum norm solver with calls to the blas engine.
For efficient solutions I think LQ and QR have to be implemented separately. LQ is probably more efficient in general because of the row major storage. The vectors describing the reflections are then actually in a continuous memory block.

I added an ApplyQ method which replaces the *Dense argument with its multiplication by Q (or Q^T). This would probably also be useful for the QR factorization.

@kortschak
Copy link
Member

Thank you for doing this.

Is it necessary to allocate a new matrix in Solve? Does Dtrsm depend on that (it doesn't seem so from the netlib docs)? If it's not necessary to allocate, please don't and say that the routine over-writes - the convenience Solve function already makes allocations for this ad we should allow clients to decide when allocations happen if at all possible.

Do we have pure Go implementations of the BLAS calls that this depends on?

I like that we are using the engine more and want to see these calls in the other decomposition routines, but I don't want to block people from using the library if they are needing a pure Go solution.

@btracey
Copy link
Member

btracey commented Jan 19, 2014

I haven’t had much time to work on the level-2 routines. I did level 1 incrementally, in that I wrote all the tests as I wrote each piece of code. It worked well, as it meant that there wasn’t a massive block of work left at the end that was testing. The level-2 routines are more complicated and have more tests. If we’d like, I don’t think it would be a ton of work to get the level-2 routines in order, but it’s a lot more work to also be sure that they’re correct.

On Jan 18, 2014, at 6:02 PM, kortschak notifications@github.com wrote:

Thank you for doing this.

Is it necessary to allocate a new matrix in Solve? Does Dtrsm depend on that (it doesn't seem so from the netlib docs)? If it's not necessary to allocate, please don't and say that the routine over-writes - the convenience Solve function already makes allocations for this ad we should allow clients to decide when allocations happen if at all possible.

Do we have pure Go implementations of the BLAS calls that this depends on?

I like that we are using the engine more and want to see these calls in the other decomposition routines, but I don't want to block people from using the library if they are needing a pure Go solution.


Reply to this email directly or view it on GitHub.

@kortschak
Copy link
Member

In order to get at least the decomposition routines in we either need to rewrite David's blas calls in place or write at least the calls that he makes - stubbing out the rest with informative panics. I prefer the latter since it will mean we can then rewrite the in-place calculation in the other decomposition routines to make use of blas calls.

@dane-unltd
Copy link
Author

In general we need to allocate here because for A*X=B with A wide X has more rows than B.
The only level 2 routine I use is actually dgemv which is already used in the library and then
the level 3 routine dtrsm which is quite useful for all the factorizations.
There are implementations of dgemv and dgemm in the goblas package (although without explicit tests) I also just added a dtrsm implementation also without test right now, but the case used in the LQ factorization seems to work correctly.

@kortschak
Copy link
Member

That all makes sense. Thanks.

kortschak added a commit that referenced this pull request Jan 19, 2014
Implemented LQ factorization, questions about API
@kortschak kortschak merged commit 1943cdb into gonum:master Jan 19, 2014
@kortschak
Copy link
Member

David, would you flesh out the doc comment for ApplyQ? (you may as well do that on gonum/matrix master directly).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants