Code covered by the BSD License

### Highlights fromslatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[uplo,n,k,alpha,a,lda,x,incx,beta,y,incy]=ssbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy);
```function [uplo,n,k,alpha,a,lda,x,incx,beta,y,incy]=ssbmv(uplo,n,k,alpha,a,lda,x,incx,beta,y,incy);
%***BEGIN PROLOGUE  SSBMV
%***PURPOSE  Multiply a real vector by a real symmetric band matrix.
%***LIBRARY   SLATEC (BLAS)
%***CATEGORY  D1B4
%***TYPE      SINGLE PRECISION (SSBMV-S, DSBMV-D, CSBMV-C)
%***KEYWORDS  LEVEL 2 BLAS, LINEAR ALGEBRA
%***AUTHOR  Dongarra, J. J., (ANL)
%           Du Croz, J., (NAG)
%           Hammarling, S., (NAG)
%           Hanson, R. J., (SNLA)
%***DESCRIPTION
%
%  SSBMV  performs the matrix-vector  operation
%
%     y := alpha*A*x + beta*y,
%
%  where alpha and beta are scalars, x and y are n element vectors and
%  A is an n by n symmetric band matrix, with k super-diagonals.
%
%  Parameters
%  ==========
%
%  UPLO   - CHARACTER*1.
%           On entry, UPLO specifies whether the upper or lower
%           triangular part of the band matrix A is being supplied as
%           follows:
%
%              UPLO = 'U' or 'u'   The upper triangular part of A is
%                                  being supplied.
%
%              UPLO = 'L' or 'l'   The lower triangular part of A is
%                                  being supplied.
%
%           Unchanged on exit.
%
%  N      - INTEGER.
%           On entry, N specifies the order of the matrix A.
%           N must be at least zero.
%           Unchanged on exit.
%
%  K      - INTEGER.
%           On entry, K specifies the number of super-diagonals of the
%           matrix A. K must satisfy  0 <= K.
%           Unchanged on exit.
%
%  ALPHA  - REAL            .
%           On entry, ALPHA specifies the scalar alpha.
%           Unchanged on exit.
%
%  A      - REAL             array of DIMENSION ( LDA, n ).
%           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )
%           by n part of the array A must contain the upper triangular
%           band part of the symmetric matrix, supplied column by
%           column, with the leading diagonal of the matrix in row
%           ( k + 1 ) of the array, the first super-diagonal starting at
%           position 2 in row k, and so on. The top left k by k triangle
%           of the array A is not referenced.
%           The following program segment will transfer the upper
%           triangular part of a symmetric band matrix from conventional
%           full matrix storage to band storage:
%
%                 DO 20, J = 1, N
%                    M = K + 1 - J
%                    DO 10, I = MAX( 1, J - K ), J
%                       A( M + I, J ) = matrix( I, J )
%              10    CONTINUE
%              20 CONTINUE
%
%           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )
%           by n part of the array A must contain the lower triangular
%           band part of the symmetric matrix, supplied column by
%           column, with the leading diagonal of the matrix in row 1 of
%           the array, the first sub-diagonal starting at position 1 in
%           row 2, and so on. The bottom right k by k triangle of the
%           array A is not referenced.
%           The following program segment will transfer the lower
%           triangular part of a symmetric band matrix from conventional
%           full matrix storage to band storage:
%
%                 DO 20, J = 1, N
%                    M = 1 - J
%                    DO 10, I = J, MIN( N, J + K )
%                       A( M + I, J ) = matrix( I, J )
%              10    CONTINUE
%              20 CONTINUE
%
%           Unchanged on exit.
%
%  LDA    - INTEGER.
%           On entry, LDA specifies the first dimension of A as declared
%           in the calling (sub) program. LDA must be at least
%           ( k + 1 ).
%           Unchanged on exit.
%
%  X      - REAL             array of DIMENSION at least
%           ( 1 + ( n - 1 )*abs( INCX ) ).
%           Before entry, the incremented array X must contain the
%           vector x.
%           Unchanged on exit.
%
%  INCX   - INTEGER.
%           On entry, INCX specifies the increment for the elements of
%           X. INCX must not be zero.
%           Unchanged on exit.
%
%  BETA   - REAL            .
%           On entry, BETA specifies the scalar beta.
%           Unchanged on exit.
%
%  Y      - REAL             array of DIMENSION at least
%           ( 1 + ( n - 1 )*abs( INCY ) ).
%           Before entry, the incremented array Y must contain the
%           vector y. On exit, Y is overwritten by the updated vector y.
%
%  INCY   - INTEGER.
%           On entry, INCY specifies the increment for the elements of
%           Y. INCY must not be zero.
%           Unchanged on exit.
%
%***REFERENCES  Dongarra, J. J., Du Croz, J., Hammarling, S., and
%                 Hanson, R. J.  An extended set of Fortran basic linear
%                 algebra subprograms.  ACM TOMS, Vol. 14, No. 1,
%                 pp. 1-17, March 1988.
%***ROUTINES CALLED  LSAME, XERBLA
%***REVISION HISTORY  (YYMMDD)
%   861022  DATE WRITTEN
%   910605  Modified to meet SLATEC prologue standards.  Only comment
%           lines were modified.  (BKS)
%***end PROLOGUE  SSBMV
%     .. Scalar Arguments ..
%     .. Array Arguments ..
persistent i info ix iy j jx jy kplus1 kx ky l one temp1 temp2 zero ;

a_shape=size(a);a=reshape([a(:).',zeros(1,ceil(numel(a)./prod([lda])).*prod([lda])-numel(a))],lda,[]);
x_shape=size(x);x=reshape(x,1,[]);
y_shape=size(y);y=reshape(y,1,[]);
%     .. Parameters ..
if isempty(one), one=1.0e+0; end;
if isempty(zero), zero=0.0e+0 ; end;
%     .. Local Scalars ..
if isempty(temp1), temp1=0; end;
if isempty(temp2), temp2=0; end;
if isempty(i), i=0; end;
if isempty(info), info=0; end;
if isempty(ix), ix=0; end;
if isempty(iy), iy=0; end;
if isempty(j), j=0; end;
if isempty(jx), jx=0; end;
if isempty(jy), jy=0; end;
if isempty(kplus1), kplus1=0; end;
if isempty(kx), kx=0; end;
if isempty(ky), ky=0; end;
if isempty(l), l=0; end;
%     .. External Functions ..
%     .. External Subroutines ..
%     .. Intrinsic Functions ..
%***FIRST EXECUTABLE STATEMENT  SSBMV
%
%     Test the input parameters.
%
info = 0;
if( ~lsame(uplo,'U') && ~lsame(uplo,'L') )
info = 1;
elseif( n<0 ) ;
info = 2;
elseif( k<0 ) ;
info = 3;
elseif( lda<(k+1) ) ;
info = 6;
elseif( incx==0 ) ;
info = 8;
elseif( incy==0 ) ;
info = 11;
end;
if( info~=0 )
[dumvar1,info]=xerbla('SSBMV ',info);
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
x_shape=zeros(x_shape);x_shape(:)=x(1:numel(x_shape));x=x_shape;
y_shape=zeros(y_shape);y_shape(:)=y(1:numel(y_shape));y=y_shape;
return;
end;
%
%     Quick return if possible.
%
if((n==0) ||((alpha==zero) &&(beta==one)) )
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
x_shape=zeros(x_shape);x_shape(:)=x(1:numel(x_shape));x=x_shape;
y_shape=zeros(y_shape);y_shape(:)=y(1:numel(y_shape));y=y_shape;
return;
end;
%
%     Set up the start points in  X  and  Y.
%
if( incx>0 )
kx = 1;
else;
kx = fix(1 -(n-1).*incx);
end;
if( incy>0 )
ky = 1;
else;
ky = fix(1 -(n-1).*incy);
end;
%
%     Start the operations. In this version the elements of the array A
%     are accessed sequentially with one pass through A.
%
%     First form  y := beta*y.
%
if( beta~=one )
if( incy~=1 )
iy = fix(ky);
if( beta==zero )
for i = 1 : n;
y(iy) = zero;
iy = fix(iy + incy);
end; i = fix(n+1);
else;
for i = 1 : n;
y(iy) = beta.*y(iy);
iy = fix(iy + incy);
end; i = fix(n+1);
end;
elseif( beta==zero ) ;
for i = 1 : n;
y(i) = zero;
end; i = fix(n+1);
else;
for i = 1 : n;
y(i) = beta.*y(i);
end; i = fix(n+1);
end;
end;
if( alpha==zero )
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
x_shape=zeros(x_shape);x_shape(:)=x(1:numel(x_shape));x=x_shape;
y_shape=zeros(y_shape);y_shape(:)=y(1:numel(y_shape));y=y_shape;
return;
end;
if( lsame(uplo,'U') )
%
%        Form  y  when upper triangle of A is stored.
%
kplus1 = fix(k + 1);
if((incx==1) &&(incy==1) )
for j = 1 : n;
temp1 = alpha.*x(j);
temp2 = zero;
l = fix(kplus1 - j);
for i = max(1,j-k) : j - 1;
y(i) = y(i) + temp1.*a(l+i,j);
temp2 = temp2 + a(l+i,j).*x(i);
end; i = fix(j - 1+1);
y(j) = y(j) + temp1.*a(kplus1,j) + alpha.*temp2;
end; j = fix(n+1);
else;
jx = fix(kx);
jy = fix(ky);
for j = 1 : n;
temp1 = alpha.*x(jx);
temp2 = zero;
ix = fix(kx);
iy = fix(ky);
l = fix(kplus1 - j);
for i = max(1,j-k) : j - 1;
y(iy) = y(iy) + temp1.*a(l+i,j);
temp2 = temp2 + a(l+i,j).*x(ix);
ix = fix(ix + incx);
iy = fix(iy + incy);
end; i = fix(j - 1+1);
y(jy) = y(jy) + temp1.*a(kplus1,j) + alpha.*temp2;
jx = fix(jx + incx);
jy = fix(jy + incy);
if( j>k )
kx = fix(kx + incx);
ky = fix(ky + incy);
end;
end; j = fix(n+1);
end;
%
%        Form  y  when lower triangle of A is stored.
%
elseif((incx==1) &&(incy==1) ) ;
for j = 1 : n;
temp1 = alpha.*x(j);
temp2 = zero;
y(j) = y(j) + temp1.*a(1,j);
l = fix(1 - j);
for i = j + 1 : min(n,j+k);
y(i) = y(i) + temp1.*a(l+i,j);
temp2 = temp2 + a(l+i,j).*x(i);
end; i = fix(min(n,j+k)+1);
y(j) = y(j) + alpha.*temp2;
end; j = fix(n+1);
else;
jx = fix(kx);
jy = fix(ky);
for j = 1 : n;
temp1 = alpha.*x(jx);
temp2 = zero;
y(jy) = y(jy) + temp1.*a(1,j);
l = fix(1 - j);
ix = fix(jx);
iy = fix(jy);
for i = j + 1 : min(n,j+k);
ix = fix(ix + incx);
iy = fix(iy + incy);
y(iy) = y(iy) + temp1.*a(l+i,j);
temp2 = temp2 + a(l+i,j).*x(ix);
end; i = fix(min(n,j+k)+1);
y(jy) = y(jy) + alpha.*temp2;
jx = fix(jx + incx);
jy = fix(jy + incy);
end; j = fix(n+1);
end;
%
%
%     end of SSBMV .
%
a_shape=zeros(a_shape);a_shape(:)=a(1:numel(a_shape));a=a_shape;
x_shape=zeros(x_shape);x_shape(:)=x(1:numel(x_shape));x=x_shape;
y_shape=zeros(y_shape);y_shape(:)=y(1:numel(y_shape));y=y_shape;
end
%DECK SSCAL
```