Skip to content

Commit 1644315

Browse files
committed
Complete algebra (+, -, scalar mult.) for combinations of tridiagonal matrices
1 parent 58c4eaf commit 1644315

File tree

3 files changed

+352
-121
lines changed

3 files changed

+352
-121
lines changed

src/stdlib_specialmatrices.fypp

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,51 @@ module stdlib_specialmatrices
468468
!! be of the same type and kind.
469469
!! [Specifications](../page/specs/stdlib_specialmatrices.html#operators)
470470
#:for k1, t1, s1 in (KINDS_TYPES)
471-
pure module function matrix_add_tridiagonal_${s1}$(A, B) result(C)
472-
class(tridiagonal_${s1}$_type), intent(in) :: A
473-
class(tridiagonal_${s1}$_type), intent(in) :: B
474-
class(tridiagonal_${s1}$_type), allocatable :: C
471+
pure module function matrix_add_tridiag_tridiag_${s1}$(A, B) result(C)
472+
type(tridiagonal_${s1}$_type), intent(in) :: A, B
473+
type(tridiagonal_${s1}$_type) :: C
474+
end function
475+
pure module function matrix_add_tridiag_symtridiag_${s1}$(A, B) result(C)
476+
type(tridiagonal_${s1}$_type), intent(in) :: A
477+
type(symtridiagonal_${s1}$_type), intent(in) :: B
478+
type(tridiagonal_${s1}$_type) :: C
479+
end function
480+
pure module function matrix_add_symtridiag_tridiag_${s1}$(A, B) result(C)
481+
type(symtridiagonal_${s1}$_type), intent(in) :: A
482+
type(tridiagonal_${s1}$_type), intent(in) :: B
483+
type(tridiagonal_${s1}$_type) :: C
484+
end function
485+
pure module function matrix_add_symtridiag_symtridiag_${s1}$(A, B) result(C)
486+
type(symtridiagonal_${s1}$_type), intent(in) :: A, B
487+
type(symtridiagonal_${s1}$_type) :: C
488+
end function
489+
490+
#:if t1.startswith("complex")
491+
pure module function matrix_add_tridiag_hermtridiag_${s1}$(A, B) result(C)
492+
type(tridiagonal_${s1}$_type), intent(in) :: A
493+
type(hermtridiagonal_${s1}$_type), intent(in) :: B
494+
type(tridiagonal_${s1}$_type) :: C
495+
end function
496+
pure module function matrix_add_hermtridiag_tridiag_${s1}$(A, B) result(C)
497+
type(hermtridiagonal_${s1}$_type), intent(in) :: A
498+
type(tridiagonal_${s1}$_type), intent(in) :: B
499+
type(tridiagonal_${s1}$_type) :: C
500+
end function
501+
pure module function matrix_add_symtridiag_hermtridiag_${s1}$(A, B) result(C)
502+
type(symtridiagonal_${s1}$_type), intent(in) :: A
503+
type(hermtridiagonal_${s1}$_type), intent(in) :: B
504+
type(tridiagonal_${s1}$_type) :: C
475505
end function
506+
pure module function matrix_add_hermtridiag_symtridiag_${s1}$(A, B) result(C)
507+
type(hermtridiagonal_${s1}$_type), intent(in) :: A
508+
type(symtridiagonal_${s1}$_type), intent(in) :: B
509+
type(tridiagonal_${s1}$_type) :: C
510+
end function
511+
pure module function matrix_add_hermtridiag_hermtridiag_${s1}$(A, B) result(C)
512+
type(hermtridiagonal_${s1}$_type), intent(in) :: A, B
513+
type(hermtridiagonal_${s1}$_type) :: C
514+
end function
515+
#:endif
476516
#:endfor
477517
end interface
478518

@@ -481,11 +521,51 @@ module stdlib_specialmatrices
481521
!! be of the same type and kind.
482522
!! [Specifications](../page/specs/stdlib_specialmatrices.html#operators)
483523
#:for k1, t1, s1 in (KINDS_TYPES)
484-
pure module function matrix_sub_tridiagonal_${s1}$(A, B) result(C)
485-
class(tridiagonal_${s1}$_type), intent(in) :: A
486-
class(tridiagonal_${s1}$_type), intent(in) :: B
487-
class(tridiagonal_${s1}$_type), allocatable :: C
524+
pure module function matrix_sub_tridiag_tridiag_${s1}$(A, B) result(C)
525+
type(tridiagonal_${s1}$_type), intent(in) :: A, B
526+
type(tridiagonal_${s1}$_type) :: C
527+
end function
528+
pure module function matrix_sub_tridiag_symtridiag_${s1}$(A, B) result(C)
529+
type(tridiagonal_${s1}$_type), intent(in) :: A
530+
type(symtridiagonal_${s1}$_type), intent(in) :: B
531+
type(tridiagonal_${s1}$_type) :: C
532+
end function
533+
pure module function matrix_sub_symtridiag_tridiag_${s1}$(A, B) result(C)
534+
type(symtridiagonal_${s1}$_type), intent(in) :: A
535+
type(tridiagonal_${s1}$_type), intent(in) :: B
536+
type(tridiagonal_${s1}$_type) :: C
537+
end function
538+
pure module function matrix_sub_symtridiag_symtridiag_${s1}$(A, B) result(C)
539+
type(symtridiagonal_${s1}$_type), intent(in) :: A, B
540+
type(symtridiagonal_${s1}$_type) :: C
541+
end function
542+
543+
#:if t1.startswith("complex")
544+
pure module function matrix_sub_tridiag_hermtridiag_${s1}$(A, B) result(C)
545+
type(tridiagonal_${s1}$_type), intent(in) :: A
546+
type(hermtridiagonal_${s1}$_type), intent(in) :: B
547+
type(tridiagonal_${s1}$_type) :: C
548+
end function
549+
pure module function matrix_sub_hermtridiag_tridiag_${s1}$(A, B) result(C)
550+
type(hermtridiagonal_${s1}$_type), intent(in) :: A
551+
type(tridiagonal_${s1}$_type), intent(in) :: B
552+
type(tridiagonal_${s1}$_type) :: C
553+
end function
554+
pure module function matrix_sub_symtridiag_hermtridiag_${s1}$(A, B) result(C)
555+
type(symtridiagonal_${s1}$_type), intent(in) :: A
556+
type(hermtridiagonal_${s1}$_type), intent(in) :: B
557+
type(tridiagonal_${s1}$_type) :: C
488558
end function
559+
pure module function matrix_sub_hermtridiag_symtridiag_${s1}$(A, B) result(C)
560+
type(hermtridiagonal_${s1}$_type), intent(in) :: A
561+
type(symtridiagonal_${s1}$_type), intent(in) :: B
562+
type(tridiagonal_${s1}$_type) :: C
563+
end function
564+
pure module function matrix_sub_hermtridiag_hermtridiag_${s1}$(A, B) result(C)
565+
type(hermtridiagonal_${s1}$_type), intent(in) :: A, B
566+
type(hermtridiagonal_${s1}$_type) :: C
567+
end function
568+
#:endif
489569
#:endfor
490570
end interface
491571

0 commit comments

Comments
 (0)