@@ -1672,7 +1672,7 @@ powm(A::LowerTriangular, p::Real) = powm(A.', p::Real).'
1672
1672
# Based on the code available at http://eprints.ma.man.ac.uk/1851/02/logm.zip,
1673
1673
# Copyright (c) 2011, Awad H. Al-Mohy and Nicholas J. Higham
1674
1674
# Julia version relicensed with permission from original authors
1675
- function logm {T<:Union{Float32, Float64,Complex{Float32} ,Complex{Float64}}} (A0:: UpperTriangular{T} )
1675
+ function logm {T<:Union{Float64,Complex{Float64}}} (A0:: UpperTriangular{T} )
1676
1676
theta = [1.586970738772063e-005 ,
1677
1677
2.313807884242979e-003 ,
1678
1678
1.938179313533253e-002 ,
@@ -1718,7 +1718,11 @@ function logm{T<:Union{Float32,Float64,Complex{Float32},Complex{Float64}}}(A0::U
1718
1718
scale! (2 ^ s,Y. data)
1719
1719
1720
1720
# Compute accurate diagonal and superdiagonal of log(A)
1721
+ <<<<<< < 617 b2a62223cd7cd0883a248a124b313bcf9d8b4
1721
1722
for k = 1 : n- 1
1723
+ ====== =
1724
+ @inbounds for k = 1 : n- 1
1725
+ >>>>>> > Make the algorithm for real powers of a matrix robust
1722
1726
Ak = complex (A0[k,k])
1723
1727
Akp1 = complex (A0[k+ 1 ,k+ 1 ])
1724
1728
logAk = log (Ak)
@@ -1749,7 +1753,11 @@ logm(A::LowerTriangular) = logm(A.').'
1749
1753
# Numer. Algorithms, 59, (2012), 393–402.
1750
1754
function sqrt_diag! (A0:: UpperTriangular , A:: UpperTriangular , s)
1751
1755
n = checksquare (A0)
1756
+ <<<<<< < 617 b2a62223cd7cd0883a248a124b313bcf9d8b4
1752
1757
for i = 1 : n
1758
+ ====== =
1759
+ @inbounds for i = 1 : n
1760
+ >>>>>> > Make the algorithm for real powers of a matrix robust
1753
1761
a = complex (A0[i,i])
1754
1762
if s == 0
1755
1763
A[i,i] = a - 1
@@ -1806,25 +1814,31 @@ function invsquaring(A0::UpperTriangular, theta)
1806
1814
d2 = sqrt (norm (AmI^ 2 , 1 ))
1807
1815
d3 = cbrt (norm (AmI^ 3 , 1 ))
1808
1816
alpha2 = max (d2, d3)
1809
- foundm = false
1810
1817
if alpha2 <= theta[2 ]
1811
1818
m = alpha2<= theta[1 ]?1 : 2
1812
- foundm = true
1813
- end
1814
-
1815
- while ~ foundm
1816
- more = false
1817
- if s > s0
1818
- d3 = cbrt (norm (AmI^ 3 , 1 ))
1819
- end
1820
- d4 = norm (AmI^ 4 , 1 )^ (1 / 4 )
1821
- alpha3 = max (d3, d4)
1822
- if alpha3 <= theta[tmax]
1823
- for j = 3 : tmax
1824
- if alpha3 <= theta[j]
1819
+ else
1820
+ while true
1821
+ more = false
1822
+ if s > s0
1823
+ d3 = cbrt (norm (AmI^ 3 , 1 ))
1824
+ end
1825
+ d4 = norm (AmI^ 4 , 1 )^ (1 / 4 )
1826
+ alpha3 = max (d3, d4)
1827
+ if alpha3 <= theta[tmax]
1828
+ for j = 3 : tmax
1829
+ if alpha3 <= theta[j]
1830
+ break
1831
+ end
1832
+ end
1833
+ if j <= 6
1834
+ m = j
1825
1835
break
1836
+ elseif alpha3 / 2 <= theta[5 ] && p < 2
1837
+ more = true
1838
+ p = p + 1
1826
1839
end
1827
1840
end
1841
+ <<<<<< < 617 b2a62223cd7cd0883a248a124b313bcf9d8b4
1828
1842
if j <= 6
1829
1843
m = j
1830
1844
foundm = true
@@ -1845,21 +1859,45 @@ function invsquaring(A0::UpperTriangular, theta)
1845
1859
if eta <= theta[j]
1846
1860
m = j
1847
1861
break
1862
+ ====== =
1863
+
1864
+ if ~ more
1865
+ d5 = norm (AmI^ 5 , 1 )^ (1 / 5 )
1866
+ alpha4 = max (d4, d5)
1867
+ eta = min (alpha3, alpha4)
1868
+ if eta <= theta[tmax]
1869
+ j = 0
1870
+ for j = 6 : tmax
1871
+ if eta <= theta[j]
1872
+ m = j
1873
+ break
1874
+ end
1875
+ >>>>>> > Make the algorithm for real powers of a matrix robust
1848
1876
end
1877
+ break
1849
1878
end
1879
+ <<<<<< < 617 b2a62223cd7cd0883a248a124b313bcf9d8b4
1850
1880
foundm = true
1851
1881
break
1882
+ ====== =
1883
+ >>>>>> > Make the algorithm for real powers of a matrix robust
1852
1884
end
1853
- end
1854
1885
1886
+ <<<<<< < 617 b2a62223cd7cd0883a248a124b313bcf9d8b4
1855
1887
if s == maxsqrt
1856
1888
m = tmax
1857
1889
foundm = true
1858
1890
break
1891
+ ====== =
1892
+ if s == maxsqrt
1893
+ m = tmax
1894
+ break
1895
+ end
1896
+ A = sqrtm (A)
1897
+ AmI = A - I
1898
+ s = s + 1
1899
+ >>>>>> > Make the algorithm for real powers of a matrix robust
1859
1900
end
1860
- A = sqrtm (A)
1861
- AmI = A - I
1862
- s = s + 1
1863
1901
end
1864
1902
1865
1903
# Compute accurate superdiagonal of T
0 commit comments