Does Fortran have a built-in function to calculate the determinant?

Click For Summary
SUMMARY

Fortran does not have a built-in function to calculate the determinant of a matrix. Instead, this functionality is provided by external libraries such as the IMSL Numerical Math Library, which includes the det() function. The intrinsic functions available in Fortran 90 are limited to MATMUL, TRANSPOSE, and DOT_PRODUCT. Historically, libraries like the IBM Scientific Subroutine Package, LINPACK, and EISPACK have been utilized for numerical calculations, with LINPACK and EISPACK now merged into LAPACK, which is accessible in Fortran 90.

PREREQUISITES
  • Familiarity with Fortran programming language, specifically Fortran 90.
  • Understanding of matrix operations and linear algebra concepts.
  • Knowledge of external libraries in programming, particularly numerical libraries.
  • Basic experience with mathematical functions and their implementations in programming.
NEXT STEPS
  • Explore the IMSL Numerical Math Library and its det() function for matrix determinant calculations.
  • Learn about LAPACK (Linear Algebra PACKage) and its applications in numerical computations.
  • Investigate the IBM Scientific Subroutine Package and its historical significance in numerical programming.
  • Study the integration of external libraries in Fortran and other programming languages like Python.
USEFUL FOR

This discussion is beneficial for Fortran programmers, numerical analysts, and software developers involved in scientific computing who require efficient matrix operations and determinant calculations.

Eclair_de_XII
Messages
1,082
Reaction score
91
TL;DR
Some Google-searching has led me to believe that Fortran does not have a built-in function for calculating the determinant of a given matrix. I've found only source codes and external libraries that have been written for this purpose. Does Fortran just not have any functions that calculate determinants directly? If it does not, then why not?
Fortran:
program main
! use ! some library that defines the function to calculate the determinant of a given matrix
implicit none
real,dimension(2,2)::A
real::det_val
A(1,1)=1
A(2,2)=1
A(2,1)=0
A(1,2)=0
! det_val=det(A)
print *,det_val ! Should print 1.
end program main
 
Technology news on Phys.org
Eclair_de_XII said:
Does Fortran just not have any functions that calculate determinants directly? If it does not, then why not?
The only Fortran 90 matrix intrinsics are; MATMUL, TRANSPOSE, and DOT_PRODUCT.
Other intrinsic functions are not usually needed, and so are better loaded from an external library.
 
In general, no FORTRAN does not have that as a built-in. Instead the functionality is provided by a math library like the IMSL numerical math library and its det() function.

https://help.imsl.com/fortran/6.0/math/default.htm?turl=imslfortrannumericalmathlibrary.htm

https://help.imsl.com/fortran/6.0/math/default.htm?turl=imslfortrannumericalmathlibrary.htm

Experienced programmers will tend to use library functions over developing their own as it saves time in debugging and allows one to look at the bigger programming issues of a project.
 
Long ago (1960s and 1970s), the FORTRAN programmers used libraries to assist in their numerical calculations. The IBM Scientific Subroutine Package (SSP) was a very well-programmed and documented set of subroutines that was bundled in with their sales packages.
The IMSL (International Mathematics and Statistics Library) for FORTRAN was published in 1970.
Then LINPACK and EISPACK became available for use on supercomputers (of that era).
There are a large variety of specialized needs (huge matrices, sparce matrices, complex matrices, etc) that were addressed by different well-documented libraries using advanced (for that era) numerical techniques.
It is conceivable that modern compilers for a language would have the ability to use the correct technique for a special situation, but I would verify that before I counted on it.
 
  • Informative
  • Like
Likes   Reactions: jedishrfu and berkeman
Let me add that LINPACK and EISPACK were merged into LAPACK (Linear Algebra PACKage). The source code (Fortran 90) is available at http://www.netlib.org/lapack/
 
  • Like
Likes   Reactions: jedishrfu and FactChecker
DrClaude said:
Let me add that LINPACK and EISPACK were merged into LAPACK (Linear Algebra PACKage). The source code (Fortran 90) is available at http://www.netlib.org/lapack/
DrClaude's example illustrates the kind of flexibility that you want in libraries. If you make the functions intrinsic to the language, you have less future flexibility. That is one reason to keep libraries separate from the programming language.

Another reason is that external libraries can be shared by programs written in many languages.
Python is very popular today, but if you dig into the details of Python packages, you may find external libraries written in C or FORTRAN.
 
  • Like
Likes   Reactions: FactChecker and jedishrfu

Similar threads

  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K