hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_real_gen_blkdiag_lu (f01lh)

Purpose

nag_matop_real_gen_blkdiag_lu (f01lh) factorizes a real almost block diagonal matrix.

Syntax

[a, pivot, tol, kpivot, ifail] = f01lh(n, blkstr, a, tol, 'nbloks', nbloks, 'lena', lena)
[a, pivot, tol, kpivot, ifail] = nag_matop_real_gen_blkdiag_lu(n, blkstr, a, tol, 'nbloks', nbloks, 'lena', lena)

Description

nag_matop_real_gen_blkdiag_lu (f01lh) factorizes a real almost block diagonal matrix, AA, by row elimination with alternate row and column pivoting such that no ‘fill-in’ is produced. The code, which is derived from ARCECO described in Diaz et al. (1983), uses Level 1 and Level 2 BLAS. No three successive diagonal blocks may have columns in common and therefore the almost block diagonal matrix must have the form shown in the following diagram:
Figure 1
Figure 1
This function may be followed by nag_linsys_real_blkdiag_fac_solve (f04lh), which is designed to solve sets of linear equations AX = BAX=B or ATX = BATX=B.

References

Diaz J C, Fairweather G and Keast P (1983) Fortran packages for solving certain almost block diagonal linear systems by modified alternate row and column elimination ACM Trans. Math. Software 9 358–375

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the order of the matrix AA.
Constraint: n > 0n>0.
2:     blkstr(33,nbloks) – int64int32nag_int array
Information which describes the block structure of AA as follows:
  • blkstr(1,k)blkstr1k must contain the number of rows in the kkth block, k = 1,2,,nbloksk=1,2,,nbloks;
  • blkstr(2,k)blkstr2k must contain the number of columns in the kkth block, k = 1,2,,nbloksk=1,2,,nbloks;
  • blkstr(3,k)blkstr3k must contain the number of columns of overlap between the kkth and (k + 1)(k+1)th blocks, k = 1,2,,nbloks1k=1,2,,nbloks-1. blkstr(3,nbloks)blkstr3nbloks need not be set.
The following conditions delimit the structure of AA:
  • blkstr(1,k),blkstr(2,k) > 0,  k = 1,2,,nbloksblkstr1k,blkstr2k>0,  k=1,2,,nbloks,
  • blkstr(3,k)0,   k = 1,2,,nbloks1blkstr3k0,   k=1,2,,nbloks-1,
(there must be at least one column and one row in each block and a non-negative number of columns of overlap);
  • blkstr(3,k1) + blkstr(3,k)blkstr(2,k),  k = 2,3,,nbloks1blkstr3k-1+blkstr3kblkstr2k,  k=2,3,,nbloks-1,
(the total number of columns in overlaps in each block must not exceed the number of columns in that block);
  • blkstr(2,1)blkstr(1,1)blkstr21blkstr11,
  • blkstr(2,1) + k = 2 j [blkstr(2,k)blkstr(3, k 1 )] k = 1 j blkstr(1,k) blkstr21 + k =2 j [ blkstr2 k -blkstr3 k -1 ] k =1 j blkstr1 k , j = 2,3,,nbloks1 j=2,3,,nbloks-1 ,
  • k = 1j[blkstr(2,k)blkstr(3,k)]k = 1jblkstr(1,k),  j = 1,2,,nbloks1k=1j[blkstr2k-blkstr3k]k=1jblkstr1k,  j=1,2,,nbloks-1,
(the index of the first column of the overlap between the jjth and (j + 1)(j+1)th blocks must be  the index of the last row of the jjth block, and the index of the last column of overlap must be  the index of the last row of the jjth block);
  • k = 1 nbloks blkstr(1,k) = n k =1 nbloks blkstr1 k =n ,
  • blkstr(2,1) + k = 2 nbloks [blkstr(2,k)blkstr(3, k 1 )] = nk blkstr21 + k =2 nbloks [ blkstr2 k -blkstr3 k -1 ] =nk ,
(both the number of rows and the number of columns of AA must equal nn).
3:     a(lena) – double array
lena, the dimension of the array, must satisfy the constraint lena k = 1 nbloks [blkstr(1,k) × blkstr(2,k)] lena k =1 nbloks [ blkstr1 k × blkstr2 k ] .
The elements of the almost block diagonal matrix stored block by block, with each block stored column by column. The sizes of the blocks and the overlaps are defined by the parameter blkstr.
If arsars is the first element in the kkth block, then an arbitrary element aijaij in the kkth block must be stored in the array element:
a(pk + (jr)mk + (is) + 1)
a(pk+(j-r)mk+(i-s)+1)
where
k 1
pk = blkstr(1,l) × blkstr(2,l)
l = 1
pk=l= 1 k- 1blkstr1l×blkstr2l
is the base address of the kkth block, and
mk = blkstr(1,k)
mk=blkstr1k
is the number of rows of the kkth block.
See Section [Further Comments] for comments on scaling.
4:     tol – double scalar
A relative tolerance to be used to indicate whether or not the matrix is singular. For a discussion on how tol is used see Section [Further Comments]. If tol is non-positive, then tol is reset to 10ε10ε, where εε is the machine precision.

Optional Input Parameters

1:     nbloks – int64int32nag_int scalar
Default: The dimension of the array blkstr.
nn, the total number of blocks of the matrix AA.
Constraint: 0 < nbloksn0<nbloksn.
2:     lena – int64int32nag_int scalar
Default: The dimension of the array a.
The dimension of the array a as declared in the (sub)program from which nag_matop_real_gen_blkdiag_lu (f01lh) is called.
Constraint: lena k = 1 nbloks [blkstr(1,k) × blkstr(2,k)] lena k =1 nbloks [ blkstr1 k × blkstr2 k ] .

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     a(lena) – double array
The factorized form of the matrix.
2:     pivot(n) – int64int32nag_int array
Details of the interchanges.
3:     tol – double scalar
Unchanged unless tol0.0tol0.0 on entry, in which case it is set to 10ε10ε.
4:     kpivot – int64int32nag_int scalar
If ifail = 2ifail=2, kpivot contains the value kk, where kk is the first position on the diagonal of the matrix AA where too small a pivot was detected. Otherwise kpivot is set to 00.
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,n < 1n<1,
ornbloks < 1nbloks<1,
orn < nbloksn<nbloks,
orlena is too small,
orillegal values detected in blkstr.
W ifail = 2ifail=2
The factorization has been completed, but a small pivot has been detected.

Accuracy

The accuracy of nag_matop_real_gen_blkdiag_lu (f01lh) depends on the conditioning of the matrix AA.

Further Comments

Singularity or near singularity in AA is determined by the parameter tol. If the absolute value of any pivot is less than tol × amaxtol×amax, where amaxamax is the maximum absolute value of an element of AA, then AA is said to be singular. The position on the diagonal of AA of the first of any such pivots is indicated by the parameter kpivot. The factorization, and the test for near singularity, will be more accurate if before entry AA is scaled so that the -norms of the rows and columns of AA are all of approximately the same order of magnitude. (The -norm is the maximum absolute value of any element in the row or column.)

Example

function nag_matop_real_gen_blkdiag_lu_example
n = int64(18);
blkstr = [int64(2),4,5,3,4;4,7,8,6,5;3,4,2,3,0];
a = [-1;
     -1;
     -0.98;
     0.25;
     -0.79;
     -0.87;
     -0.15;
     0.35;
     0.78;
     -0.82;
     -0.83;
     -0.21;
     0.31;
     0.12;
     -0.98;
     -0.93;
     -0.85;
     -0.01;
     -0.58;
     -0.84;
     0.89;
     0.75;
     0.04;
     0.37;
     -0.69;
     0.32;
     0.87;
     -0.94;
     -0.98;
     -1;
     0.38;
     -0.96;
     -0.76;
     -0.53;
     -1;
     -1;
     -0.99;
     -0.87;
     -0.93;
     0.85;
     0.17;
     -0.91;
     -0.14;
     -0.91;
     -0.39;
     -1.37;
     -0.28;
     -1;
     0.1;
     0.79;
     1.29;
     0.9;
     -0.59;
     -0.89;
     -0.71;
     -1.59;
     0.78;
     -0.99;
     -0.68;
     0.39;
     1.1;
     -0.93;
     0.21;
     -0.09;
     -0.99;
     -1.63;
     -0.76;
     -0.73;
     -0.58;
     -0.12;
     -1.01;
     0.48;
     -0.48;
     -0.21;
     -0.75;
     -0.27;
     0.08;
     -0.67;
     -0.24;
     0.61;
     0.56;
     -0.41;
     0.54;
     -0.99;
     0.4;
     -0.41;
     0.16;
     -0.93;
     0.16;
     -0.16;
     0.7;
     -0.46;
     0.98;
     0.43;
     0.71;
     -0.47;
     -0.25;
     0.89;
     -0.97;
     -0.98;
     -0.92;
     -0.94;
     -0.6;
     -0.73;
     -0.52;
     -0.54;
     -0.3;
     0.07;
     -0.46;
     -1;
     0.18;
     0.04;
     -0.58;
     -0.36];
tol = 0;
[aOut, pivot, tolOut, index, ifail] = nag_matop_real_gen_blkdiag_lu(n, blkstr, a, tol)
 

aOut =

   -1.0000
    1.0000
   -0.9800
    1.2300
   -0.7900
   -0.0800
   -0.1500
    0.5000
    0.6341
   -0.6667
   -0.6748
   -0.1707
   -1.0340
   -0.3489
   -0.0645
    0.9126
   -0.2426
   -1.2517
   -0.2458
    0.4260
    0.3800
   -0.8474
   -1.1838
    0.7989
    0.8700
   -0.3865
    0.2811
   -1.7939
    0.0400
    0.9040
    0.9748
   -0.8304
   -1.0000
   -1.1089
   -0.8671
    1.0778
    0.2365
    0.8447
   -0.0845
   -0.6673
   -1.0897
    0.5443
    0.2104
    0.4940
    0.1128
    0.5929
    1.7246
   -0.8806
   -0.4456
    0.9244
   -0.2536
   -3.1739
   -2.8793
    0.3112
   -0.5292
    0.7990
    1.1000
   -0.0213
    1.2768
   -0.4998
   -0.3007
   -1.6300
   -1.2254
   -1.2751
   -0.7689
   -0.1200
   -0.2700
   -0.7178
    0.5830
   -0.5889
    0.3997
   -1.0100
   -1.6194
   -0.7062
   -0.3962
    0.1979
    1.5262
    1.4011
   -1.0258
   -0.9473
    0.2344
    0.0391
   -0.9900
    0.7720
    0.5682
    0.9800
   -0.6897
    0.7836
   -0.1600
    0.1975
    0.5940
    0.1600
   -0.4475
   -0.6820
   -0.7657
   -0.9316
   -0.6636
   -0.6891
   -0.5306
    0.8039
    0.9708
    0.9909
    0.4200
   -1.4430
    0.1524
    0.7753
   -1.0000
    0.8739
    0.5376
   -0.2729
   -0.3600
    0.3294
    0.4793
   -0.3479


pivot =

                    1
                    2
                    3
                    3
                    6
                    5
                    5
                    2
                    5
                    4
                    8
                    2
                    2
                    6
                    4
                    2
                    4
                    4


tolOut =

   1.1102e-15


index =

                    0


ifail =

                    0


function f01lh_example
n = int64(18);
blkstr = [int64(2),4,5,3,4;4,7,8,6,5;3,4,2,3,0];
a = [-1;
     -1;
     -0.98;
     0.25;
     -0.79;
     -0.87;
     -0.15;
     0.35;
     0.78;
     -0.82;
     -0.83;
     -0.21;
     0.31;
     0.12;
     -0.98;
     -0.93;
     -0.85;
     -0.01;
     -0.58;
     -0.84;
     0.89;
     0.75;
     0.04;
     0.37;
     -0.69;
     0.32;
     0.87;
     -0.94;
     -0.98;
     -1;
     0.38;
     -0.96;
     -0.76;
     -0.53;
     -1;
     -1;
     -0.99;
     -0.87;
     -0.93;
     0.85;
     0.17;
     -0.91;
     -0.14;
     -0.91;
     -0.39;
     -1.37;
     -0.28;
     -1;
     0.1;
     0.79;
     1.29;
     0.9;
     -0.59;
     -0.89;
     -0.71;
     -1.59;
     0.78;
     -0.99;
     -0.68;
     0.39;
     1.1;
     -0.93;
     0.21;
     -0.09;
     -0.99;
     -1.63;
     -0.76;
     -0.73;
     -0.58;
     -0.12;
     -1.01;
     0.48;
     -0.48;
     -0.21;
     -0.75;
     -0.27;
     0.08;
     -0.67;
     -0.24;
     0.61;
     0.56;
     -0.41;
     0.54;
     -0.99;
     0.4;
     -0.41;
     0.16;
     -0.93;
     0.16;
     -0.16;
     0.7;
     -0.46;
     0.98;
     0.43;
     0.71;
     -0.47;
     -0.25;
     0.89;
     -0.97;
     -0.98;
     -0.92;
     -0.94;
     -0.6;
     -0.73;
     -0.52;
     -0.54;
     -0.3;
     0.07;
     -0.46;
     -1;
     0.18;
     0.04;
     -0.58;
     -0.36];
tol = 0;
[aOut, pivot, tolOut, index, ifail] = f01lh(n, blkstr, a, tol)
 

aOut =

   -1.0000
    1.0000
   -0.9800
    1.2300
   -0.7900
   -0.0800
   -0.1500
    0.5000
    0.6341
   -0.6667
   -0.6748
   -0.1707
   -1.0340
   -0.3489
   -0.0645
    0.9126
   -0.2426
   -1.2517
   -0.2458
    0.4260
    0.3800
   -0.8474
   -1.1838
    0.7989
    0.8700
   -0.3865
    0.2811
   -1.7939
    0.0400
    0.9040
    0.9748
   -0.8304
   -1.0000
   -1.1089
   -0.8671
    1.0778
    0.2365
    0.8447
   -0.0845
   -0.6673
   -1.0897
    0.5443
    0.2104
    0.4940
    0.1128
    0.5929
    1.7246
   -0.8806
   -0.4456
    0.9244
   -0.2536
   -3.1739
   -2.8793
    0.3112
   -0.5292
    0.7990
    1.1000
   -0.0213
    1.2768
   -0.4998
   -0.3007
   -1.6300
   -1.2254
   -1.2751
   -0.7689
   -0.1200
   -0.2700
   -0.7178
    0.5830
   -0.5889
    0.3997
   -1.0100
   -1.6194
   -0.7062
   -0.3962
    0.1979
    1.5262
    1.4011
   -1.0258
   -0.9473
    0.2344
    0.0391
   -0.9900
    0.7720
    0.5682
    0.9800
   -0.6897
    0.7836
   -0.1600
    0.1975
    0.5940
    0.1600
   -0.4475
   -0.6820
   -0.7657
   -0.9316
   -0.6636
   -0.6891
   -0.5306
    0.8039
    0.9708
    0.9909
    0.4200
   -1.4430
    0.1524
    0.7753
   -1.0000
    0.8739
    0.5376
   -0.2729
   -0.3600
    0.3294
    0.4793
   -0.3479


pivot =

                    1
                    2
                    3
                    3
                    6
                    5
                    5
                    2
                    5
                    4
                    8
                    2
                    2
                    6
                    4
                    2
                    4
                    4


tolOut =

   1.1102e-15


index =

                    0


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013