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

Click For Summary

Discussion Overview

The discussion centers on whether Fortran has a built-in function for calculating the determinant of a matrix. Participants explore the capabilities of Fortran regarding matrix operations, specifically focusing on the absence of direct intrinsic functions for determinants and the reliance on external libraries for such functionality.

Discussion Character

  • Technical explanation
  • Historical
  • Debate/contested

Main Points Raised

  • Some participants note that Fortran does not have a built-in function for calculating determinants, suggesting that such functionality is typically provided by external libraries like IMSL.
  • One participant mentions the intrinsic matrix functions available in Fortran 90, which include MATMUL, TRANSPOSE, and DOT_PRODUCT, but does not include determinant calculations.
  • Another participant references historical context, stating that libraries have been used since the 1960s and 1970s for numerical calculations, highlighting the IBM Scientific Subroutine Package and the IMSL library.
  • Some participants discuss the evolution of numerical libraries, mentioning that LINPACK and EISPACK were merged into LAPACK, which is now a standard for linear algebra operations.
  • There is a viewpoint that keeping mathematical functions as part of external libraries rather than intrinsic to the language allows for greater flexibility and the ability to share libraries across different programming languages.

Areas of Agreement / Disagreement

Participants generally agree that Fortran does not include a built-in function for calculating determinants and that external libraries are necessary for this functionality. However, there is a discussion about the implications of this design choice, with differing opinions on the benefits of intrinsic versus external library functions.

Contextual Notes

Participants mention various historical libraries and their purposes, indicating a range of specialized needs that have been addressed over time. The discussion reflects on the evolution of numerical techniques and the role of libraries in programming practices.

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 25 ·
Replies
25
Views
4K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
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