Fortran Programming Tools under Linux
SciLab is one of my favorite programs running under Linux. If you deal with matrix or vector data, signal analysis, nonlinear optimization, plotting, or other mathematical manipulations, you owe it to yourself to explore this feature-packed program. (SciLab was reviewed in Linux Journal, Issue 11, and it is available for a variety of other computer platforms, including Sun Sparc station, IBM RS 6000, HP 9000, DEC Mips, and DEC Alpha.)
Beyond the hundreds of built-in or supplied mathematical functions, SciLab users can also dynamically link their own Fortran and C subroutines to the SciLab binary without recompiling the SciLab source code. The linked subroutines are then available for calling from within SciLab using either interactive commands or by executing scripts.
This important feature allows Fortran users (and C programmers) to make use of “tried and true” source code without the trouble of converting the subroutines to equivalent SciLab macros and scripts that use built-in SciLab functions. Just as important, tedious debugging can be kept to a minimum (provided the linked subroutines have already been tested thoroughly).
Returning once again to our original trivial example code, let's link the subroutine TRIG into a SciLab session. First, we need to compile the TRIG object module using the f77 command:
$ f77 -c trig.f
which produces trig.o in the present working directory. From within Scilab we link trig.o using the link command:
-->link('trig.o','trig')
linking "trig_" defined in "trig.o "
lastlink 0,0
The first argument string in the link command is the name (case sensitive) of the Fortran object module. If this module is not in the current SciLab working directory, you must include the path. The second argument string must be the exact name of the Fortran subroutine being linked; however, case is not important. (Note that SciLab variables are case-sensitive, so subsequent use of trig within SciLab requires that you use lower case.)
Other subroutines also can be linked in the same way, and SciLab lists all linked subroutines when the link command is issued without arguments, i.e.:
-->link() ans = trig
Now we are ready to use trig in our SciLab session, but first we need to specify the two input variables (n,x) for the trig subroutine. Below are the commands issued with Scilab echoing the results.
-->n=5
n =
5.
-->x=[.1 .2 .3 .4 .5]
x =
! .1 .2 .3 .4 .5 !
Actually calling trig is done using SciLab's fort command as illustrated below (along with the result) for our example:
-->y=fort('trig',n,1,'i',x,2,'r','out',[1,5],3,'r')
y =
! .0903330 .1626567 .2189268 .2610349 .2907863 !
Okay, now for the explanation. On the left-hand side of the entered expression is a list of the subroutine output variables (y in this example). The arguments inside the fort expression consist of three groups. First is the called subroutine name (trig) as a string variable. This is followed by a list of the subroutine input variables, given in this example as:
n,1,'i', x,2,'r'
The first three items are the input variable (n), its position in the trig subroutine argument list (1), and a string character representing the variable's type (i for integer). Likewise, the second input variable is the real array, x, positioned as the second argument in trig. This pattern continues until all the input variables are listed. Variables in the input list do not have to be listed in any particular order. In other words, we could have just as easily listed the inputs as:
x,2,'r', n,1,'i'
Once all the input variables are listed, we can specify the output variable or variables, denoted in this example by:
'out',[1,5],3,'r'
The key word 'out' always appears, followed by a matrix notation informing SciLab that the output variable, y, is a 1x5 array. The 3 gives the position of y in the subroutine's argument list, and r states that the variable is type real.
Subroutines having more than one output variable simply need to list the parameters associated with each variable on the output side in the fort argument list and include each variable on the left-hand side of the expression. For example, assume we have a Fortran subroutine given by:
SUBROUTINE WIN95(IDEAS,BUGS,DOS,DELAY) REAL*4 BUGS(1,1), DOS, DELAY(1) INTEGER*2 IDEAS . . . RETURN END
The input variables are DOS and IDEAS, and the outputs are BUGS and DELAY. After compiling and linking this subroutine into SciLab, it is called by:
-->bugs,delay]=fort('win95',dos,3,'r',ideas,1,'i',
'out'[99,99],2,'r',[1,10],4,'r')
It's as easy as that!
When coupling Fortran subroutines with SciLab, any print statements within your Fortran subroutines will not print to the SciLab session. Instead they print to the X window from which you started SciLab (or on the console monitor if you loaded Scilab from a window manager, such as FVWM). More importantly, the dynamically linked Fortran subroutines can open, read, write, and close disk files. Subroutines containing COMMON blocks must be restructured to accept all the variables and constants through the fort command line.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- Trying to Tame the Tablet
- What's the tweeting protocol?
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal is an Awesome CMS and a Crappy development framework
1 hour 43 min ago - IT industry leaders
4 hours 5 min ago - Reply to comment | Linux Journal
20 hours 53 min ago - Reply to comment | Linux Journal
23 hours 26 min ago - Reply to comment | Linux Journal
1 day 43 min ago - great post
1 day 1 hour ago - Google Docs
1 day 1 hour ago - Reply to comment | Linux Journal
1 day 6 hours ago - Reply to comment | Linux Journal
1 day 7 hours ago - Web Hosting IQ
1 day 8 hours ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
Fortran on Linux
Take look at this web site:
http://www.fesb.hr/~psarajce/LinuxOS.html
Also, the Netbeans IDE
Also, the Netbeans IDE provides good FORTRAN support.
Fortran F90/95
For those interested in FORTRAN under Linux OS, look for Fortran F90/95 which is a high level programming language, successor to the Fortran F77. It includes pointers, dinamic allocation, collon notation (when working with arrays), operator overloading, modules, and many more! It is equivalent to C programming language in all of it's features, plus everything from standard Fortran F77 (complex numbers native support). Fortran F90/95 is THE choice for scientists and engineers, due to the fact that it can be easily mixed with F77 source codes (calling F77 subroutines from F90 source code)! Thus, all subroutines once written in F77 are accesible through F90 sintax (including all repository subroutines found on Netlib (such as Slatec)! Also, there is an complete IDE for Fortran F90 on Linux OS, which is called Photran (based on Eclipse). KDevelop Multilanguage can be used as Fortran F77 IDE on any Linux OS (with KDE desktop)! Fortran F90/95 compilers (free versions) for Linux include: Intel Fortran Compiler for Linux 9.0, G95 fortran compiler, and GCC 4.0 part called gfortran. They all can be integrated with Photran IDE.