Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Conversation

@btracey
Copy link
Member

@btracey btracey commented Nov 7, 2015

No description provided.

@btracey
Copy link
Member Author

btracey commented Nov 7, 2015

This is not ready for submission, but pretty close to get the right idea.

Rather than the loops at the bottom just checking for infinite loops (which I had for a while), I'd like to turn that into a test of the behavior.

The dlasq2 tests having a tolerance of 1e-6 I think is because of single precision issues I couldn't figure out. Fortran wasn't giving the same answer depending if I generated the numbers randomly vs. actually giving it the number.

There are a lot of ugly parts of the code. The gotos are highly nontrivial. At least for now I'd like to leave all the weird loop index stuff. If we discover more bugs down the line it's way easier to debug this way than if the code is idiomatic go.

I also have all the debugging scripts. I assume we don't want them in the tree, but they'll be very useful if we find bugs in the future.

The coverage of paths on this is decent. It seems like the unused paths come in for underflow.

@btracey
Copy link
Member Author

btracey commented Nov 7, 2015

My reading of the matrices is an is the construction of triDi. However, this constructed matrix is not symmetric (let alone positive definite). Am I interpreting something wrong? Does "The tridiagonal is LU or, if you prefer, the symmetric tridiagonal to which it is similar." mean one needs to transform LU?

@kortschak
Copy link
Member

I'm a little confused by this PR. The additions, I'll take a look at tomorrow, but I don't understand what's happening with Dorglq and Dorgqr in cgo.

I think that we may want the debugging code available - I was actually thinking of adding a cgo/internal/fortran to add utilities to help with direct use of fortran calls that are made available via the CL Seb proposed. This would fit in the same space.

BTW I edited your comment above so the * does not get interpretted as italic. That was very confusing.

@btracey
Copy link
Member Author

btracey commented Nov 7, 2015

I am also confused by those changes. Will fix.

I can add the debugging code

@btracey
Copy link
Member Author

btracey commented Nov 9, 2015

Part of the problem was my reading of the documentation for U. However, that doesn't solve the problem. Opened Stack Overflow question where maybe someone will see it. http://stackoverflow.com/questions/33614240/lapack-dlasq2-matrix-input-format
Do you happen to understand @xianyi ?

My debugging code is all strictly Fortran with some print statements used to translate between fortran and go inputs. Should I include that code as a subfolder of lapack/native, lapack/testlapack, or somewhere else?

@btracey
Copy link
Member Author

btracey commented Nov 14, 2015

@kortschak I don't understand. If I do

git diff origin/master:native/dorglq.go native/dorglq.go

There is no difference shown. Is this a bug with the github interface, or do I not know how to use git properly?

@kortschak
Copy link
Member

Neither. There is no difference in native/dorglq.go between those two branches. Though, the command can be more easily said as git diff origin/master adddlasq native/dorgql.go assuming you want diff against your local adddlasq branch.

@btracey
Copy link
Member Author

btracey commented Nov 14, 2015

Oh, I see, it's in the c interface. Sorry.

I'll check that, and I'll clean up the Fortran code to remove a lot of the unnecessary print statements and comments. Otherwise I think the Go code is good enough to go. Working up to the full SVD will allow us to have better tests of the full integrated system.

@btracey
Copy link
Member Author

btracey commented Nov 14, 2015

Okay, cleaned up the Fortran code.

PTAL

I know there's still a bunch of ugly code there, but I'd prefer to leave it as is until we have integrated SVD tests if that's okay.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this something that can be executed, or at least sourced - prefix this line with #.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@kortschak
Copy link
Member

It seems to me that internal/dlasqtest is more meaningfully named testdata/dlasqtest or something else.

@kortschak
Copy link
Member

Are the whitespace diffs between the fortran code in dlasqtest and OpenBLAS/lapack-netlib/SRC there intentionally or residually? Just curious.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this still be here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. None of the random test cases I generated ever reached dlasq6. My error rate was low in translation, but not non-zero (and sometimes in tricky ways). Part of me wants a trigger in dlasq6.go so when a case is found we can debug it.

@kortschak
Copy link
Member

I can't comment on testlapack/dlasq2-5 because of github limits presumably. So...

dlasq2.go L26 - delete commented out interface

dlasq2.go L638 - do these need to stay?

dlasq3.go L2643 - use t.Error or show values

dlasq3.go L2646-2697 - use idiomatic test failure phrasing

dlasq4.go L24-54 - move these out to a fortran helper file. If you make a fortran64 type with a String method the code for string representation of float64 will read better.

All - add copyright header.

@kortschak
Copy link
Member

What is native/c.out?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here dmin is actually an out only, so drop it from the input parameter list, also dmin1, dmin2, dn, dnm1 and dnm2.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that simple. You'll notice that the first return happens, and that in the LAPACK function none of the values are initialized. Well... since Fortran passes by reference their value is preserved through the call. It seems like they are actually outputs here (the tests don't fail if I add it), but I ran into these bugs in Dlasq4. I added a TODO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's horrible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is. Not a fun bug to find. I fixed the first one, found a second bug along those lines, and then just decided not to believe the documentation and make the function behave like the Fortran one. I probably overreacted, but we can fix later.

@kortschak
Copy link
Member

OK finished first pass.

@vladimir-ch Would you please take a look as well. There is a lot here and even a low review error rate (which I don't guarantee) is troubling.

@vladimir-ch
Copy link
Member

There is a binary file internal/testdata/dlasqtest/dlasq1test

native/dlasq5.go Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"listed inputs"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I meant outputs, but I improved the documentation.

@kortschak
Copy link
Member

I think that with some of the issues you've found here due to pass through, we should not allow unnamed returns in native. There are a few cases elsewhere that do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return info

@btracey btracey mentioned this pull request Nov 20, 2015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will be doing something wrong but I get a segfault at dlasq3.f:246.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.... how did that happen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it's because there isn't any data in testdlasq3 at the moment.

@vladimir-ch
Copy link
Member

Finally had some time for the first time in two weeks to take a superficial look at this. I'm not sure if my comments are helpful and if I will be able to look into this deeper.

@btracey
Copy link
Member Author

btracey commented Dec 4, 2015

Thanks for the commentary.

Onward to routines we can write real tests for!

btracey added a commit that referenced this pull request Dec 4, 2015
Adddlasq routines and tests
@btracey btracey merged commit b9f6b83 into master Dec 4, 2015
@vladimir-ch vladimir-ch deleted the adddlasq branch May 31, 2016 21:39
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.

4 participants