Skip to content
This repository was archived by the owner on Apr 26, 2021. It is now read-only.

Commit ced43d1

Browse files
committed
improve ldiv method, add LAPACK license text
1 parent 5856330 commit ced43d1

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

LICENSE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,37 @@ The GenericSVD.jl package is licensed under the MIT "Expat" License:
2020
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
2121
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2222
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
24+
`svdvals2x2` is a Julia translation of the LAPACK DLAS2 function, which is made available under the LAPACK license:
25+
26+
> Copyright (c) 1992-2008 The University of Tennessee. All rights reserved.
27+
>
28+
> Additional copyrights may follow
29+
>
30+
> Redistribution and use in source and binary forms, with or without
31+
> modification, are permitted provided that the following conditions are
32+
> met:
33+
>
34+
> - Redistributions of source code must retain the above copyright
35+
> notice, this list of conditions and the following disclaimer.
36+
>
37+
> - Redistributions in binary form must reproduce the above copyright
38+
> notice, this list of conditions and the following disclaimer listed
39+
> in this license in the documentation and/or other materials
40+
> provided with the distribution.
41+
>
42+
> - Neither the name of the copyright holders nor the names of its
43+
> contributors may be used to endorse or promote products derived from
44+
> this software without specific prior written permission.
45+
>
46+
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47+
> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48+
> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49+
> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50+
> OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51+
> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52+
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53+
> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54+
> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55+
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56+
> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

src/utils.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ A_mul_B!(G::LinAlg.Givens, ::Void) = nothing
2727
A_mul_Bc!(::Void, G::LinAlg.Givens) = nothing
2828

2929
function A_ldiv_B!{Ta,Tb}(A::SVD{Ta}, B::StridedVecOrMat{Tb})
30-
T = promote_type(Ta,Tb)
31-
k = length(find(A.S .> eps(real(T))*maximum(A.S)))
30+
k = searchsortedlast(A.S, eps(real(Ta))*A.S[1], rev=true)
3231
A.Vt[1:k,:]' * (A.S[1:k] .\ (A.U[:,1:k]' * B))
3332
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bS = svdfact(bX)
2222

2323

2424
bY = big(randn(n))
25-
@test qrfact(bX,Val{false}) \ bY bS \ bY
25+
@test isapprox(qrfact(bX,Val{false}) \ bY, bS \ bY, rtol=1e3*eps(BigFloat))
2626

2727
X = randn(n,m)+im*randn(n,m)
2828
bX = big(X)

0 commit comments

Comments
 (0)