square_matrix_multiplication Function

public function square_matrix_multiplication(a, b) result(c)

Arguments

Type IntentOptional Attributes Name
double precision, intent(in), DIMENSION(:,:) :: a

First matrix

double precision, intent(in), DIMENSION(:,:) :: b

Second matrix

Return Value double precision, DIMENSION(SIZE(a(1,:)),SIZE(a(1,:)))


Calls

proc~~square_matrix_multiplication~~CallsGraph proc~square_matrix_multiplication square_matrix_multiplication proc~row_by_column row_by_column proc~square_matrix_multiplication->proc~row_by_column

Called by

proc~~square_matrix_multiplication~~CalledByGraph proc~square_matrix_multiplication square_matrix_multiplication proc~apply_as_congruence_to_tensor apply_as_congruence_to_tensor proc~apply_as_congruence_to_tensor->proc~square_matrix_multiplication proc~apply_as_similarity_to_tensor apply_as_similarity_to_tensor proc~apply_as_similarity_to_tensor->proc~square_matrix_multiplication proc~compute_rotation_matrices compute_rotation_matrices proc~compute_rotation_matrices->proc~square_matrix_multiplication proc~construct_boost construct_boost proc~construct_boost->proc~square_matrix_multiplication proc~construct_rotation construct_rotation proc~construct_rotation->proc~square_matrix_multiplication interface~apply_as_congruence_to_tensor apply_as_congruence_to_tensor interface~apply_as_congruence_to_tensor->proc~apply_as_congruence_to_tensor interface~apply_as_similarity_to_tensor apply_as_similarity_to_tensor interface~apply_as_similarity_to_tensor->proc~apply_as_similarity_to_tensor interface~compute_rotation_matrices compute_rotation_matrices interface~compute_rotation_matrices->proc~compute_rotation_matrices

Contents


Variables

Type Visibility Attributes Name Initial
double precision, public, DIMENSION(SIZE(a(1,:))) :: column
integer, public :: i
integer, public :: j
integer, public :: n
double precision, public, DIMENSION(SIZE(a(1,:))) :: row

Source Code

  FUNCTION square_matrix_multiplication( a, b ) RESULT( c )

    IMPLICIT NONE

    DOUBLE PRECISION, DIMENSION(:,:), INTENT(IN):: a
    !! First matrix
    DOUBLE PRECISION, DIMENSION(:,:), INTENT(IN):: b
    !! Second matrix

    DOUBLE PRECISION, DIMENSION(SIZE(a(1,:))):: row
    DOUBLE PRECISION, DIMENSION(SIZE(a(1,:))):: column
    DOUBLE PRECISION, DIMENSION(SIZE(a(1,:)),SIZE(a(1,:))):: c

    INTEGER:: i, j, n

    n= SIZE(a(1,:))

    IF(n /= SIZE(a(:,1)))THEN
      PRINT *, "** ERROR! Matrix a is not square!"
      PRINT *, " * Number of rows=", SIZE(a(:,1))
      PRINT *, "   Number of columns=", n
      PRINT *, " * Stopping..."
      PRINT *
      STOP
    ENDIF
    IF(SIZE(b(1,:)) /= SIZE(b(:,1)))THEN
      PRINT *, "** ERROR! Matrix b is not square!"
      PRINT *, " * Number of rows=", SIZE(b(:,1))
      PRINT *, "   Number of columns=", SIZE(b(1,:))
      PRINT *, " * Stopping..."
      PRINT *
      STOP
    ENDIF
    IF(n /= SIZE(b(:,1)))THEN
      PRINT *, "** ERROR! Matrix a and b do not have compatible dimensions!"
      PRINT *, "   Number of columns of a=", n
      PRINT *, " * Number of rows of b=", SIZE(b(:,1))
      PRINT *, " * Stopping..."
      PRINT *
      STOP
    ENDIF

    DO i= 1, n, 1
      DO j= 1, n, 1

        row   = a(i,:)
        column= b(:,j)

        c(i,j)= row_by_column(row,column)

      ENDDO
    ENDDO


  END FUNCTION square_matrix_multiplication