ruby-lapack 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,10 +64,6 @@ ARGS = {
64
64
  "spstf2" => {
65
65
  "work" => {:intent => "input", :type => "real"}
66
66
  },
67
- "slarrf" => {
68
- "clgapl" => {:intent => "input", :type => "real"},
69
- "clgapr" => {:intent => "input", :type => "real"},
70
- },
71
67
  "cheequb" => {
72
68
  "uplo" => {:intent => "input", :type => "char"},
73
69
  "work" => {:intent => "input", :type => "complex"}
@@ -918,7 +914,7 @@ SUBSTS["dlansp"] = {"lwork" => '(lsame_(&norm,"I") || lsame_(&norm,"1") || lsame
918
914
  %w(zlange zlanhs).each{|n| SUBSTS[n] = {"lwork" => 'lsame_(&norm,"I") ? n : 0'}}
919
915
  %w(spprfs dpprfs cpprfs zpprfs chpsv zhpsv sspsv dspsv cspsv zspsv stprfs dtprfs ctprfs ztprfs).each{|n| SUBSTS[n] = {"n" => 'ldb'}}
920
916
  SUBSTS["slasd0"] = {"m" => "sqre == 0 ? n : sqre == 1 ? n+1 : 0", "ldu" => "n", "ldvt" => "m"}
921
- SUBSTS["dlasd0"] = {"m" => "sqre == 0 ? n : sqre == 1 ? n+1 : 0", "ldu" => "n", "ldu" => "n", "ldvt" => "n"}
917
+ SUBSTS["dlasd0"] = {"m" => "sqre == 0 ? n : sqre == 1 ? n+1 : 0", "ldu" => "n", "ldvt" => "n"}
922
918
  SUBSTS["slasd3"] = {"ldu2" => "n", "n" => "nl + nr + 1", "ldvt2" => "n", "m" => "n+sqre"}
923
919
  SUBSTS["dlasd3"] = {"ldu2" => "n", "n" => "nl + nr + 1", "ldvt2" => "n", "m" => "n + sqre"}
924
920
  %w(slasda dlasda).each{|n| SUBSTS[n] = {"m" => "sqre == 0 ? n : sqre == 1 ? n+1 : 0", "ldu" => "n"}}
@@ -1178,7 +1174,7 @@ def read_file(fname)
1178
1174
  return {:subr => subr, :purpose => purpose, :args => args, :help => help}
1179
1175
  end
1180
1176
 
1181
- def parse_file(fname)
1177
+ def parse_file(fname, debug)
1182
1178
  hash = read_file(fname)
1183
1179
  subr = hash[:subr]
1184
1180
  purpose = hash[:purpose]
@@ -1219,7 +1215,7 @@ def parse_file(fname)
1219
1215
  raise "arg_names is nil #{fname}"
1220
1216
  end
1221
1217
 
1222
- if @@debug
1218
+ if debug
1223
1219
  p sub_name
1224
1220
  p arg_names
1225
1221
  end
@@ -1289,7 +1285,7 @@ def parse_file(fname)
1289
1285
  end
1290
1286
  }
1291
1287
 
1292
- if @debug
1288
+ if debug
1293
1289
  pp ary
1294
1290
  end
1295
1291
 
@@ -1437,7 +1433,7 @@ def parse_file(fname)
1437
1433
  str.sub!(/(just )?as declared in the (in the )?calling (subroutine|procedure)\./,"")
1438
1434
  str.strip
1439
1435
  if /^([^;]+); if ([^,]+), ([^;]+); if ([^,]+), (.+)$/ =~ str
1440
- if @@debug
1436
+ if debug
1441
1437
  p 100
1442
1438
  end
1443
1439
  v = get_vname($1)
@@ -1447,7 +1443,7 @@ def parse_file(fname)
1447
1443
  v1 = get_vname($5)
1448
1444
  str = "#{cond0} ? #{v0} : #{cond1} ? #{v1} : #{v}"
1449
1445
  elsif /^If ([^\,]+)\,\s+([^;]+); if ([^\,]+)\,\s+(.*)$/ =~ str || /^If ([^\,]+)\,\s+([^\.]+)\. If ([^\,]+)\,\s+(.*)$/ =~ str
1450
- if @@debug
1446
+ if debug
1451
1447
  p 110
1452
1448
  end
1453
1449
  v0 = get_vname($1)
@@ -1456,7 +1452,7 @@ def parse_file(fname)
1456
1452
  cond1 = get_cond($4)
1457
1453
  str = "#{cond0} ? #{v0} : #{cond1} ? #{v1} : 0"
1458
1454
  elsif /^([^\,]+)\, and if ([^\,]+)\, (?:then )?(.*)$/ =~ str || /^([^;]+); if ([^\,]+)\, (?:then )?(.*)$/ =~ str
1459
- if @@debug
1455
+ if debug
1460
1456
  p 120
1461
1457
  end
1462
1458
  v0 = get_vname($1)
@@ -1464,7 +1460,7 @@ def parse_file(fname)
1464
1460
  v1 = get_vname($3)
1465
1461
  str = "#{cond1} ? #{v1} : #{v0}"
1466
1462
  elsif /^(.+?) if ([^;]+); (.+?) otherwise$/ =~ str
1467
- if @@debug
1463
+ if debug
1468
1464
  p 130
1469
1465
  end
1470
1466
  v0 = get_vname($1)
@@ -1472,7 +1468,7 @@ def parse_file(fname)
1472
1468
  v = get_vname($3)
1473
1469
  str = "#{cond0} ? #{v0} : #{v}"
1474
1470
  elsif /^If ([^,]+), then\s+(.+?)\.\s+In any case, (.+)$/ =~ str
1475
- if @@debug
1471
+ if debug
1476
1472
  p 140
1477
1473
  end
1478
1474
  cond0 = get_cond($1)
@@ -1480,7 +1476,7 @@ def parse_file(fname)
1480
1476
  v = get_vname($3)
1481
1477
  str = "#{cond0} ? #{v0} : #{v}"
1482
1478
  elsif /^([^;]+); and if ([^,]+), (.+)$/ =~ str
1483
- if @@debug
1479
+ if debug
1484
1480
  p 150
1485
1481
  end
1486
1482
  v = get_vname($1)
@@ -1488,24 +1484,24 @@ def parse_file(fname)
1488
1484
  v0 = get_vname($3)
1489
1485
  str = "#{cond0} ? #{v0} : #{v}"
1490
1486
  elsif /^(.+?) \.LE\. #{un}$/ =~ str
1491
- if @@debug
1487
+ if debug
1492
1488
  p 160
1493
1489
  end
1494
1490
  str = get_vname($1)
1495
1491
  elsif /^If ([^,]+), then\s+(.+)$/ =~ str
1496
- if @@debug
1492
+ if debug
1497
1493
  p 170
1498
1494
  end
1499
1495
  cond0 = get_cond($1)
1500
1496
  v0 = get_vname($2)
1501
1497
  str = "#{cond0} ? #{v0} : 0"
1502
1498
  elsif (/^[sd]bdsdc$/ =~ sub_name && /^ld(u|vt)$/ =~ name)
1503
- if @@debug
1499
+ if debug
1504
1500
  p 180
1505
1501
  end
1506
1502
  str = 'lsame_(&compq,"I") ? MAX(1,n) : 0'
1507
1503
  else
1508
- if @@debug
1504
+ if debug
1509
1505
  p 190
1510
1506
  end
1511
1507
  if /^[sdcz]laqr[23]$/ =~ sub_name && name == "ldwv"
@@ -1569,39 +1565,39 @@ def parse_file(fname)
1569
1565
  if /^\([^;]+\); (\(.+?\) if [A-Z\d]+ = .+? or \(.+?\) if [A-Z\d]+ = .+)$/ =~ str
1570
1566
  str = $1
1571
1567
  end
1572
- if @@debug
1568
+ if debug
1573
1569
  p name
1574
1570
  p str
1575
1571
  end
1576
1572
  while (str && str!="")
1577
1573
  if (/^(?:and )?\((.*?)\)\s+if\s+([^\,\;]+)[\,\;]\s+(.*)$/ =~ str) && (dim = $1.strip) && (cond = $2.strip) && (str_tmp = $3.strip) && (/ if .* if / !~ cond) && (/\([^\)]+$/ !~ cond) && (/=/ !~ dim)
1578
- if @@debug
1574
+ if debug
1579
1575
  p 1
1580
1576
  end
1581
1577
  str = str_tmp
1582
1578
  elsif (/^\(([^;]+?)\)\s+if\s+(.+?)\s+(?:or|and)\s+(\(.*\) if.*)$/ =~ str) || (/^\(([^;]+?)\)\s+if\s+(.+?)\s+(\(.*\)\s+if.*)$/ =~ str)
1583
- if @@debug
1579
+ if debug
1584
1580
  p 2
1585
1581
  end
1586
1582
  dim = $1
1587
1583
  cond = $2.strip
1588
1584
  str = $3.strip
1589
1585
  elsif /^If ([^\,]+)\,\s+([^;\.]+)[;\.]?(.*)$/ =~ str
1590
- if @@debug
1586
+ if debug
1591
1587
  p 2.5
1592
1588
  end
1593
1589
  cond = $1.strip
1594
1590
  dim = $2
1595
1591
  str = $3.strip
1596
1592
  elsif /^\((.*?)\)\s+if\s+([^\,]+)\, (\(.*\) otherwise)$/ =~ str
1597
- if @@debug
1593
+ if debug
1598
1594
  p 3
1599
1595
  end
1600
1596
  dim = $1.strip
1601
1597
  cond = $2.strip
1602
1598
  str = $3.strip
1603
1599
  elsif (/^(?:and )?\((.+?)\)\s+if\s+(.*)$/ =~ str) && (dim = $1.strip) && (cond = $2.strip) && (/if/ !~ dim) && (/ if /i !~ cond) && (/^[^\(]+\)/ !~ dim)
1604
- if @@debug
1600
+ if debug
1605
1601
  p 4
1606
1602
  end
1607
1603
  str = nil
@@ -1610,7 +1606,7 @@ def parse_file(fname)
1610
1606
  cond = $2
1611
1607
  str = $'
1612
1608
  elsif /^(.*?)\s+otherwise$/ =~ str && (dim = $1.strip) && (/ if / !~ dim)
1613
- if @@debug
1609
+ if debug
1614
1610
  p 5
1615
1611
  end
1616
1612
  if cond == "not referenced"
@@ -1623,7 +1619,7 @@ def parse_file(fname)
1623
1619
  flag = false
1624
1620
  break
1625
1621
  elsif /^\((.+?)\);?\s+If ([A-Z_\d]+ = [^\,]+)\, (then )?#{name.upcase} is not referenced.?$/ =~ str
1626
- if @@debug
1622
+ if debug
1627
1623
  p 6
1628
1624
  end
1629
1625
  dims = get_dims($1)
@@ -1634,7 +1630,7 @@ def parse_file(fname)
1634
1630
  flag = false
1635
1631
  break
1636
1632
  elsif /^\((.+?)\); Not referenced if (.*)$/ =~ str
1637
- if @@debug
1633
+ if debug
1638
1634
  p 6.5
1639
1635
  end
1640
1636
  v0 = get_vname($1)
@@ -1643,7 +1639,7 @@ def parse_file(fname)
1643
1639
  flag = false
1644
1640
  break
1645
1641
  elsif /\((.+?)\)\, where ([A-Z\d]+) >= ([A-Z\d]+) when ([^;]+); otherwise, #{name.upcase} is not referenced\.?$/ =~ str
1646
- if @@debug
1642
+ if debug
1647
1643
  p 7
1648
1644
  end
1649
1645
  dims = get_dims($1)
@@ -1654,7 +1650,7 @@ def parse_file(fname)
1654
1650
  flag = false
1655
1651
  break
1656
1652
  elsif /\((.+)\)[\.\,] where ([A-Z\d]+) = (.+)\.?$/ =~ str
1657
- if @@debug
1653
+ if debug
1658
1654
  p 8
1659
1655
  end
1660
1656
  dims = get_dims($1)
@@ -1664,7 +1660,7 @@ def parse_file(fname)
1664
1660
  flag = false
1665
1661
  break
1666
1662
  elsif /^(?:and )?(not referenced) if (.+).?$/ =~ str
1667
- if @@debug
1663
+ if debug
1668
1664
  p 9
1669
1665
  end
1670
1666
  dim = $1
@@ -1677,7 +1673,7 @@ def parse_file(fname)
1677
1673
  break
1678
1674
  else
1679
1675
  if /^\((.+?)\) (.+?) = (.+?) (?:when|if) ([^,]+), and (.+?) when (.+)$/ =~ str
1680
- if @@debug
1676
+ if debug
1681
1677
  p 10
1682
1678
  end
1683
1679
  dim = $1
@@ -1694,7 +1690,7 @@ def parse_file(fname)
1694
1690
  flag = false
1695
1691
  break
1696
1692
  elsif /^\((.+?)\) (.+?) = (.+?) (?:when|if) ([^,]+), and (.+?) otherwise.?$/ =~ str
1697
- if @@debug
1693
+ if debug
1698
1694
  p 11
1699
1695
  end
1700
1696
  dim = $1
@@ -1710,7 +1706,7 @@ def parse_file(fname)
1710
1706
  flag = false
1711
1707
  break
1712
1708
  elsif /^\((.+?)\);\s+[Ii]f ([A-Z_\d]+ = [^\,]+)\, ([A-Z_\d]+) \>?= ([^\.]+)\.\s+Otherwise\, ([A-Z_\d]+) \>?= (.*)$/ =~ str
1713
- if @@debug
1709
+ if debug
1714
1710
  p 14
1715
1711
  end
1716
1712
  dim = $1
@@ -1729,7 +1725,7 @@ def parse_file(fname)
1729
1725
  break
1730
1726
  end
1731
1727
  if /^\((.+?)\)\.\s+[Ii]f ([A-Z_\d]+ = [^\,]+)\, ([A-Z_\d]+) = ([A-Z_\d]+); if ([A-Z_\d]+ = [^\,]+), ([A-Z_\d]+) = ([A-Z_\d]+)$/ =~ str
1732
- if @@debug
1728
+ if debug
1733
1729
  p 13
1734
1730
  end
1735
1731
  dim = $1
@@ -1740,7 +1736,7 @@ def parse_file(fname)
1740
1736
  c10 = $6.downcase
1741
1737
  c11 = $7.downcase
1742
1738
  elsif /\((.+?)\);? ([A-Z_\d]+) = (.+?) if ([^;]+); ([A-Z_\d]+) = (.+?) if (.+)$/ =~ str
1743
- if @@debug
1739
+ if debug
1744
1740
  p 13
1745
1741
  end
1746
1742
  dim = $1
@@ -1865,7 +1861,7 @@ def parse_file(fname)
1865
1861
  args["iloz"] = {:type => "integer", :intent => "input"}
1866
1862
  args["ihiz"] = {:type => "integer", :intent => "input"}
1867
1863
  end
1868
- if @@debug
1864
+ if debug
1869
1865
  pp args
1870
1866
  end
1871
1867
 
@@ -1875,8 +1871,8 @@ def parse_file(fname)
1875
1871
  end
1876
1872
 
1877
1873
 
1878
- def create_hash(fname)
1879
- hash = parse_file(fname)
1874
+ def create_hash(fname, debug)
1875
+ hash = parse_file(fname, debug)
1880
1876
  if hash.nil?
1881
1877
  warn "skip #{fname}"
1882
1878
  return nil
@@ -1911,7 +1907,7 @@ def create_hash(fname)
1911
1907
  return hash
1912
1908
  end
1913
1909
 
1914
- def generate_code(fnames)
1910
+ def generate_code(fnames, debug)
1915
1911
  nfnames = fnames.length
1916
1912
  sub_names = Array.new
1917
1913
  fnames.each_with_index{|fname,i|
@@ -1929,7 +1925,7 @@ def generate_code(fnames)
1929
1925
  next if get_md5sum(help) == md5sum && !@@force
1930
1926
  end
1931
1927
 
1932
- hash = create_hash(fname)
1928
+ hash = create_hash(fname, debug)
1933
1929
  def hash.each
1934
1930
  [:name, :md5sum, :category].each do |k|
1935
1931
  yield(k, self[k])
@@ -1941,7 +1937,7 @@ def generate_code(fnames)
1941
1937
  yield(k, self[k])
1942
1938
  end
1943
1939
  end
1944
- p "write #{hash[:name]}" if @@debug
1940
+ p "write #{hash[:name]}" if debug
1945
1941
  File.open(def_fname, "w") do |file|
1946
1942
  file.write hash.to_yaml
1947
1943
  end
@@ -1956,8 +1952,8 @@ end
1956
1952
 
1957
1953
 
1958
1954
 
1959
- @@debug = ARGV.delete("--debug")
1960
- @@force = ARGV.delete("--force")
1955
+ debug = ARGV.delete("--debug")
1956
+ force = ARGV.delete("--force")
1961
1957
 
1962
1958
  dname = ARGV[0] || raise("Usage: ruby #$0 path_to_lapack_src")
1963
1959
  if File.directory?(dname)
@@ -1967,6 +1963,6 @@ elsif File.file?(dname)
1967
1963
  # @@debug = true
1968
1964
  end
1969
1965
 
1970
- generate_code(fnames)
1966
+ generate_code(fnames, debug)
1971
1967
 
1972
1968
 
@@ -59,7 +59,7 @@ rblapack_claed7(int argc, VALUE *argv, VALUE self){
59
59
  argc--;
60
60
  rblapack_options = argv[argc];
61
61
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
62
- printf("%s\n", "USAGE:\n indxq, info, d, q, qstore, qptr = NumRu::Lapack.claed7( cutpnt, qsiz, tlvls, curlvl, curpbm, d, q, rho, qstore, qptr, prmptr, perm, givptr, givcol, givnum, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE CLAED7( N, CUTPNT, QSIZ, TLVLS, CURLVL, CURPBM, D, Q, LDQ, RHO, INDXQ, QSTORE, QPTR, PRMPTR, PERM, GIVPTR, GIVCOL, GIVNUM, WORK, RWORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* CLAED7 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and optionally eigenvectors of a dense or banded\n* Hermitian matrix that has been reduced to tridiagonal form.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine SLAED2.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine SLAED4 (as called by SLAED3).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* CUTPNT (input) INTEGER\n* Contains the location of the last eigenvalue in the leading\n* sub-matrix. min(1,N) <= CUTPNT <= N.\n*\n* QSIZ (input) INTEGER\n* The dimension of the unitary matrix used to reduce\n* the full matrix to tridiagonal form. QSIZ >= N.\n*\n* TLVLS (input) INTEGER\n* The total number of merging levels in the overall divide and\n* conquer tree.\n*\n* CURLVL (input) INTEGER\n* The current level in the overall merge routine,\n* 0 <= curlvl <= tlvls.\n*\n* CURPBM (input) INTEGER\n* The current problem in the current level in the overall\n* merge routine (counting from upper left to lower right).\n*\n* D (input/output) REAL array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) COMPLEX array, dimension (LDQ,N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* RHO (input) REAL\n* Contains the subdiagonal element used to create the rank-1\n* modification.\n*\n* INDXQ (output) INTEGER array, dimension (N)\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order,\n* ie. D( INDXQ( I = 1, N ) ) will be in ascending order.\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* RWORK (workspace) REAL array,\n* dimension (3*N+2*QSIZ*N)\n*\n* WORK (workspace) COMPLEX array, dimension (QSIZ*N)\n*\n* QSTORE (input/output) REAL array, dimension (N**2+1)\n* Stores eigenvectors of submatrices encountered during\n* divide and conquer, packed together. QPTR points to\n* beginning of the submatrices.\n*\n* QPTR (input/output) INTEGER array, dimension (N+2)\n* List of indices pointing to beginning of submatrices stored\n* in QSTORE. The submatrices are numbered starting at the\n* bottom left of the divide and conquer tree, from left to\n* right and bottom to top.\n*\n* PRMPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in PERM a\n* level's permutation is stored. PRMPTR(i+1) - PRMPTR(i)\n* indicates the size of the permutation and also the size of\n* the full, non-deflated problem.\n*\n* PERM (input) INTEGER array, dimension (N lg N)\n* Contains the permutations (from deflation and sorting) to be\n* applied to each eigenblock.\n*\n* GIVPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in GIVCOL a\n* level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i)\n* indicates the number of Givens rotations.\n*\n* GIVCOL (input) INTEGER array, dimension (2, N lg N)\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation.\n*\n* GIVNUM (input) REAL array, dimension (2, N lg N)\n* Each number indicates the S value to be used in the\n* corresponding Givens rotation.\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER COLTYP, CURR, I, IDLMDA, INDX,\n $ INDXC, INDXP, IQ, IW, IZ, K, N1, N2, PTR\n* ..\n* .. External Subroutines ..\n EXTERNAL CLACRM, CLAED8, SLAED9, SLAEDA, SLAMRG, XERBLA\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC MAX, MIN\n* ..\n\n");
62
+ printf("%s\n", "USAGE:\n indxq, info, d, q, qstore, qptr = NumRu::Lapack.claed7( cutpnt, qsiz, tlvls, curlvl, curpbm, d, q, rho, qstore, qptr, prmptr, perm, givptr, givcol, givnum, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE CLAED7( N, CUTPNT, QSIZ, TLVLS, CURLVL, CURPBM, D, Q, LDQ, RHO, INDXQ, QSTORE, QPTR, PRMPTR, PERM, GIVPTR, GIVCOL, GIVNUM, WORK, RWORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* CLAED7 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and optionally eigenvectors of a dense or banded\n* Hermitian matrix that has been reduced to tridiagonal form.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurrence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine SLAED2.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine SLAED4 (as called by SLAED3).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* CUTPNT (input) INTEGER\n* Contains the location of the last eigenvalue in the leading\n* sub-matrix. min(1,N) <= CUTPNT <= N.\n*\n* QSIZ (input) INTEGER\n* The dimension of the unitary matrix used to reduce\n* the full matrix to tridiagonal form. QSIZ >= N.\n*\n* TLVLS (input) INTEGER\n* The total number of merging levels in the overall divide and\n* conquer tree.\n*\n* CURLVL (input) INTEGER\n* The current level in the overall merge routine,\n* 0 <= curlvl <= tlvls.\n*\n* CURPBM (input) INTEGER\n* The current problem in the current level in the overall\n* merge routine (counting from upper left to lower right).\n*\n* D (input/output) REAL array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) COMPLEX array, dimension (LDQ,N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* RHO (input) REAL\n* Contains the subdiagonal element used to create the rank-1\n* modification.\n*\n* INDXQ (output) INTEGER array, dimension (N)\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order,\n* ie. D( INDXQ( I = 1, N ) ) will be in ascending order.\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* RWORK (workspace) REAL array,\n* dimension (3*N+2*QSIZ*N)\n*\n* WORK (workspace) COMPLEX array, dimension (QSIZ*N)\n*\n* QSTORE (input/output) REAL array, dimension (N**2+1)\n* Stores eigenvectors of submatrices encountered during\n* divide and conquer, packed together. QPTR points to\n* beginning of the submatrices.\n*\n* QPTR (input/output) INTEGER array, dimension (N+2)\n* List of indices pointing to beginning of submatrices stored\n* in QSTORE. The submatrices are numbered starting at the\n* bottom left of the divide and conquer tree, from left to\n* right and bottom to top.\n*\n* PRMPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in PERM a\n* level's permutation is stored. PRMPTR(i+1) - PRMPTR(i)\n* indicates the size of the permutation and also the size of\n* the full, non-deflated problem.\n*\n* PERM (input) INTEGER array, dimension (N lg N)\n* Contains the permutations (from deflation and sorting) to be\n* applied to each eigenblock.\n*\n* GIVPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in GIVCOL a\n* level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i)\n* indicates the number of Givens rotations.\n*\n* GIVCOL (input) INTEGER array, dimension (2, N lg N)\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation.\n*\n* GIVNUM (input) REAL array, dimension (2, N lg N)\n* Each number indicates the S value to be used in the\n* corresponding Givens rotation.\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER COLTYP, CURR, I, IDLMDA, INDX,\n $ INDXC, INDXP, IQ, IW, IZ, K, N1, N2, PTR\n* ..\n* .. External Subroutines ..\n EXTERNAL CLACRM, CLAED8, SLAED9, SLAEDA, SLAMRG, XERBLA\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC MAX, MIN\n* ..\n\n");
63
63
  return Qnil;
64
64
  }
65
65
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -68,7 +68,7 @@ rblapack_clarrv(int argc, VALUE *argv, VALUE self){
68
68
  argc--;
69
69
  rblapack_options = argv[argc];
70
70
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
71
- printf("%s\n", "USAGE:\n z, isuppz, info, d, l, w, werr, wgap = NumRu::Lapack.clarrv( vl, vu, d, l, pivmin, isplit, m, dol, dou, minrgp, rtol1, rtol2, w, werr, wgap, iblock, indexw, gers, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, ISPLIT, M, DOL, DOU, MINRGP, RTOL1, RTOL2, W, WERR, WGAP, IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* CLARRV computes the eigenvectors of the tridiagonal matrix\n* T = L D L^T given L, D and APPROXIMATIONS to the eigenvalues of L D L^T.\n* The input eigenvalues should have been computed by SLARRE.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix. N >= 0.\n*\n* VL (input) REAL \n* VU (input) REAL \n* Lower and upper bounds of the interval that contains the desired\n* eigenvalues. VL < VU. Needed to compute gaps on the left or right\n* end of the extremal eigenvalues in the desired RANGE.\n*\n* D (input/output) REAL array, dimension (N)\n* On entry, the N diagonal elements of the diagonal matrix D.\n* On exit, D may be overwritten.\n*\n* L (input/output) REAL array, dimension (N)\n* On entry, the (N-1) subdiagonal elements of the unit\n* bidiagonal matrix L are in elements 1 to N-1 of L\n* (if the matrix is not splitted.) At the end of each block\n* is stored the corresponding shift as given by SLARRE.\n* On exit, L is overwritten.\n*\n* PIVMIN (in) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* ISPLIT (input) INTEGER array, dimension (N)\n* The splitting points, at which T breaks up into blocks.\n* The first block consists of rows/columns 1 to\n* ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1\n* through ISPLIT( 2 ), etc.\n*\n* M (input) INTEGER\n* The total number of input eigenvalues. 0 <= M <= N.\n*\n* DOL (input) INTEGER\n* DOU (input) INTEGER\n* If the user wants to compute only selected eigenvectors from all\n* the eigenvalues supplied, he can specify an index range DOL:DOU.\n* Or else the setting DOL=1, DOU=M should be applied.\n* Note that DOL and DOU refer to the order in which the eigenvalues\n* are stored in W.\n* If the user wants to compute only selected eigenpairs, then\n* the columns DOL-1 to DOU+1 of the eigenvector space Z contain the\n* computed eigenvectors. All other columns of Z are set to zero.\n*\n* MINRGP (input) REAL \n*\n* RTOL1 (input) REAL \n* RTOL2 (input) REAL \n* Parameters for bisection.\n* An interval [LEFT,RIGHT] has converged if\n* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )\n*\n* W (input/output) REAL array, dimension (N)\n* The first M elements of W contain the APPROXIMATE eigenvalues for\n* which eigenvectors are to be computed. The eigenvalues\n* should be grouped by split-off block and ordered from\n* smallest to largest within the block ( The output array\n* W from SLARRE is expected here ). Furthermore, they are with\n* respect to the shift of the corresponding root representation\n* for their block. On exit, W holds the eigenvalues of the\n* UNshifted matrix.\n*\n* WERR (input/output) REAL array, dimension (N)\n* The first M elements contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue in W\n*\n* WGAP (input/output) REAL array, dimension (N)\n* The separation from the right neighbor eigenvalue in W.\n*\n* IBLOCK (input) INTEGER array, dimension (N)\n* The indices of the blocks (submatrices) associated with the\n* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue\n* W(i) belongs to the first block from the top, =2 if W(i)\n* belongs to the second block, etc.\n*\n* INDEXW (input) INTEGER array, dimension (N)\n* The indices of the eigenvalues within each block (submatrix);\n* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the\n* i-th eigenvalue W(i) is the 10-th eigenvalue in the second block.\n*\n* GERS (input) REAL array, dimension (2*N)\n* The N Gerschgorin intervals (the i-th Gerschgorin interval\n* is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should\n* be computed from the original UNshifted matrix.\n*\n* Z (output) COMPLEX array, dimension (LDZ, max(1,M) )\n* If INFO = 0, the first M columns of Z contain the\n* orthonormal eigenvectors of the matrix T\n* corresponding to the input eigenvalues, with the i-th\n* column of Z holding the eigenvector associated with W(i).\n* Note: the user must ensure that at least max(1,M) columns are\n* supplied in the array Z.\n*\n* LDZ (input) INTEGER\n* The leading dimension of the array Z. LDZ >= 1, and if\n* JOBZ = 'V', LDZ >= max(1,N).\n*\n* ISUPPZ (output) INTEGER array, dimension ( 2*max(1,M) )\n* The support of the eigenvectors in Z, i.e., the indices\n* indicating the nonzero elements in Z. The I-th eigenvector\n* is nonzero only in elements ISUPPZ( 2*I-1 ) through\n* ISUPPZ( 2*I ).\n*\n* WORK (workspace) REAL array, dimension (12*N)\n*\n* IWORK (workspace) INTEGER array, dimension (7*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit\n*\n* > 0: A problem occured in CLARRV.\n* < 0: One of the called subroutines signaled an internal problem.\n* Needs inspection of the corresponding parameter IINFO\n* for further information.\n*\n* =-1: Problem in SLARRB when refining a child's eigenvalues.\n* =-2: Problem in SLARRF when computing the RRR of a child.\n* When a child is inside a tight cluster, it can be difficult\n* to find an RRR. A partial remedy from the user's point of\n* view is to make the parameter MINRGP smaller and recompile.\n* However, as the orthogonality of the computed vectors is\n* proportional to 1/MINRGP, the user should be aware that\n* he might be trading in precision when he decreases MINRGP.\n* =-3: Problem in SLARRB when refining a single eigenvalue\n* after the Rayleigh correction was rejected.\n* = 5: The Rayleigh Quotient Iteration failed to converge to\n* full accuracy in MAXITR steps.\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
71
+ printf("%s\n", "USAGE:\n z, isuppz, info, d, l, w, werr, wgap = NumRu::Lapack.clarrv( vl, vu, d, l, pivmin, isplit, m, dol, dou, minrgp, rtol1, rtol2, w, werr, wgap, iblock, indexw, gers, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE CLARRV( N, VL, VU, D, L, PIVMIN, ISPLIT, M, DOL, DOU, MINRGP, RTOL1, RTOL2, W, WERR, WGAP, IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* CLARRV computes the eigenvectors of the tridiagonal matrix\n* T = L D L^T given L, D and APPROXIMATIONS to the eigenvalues of L D L^T.\n* The input eigenvalues should have been computed by SLARRE.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix. N >= 0.\n*\n* VL (input) REAL \n* VU (input) REAL \n* Lower and upper bounds of the interval that contains the desired\n* eigenvalues. VL < VU. Needed to compute gaps on the left or right\n* end of the extremal eigenvalues in the desired RANGE.\n*\n* D (input/output) REAL array, dimension (N)\n* On entry, the N diagonal elements of the diagonal matrix D.\n* On exit, D may be overwritten.\n*\n* L (input/output) REAL array, dimension (N)\n* On entry, the (N-1) subdiagonal elements of the unit\n* bidiagonal matrix L are in elements 1 to N-1 of L\n* (if the matrix is not split.) At the end of each block\n* is stored the corresponding shift as given by SLARRE.\n* On exit, L is overwritten.\n*\n* PIVMIN (in) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* ISPLIT (input) INTEGER array, dimension (N)\n* The splitting points, at which T breaks up into blocks.\n* The first block consists of rows/columns 1 to\n* ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1\n* through ISPLIT( 2 ), etc.\n*\n* M (input) INTEGER\n* The total number of input eigenvalues. 0 <= M <= N.\n*\n* DOL (input) INTEGER\n* DOU (input) INTEGER\n* If the user wants to compute only selected eigenvectors from all\n* the eigenvalues supplied, he can specify an index range DOL:DOU.\n* Or else the setting DOL=1, DOU=M should be applied.\n* Note that DOL and DOU refer to the order in which the eigenvalues\n* are stored in W.\n* If the user wants to compute only selected eigenpairs, then\n* the columns DOL-1 to DOU+1 of the eigenvector space Z contain the\n* computed eigenvectors. All other columns of Z are set to zero.\n*\n* MINRGP (input) REAL \n*\n* RTOL1 (input) REAL \n* RTOL2 (input) REAL \n* Parameters for bisection.\n* An interval [LEFT,RIGHT] has converged if\n* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )\n*\n* W (input/output) REAL array, dimension (N)\n* The first M elements of W contain the APPROXIMATE eigenvalues for\n* which eigenvectors are to be computed. The eigenvalues\n* should be grouped by split-off block and ordered from\n* smallest to largest within the block ( The output array\n* W from SLARRE is expected here ). Furthermore, they are with\n* respect to the shift of the corresponding root representation\n* for their block. On exit, W holds the eigenvalues of the\n* UNshifted matrix.\n*\n* WERR (input/output) REAL array, dimension (N)\n* The first M elements contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue in W\n*\n* WGAP (input/output) REAL array, dimension (N)\n* The separation from the right neighbor eigenvalue in W.\n*\n* IBLOCK (input) INTEGER array, dimension (N)\n* The indices of the blocks (submatrices) associated with the\n* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue\n* W(i) belongs to the first block from the top, =2 if W(i)\n* belongs to the second block, etc.\n*\n* INDEXW (input) INTEGER array, dimension (N)\n* The indices of the eigenvalues within each block (submatrix);\n* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the\n* i-th eigenvalue W(i) is the 10-th eigenvalue in the second block.\n*\n* GERS (input) REAL array, dimension (2*N)\n* The N Gerschgorin intervals (the i-th Gerschgorin interval\n* is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should\n* be computed from the original UNshifted matrix.\n*\n* Z (output) COMPLEX array, dimension (LDZ, max(1,M) )\n* If INFO = 0, the first M columns of Z contain the\n* orthonormal eigenvectors of the matrix T\n* corresponding to the input eigenvalues, with the i-th\n* column of Z holding the eigenvector associated with W(i).\n* Note: the user must ensure that at least max(1,M) columns are\n* supplied in the array Z.\n*\n* LDZ (input) INTEGER\n* The leading dimension of the array Z. LDZ >= 1, and if\n* JOBZ = 'V', LDZ >= max(1,N).\n*\n* ISUPPZ (output) INTEGER array, dimension ( 2*max(1,M) )\n* The support of the eigenvectors in Z, i.e., the indices\n* indicating the nonzero elements in Z. The I-th eigenvector\n* is nonzero only in elements ISUPPZ( 2*I-1 ) through\n* ISUPPZ( 2*I ).\n*\n* WORK (workspace) REAL array, dimension (12*N)\n*\n* IWORK (workspace) INTEGER array, dimension (7*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit\n*\n* > 0: A problem occured in CLARRV.\n* < 0: One of the called subroutines signaled an internal problem.\n* Needs inspection of the corresponding parameter IINFO\n* for further information.\n*\n* =-1: Problem in SLARRB when refining a child's eigenvalues.\n* =-2: Problem in SLARRF when computing the RRR of a child.\n* When a child is inside a tight cluster, it can be difficult\n* to find an RRR. A partial remedy from the user's point of\n* view is to make the parameter MINRGP smaller and recompile.\n* However, as the orthogonality of the computed vectors is\n* proportional to 1/MINRGP, the user should be aware that\n* he might be trading in precision when he decreases MINRGP.\n* =-3: Problem in SLARRB when refining a single eigenvalue\n* after the Rayleigh correction was rejected.\n* = 5: The Rayleigh Quotient Iteration failed to converge to\n* full accuracy in MAXITR steps.\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
72
72
  return Qnil;
73
73
  }
74
74
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -34,7 +34,7 @@ rblapack_dlaed1(int argc, VALUE *argv, VALUE self){
34
34
  argc--;
35
35
  rblapack_options = argv[argc];
36
36
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
37
- printf("%s\n", "USAGE:\n info, d, q, indxq = NumRu::Lapack.dlaed1( d, q, indxq, rho, cutpnt, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAED1( N, D, Q, LDQ, INDXQ, RHO, CUTPNT, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLAED1 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and eigenvectors of a tridiagonal matrix. DLAED7 handles\n* the case in which eigenvalues only or eigenvalues and eigenvectors\n* of a full symmetric matrix (which was reduced to tridiagonal form)\n* are desired.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLAED2.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine DLAED4 (as called by DLAED3).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* INDXQ (input/output) INTEGER array, dimension (N)\n* On entry, the permutation which separately sorts the two\n* subproblems in D into ascending order.\n* On exit, the permutation which will reintegrate the\n* subproblems back into sorted order,\n* i.e. D( INDXQ( I = 1, N ) ) will be in ascending order.\n*\n* RHO (input) DOUBLE PRECISION\n* The subdiagonal entry used to create the rank-1 modification.\n*\n* CUTPNT (input) INTEGER\n* The location of the last eigenvalue in the leading sub-matrix.\n* min(1,N) <= CUTPNT <= N/2.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (4*N + N**2)\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Jeff Rutter, Computer Science Division, University of California\n* at Berkeley, USA\n* Modified by Francoise Tisseur, University of Tennessee.\n*\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER COLTYP, I, IDLMDA, INDX, INDXC, INDXP, IQ2, IS,\n $ IW, IZ, K, N1, N2, ZPP1\n* ..\n* .. External Subroutines ..\n EXTERNAL DCOPY, DLAED2, DLAED3, DLAMRG, XERBLA\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC MAX, MIN\n* ..\n\n");
37
+ printf("%s\n", "USAGE:\n info, d, q, indxq = NumRu::Lapack.dlaed1( d, q, indxq, rho, cutpnt, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAED1( N, D, Q, LDQ, INDXQ, RHO, CUTPNT, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLAED1 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and eigenvectors of a tridiagonal matrix. DLAED7 handles\n* the case in which eigenvalues only or eigenvalues and eigenvectors\n* of a full symmetric matrix (which was reduced to tridiagonal form)\n* are desired.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurrence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLAED2.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine DLAED4 (as called by DLAED3).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) DOUBLE PRECISION array, dimension (LDQ,N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* INDXQ (input/output) INTEGER array, dimension (N)\n* On entry, the permutation which separately sorts the two\n* subproblems in D into ascending order.\n* On exit, the permutation which will reintegrate the\n* subproblems back into sorted order,\n* i.e. D( INDXQ( I = 1, N ) ) will be in ascending order.\n*\n* RHO (input) DOUBLE PRECISION\n* The subdiagonal entry used to create the rank-1 modification.\n*\n* CUTPNT (input) INTEGER\n* The location of the last eigenvalue in the leading sub-matrix.\n* min(1,N) <= CUTPNT <= N/2.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (4*N + N**2)\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Jeff Rutter, Computer Science Division, University of California\n* at Berkeley, USA\n* Modified by Francoise Tisseur, University of Tennessee.\n*\n* =====================================================================\n*\n* .. Local Scalars ..\n INTEGER COLTYP, I, IDLMDA, INDX, INDXC, INDXP, IQ2, IS,\n $ IW, IZ, K, N1, N2, ZPP1\n* ..\n* .. External Subroutines ..\n EXTERNAL DCOPY, DLAED2, DLAED3, DLAMRG, XERBLA\n* ..\n* .. Intrinsic Functions ..\n INTRINSIC MAX, MIN\n* ..\n\n");
38
38
  return Qnil;
39
39
  }
40
40
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -60,7 +60,7 @@ rblapack_dlaed7(int argc, VALUE *argv, VALUE self){
60
60
  argc--;
61
61
  rblapack_options = argv[argc];
62
62
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
63
- printf("%s\n", "USAGE:\n indxq, info, d, q, qstore, qptr = NumRu::Lapack.dlaed7( icompq, qsiz, tlvls, curlvl, curpbm, d, q, rho, cutpnt, qstore, qptr, prmptr, perm, givptr, givcol, givnum, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAED7( ICOMPQ, N, QSIZ, TLVLS, CURLVL, CURPBM, D, Q, LDQ, INDXQ, RHO, CUTPNT, QSTORE, QPTR, PRMPTR, PERM, GIVPTR, GIVCOL, GIVNUM, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLAED7 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and optionally eigenvectors of a dense symmetric matrix\n* that has been reduced to tridiagonal form. DLAED1 handles\n* the case in which all eigenvalues and eigenvectors of a symmetric\n* tridiagonal matrix are desired.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLAED8.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine DLAED4 (as called by DLAED9).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* ICOMPQ (input) INTEGER\n* = 0: Compute eigenvalues only.\n* = 1: Compute eigenvectors of original dense symmetric matrix\n* also. On entry, Q contains the orthogonal matrix used\n* to reduce the original matrix to tridiagonal form.\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* QSIZ (input) INTEGER\n* The dimension of the orthogonal matrix used to reduce\n* the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1.\n*\n* TLVLS (input) INTEGER\n* The total number of merging levels in the overall divide and\n* conquer tree.\n*\n* CURLVL (input) INTEGER\n* The current level in the overall merge routine,\n* 0 <= CURLVL <= TLVLS.\n*\n* CURPBM (input) INTEGER\n* The current problem in the current level in the overall\n* merge routine (counting from upper left to lower right).\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* INDXQ (output) INTEGER array, dimension (N)\n* The permutation which will reintegrate the subproblem just\n* solved back into sorted order, i.e., D( INDXQ( I = 1, N ) )\n* will be in ascending order.\n*\n* RHO (input) DOUBLE PRECISION\n* The subdiagonal element used to create the rank-1\n* modification.\n*\n* CUTPNT (input) INTEGER\n* Contains the location of the last eigenvalue in the leading\n* sub-matrix. min(1,N) <= CUTPNT <= N.\n*\n* QSTORE (input/output) DOUBLE PRECISION array, dimension (N**2+1)\n* Stores eigenvectors of submatrices encountered during\n* divide and conquer, packed together. QPTR points to\n* beginning of the submatrices.\n*\n* QPTR (input/output) INTEGER array, dimension (N+2)\n* List of indices pointing to beginning of submatrices stored\n* in QSTORE. The submatrices are numbered starting at the\n* bottom left of the divide and conquer tree, from left to\n* right and bottom to top.\n*\n* PRMPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in PERM a\n* level's permutation is stored. PRMPTR(i+1) - PRMPTR(i)\n* indicates the size of the permutation and also the size of\n* the full, non-deflated problem.\n*\n* PERM (input) INTEGER array, dimension (N lg N)\n* Contains the permutations (from deflation and sorting) to be\n* applied to each eigenblock.\n*\n* GIVPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in GIVCOL a\n* level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i)\n* indicates the number of Givens rotations.\n*\n* GIVCOL (input) INTEGER array, dimension (2, N lg N)\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation.\n*\n* GIVNUM (input) DOUBLE PRECISION array, dimension (2, N lg N)\n* Each number indicates the S value to be used in the\n* corresponding Givens rotation.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (3*N+QSIZ*N)\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Jeff Rutter, Computer Science Division, University of California\n* at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
63
+ printf("%s\n", "USAGE:\n indxq, info, d, q, qstore, qptr = NumRu::Lapack.dlaed7( icompq, qsiz, tlvls, curlvl, curpbm, d, q, rho, cutpnt, qstore, qptr, prmptr, perm, givptr, givcol, givnum, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAED7( ICOMPQ, N, QSIZ, TLVLS, CURLVL, CURPBM, D, Q, LDQ, INDXQ, RHO, CUTPNT, QSTORE, QPTR, PRMPTR, PERM, GIVPTR, GIVCOL, GIVNUM, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLAED7 computes the updated eigensystem of a diagonal\n* matrix after modification by a rank-one symmetric matrix. This\n* routine is used only for the eigenproblem which requires all\n* eigenvalues and optionally eigenvectors of a dense symmetric matrix\n* that has been reduced to tridiagonal form. DLAED1 handles\n* the case in which all eigenvalues and eigenvectors of a symmetric\n* tridiagonal matrix are desired.\n*\n* T = Q(in) ( D(in) + RHO * Z*Z' ) Q'(in) = Q(out) * D(out) * Q'(out)\n*\n* where Z = Q'u, u is a vector of length N with ones in the\n* CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.\n*\n* The eigenvectors of the original matrix are stored in Q, and the\n* eigenvalues are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple eigenvalues or if there is a zero in\n* the Z vector. For each such occurrence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLAED8.\n*\n* The second stage consists of calculating the updated\n* eigenvalues. This is done by finding the roots of the secular\n* equation via the routine DLAED4 (as called by DLAED9).\n* This routine also calculates the eigenvectors of the current\n* problem.\n*\n* The final stage consists of computing the updated eigenvectors\n* directly using the updated eigenvalues. The eigenvectors for\n* the current problem are multiplied with the eigenvectors from\n* the overall problem.\n*\n\n* Arguments\n* =========\n*\n* ICOMPQ (input) INTEGER\n* = 0: Compute eigenvalues only.\n* = 1: Compute eigenvectors of original dense symmetric matrix\n* also. On entry, Q contains the orthogonal matrix used\n* to reduce the original matrix to tridiagonal form.\n*\n* N (input) INTEGER\n* The dimension of the symmetric tridiagonal matrix. N >= 0.\n*\n* QSIZ (input) INTEGER\n* The dimension of the orthogonal matrix used to reduce\n* the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1.\n*\n* TLVLS (input) INTEGER\n* The total number of merging levels in the overall divide and\n* conquer tree.\n*\n* CURLVL (input) INTEGER\n* The current level in the overall merge routine,\n* 0 <= CURLVL <= TLVLS.\n*\n* CURPBM (input) INTEGER\n* The current problem in the current level in the overall\n* merge routine (counting from upper left to lower right).\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the eigenvalues of the rank-1-perturbed matrix.\n* On exit, the eigenvalues of the repaired matrix.\n*\n* Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)\n* On entry, the eigenvectors of the rank-1-perturbed matrix.\n* On exit, the eigenvectors of the repaired tridiagonal matrix.\n*\n* LDQ (input) INTEGER\n* The leading dimension of the array Q. LDQ >= max(1,N).\n*\n* INDXQ (output) INTEGER array, dimension (N)\n* The permutation which will reintegrate the subproblem just\n* solved back into sorted order, i.e., D( INDXQ( I = 1, N ) )\n* will be in ascending order.\n*\n* RHO (input) DOUBLE PRECISION\n* The subdiagonal element used to create the rank-1\n* modification.\n*\n* CUTPNT (input) INTEGER\n* Contains the location of the last eigenvalue in the leading\n* sub-matrix. min(1,N) <= CUTPNT <= N.\n*\n* QSTORE (input/output) DOUBLE PRECISION array, dimension (N**2+1)\n* Stores eigenvectors of submatrices encountered during\n* divide and conquer, packed together. QPTR points to\n* beginning of the submatrices.\n*\n* QPTR (input/output) INTEGER array, dimension (N+2)\n* List of indices pointing to beginning of submatrices stored\n* in QSTORE. The submatrices are numbered starting at the\n* bottom left of the divide and conquer tree, from left to\n* right and bottom to top.\n*\n* PRMPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in PERM a\n* level's permutation is stored. PRMPTR(i+1) - PRMPTR(i)\n* indicates the size of the permutation and also the size of\n* the full, non-deflated problem.\n*\n* PERM (input) INTEGER array, dimension (N lg N)\n* Contains the permutations (from deflation and sorting) to be\n* applied to each eigenblock.\n*\n* GIVPTR (input) INTEGER array, dimension (N lg N)\n* Contains a list of pointers which indicate where in GIVCOL a\n* level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i)\n* indicates the number of Givens rotations.\n*\n* GIVCOL (input) INTEGER array, dimension (2, N lg N)\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation.\n*\n* GIVNUM (input) DOUBLE PRECISION array, dimension (2, N lg N)\n* Each number indicates the S value to be used in the\n* corresponding Givens rotation.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (3*N+QSIZ*N)\n*\n* IWORK (workspace) INTEGER array, dimension (4*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, an eigenvalue did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Jeff Rutter, Computer Science Division, University of California\n* at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
64
64
  return Qnil;
65
65
  }
66
66
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -30,7 +30,7 @@ rblapack_dlag2(int argc, VALUE *argv, VALUE self){
30
30
  argc--;
31
31
  rblapack_options = argv[argc];
32
32
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
33
- printf("%s\n", "USAGE:\n scale1, scale2, wr1, wr2, wi = NumRu::Lapack.dlag2( a, b, safmin, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAG2( A, LDA, B, LDB, SAFMIN, SCALE1, SCALE2, WR1, WR2, WI )\n\n* Purpose\n* =======\n*\n* DLAG2 computes the eigenvalues of a 2 x 2 generalized eigenvalue\n* problem A - w B, with scaling as necessary to avoid over-/underflow.\n*\n* The scaling factor \"s\" results in a modified eigenvalue equation\n*\n* s A - w B\n*\n* where s is a non-negative scaling factor chosen so that w, w B,\n* and s A do not overflow and, if possible, do not underflow, either.\n*\n\n* Arguments\n* =========\n*\n* A (input) DOUBLE PRECISION array, dimension (LDA, 2)\n* On entry, the 2 x 2 matrix A. It is assumed that its 1-norm\n* is less than 1/SAFMIN. Entries less than\n* sqrt(SAFMIN)*norm(A) are subject to being treated as zero.\n*\n* LDA (input) INTEGER\n* The leading dimension of the array A. LDA >= 2.\n*\n* B (input) DOUBLE PRECISION array, dimension (LDB, 2)\n* On entry, the 2 x 2 upper triangular matrix B. It is\n* assumed that the one-norm of B is less than 1/SAFMIN. The\n* diagonals should be at least sqrt(SAFMIN) times the largest\n* element of B (in absolute value); if a diagonal is smaller\n* than that, then +/- sqrt(SAFMIN) will be used instead of\n* that diagonal.\n*\n* LDB (input) INTEGER\n* The leading dimension of the array B. LDB >= 2.\n*\n* SAFMIN (input) DOUBLE PRECISION\n* The smallest positive number s.t. 1/SAFMIN does not\n* overflow. (This should always be DLAMCH('S') -- it is an\n* argument in order to avoid having to call DLAMCH frequently.)\n*\n* SCALE1 (output) DOUBLE PRECISION\n* A scaling factor used to avoid over-/underflow in the\n* eigenvalue equation which defines the first eigenvalue. If\n* the eigenvalues are complex, then the eigenvalues are\n* ( WR1 +/- WI i ) / SCALE1 (which may lie outside the\n* exponent range of the machine), SCALE1=SCALE2, and SCALE1\n* will always be positive. If the eigenvalues are real, then\n* the first (real) eigenvalue is WR1 / SCALE1 , but this may\n* overflow or underflow, and in fact, SCALE1 may be zero or\n* less than the underflow threshhold if the exact eigenvalue\n* is sufficiently large.\n*\n* SCALE2 (output) DOUBLE PRECISION\n* A scaling factor used to avoid over-/underflow in the\n* eigenvalue equation which defines the second eigenvalue. If\n* the eigenvalues are complex, then SCALE2=SCALE1. If the\n* eigenvalues are real, then the second (real) eigenvalue is\n* WR2 / SCALE2 , but this may overflow or underflow, and in\n* fact, SCALE2 may be zero or less than the underflow\n* threshhold if the exact eigenvalue is sufficiently large.\n*\n* WR1 (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WR1 is SCALE1 times the\n* eigenvalue closest to the (2,2) element of A B**(-1). If the\n* eigenvalue is complex, then WR1=WR2 is SCALE1 times the real\n* part of the eigenvalues.\n*\n* WR2 (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WR2 is SCALE2 times the\n* other eigenvalue. If the eigenvalue is complex, then\n* WR1=WR2 is SCALE1 times the real part of the eigenvalues.\n*\n* WI (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WI is zero. If the\n* eigenvalue is complex, then WI is SCALE1 times the imaginary\n* part of the eigenvalues. WI will always be non-negative.\n*\n\n* =====================================================================\n*\n\n");
33
+ printf("%s\n", "USAGE:\n scale1, scale2, wr1, wr2, wi = NumRu::Lapack.dlag2( a, b, safmin, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAG2( A, LDA, B, LDB, SAFMIN, SCALE1, SCALE2, WR1, WR2, WI )\n\n* Purpose\n* =======\n*\n* DLAG2 computes the eigenvalues of a 2 x 2 generalized eigenvalue\n* problem A - w B, with scaling as necessary to avoid over-/underflow.\n*\n* The scaling factor \"s\" results in a modified eigenvalue equation\n*\n* s A - w B\n*\n* where s is a non-negative scaling factor chosen so that w, w B,\n* and s A do not overflow and, if possible, do not underflow, either.\n*\n\n* Arguments\n* =========\n*\n* A (input) DOUBLE PRECISION array, dimension (LDA, 2)\n* On entry, the 2 x 2 matrix A. It is assumed that its 1-norm\n* is less than 1/SAFMIN. Entries less than\n* sqrt(SAFMIN)*norm(A) are subject to being treated as zero.\n*\n* LDA (input) INTEGER\n* The leading dimension of the array A. LDA >= 2.\n*\n* B (input) DOUBLE PRECISION array, dimension (LDB, 2)\n* On entry, the 2 x 2 upper triangular matrix B. It is\n* assumed that the one-norm of B is less than 1/SAFMIN. The\n* diagonals should be at least sqrt(SAFMIN) times the largest\n* element of B (in absolute value); if a diagonal is smaller\n* than that, then +/- sqrt(SAFMIN) will be used instead of\n* that diagonal.\n*\n* LDB (input) INTEGER\n* The leading dimension of the array B. LDB >= 2.\n*\n* SAFMIN (input) DOUBLE PRECISION\n* The smallest positive number s.t. 1/SAFMIN does not\n* overflow. (This should always be DLAMCH('S') -- it is an\n* argument in order to avoid having to call DLAMCH frequently.)\n*\n* SCALE1 (output) DOUBLE PRECISION\n* A scaling factor used to avoid over-/underflow in the\n* eigenvalue equation which defines the first eigenvalue. If\n* the eigenvalues are complex, then the eigenvalues are\n* ( WR1 +/- WI i ) / SCALE1 (which may lie outside the\n* exponent range of the machine), SCALE1=SCALE2, and SCALE1\n* will always be positive. If the eigenvalues are real, then\n* the first (real) eigenvalue is WR1 / SCALE1 , but this may\n* overflow or underflow, and in fact, SCALE1 may be zero or\n* less than the underflow threshold if the exact eigenvalue\n* is sufficiently large.\n*\n* SCALE2 (output) DOUBLE PRECISION\n* A scaling factor used to avoid over-/underflow in the\n* eigenvalue equation which defines the second eigenvalue. If\n* the eigenvalues are complex, then SCALE2=SCALE1. If the\n* eigenvalues are real, then the second (real) eigenvalue is\n* WR2 / SCALE2 , but this may overflow or underflow, and in\n* fact, SCALE2 may be zero or less than the underflow\n* threshold if the exact eigenvalue is sufficiently large.\n*\n* WR1 (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WR1 is SCALE1 times the\n* eigenvalue closest to the (2,2) element of A B**(-1). If the\n* eigenvalue is complex, then WR1=WR2 is SCALE1 times the real\n* part of the eigenvalues.\n*\n* WR2 (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WR2 is SCALE2 times the\n* other eigenvalue. If the eigenvalue is complex, then\n* WR1=WR2 is SCALE1 times the real part of the eigenvalues.\n*\n* WI (output) DOUBLE PRECISION\n* If the eigenvalue is real, then WI is zero. If the\n* eigenvalue is complex, then WI is SCALE1 times the imaginary\n* part of the eigenvalues. WI will always be non-negative.\n*\n\n* =====================================================================\n*\n\n");
34
34
  return Qnil;
35
35
  }
36
36
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -23,7 +23,7 @@ rblapack_dlag2s(int argc, VALUE *argv, VALUE self){
23
23
  argc--;
24
24
  rblapack_options = argv[argc];
25
25
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
26
- printf("%s\n", "USAGE:\n sa, info = NumRu::Lapack.dlag2s( m, a, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAG2S( M, N, A, LDA, SA, LDSA, INFO )\n\n* Purpose\n* =======\n*\n* DLAG2S converts a DOUBLE PRECISION matrix, SA, to a SINGLE\n* PRECISION matrix, A.\n*\n* RMAX is the overflow for the SINGLE PRECISION arithmetic\n* DLAG2S checks that all the entries of A are between -RMAX and\n* RMAX. If not the convertion is aborted and a flag is raised.\n*\n* This is an auxiliary routine so there is no argument checking.\n*\n\n* Arguments\n* =========\n*\n* M (input) INTEGER\n* The number of lines of the matrix A. M >= 0.\n*\n* N (input) INTEGER\n* The number of columns of the matrix A. N >= 0.\n*\n* A (input) DOUBLE PRECISION array, dimension (LDA,N)\n* On entry, the M-by-N coefficient matrix A.\n*\n* LDA (input) INTEGER\n* The leading dimension of the array A. LDA >= max(1,M).\n*\n* SA (output) REAL array, dimension (LDSA,N)\n* On exit, if INFO=0, the M-by-N coefficient matrix SA; if\n* INFO>0, the content of SA is unspecified.\n*\n* LDSA (input) INTEGER\n* The leading dimension of the array SA. LDSA >= max(1,M).\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* = 1: an entry of the matrix A is greater than the SINGLE\n* PRECISION overflow threshold, in this case, the content\n* of SA in exit is unspecified.\n*\n* =========\n*\n* .. Local Scalars ..\n INTEGER I, J\n DOUBLE PRECISION RMAX\n* ..\n* .. External Functions ..\n REAL SLAMCH\n EXTERNAL SLAMCH\n* ..\n\n");
26
+ printf("%s\n", "USAGE:\n sa, info = NumRu::Lapack.dlag2s( m, a, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLAG2S( M, N, A, LDA, SA, LDSA, INFO )\n\n* Purpose\n* =======\n*\n* DLAG2S converts a DOUBLE PRECISION matrix, SA, to a SINGLE\n* PRECISION matrix, A.\n*\n* RMAX is the overflow for the SINGLE PRECISION arithmetic\n* DLAG2S checks that all the entries of A are between -RMAX and\n* RMAX. If not the conversion is aborted and a flag is raised.\n*\n* This is an auxiliary routine so there is no argument checking.\n*\n\n* Arguments\n* =========\n*\n* M (input) INTEGER\n* The number of lines of the matrix A. M >= 0.\n*\n* N (input) INTEGER\n* The number of columns of the matrix A. N >= 0.\n*\n* A (input) DOUBLE PRECISION array, dimension (LDA,N)\n* On entry, the M-by-N coefficient matrix A.\n*\n* LDA (input) INTEGER\n* The leading dimension of the array A. LDA >= max(1,M).\n*\n* SA (output) REAL array, dimension (LDSA,N)\n* On exit, if INFO=0, the M-by-N coefficient matrix SA; if\n* INFO>0, the content of SA is unspecified.\n*\n* LDSA (input) INTEGER\n* The leading dimension of the array SA. LDSA >= max(1,M).\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* = 1: an entry of the matrix A is greater than the SINGLE\n* PRECISION overflow threshold, in this case, the content\n* of SA in exit is unspecified.\n*\n* =========\n*\n* .. Local Scalars ..\n INTEGER I, J\n DOUBLE PRECISION RMAX\n* ..\n* .. External Functions ..\n REAL SLAMCH\n EXTERNAL SLAMCH\n* ..\n\n");
27
27
  return Qnil;
28
28
  }
29
29
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -48,7 +48,7 @@ rblapack_dlarrf(int argc, VALUE *argv, VALUE self){
48
48
  argc--;
49
49
  rblapack_options = argv[argc];
50
50
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
51
- printf("%s\n", "USAGE:\n sigma, dplus, lplus, info, wgap = NumRu::Lapack.dlarrf( d, l, ld, clstrt, clend, w, wgap, werr, spdiam, clgapl, clgapr, pivmin, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLARRF( N, D, L, LD, CLSTRT, CLEND, W, WGAP, WERR, SPDIAM, CLGAPL, CLGAPR, PIVMIN, SIGMA, DPLUS, LPLUS, WORK, INFO )\n\n* Purpose\n* =======\n*\n* Given the initial representation L D L^T and its cluster of close\n* eigenvalues (in a relative measure), W( CLSTRT ), W( CLSTRT+1 ), ...\n* W( CLEND ), DLARRF finds a new relatively robust representation\n* L D L^T - SIGMA I = L(+) D(+) L(+)^T such that at least one of the\n* eigenvalues of L(+) D(+) L(+)^T is relatively isolated.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix (subblock, if the matrix splitted).\n*\n* D (input) DOUBLE PRECISION array, dimension (N)\n* The N diagonal elements of the diagonal matrix D.\n*\n* L (input) DOUBLE PRECISION array, dimension (N-1)\n* The (N-1) subdiagonal elements of the unit bidiagonal\n* matrix L.\n*\n* LD (input) DOUBLE PRECISION array, dimension (N-1)\n* The (N-1) elements L(i)*D(i).\n*\n* CLSTRT (input) INTEGER\n* The index of the first eigenvalue in the cluster.\n*\n* CLEND (input) INTEGER\n* The index of the last eigenvalue in the cluster.\n*\n* W (input) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* The eigenvalue APPROXIMATIONS of L D L^T in ascending order.\n* W( CLSTRT ) through W( CLEND ) form the cluster of relatively\n* close eigenalues.\n*\n* WGAP (input/output) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* The separation from the right neighbor eigenvalue in W.\n*\n* WERR (input) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* WERR contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue APPROXIMATION in W\n*\n* SPDIAM (input) DOUBLE PRECISION\n* estimate of the spectral diameter obtained from the\n* Gerschgorin intervals\n*\n* CLGAPL (input) DOUBLE PRECISION\n*\n* CLGAPR (input) DOUBLE PRECISION\n* absolute gap on each end of the cluster.\n* Set by the calling routine to protect against shifts too close\n* to eigenvalues outside the cluster.\n*\n* PIVMIN (input) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* SIGMA (output) DOUBLE PRECISION\n* The shift used to form L(+) D(+) L(+)^T.\n*\n* DPLUS (output) DOUBLE PRECISION array, dimension (N)\n* The N diagonal elements of the diagonal matrix D(+).\n*\n* LPLUS (output) DOUBLE PRECISION array, dimension (N-1)\n* The first (N-1) elements of LPLUS contain the subdiagonal\n* elements of the unit bidiagonal matrix L(+).\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (2*N)\n* Workspace.\n*\n* INFO (output) INTEGER\n* Signals processing OK (=0) or failure (=1)\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
51
+ printf("%s\n", "USAGE:\n sigma, dplus, lplus, info, wgap = NumRu::Lapack.dlarrf( d, l, ld, clstrt, clend, w, wgap, werr, spdiam, clgapl, clgapr, pivmin, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLARRF( N, D, L, LD, CLSTRT, CLEND, W, WGAP, WERR, SPDIAM, CLGAPL, CLGAPR, PIVMIN, SIGMA, DPLUS, LPLUS, WORK, INFO )\n\n* Purpose\n* =======\n*\n* Given the initial representation L D L^T and its cluster of close\n* eigenvalues (in a relative measure), W( CLSTRT ), W( CLSTRT+1 ), ...\n* W( CLEND ), DLARRF finds a new relatively robust representation\n* L D L^T - SIGMA I = L(+) D(+) L(+)^T such that at least one of the\n* eigenvalues of L(+) D(+) L(+)^T is relatively isolated.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix (subblock, if the matrix split).\n*\n* D (input) DOUBLE PRECISION array, dimension (N)\n* The N diagonal elements of the diagonal matrix D.\n*\n* L (input) DOUBLE PRECISION array, dimension (N-1)\n* The (N-1) subdiagonal elements of the unit bidiagonal\n* matrix L.\n*\n* LD (input) DOUBLE PRECISION array, dimension (N-1)\n* The (N-1) elements L(i)*D(i).\n*\n* CLSTRT (input) INTEGER\n* The index of the first eigenvalue in the cluster.\n*\n* CLEND (input) INTEGER\n* The index of the last eigenvalue in the cluster.\n*\n* W (input) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* The eigenvalue APPROXIMATIONS of L D L^T in ascending order.\n* W( CLSTRT ) through W( CLEND ) form the cluster of relatively\n* close eigenalues.\n*\n* WGAP (input/output) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* The separation from the right neighbor eigenvalue in W.\n*\n* WERR (input) DOUBLE PRECISION array, dimension\n* dimension is >= (CLEND-CLSTRT+1)\n* WERR contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue APPROXIMATION in W\n*\n* SPDIAM (input) DOUBLE PRECISION\n* estimate of the spectral diameter obtained from the\n* Gerschgorin intervals\n*\n* CLGAPL (input) DOUBLE PRECISION\n*\n* CLGAPR (input) DOUBLE PRECISION\n* absolute gap on each end of the cluster.\n* Set by the calling routine to protect against shifts too close\n* to eigenvalues outside the cluster.\n*\n* PIVMIN (input) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* SIGMA (output) DOUBLE PRECISION\n* The shift used to form L(+) D(+) L(+)^T.\n*\n* DPLUS (output) DOUBLE PRECISION array, dimension (N)\n* The N diagonal elements of the diagonal matrix D(+).\n*\n* LPLUS (output) DOUBLE PRECISION array, dimension (N-1)\n* The first (N-1) elements of LPLUS contain the subdiagonal\n* elements of the unit bidiagonal matrix L(+).\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (2*N)\n* Workspace.\n*\n* INFO (output) INTEGER\n* Signals processing OK (=0) or failure (=1)\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
52
52
  return Qnil;
53
53
  }
54
54
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -68,7 +68,7 @@ rblapack_dlarrv(int argc, VALUE *argv, VALUE self){
68
68
  argc--;
69
69
  rblapack_options = argv[argc];
70
70
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
71
- printf("%s\n", "USAGE:\n z, isuppz, info, d, l, w, werr, wgap = NumRu::Lapack.dlarrv( vl, vu, d, l, pivmin, isplit, m, dol, dou, minrgp, rtol1, rtol2, w, werr, wgap, iblock, indexw, gers, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLARRV( N, VL, VU, D, L, PIVMIN, ISPLIT, M, DOL, DOU, MINRGP, RTOL1, RTOL2, W, WERR, WGAP, IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLARRV computes the eigenvectors of the tridiagonal matrix\n* T = L D L^T given L, D and APPROXIMATIONS to the eigenvalues of L D L^T.\n* The input eigenvalues should have been computed by DLARRE.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix. N >= 0.\n*\n* VL (input) DOUBLE PRECISION\n* VU (input) DOUBLE PRECISION\n* Lower and upper bounds of the interval that contains the desired\n* eigenvalues. VL < VU. Needed to compute gaps on the left or right\n* end of the extremal eigenvalues in the desired RANGE.\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the N diagonal elements of the diagonal matrix D.\n* On exit, D may be overwritten.\n*\n* L (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the (N-1) subdiagonal elements of the unit\n* bidiagonal matrix L are in elements 1 to N-1 of L\n* (if the matrix is not splitted.) At the end of each block\n* is stored the corresponding shift as given by DLARRE.\n* On exit, L is overwritten.\n*\n* PIVMIN (input) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* ISPLIT (input) INTEGER array, dimension (N)\n* The splitting points, at which T breaks up into blocks.\n* The first block consists of rows/columns 1 to\n* ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1\n* through ISPLIT( 2 ), etc.\n*\n* M (input) INTEGER\n* The total number of input eigenvalues. 0 <= M <= N.\n*\n* DOL (input) INTEGER\n* DOU (input) INTEGER\n* If the user wants to compute only selected eigenvectors from all\n* the eigenvalues supplied, he can specify an index range DOL:DOU.\n* Or else the setting DOL=1, DOU=M should be applied.\n* Note that DOL and DOU refer to the order in which the eigenvalues\n* are stored in W.\n* If the user wants to compute only selected eigenpairs, then\n* the columns DOL-1 to DOU+1 of the eigenvector space Z contain the\n* computed eigenvectors. All other columns of Z are set to zero.\n*\n* MINRGP (input) DOUBLE PRECISION\n*\n* RTOL1 (input) DOUBLE PRECISION\n* RTOL2 (input) DOUBLE PRECISION\n* Parameters for bisection.\n* An interval [LEFT,RIGHT] has converged if\n* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )\n*\n* W (input/output) DOUBLE PRECISION array, dimension (N)\n* The first M elements of W contain the APPROXIMATE eigenvalues for\n* which eigenvectors are to be computed. The eigenvalues\n* should be grouped by split-off block and ordered from\n* smallest to largest within the block ( The output array\n* W from DLARRE is expected here ). Furthermore, they are with\n* respect to the shift of the corresponding root representation\n* for their block. On exit, W holds the eigenvalues of the\n* UNshifted matrix.\n*\n* WERR (input/output) DOUBLE PRECISION array, dimension (N)\n* The first M elements contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue in W\n*\n* WGAP (input/output) DOUBLE PRECISION array, dimension (N)\n* The separation from the right neighbor eigenvalue in W.\n*\n* IBLOCK (input) INTEGER array, dimension (N)\n* The indices of the blocks (submatrices) associated with the\n* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue\n* W(i) belongs to the first block from the top, =2 if W(i)\n* belongs to the second block, etc.\n*\n* INDEXW (input) INTEGER array, dimension (N)\n* The indices of the eigenvalues within each block (submatrix);\n* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the\n* i-th eigenvalue W(i) is the 10-th eigenvalue in the second block.\n*\n* GERS (input) DOUBLE PRECISION array, dimension (2*N)\n* The N Gerschgorin intervals (the i-th Gerschgorin interval\n* is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should\n* be computed from the original UNshifted matrix.\n*\n* Z (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M) )\n* If INFO = 0, the first M columns of Z contain the\n* orthonormal eigenvectors of the matrix T\n* corresponding to the input eigenvalues, with the i-th\n* column of Z holding the eigenvector associated with W(i).\n* Note: the user must ensure that at least max(1,M) columns are\n* supplied in the array Z.\n*\n* LDZ (input) INTEGER\n* The leading dimension of the array Z. LDZ >= 1, and if\n* JOBZ = 'V', LDZ >= max(1,N).\n*\n* ISUPPZ (output) INTEGER array, dimension ( 2*max(1,M) )\n* The support of the eigenvectors in Z, i.e., the indices\n* indicating the nonzero elements in Z. The I-th eigenvector\n* is nonzero only in elements ISUPPZ( 2*I-1 ) through\n* ISUPPZ( 2*I ).\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (12*N)\n*\n* IWORK (workspace) INTEGER array, dimension (7*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit\n*\n* > 0: A problem occured in DLARRV.\n* < 0: One of the called subroutines signaled an internal problem.\n* Needs inspection of the corresponding parameter IINFO\n* for further information.\n*\n* =-1: Problem in DLARRB when refining a child's eigenvalues.\n* =-2: Problem in DLARRF when computing the RRR of a child.\n* When a child is inside a tight cluster, it can be difficult\n* to find an RRR. A partial remedy from the user's point of\n* view is to make the parameter MINRGP smaller and recompile.\n* However, as the orthogonality of the computed vectors is\n* proportional to 1/MINRGP, the user should be aware that\n* he might be trading in precision when he decreases MINRGP.\n* =-3: Problem in DLARRB when refining a single eigenvalue\n* after the Rayleigh correction was rejected.\n* = 5: The Rayleigh Quotient Iteration failed to converge to\n* full accuracy in MAXITR steps.\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
71
+ printf("%s\n", "USAGE:\n z, isuppz, info, d, l, w, werr, wgap = NumRu::Lapack.dlarrv( vl, vu, d, l, pivmin, isplit, m, dol, dou, minrgp, rtol1, rtol2, w, werr, wgap, iblock, indexw, gers, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLARRV( N, VL, VU, D, L, PIVMIN, ISPLIT, M, DOL, DOU, MINRGP, RTOL1, RTOL2, W, WERR, WGAP, IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLARRV computes the eigenvectors of the tridiagonal matrix\n* T = L D L^T given L, D and APPROXIMATIONS to the eigenvalues of L D L^T.\n* The input eigenvalues should have been computed by DLARRE.\n*\n\n* Arguments\n* =========\n*\n* N (input) INTEGER\n* The order of the matrix. N >= 0.\n*\n* VL (input) DOUBLE PRECISION\n* VU (input) DOUBLE PRECISION\n* Lower and upper bounds of the interval that contains the desired\n* eigenvalues. VL < VU. Needed to compute gaps on the left or right\n* end of the extremal eigenvalues in the desired RANGE.\n*\n* D (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the N diagonal elements of the diagonal matrix D.\n* On exit, D may be overwritten.\n*\n* L (input/output) DOUBLE PRECISION array, dimension (N)\n* On entry, the (N-1) subdiagonal elements of the unit\n* bidiagonal matrix L are in elements 1 to N-1 of L\n* (if the matrix is not split.) At the end of each block\n* is stored the corresponding shift as given by DLARRE.\n* On exit, L is overwritten.\n*\n* PIVMIN (input) DOUBLE PRECISION\n* The minimum pivot allowed in the Sturm sequence.\n*\n* ISPLIT (input) INTEGER array, dimension (N)\n* The splitting points, at which T breaks up into blocks.\n* The first block consists of rows/columns 1 to\n* ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1\n* through ISPLIT( 2 ), etc.\n*\n* M (input) INTEGER\n* The total number of input eigenvalues. 0 <= M <= N.\n*\n* DOL (input) INTEGER\n* DOU (input) INTEGER\n* If the user wants to compute only selected eigenvectors from all\n* the eigenvalues supplied, he can specify an index range DOL:DOU.\n* Or else the setting DOL=1, DOU=M should be applied.\n* Note that DOL and DOU refer to the order in which the eigenvalues\n* are stored in W.\n* If the user wants to compute only selected eigenpairs, then\n* the columns DOL-1 to DOU+1 of the eigenvector space Z contain the\n* computed eigenvectors. All other columns of Z are set to zero.\n*\n* MINRGP (input) DOUBLE PRECISION\n*\n* RTOL1 (input) DOUBLE PRECISION\n* RTOL2 (input) DOUBLE PRECISION\n* Parameters for bisection.\n* An interval [LEFT,RIGHT] has converged if\n* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )\n*\n* W (input/output) DOUBLE PRECISION array, dimension (N)\n* The first M elements of W contain the APPROXIMATE eigenvalues for\n* which eigenvectors are to be computed. The eigenvalues\n* should be grouped by split-off block and ordered from\n* smallest to largest within the block ( The output array\n* W from DLARRE is expected here ). Furthermore, they are with\n* respect to the shift of the corresponding root representation\n* for their block. On exit, W holds the eigenvalues of the\n* UNshifted matrix.\n*\n* WERR (input/output) DOUBLE PRECISION array, dimension (N)\n* The first M elements contain the semiwidth of the uncertainty\n* interval of the corresponding eigenvalue in W\n*\n* WGAP (input/output) DOUBLE PRECISION array, dimension (N)\n* The separation from the right neighbor eigenvalue in W.\n*\n* IBLOCK (input) INTEGER array, dimension (N)\n* The indices of the blocks (submatrices) associated with the\n* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue\n* W(i) belongs to the first block from the top, =2 if W(i)\n* belongs to the second block, etc.\n*\n* INDEXW (input) INTEGER array, dimension (N)\n* The indices of the eigenvalues within each block (submatrix);\n* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the\n* i-th eigenvalue W(i) is the 10-th eigenvalue in the second block.\n*\n* GERS (input) DOUBLE PRECISION array, dimension (2*N)\n* The N Gerschgorin intervals (the i-th Gerschgorin interval\n* is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should\n* be computed from the original UNshifted matrix.\n*\n* Z (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M) )\n* If INFO = 0, the first M columns of Z contain the\n* orthonormal eigenvectors of the matrix T\n* corresponding to the input eigenvalues, with the i-th\n* column of Z holding the eigenvector associated with W(i).\n* Note: the user must ensure that at least max(1,M) columns are\n* supplied in the array Z.\n*\n* LDZ (input) INTEGER\n* The leading dimension of the array Z. LDZ >= 1, and if\n* JOBZ = 'V', LDZ >= max(1,N).\n*\n* ISUPPZ (output) INTEGER array, dimension ( 2*max(1,M) )\n* The support of the eigenvectors in Z, i.e., the indices\n* indicating the nonzero elements in Z. The I-th eigenvector\n* is nonzero only in elements ISUPPZ( 2*I-1 ) through\n* ISUPPZ( 2*I ).\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension (12*N)\n*\n* IWORK (workspace) INTEGER array, dimension (7*N)\n*\n* INFO (output) INTEGER\n* = 0: successful exit\n*\n* > 0: A problem occured in DLARRV.\n* < 0: One of the called subroutines signaled an internal problem.\n* Needs inspection of the corresponding parameter IINFO\n* for further information.\n*\n* =-1: Problem in DLARRB when refining a child's eigenvalues.\n* =-2: Problem in DLARRF when computing the RRR of a child.\n* When a child is inside a tight cluster, it can be difficult\n* to find an RRR. A partial remedy from the user's point of\n* view is to make the parameter MINRGP smaller and recompile.\n* However, as the orthogonality of the computed vectors is\n* proportional to 1/MINRGP, the user should be aware that\n* he might be trading in precision when he decreases MINRGP.\n* =-3: Problem in DLARRB when refining a single eigenvalue\n* after the Rayleigh correction was rejected.\n* = 5: The Rayleigh Quotient Iteration failed to converge to\n* full accuracy in MAXITR steps.\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Beresford Parlett, University of California, Berkeley, USA\n* Jim Demmel, University of California, Berkeley, USA\n* Inderjit Dhillon, University of Texas, Austin, USA\n* Osni Marques, LBNL/NERSC, USA\n* Christof Voemel, University of California, Berkeley, USA\n*\n* =====================================================================\n*\n\n");
72
72
  return Qnil;
73
73
  }
74
74
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -44,7 +44,7 @@ rblapack_dlasd1(int argc, VALUE *argv, VALUE self){
44
44
  argc--;
45
45
  rblapack_options = argv[argc];
46
46
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
47
- printf("%s\n", "USAGE:\n idxq, info, d, alpha, beta, u, vt = NumRu::Lapack.dlasd1( nl, nr, sqre, d, alpha, beta, u, vt, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLASD1( NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO )\n\n* Purpose\n* =======\n*\n* DLASD1 computes the SVD of an upper bidiagonal N-by-M matrix B,\n* where N = NL + NR + 1 and M = N + SQRE. DLASD1 is called from DLASD0.\n*\n* A related subroutine DLASD7 handles the case in which the singular\n* values (and the singular vectors in factored form) are desired.\n*\n* DLASD1 computes the SVD as follows:\n*\n* ( D1(in) 0 0 0 )\n* B = U(in) * ( Z1' a Z2' b ) * VT(in)\n* ( 0 0 D2(in) 0 )\n*\n* = U(out) * ( D(out) 0) * VT(out)\n*\n* where Z' = (Z1' a Z2' b) = u' VT', and u is a vector of dimension M\n* with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros\n* elsewhere; and the entry b is empty if SQRE = 0.\n*\n* The left singular vectors of the original matrix are stored in U, and\n* the transpose of the right singular vectors are stored in VT, and the\n* singular values are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple singular values or when there are zeros in\n* the Z vector. For each such occurence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLASD2.\n*\n* The second stage consists of calculating the updated\n* singular values. This is done by finding the square roots of the\n* roots of the secular equation via the routine DLASD4 (as called\n* by DLASD3). This routine also calculates the singular vectors of\n* the current problem.\n*\n* The final stage consists of computing the updated singular vectors\n* directly using the updated singular values. The singular vectors\n* for the current problem are multiplied with the singular vectors\n* from the overall problem.\n*\n\n* Arguments\n* =========\n*\n* NL (input) INTEGER\n* The row dimension of the upper block. NL >= 1.\n*\n* NR (input) INTEGER\n* The row dimension of the lower block. NR >= 1.\n*\n* SQRE (input) INTEGER\n* = 0: the lower block is an NR-by-NR square matrix.\n* = 1: the lower block is an NR-by-(NR+1) rectangular matrix.\n*\n* The bidiagonal matrix has row dimension N = NL + NR + 1,\n* and column dimension M = N + SQRE.\n*\n* D (input/output) DOUBLE PRECISION array,\n* dimension (N = NL+NR+1).\n* On entry D(1:NL,1:NL) contains the singular values of the\n* upper block; and D(NL+2:N) contains the singular values of\n* the lower block. On exit D(1:N) contains the singular values\n* of the modified matrix.\n*\n* ALPHA (input/output) DOUBLE PRECISION\n* Contains the diagonal element associated with the added row.\n*\n* BETA (input/output) DOUBLE PRECISION\n* Contains the off-diagonal element associated with the added\n* row.\n*\n* U (input/output) DOUBLE PRECISION array, dimension(LDU,N)\n* On entry U(1:NL, 1:NL) contains the left singular vectors of\n* the upper block; U(NL+2:N, NL+2:N) contains the left singular\n* vectors of the lower block. On exit U contains the left\n* singular vectors of the bidiagonal matrix.\n*\n* LDU (input) INTEGER\n* The leading dimension of the array U. LDU >= max( 1, N ).\n*\n* VT (input/output) DOUBLE PRECISION array, dimension(LDVT,M)\n* where M = N + SQRE.\n* On entry VT(1:NL+1, 1:NL+1)' contains the right singular\n* vectors of the upper block; VT(NL+2:M, NL+2:M)' contains\n* the right singular vectors of the lower block. On exit\n* VT' contains the right singular vectors of the\n* bidiagonal matrix.\n*\n* LDVT (input) INTEGER\n* The leading dimension of the array VT. LDVT >= max( 1, M ).\n*\n* IDXQ (output) INTEGER array, dimension(N)\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order, i.e.\n* D( IDXQ( I = 1, N ) ) will be in ascending order.\n*\n* IWORK (workspace) INTEGER array, dimension( 4 * N )\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension( 3*M**2 + 2*M )\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, a singular value did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Ming Gu and Huan Ren, Computer Science Division, University of\n* California at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
47
+ printf("%s\n", "USAGE:\n idxq, info, d, alpha, beta, u, vt = NumRu::Lapack.dlasd1( nl, nr, sqre, d, alpha, beta, u, vt, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLASD1( NL, NR, SQRE, D, ALPHA, BETA, U, LDU, VT, LDVT, IDXQ, IWORK, WORK, INFO )\n\n* Purpose\n* =======\n*\n* DLASD1 computes the SVD of an upper bidiagonal N-by-M matrix B,\n* where N = NL + NR + 1 and M = N + SQRE. DLASD1 is called from DLASD0.\n*\n* A related subroutine DLASD7 handles the case in which the singular\n* values (and the singular vectors in factored form) are desired.\n*\n* DLASD1 computes the SVD as follows:\n*\n* ( D1(in) 0 0 0 )\n* B = U(in) * ( Z1' a Z2' b ) * VT(in)\n* ( 0 0 D2(in) 0 )\n*\n* = U(out) * ( D(out) 0) * VT(out)\n*\n* where Z' = (Z1' a Z2' b) = u' VT', and u is a vector of dimension M\n* with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros\n* elsewhere; and the entry b is empty if SQRE = 0.\n*\n* The left singular vectors of the original matrix are stored in U, and\n* the transpose of the right singular vectors are stored in VT, and the\n* singular values are in D. The algorithm consists of three stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple singular values or when there are zeros in\n* the Z vector. For each such occurrence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLASD2.\n*\n* The second stage consists of calculating the updated\n* singular values. This is done by finding the square roots of the\n* roots of the secular equation via the routine DLASD4 (as called\n* by DLASD3). This routine also calculates the singular vectors of\n* the current problem.\n*\n* The final stage consists of computing the updated singular vectors\n* directly using the updated singular values. The singular vectors\n* for the current problem are multiplied with the singular vectors\n* from the overall problem.\n*\n\n* Arguments\n* =========\n*\n* NL (input) INTEGER\n* The row dimension of the upper block. NL >= 1.\n*\n* NR (input) INTEGER\n* The row dimension of the lower block. NR >= 1.\n*\n* SQRE (input) INTEGER\n* = 0: the lower block is an NR-by-NR square matrix.\n* = 1: the lower block is an NR-by-(NR+1) rectangular matrix.\n*\n* The bidiagonal matrix has row dimension N = NL + NR + 1,\n* and column dimension M = N + SQRE.\n*\n* D (input/output) DOUBLE PRECISION array,\n* dimension (N = NL+NR+1).\n* On entry D(1:NL,1:NL) contains the singular values of the\n* upper block; and D(NL+2:N) contains the singular values of\n* the lower block. On exit D(1:N) contains the singular values\n* of the modified matrix.\n*\n* ALPHA (input/output) DOUBLE PRECISION\n* Contains the diagonal element associated with the added row.\n*\n* BETA (input/output) DOUBLE PRECISION\n* Contains the off-diagonal element associated with the added\n* row.\n*\n* U (input/output) DOUBLE PRECISION array, dimension(LDU,N)\n* On entry U(1:NL, 1:NL) contains the left singular vectors of\n* the upper block; U(NL+2:N, NL+2:N) contains the left singular\n* vectors of the lower block. On exit U contains the left\n* singular vectors of the bidiagonal matrix.\n*\n* LDU (input) INTEGER\n* The leading dimension of the array U. LDU >= max( 1, N ).\n*\n* VT (input/output) DOUBLE PRECISION array, dimension(LDVT,M)\n* where M = N + SQRE.\n* On entry VT(1:NL+1, 1:NL+1)' contains the right singular\n* vectors of the upper block; VT(NL+2:M, NL+2:M)' contains\n* the right singular vectors of the lower block. On exit\n* VT' contains the right singular vectors of the\n* bidiagonal matrix.\n*\n* LDVT (input) INTEGER\n* The leading dimension of the array VT. LDVT >= max( 1, M ).\n*\n* IDXQ (output) INTEGER array, dimension(N)\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order, i.e.\n* D( IDXQ( I = 1, N ) ) will be in ascending order.\n*\n* IWORK (workspace) INTEGER array, dimension( 4 * N )\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension( 3*M**2 + 2*M )\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, a singular value did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Ming Gu and Huan Ren, Computer Science Division, University of\n* California at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
48
48
  return Qnil;
49
49
  }
50
50
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -68,7 +68,7 @@ rblapack_dlasd6(int argc, VALUE *argv, VALUE self){
68
68
  argc--;
69
69
  rblapack_options = argv[argc];
70
70
  if (rb_hash_aref(rblapack_options, sHelp) == Qtrue) {
71
- printf("%s\n", "USAGE:\n idxq, perm, givptr, givcol, givnum, poles, difl, difr, z, k, c, s, info, d, vf, vl, alpha, beta = NumRu::Lapack.dlasd6( icompq, nl, nr, sqre, d, vf, vl, alpha, beta, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLASD6( ICOMPQ, NL, NR, SQRE, D, VF, VL, ALPHA, BETA, IDXQ, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, POLES, DIFL, DIFR, Z, K, C, S, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLASD6 computes the SVD of an updated upper bidiagonal matrix B\n* obtained by merging two smaller ones by appending a row. This\n* routine is used only for the problem which requires all singular\n* values and optionally singular vector matrices in factored form.\n* B is an N-by-M matrix with N = NL + NR + 1 and M = N + SQRE.\n* A related subroutine, DLASD1, handles the case in which all singular\n* values and singular vectors of the bidiagonal matrix are desired.\n*\n* DLASD6 computes the SVD as follows:\n*\n* ( D1(in) 0 0 0 )\n* B = U(in) * ( Z1' a Z2' b ) * VT(in)\n* ( 0 0 D2(in) 0 )\n*\n* = U(out) * ( D(out) 0) * VT(out)\n*\n* where Z' = (Z1' a Z2' b) = u' VT', and u is a vector of dimension M\n* with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros\n* elsewhere; and the entry b is empty if SQRE = 0.\n*\n* The singular values of B can be computed using D1, D2, the first\n* components of all the right singular vectors of the lower block, and\n* the last components of all the right singular vectors of the upper\n* block. These components are stored and updated in VF and VL,\n* respectively, in DLASD6. Hence U and VT are not explicitly\n* referenced.\n*\n* The singular values are stored in D. The algorithm consists of two\n* stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple singular values or if there is a zero\n* in the Z vector. For each such occurence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLASD7.\n*\n* The second stage consists of calculating the updated\n* singular values. This is done by finding the roots of the\n* secular equation via the routine DLASD4 (as called by DLASD8).\n* This routine also updates VF and VL and computes the distances\n* between the updated singular values and the old singular\n* values.\n*\n* DLASD6 is called from DLASDA.\n*\n\n* Arguments\n* =========\n*\n* ICOMPQ (input) INTEGER\n* Specifies whether singular vectors are to be computed in\n* factored form:\n* = 0: Compute singular values only.\n* = 1: Compute singular vectors in factored form as well.\n*\n* NL (input) INTEGER\n* The row dimension of the upper block. NL >= 1.\n*\n* NR (input) INTEGER\n* The row dimension of the lower block. NR >= 1.\n*\n* SQRE (input) INTEGER\n* = 0: the lower block is an NR-by-NR square matrix.\n* = 1: the lower block is an NR-by-(NR+1) rectangular matrix.\n*\n* The bidiagonal matrix has row dimension N = NL + NR + 1,\n* and column dimension M = N + SQRE.\n*\n* D (input/output) DOUBLE PRECISION array, dimension ( NL+NR+1 ).\n* On entry D(1:NL,1:NL) contains the singular values of the\n* upper block, and D(NL+2:N) contains the singular values\n* of the lower block. On exit D(1:N) contains the singular\n* values of the modified matrix.\n*\n* VF (input/output) DOUBLE PRECISION array, dimension ( M )\n* On entry, VF(1:NL+1) contains the first components of all\n* right singular vectors of the upper block; and VF(NL+2:M)\n* contains the first components of all right singular vectors\n* of the lower block. On exit, VF contains the first components\n* of all right singular vectors of the bidiagonal matrix.\n*\n* VL (input/output) DOUBLE PRECISION array, dimension ( M )\n* On entry, VL(1:NL+1) contains the last components of all\n* right singular vectors of the upper block; and VL(NL+2:M)\n* contains the last components of all right singular vectors of\n* the lower block. On exit, VL contains the last components of\n* all right singular vectors of the bidiagonal matrix.\n*\n* ALPHA (input/output) DOUBLE PRECISION\n* Contains the diagonal element associated with the added row.\n*\n* BETA (input/output) DOUBLE PRECISION\n* Contains the off-diagonal element associated with the added\n* row.\n*\n* IDXQ (output) INTEGER array, dimension ( N )\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order, i.e.\n* D( IDXQ( I = 1, N ) ) will be in ascending order.\n*\n* PERM (output) INTEGER array, dimension ( N )\n* The permutations (from deflation and sorting) to be applied\n* to each block. Not referenced if ICOMPQ = 0.\n*\n* GIVPTR (output) INTEGER\n* The number of Givens rotations which took place in this\n* subproblem. Not referenced if ICOMPQ = 0.\n*\n* GIVCOL (output) INTEGER array, dimension ( LDGCOL, 2 )\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation. Not referenced if ICOMPQ = 0.\n*\n* LDGCOL (input) INTEGER\n* leading dimension of GIVCOL, must be at least N.\n*\n* GIVNUM (output) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )\n* Each number indicates the C or S value to be used in the\n* corresponding Givens rotation. Not referenced if ICOMPQ = 0.\n*\n* LDGNUM (input) INTEGER\n* The leading dimension of GIVNUM and POLES, must be at least N.\n*\n* POLES (output) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )\n* On exit, POLES(1,*) is an array containing the new singular\n* values obtained from solving the secular equation, and\n* POLES(2,*) is an array containing the poles in the secular\n* equation. Not referenced if ICOMPQ = 0.\n*\n* DIFL (output) DOUBLE PRECISION array, dimension ( N )\n* On exit, DIFL(I) is the distance between I-th updated\n* (undeflated) singular value and the I-th (undeflated) old\n* singular value.\n*\n* DIFR (output) DOUBLE PRECISION array,\n* dimension ( LDGNUM, 2 ) if ICOMPQ = 1 and\n* dimension ( N ) if ICOMPQ = 0.\n* On exit, DIFR(I, 1) is the distance between I-th updated\n* (undeflated) singular value and the I+1-th (undeflated) old\n* singular value.\n*\n* If ICOMPQ = 1, DIFR(1:K,2) is an array containing the\n* normalizing factors for the right singular vector matrix.\n*\n* See DLASD8 for details on DIFL and DIFR.\n*\n* Z (output) DOUBLE PRECISION array, dimension ( M )\n* The first elements of this array contain the components\n* of the deflation-adjusted updating row vector.\n*\n* K (output) INTEGER\n* Contains the dimension of the non-deflated matrix,\n* This is the order of the related secular equation. 1 <= K <=N.\n*\n* C (output) DOUBLE PRECISION\n* C contains garbage if SQRE =0 and the C-value of a Givens\n* rotation related to the right null space if SQRE = 1.\n*\n* S (output) DOUBLE PRECISION\n* S contains garbage if SQRE =0 and the S-value of a Givens\n* rotation related to the right null space if SQRE = 1.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension ( 4 * M )\n*\n* IWORK (workspace) INTEGER array, dimension ( 3 * N )\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, a singular value did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Ming Gu and Huan Ren, Computer Science Division, University of\n* California at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
71
+ printf("%s\n", "USAGE:\n idxq, perm, givptr, givcol, givnum, poles, difl, difr, z, k, c, s, info, d, vf, vl, alpha, beta = NumRu::Lapack.dlasd6( icompq, nl, nr, sqre, d, vf, vl, alpha, beta, [:usage => usage, :help => help])\n\n\nFORTRAN MANUAL\n SUBROUTINE DLASD6( ICOMPQ, NL, NR, SQRE, D, VF, VL, ALPHA, BETA, IDXQ, PERM, GIVPTR, GIVCOL, LDGCOL, GIVNUM, LDGNUM, POLES, DIFL, DIFR, Z, K, C, S, WORK, IWORK, INFO )\n\n* Purpose\n* =======\n*\n* DLASD6 computes the SVD of an updated upper bidiagonal matrix B\n* obtained by merging two smaller ones by appending a row. This\n* routine is used only for the problem which requires all singular\n* values and optionally singular vector matrices in factored form.\n* B is an N-by-M matrix with N = NL + NR + 1 and M = N + SQRE.\n* A related subroutine, DLASD1, handles the case in which all singular\n* values and singular vectors of the bidiagonal matrix are desired.\n*\n* DLASD6 computes the SVD as follows:\n*\n* ( D1(in) 0 0 0 )\n* B = U(in) * ( Z1' a Z2' b ) * VT(in)\n* ( 0 0 D2(in) 0 )\n*\n* = U(out) * ( D(out) 0) * VT(out)\n*\n* where Z' = (Z1' a Z2' b) = u' VT', and u is a vector of dimension M\n* with ALPHA and BETA in the NL+1 and NL+2 th entries and zeros\n* elsewhere; and the entry b is empty if SQRE = 0.\n*\n* The singular values of B can be computed using D1, D2, the first\n* components of all the right singular vectors of the lower block, and\n* the last components of all the right singular vectors of the upper\n* block. These components are stored and updated in VF and VL,\n* respectively, in DLASD6. Hence U and VT are not explicitly\n* referenced.\n*\n* The singular values are stored in D. The algorithm consists of two\n* stages:\n*\n* The first stage consists of deflating the size of the problem\n* when there are multiple singular values or if there is a zero\n* in the Z vector. For each such occurrence the dimension of the\n* secular equation problem is reduced by one. This stage is\n* performed by the routine DLASD7.\n*\n* The second stage consists of calculating the updated\n* singular values. This is done by finding the roots of the\n* secular equation via the routine DLASD4 (as called by DLASD8).\n* This routine also updates VF and VL and computes the distances\n* between the updated singular values and the old singular\n* values.\n*\n* DLASD6 is called from DLASDA.\n*\n\n* Arguments\n* =========\n*\n* ICOMPQ (input) INTEGER\n* Specifies whether singular vectors are to be computed in\n* factored form:\n* = 0: Compute singular values only.\n* = 1: Compute singular vectors in factored form as well.\n*\n* NL (input) INTEGER\n* The row dimension of the upper block. NL >= 1.\n*\n* NR (input) INTEGER\n* The row dimension of the lower block. NR >= 1.\n*\n* SQRE (input) INTEGER\n* = 0: the lower block is an NR-by-NR square matrix.\n* = 1: the lower block is an NR-by-(NR+1) rectangular matrix.\n*\n* The bidiagonal matrix has row dimension N = NL + NR + 1,\n* and column dimension M = N + SQRE.\n*\n* D (input/output) DOUBLE PRECISION array, dimension ( NL+NR+1 ).\n* On entry D(1:NL,1:NL) contains the singular values of the\n* upper block, and D(NL+2:N) contains the singular values\n* of the lower block. On exit D(1:N) contains the singular\n* values of the modified matrix.\n*\n* VF (input/output) DOUBLE PRECISION array, dimension ( M )\n* On entry, VF(1:NL+1) contains the first components of all\n* right singular vectors of the upper block; and VF(NL+2:M)\n* contains the first components of all right singular vectors\n* of the lower block. On exit, VF contains the first components\n* of all right singular vectors of the bidiagonal matrix.\n*\n* VL (input/output) DOUBLE PRECISION array, dimension ( M )\n* On entry, VL(1:NL+1) contains the last components of all\n* right singular vectors of the upper block; and VL(NL+2:M)\n* contains the last components of all right singular vectors of\n* the lower block. On exit, VL contains the last components of\n* all right singular vectors of the bidiagonal matrix.\n*\n* ALPHA (input/output) DOUBLE PRECISION\n* Contains the diagonal element associated with the added row.\n*\n* BETA (input/output) DOUBLE PRECISION\n* Contains the off-diagonal element associated with the added\n* row.\n*\n* IDXQ (output) INTEGER array, dimension ( N )\n* This contains the permutation which will reintegrate the\n* subproblem just solved back into sorted order, i.e.\n* D( IDXQ( I = 1, N ) ) will be in ascending order.\n*\n* PERM (output) INTEGER array, dimension ( N )\n* The permutations (from deflation and sorting) to be applied\n* to each block. Not referenced if ICOMPQ = 0.\n*\n* GIVPTR (output) INTEGER\n* The number of Givens rotations which took place in this\n* subproblem. Not referenced if ICOMPQ = 0.\n*\n* GIVCOL (output) INTEGER array, dimension ( LDGCOL, 2 )\n* Each pair of numbers indicates a pair of columns to take place\n* in a Givens rotation. Not referenced if ICOMPQ = 0.\n*\n* LDGCOL (input) INTEGER\n* leading dimension of GIVCOL, must be at least N.\n*\n* GIVNUM (output) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )\n* Each number indicates the C or S value to be used in the\n* corresponding Givens rotation. Not referenced if ICOMPQ = 0.\n*\n* LDGNUM (input) INTEGER\n* The leading dimension of GIVNUM and POLES, must be at least N.\n*\n* POLES (output) DOUBLE PRECISION array, dimension ( LDGNUM, 2 )\n* On exit, POLES(1,*) is an array containing the new singular\n* values obtained from solving the secular equation, and\n* POLES(2,*) is an array containing the poles in the secular\n* equation. Not referenced if ICOMPQ = 0.\n*\n* DIFL (output) DOUBLE PRECISION array, dimension ( N )\n* On exit, DIFL(I) is the distance between I-th updated\n* (undeflated) singular value and the I-th (undeflated) old\n* singular value.\n*\n* DIFR (output) DOUBLE PRECISION array,\n* dimension ( LDGNUM, 2 ) if ICOMPQ = 1 and\n* dimension ( N ) if ICOMPQ = 0.\n* On exit, DIFR(I, 1) is the distance between I-th updated\n* (undeflated) singular value and the I+1-th (undeflated) old\n* singular value.\n*\n* If ICOMPQ = 1, DIFR(1:K,2) is an array containing the\n* normalizing factors for the right singular vector matrix.\n*\n* See DLASD8 for details on DIFL and DIFR.\n*\n* Z (output) DOUBLE PRECISION array, dimension ( M )\n* The first elements of this array contain the components\n* of the deflation-adjusted updating row vector.\n*\n* K (output) INTEGER\n* Contains the dimension of the non-deflated matrix,\n* This is the order of the related secular equation. 1 <= K <=N.\n*\n* C (output) DOUBLE PRECISION\n* C contains garbage if SQRE =0 and the C-value of a Givens\n* rotation related to the right null space if SQRE = 1.\n*\n* S (output) DOUBLE PRECISION\n* S contains garbage if SQRE =0 and the S-value of a Givens\n* rotation related to the right null space if SQRE = 1.\n*\n* WORK (workspace) DOUBLE PRECISION array, dimension ( 4 * M )\n*\n* IWORK (workspace) INTEGER array, dimension ( 3 * N )\n*\n* INFO (output) INTEGER\n* = 0: successful exit.\n* < 0: if INFO = -i, the i-th argument had an illegal value.\n* > 0: if INFO = 1, a singular value did not converge\n*\n\n* Further Details\n* ===============\n*\n* Based on contributions by\n* Ming Gu and Huan Ren, Computer Science Division, University of\n* California at Berkeley, USA\n*\n* =====================================================================\n*\n\n");
72
72
  return Qnil;
73
73
  }
74
74
  if (rb_hash_aref(rblapack_options, sUsage) == Qtrue) {
@@ -62,19 +62,33 @@ unless find_library("lapack", nil)
62
62
  end
63
63
  end
64
64
 
65
- if Gem.respond_to?(:find_files)
66
- require "rbconfig"
67
- so = RbConfig::CONFIG["DLEXT"]
68
- narray_include = File.expand_path(File.dirname(Gem.find_files("narray.h")[0]))
69
- narray_lib = File.expand_path(File.dirname(Gem.find_files("narray." + so)[0]))
70
- else
71
- gem_home=(`gem environment GEM_HOME`).chomp
72
- narray_dir = Dir.glob("#{gem_home}/gems/narray-*").sort[-1]
73
- if narray_dir
74
- narray_include = narray_lib = narray_dir
65
+ narray_dir = nil
66
+ if s = ( Gem::Specification.find_all_by_name("narray")[0] || Gem::Specification.find_all_by_name("narray-bigmem")[0] )
67
+ if s.respond_to?(:exts_dir)
68
+ narray_dir = s.exts_dir + "/narray"
69
+ narray_dir = s.gem_dir+"/lib/narray" unless File.exist?(narray_dir)
75
70
  else
76
- sitearchdir = RbConfig::CONFIG["sitearchdir"]
77
- narray_include = narray_lib = [ $sitearchdir, $sitearchdir]
71
+ narray_dir = s.extension_dir + "/narray"
72
+ end
73
+ narray_include = narray_dir
74
+ narray_lib = narray_dir
75
+ end
76
+
77
+ unless narray_dir && File.exist?(narray_dir)
78
+ if Gem.respond_to?(:find_files)
79
+ require "rbconfig"
80
+ so = RbConfig::CONFIG["DLEXT"]
81
+ narray_include = File.expand_path(File.dirname(Gem.find_files("narray.h")[0]))
82
+ narray_lib = File.expand_path(File.dirname(Gem.find_files("narray." + so)[0]))
83
+ else
84
+ gem_home=(`gem environment GEM_HOME`).chomp
85
+ narray_dir = Dir.glob("#{gem_home}/gems/narray-*").sort[-1]
86
+ if narray_dir
87
+ narray_include = narray_lib = narray_dir
88
+ else
89
+ sitearchdir = RbConfig::CONFIG["sitearchdir"]
90
+ narray_include = narray_lib = [$sitearchdir, $sitearchdir]
91
+ end
78
92
  end
79
93
  end
80
94
  dir_config('narray', narray_include, narray_lib)