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

AI Thread Summary
Fortran does not include built-in functions for calculating the determinant of a matrix, relying instead on external libraries for such functionality. The only intrinsic matrix operations in Fortran 90 are MATMUL, TRANSPOSE, and DOT_PRODUCT. Historically, Fortran programmers have utilized libraries like the IMSL numerical math library, which includes a det() function, to handle complex numerical calculations efficiently. This approach allows developers to focus on broader programming challenges rather than debugging custom functions. Notable libraries such as LINPACK and EISPACK, which were later merged into LAPACK, provide advanced numerical techniques for various matrix types. The separation of libraries from the core language enhances flexibility and allows for cross-language compatibility, as many modern programming languages, including Python, leverage these external libraries.
Eclair_de_XII
Messages
1,082
Reaction score
91
TL;DR Summary
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 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 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 FactChecker and jedishrfu
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...

Similar threads

Back
Top