|
|
Up |
|
|
  |
Author: simonvandonksimonvandonk
Date: Feb 29, 2008 06:28
In Fortran 95, I am looking for a 'mean' (or average) function to
calculate the mean of an array, but I am not finding it. I am now
using 'sum(array)/size(array)'. Is there something like a 'mean'
function (intrinsic) in Fortran 95? If not, what is the best way to
calculate the mean? Thanks!! Simon
|
| |
|
| |
17 Comments |
|
  |
Author: FXFX
Date: Feb 29, 2008 02:46
I'm reading the description of EXECUTE_COMMAND_LINE in the current
Fortran 2008 draft. I have questions about the following:
-- "WAIT (optional) shall be a default character scalar. It is an
INTENT (IN) argument. If WAIT is present with the value false, [...]".
Will WAIT really by a character expression? What advantages does it have
over a logical scalar?
-- "EXITSTAT (optional) shall be a default character scalar. It is an
INTENT (INOUT) argument. If the command is executed synchronously, it is
assigned the value of the processor-dependent exit status." Again,
shouldn't that be an integer scalar? Most exit status are integers (see
the STOP intrinsic, for example).
-- "CMDSTAT (optional) shall be a default character scalar. It is an
INTENT (OUT) argument. It is assigned the value −1 [...]" I suspect that
this should be an integer also... unless you want to assign the character
value '-1', but it wouldn't make much sense to me!
-- "CMDMSG (optional) shall be a default character scalar. It is an
INTENT (INOUT) argument. If an error condition occurs, it is assigned a
processor-dependent explanatory message." I don't suppose there's any way
I can convince anyone that CMDMSG should be an integer or logical scalar.
|
| Show full article (1.25Kb) |
|
| |
6 Comments |
|
  |
Author: Gerry FordGerry Ford
Date: Feb 28, 2008 23:12
I've been working up my game with open-source distros and believe to have
come upon a compelling reason not to have more than one on a given machine.
So I'll be ripping out everything I have in anticipation of the new release.
Linux is much more aware this way. Anyways, I had an installation that
turned out to be 4.3.0, after which I installed 4.2.3. This is what the
linker is looking for:
g++ -o lang1.o -c langston1.cpp -v 2>text69.txt
, where langston1.cpp is a c++ function that does modest mathematical
things:
Built by Equation Solution ( http://www.Equation.com).
Using built-in specs.
Target: i386-pc-mingw32
Configured with:
../ gcc-4.2.3-mingw/configure --host=i386-pc-mingw32 --build=x86_64-unknown-linux-gnu...
|
| Show full article (3.95Kb) |
|
13 Comments |
|
  |
Author: DamianDamian
Date: Feb 27, 2008 21:12
I'm attempting to dereference a C function pointer declared using the
Fortran 2003 ISO C bindings in gfortran 4.3.0. The code below stores
the C address of the procedure in an entity of type(c_funptr) and then
passes that address to a C++ procedure (wrapped by 'extern "C"'),
which does three things: (1) prints a greeting, (2) explicitly calls a
Fortran procedure that prints a second greeting, and (3) calls the
same Fortran procedure by dereferencing a pointer to it. The first
two steps complete as expected. The third gives the segmentation
fault. Can someone tell me if this code is incorrect or if there is a
bug in the compiler?
Thanks in advance.
Damian
--------------------- Fortran code
-----------------------------------------------------
program main
use iso_c_binding ,only : c_funloc ,c_funptr
use hello ,only : print_hello
implicit none
type(c_funptr) :: hello_subroutine
|
| Show full article (1.70Kb) |
|
9 Comments |
|
  |
Author: shazrahbarshazrahbar
Date: Feb 27, 2008 15:22
Hello Fortran Community,
Those of you young at hearts might relate to this and be sympathetic.
I used to be a Fortran buff 30 years ago, haven't done much since the
early 80s, my university going offspring is struggling with reading a
binary data containing 2 byte integers in Fortran 90.
She has a text binary file that stores numbers 1, 1000 in binary to
verify methodology before tackling the real assignment. She is
struggling. I had hoped to help:)... I started on Fortran 4, F-77 was
revolutionary, F-90 is beyond me, and I am rusty (2 and half decades
worth).
Help anyone?
|
| |
|
7 Comments |
|
  |
Author: ShawnShawn
Date: Feb 27, 2008 13:10
How would I go about changing a common block that is used as a file
and referenced with include statements in every sub and function into
a module. Keep in mind that there is a vast amount of variables in
the common block. I've seen the tutorials on changing small common
blocks over, but not for when they are separate files.
Shawn
|
| |
|
5 Comments |
|
  |
Author: Bart VandewoestyneBart Vandewoestyne
Date: Feb 27, 2008 04:04
Today, during a first introductory Fortran 95 session, a student
of mine came up with the following program:
program numbers
implicit none
integer, parameter :: mykind = selected_real_kind(5,8)
real(kind=mykind) :: x
print *, "precision = ", precision(x)
read *, x
print *, x
end program numbers
He entered 4.000001 for x so that the output (with for example
NAGWare's f95 compiler) is
precision = 6
4.000001
4.0000010
or with gfortran 4.3.0 (20071002)
precision = 6
4.000001
4.000001
|
| Show full article (1.35Kb) |
|
4 Comments |
|
  |
Author: RAMI Y.RAMI Y.
Date: Feb 27, 2008 01:30
Recently, i have posted that i work with lot of factorial function and
my program shows that i have M6104: overflow and i found out that it
actually becasue of the factorial function as some of you have pointed
out. i do hope that you can help me with this
suppose i want to compute the source code as followed,
DO L= NOJ , NOJ+NOI
TA=(X(3)+L) * (EXP(-VALU)) * ((VALU)**L) / FACT(L)
TERMA = TERMA+TA
ENDDO
it's just part of the program, i want to compute this summation
however in some case the number of NOJ+NOI is more than 35 therefore
the program have to compute
|
| |
|
8 Comments |
|
  |
|
|
  |
|
|
  |
Author: averageaverage
Date: Feb 26, 2008 14:19
Does anyone know of any good tools to generate a dependency list for a
makefile for g77?
It seems that all posts I have found on this subject are several years
old and I was hoping something out there is a little more refined than
the 'sfmakedepend' that was so popular back in the 90s. Thank you!
|
| |
|
8 Comments |
|
|
|
|