Compare commits
2 Commits
main
...
migrate_fo
Author | SHA1 | Date |
---|---|---|
|
152328936e | 3 years ago |
|
7b104e9ef9 | 3 years ago |
@ -0,0 +1,7 @@
|
|||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "3.8"
|
||||||
|
install:
|
||||||
|
- make install
|
||||||
|
script:
|
||||||
|
- make test
|
@ -1,23 +1,19 @@
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
bash ./script_install.sh
|
. ./script_install.sh
|
||||||
|
|
||||||
run:
|
run:
|
||||||
bash ./run_simulation.sh
|
./run_simulation.sh
|
||||||
|
|
||||||
|
fftma:
|
||||||
|
cd fftma_module/gen && python3 setup.py install --user
|
||||||
|
|
||||||
test:
|
binaries:
|
||||||
|
cd ./tools/connec && make clean && make all
|
||||||
|
|
||||||
|
test: binaries
|
||||||
cd tests/integration && python3 -m unittest test.py
|
cd tests/integration && python3 -m unittest test.py
|
||||||
|
|
||||||
perf:
|
perf: binaries
|
||||||
cd tests/performance && python3 generation.py
|
cd tests/performance && python3 generation.py
|
||||||
cd tests/performance && python3 connectivity.py
|
cd tests/performance && python3 connectivity.py
|
||||||
|
|
||||||
run-slurm:
|
|
||||||
sbatch run-simulation-slurm
|
|
||||||
|
|
||||||
test-slurm:
|
|
||||||
sbatch run-test-slurm
|
|
||||||
|
|
||||||
perf-slurm:
|
|
||||||
sbatch run-perf-slurm
|
|
@ -1,73 +0,0 @@
|
|||||||
# Paralelización de simulación de permeabilidad
|
|
||||||
|
|
||||||
## Clonar este repositorio
|
|
||||||
|
|
||||||
```
|
|
||||||
# Por HTTPS
|
|
||||||
git clone https://git.csc.gob.ar/ssantisi/simulacion-permeabilidad.git
|
|
||||||
# Por SSH
|
|
||||||
git clone git@git.csc.gob.ar:ssantisi/simulacion-permeabilidad.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Entrar a la carpeta del proyecto
|
|
||||||
|
|
||||||
```
|
|
||||||
cd simulacion-permeabilidad
|
|
||||||
```
|
|
||||||
|
|
||||||
## Instalación de las librerías (Python 3)
|
|
||||||
|
|
||||||
Como requisitos previos a la instalación hace falta tener:
|
|
||||||
|
|
||||||
* `python3`
|
|
||||||
* `python3-pip`
|
|
||||||
* `gfortran`
|
|
||||||
* `gcc`
|
|
||||||
* `build-essentials`
|
|
||||||
|
|
||||||
```
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
|
|
||||||
El instalador genera un entorno virtual en `venv`.
|
|
||||||
|
|
||||||
Para activar el entorno virtual:
|
|
||||||
|
|
||||||
```
|
|
||||||
source venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Para desactivarlo `deactivate`.
|
|
||||||
|
|
||||||
|
|
||||||
## Correr la simulación
|
|
||||||
|
|
||||||
```
|
|
||||||
make run
|
|
||||||
```
|
|
||||||
|
|
||||||
## Correr los casos de prueba
|
|
||||||
|
|
||||||
```
|
|
||||||
make test
|
|
||||||
```
|
|
||||||
|
|
||||||
## Correr las pruebas de performance
|
|
||||||
|
|
||||||
```
|
|
||||||
make perf
|
|
||||||
```
|
|
||||||
|
|
||||||
## Branches de github
|
|
||||||
|
|
||||||
Explicacion sobre las branches que quedaron en github para entender cuales usar:
|
|
||||||
|
|
||||||
- `main` -> solo la migracion a python3 sin ninguna cambio sobre el modulo de FFTMA (sin mejoras)
|
|
||||||
|
|
||||||
- `improvement_NOMBRE` -> branch con el `NOMBRE` de la mejora que esta explicado que hace cada una en el analisis
|
|
||||||
|
|
||||||
donde la primera es `remove_generate_array` y la ultima es `multiple_buffers`
|
|
||||||
|
|
||||||
- `improvement_NOMBRE-logs` -> misma branch de mejora pero agregando informacion de logs que se utilizo para realizar los analisis y no deberian utilizarse porque degradan la performance considerablemente.
|
|
||||||
|
|
||||||
- `migrate_fortran` -> una branch donde se trato de migrar de fortran a C pero quedo inconcluso el trabajo y no se continuo.
|
|
@ -1,126 +0,0 @@
|
|||||||
# Paralelización de simulación de permeabilidad en Cluster HPC (SLURM)
|
|
||||||
|
|
||||||
## ANTES DEL PRIMER USO
|
|
||||||
|
|
||||||
Seguir los siguientes pasos del tutorial:
|
|
||||||
|
|
||||||
1. Clonar este repositorio
|
|
||||||
2. Entrar al entorno NIX
|
|
||||||
3. Generar entorno Python para la simulación
|
|
||||||
|
|
||||||
## USO HABITUAL:
|
|
||||||
|
|
||||||
Habiendo completado las instrucciones previas al primer uso:
|
|
||||||
|
|
||||||
1. Entrar al entorno NIX
|
|
||||||
2. Activar el entorno python
|
|
||||||
3. Ejecutar las siimulaciones de interés
|
|
||||||
|
|
||||||
## Clonar este repositorio
|
|
||||||
|
|
||||||
```
|
|
||||||
# Por HTTPS
|
|
||||||
git clone https://git.csc.gob.ar/ssantisi/simulacion-permeabilidad.git
|
|
||||||
# Por SSH
|
|
||||||
git clone git@git.csc.gob.ar:ssantisi/simulacion-permeabilidad.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Entrar a la carpeta del proyecto
|
|
||||||
|
|
||||||
```
|
|
||||||
cd simulacion-permeabilidad
|
|
||||||
```
|
|
||||||
|
|
||||||
## Entrar al entorno NIX
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
nix-shell
|
|
||||||
```
|
|
||||||
|
|
||||||
Para más info ver el archivo `shell.nix`.
|
|
||||||
|
|
||||||
## Generar entorno Python para la simulación
|
|
||||||
|
|
||||||
Los siguentes requisitos ya vienen provistos por `nix-shell`:
|
|
||||||
|
|
||||||
* `python3`
|
|
||||||
* `python3-pip`
|
|
||||||
* `gfortran`
|
|
||||||
* `gcc`
|
|
||||||
* `build-essentials`
|
|
||||||
|
|
||||||
```
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
|
|
||||||
El instalador genera un entorno virtual en `venv`.
|
|
||||||
|
|
||||||
## Activar el entorno python
|
|
||||||
|
|
||||||
Para activar el entorno virtual (LUEGO DE HABER ACTIVADO EL ENTORNO NIX):
|
|
||||||
|
|
||||||
```
|
|
||||||
source venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Para desactivarlo `deactivate`.
|
|
||||||
|
|
||||||
## Correr simulaciones de interés
|
|
||||||
|
|
||||||
Los siguientes comandos encolan trabajos en el cluster, que correrán tan pronto como les toque su lugar en la cola de trabajos.
|
|
||||||
Se puede monitorear el estado de el/los trabajos encolados con `squeue`.
|
|
||||||
Se puede cancelar un trabajo encolado con `scancel numero_de_trabajo`
|
|
||||||
|
|
||||||
### Correr la simulación (en SLURM)
|
|
||||||
|
|
||||||
Por defecto: 2 nodos, 32 tasks por nodo.
|
|
||||||
Para cambiarlo editar archivo `run-simulation-slurm`.
|
|
||||||
|
|
||||||
```
|
|
||||||
make run-slurm
|
|
||||||
```
|
|
||||||
|
|
||||||
Una vez en ejecución, la salida se escribe a los siguientes archivos:
|
|
||||||
* `simulation-nro-de-trabajo.out` la salida del trabajo.
|
|
||||||
* `simulation-nro-de-trabajo.err` los errores del proceso
|
|
||||||
|
|
||||||
### Correr los casos de prueba (en SLURM)
|
|
||||||
|
|
||||||
Por defecto: 1 nodo, 64 cpus por nodo.
|
|
||||||
Para cambiarlo editar archivo `run-tests-slurm`.
|
|
||||||
|
|
||||||
```
|
|
||||||
make test-slurm
|
|
||||||
```
|
|
||||||
|
|
||||||
Una vez en ejecución, la salida se escribe a los siguientes archivos:
|
|
||||||
* `test-nro-de-trabajo.out` la salida del trabajo.
|
|
||||||
* `test-nro-de-trabajo.err` los errores del proceso
|
|
||||||
|
|
||||||
### Correr las pruebas de performance (en SLURM)
|
|
||||||
|
|
||||||
Por defecto: 1 nodo, 64 cpus por nodo.
|
|
||||||
Para cambiarlo editar archivo `run-perf-slurm`.
|
|
||||||
|
|
||||||
```
|
|
||||||
make perf-slurm
|
|
||||||
```
|
|
||||||
|
|
||||||
Una vez en ejecución, la salida se escribe a los siguientes archivos:
|
|
||||||
* `perf-nro-de-trabajo.out` la salida del trabajo.
|
|
||||||
* `perf-nro-de-trabajo.err` los errores del proceso
|
|
||||||
|
|
||||||
## Branches de github
|
|
||||||
|
|
||||||
Explicacion sobre las branches que quedaron en github para entender cuales usar:
|
|
||||||
|
|
||||||
- `main` -> solo la migracion a python3 sin ninguna cambio sobre el modulo de FFTMA (sin mejoras)
|
|
||||||
|
|
||||||
- `improvement_NOMBRE` -> branch con el `NOMBRE` de la mejora que esta explicado que hace cada una en el analisis
|
|
||||||
|
|
||||||
donde la primera es `remove_generate_array` y la ultima es `multiple_buffers`
|
|
||||||
|
|
||||||
- `improvement_NOMBRE-logs` -> misma branch de mejora pero agregando informacion de logs que se utilizo para realizar los analisis y no deberian utilizarse porque degradan la performance considerablemente.
|
|
||||||
|
|
||||||
- `migrate_fortran` -> una branch donde se trato de migrar de fortran a C pero quedo inconcluso el trabajo y no se continuo.
|
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ~/miniconda3/etc/profile.d/conda.sh
|
||||||
|
conda activate py2_7
|
||||||
|
python --version
|
@ -1,7 +1,10 @@
|
|||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
import numpy
|
|
||||||
|
|
||||||
module_FFTMA = Extension('FFTMA', include_dirs=["./include", numpy.get_include()], sources=["moduleFFTMA.c","./lib_src/Py_getvalues.c","./lib_src/Py_kgeneration.c","./lib_src/genlib.c","./lib_src/random.c","./lib_src/simpio.c","./lib_src/strlib.c","./lib_src/symtab.c","./lib_src/scanadt.c","./lib_src/stack.c","./lib_src/gammf.c","./lib_src/fftma.c","./lib_src/addstat.c","./lib_src/axes.c","./lib_src/cgrid.c","./lib_src/covariance.c","./lib_src/fourt.c","./lib_src/length.c","./lib_src/maxfactor.c","./lib_src/test_fact.c","./lib_src/cov_value.c","./lib_src/generate.c","./lib_src/gasdev.c","./lib_src/ran2.c","./lib_src/stable.c","./lib_src/gaussian.c","./lib_src/power.c","./lib_src/cubic.c","./lib_src/spherical.c","./lib_src/nugget.c","./lib_src/exponential.c","./lib_src/cardsin.c","./lib_src/nor2log.c","./lib_src/kgeneration.c","./lib_src/kgeneration2.c","./lib_src/fftma2.c","./lib_src/prebuild_gwn.c","./lib_src/build_real.c","./lib_src/addstat2.c","./lib_src/clean_real.c","./lib_src/pgeneration.c","./lib_src/pgeneration2.c","./lib_src/FFTPressure.c","./lib_src/FFTtest.c","./lib_src/build_pressure.c","./lib_src/build_velocity.c","./lib_src/total_pressure.c","./lib_src/total_velocity.c","./lib_src/clean_real2.c","./lib_src/waveVectorCompute3D.c","./lib_src/mat_vec.c","./lib_src/derivReal.c","./lib_src/inputdata.c","./lib_src/inputfiledata.c","./lib_src/debuginput.c","./lib_src/readdata.c","./lib_src/readfile_bin.c","./lib_src/writefile.c","./lib_src/writefile_bin.c","./lib_src/testmemory.c","./lib_src/testopenfile.c","./lib_src/readdata3.c"])
|
|
||||||
|
module_FFTMA = Extension('FFTMA', include_dirs = ['./include'],sources=["moduleFFTMA.c","./lib_src/Py_getvalues.c","./lib_src/Py_kgeneration.c","./lib_src/genlib.c","./lib_src/random.c","./lib_src/simpio.c","./lib_src/strlib.c","./lib_src/symtab.c","./lib_src/scanadt.c","./lib_src/stack.c","./lib_src/gammf.c","./lib_src/fftma.c","./lib_src/addstat.c","./lib_src/axes.c","./lib_src/cgrid.c","./lib_src/covariance.c","./lib_src/fourt.c","./lib_src/length.c","./lib_src/maxfactor.c","./lib_src/test_fact.c","./lib_src/cov_value.c","./lib_src/generate.c","./lib_src/gasdev.c","./lib_src/ran2.c","./lib_src/stable.c","./lib_src/gaussian.c","./lib_src/power.c","./lib_src/cubic.c","./lib_src/spherical.c","./lib_src/nugget.c","./lib_src/exponential.c","./lib_src/cardsin.c","./lib_src/nor2log.c","./lib_src/kgeneration.c","./lib_src/kgeneration2.c","./lib_src/fftma2.c","./lib_src/prebuild_gwn.c","./lib_src/build_real.c","./lib_src/addstat2.c","./lib_src/clean_real.c","./lib_src/pgeneration.c","./lib_src/pgeneration2.c","./lib_src/FFTPressure.c","./lib_src/FFTtest.c","./lib_src/build_pressure.c","./lib_src/build_velocity.c","./lib_src/total_pressure.c","./lib_src/total_velocity.c","./lib_src/clean_real2.c","./lib_src/waveVectorCompute3D.c","./lib_src/mat_vec.c","./lib_src/derivReal.c","./lib_src/inputdata.c","./lib_src/inputfiledata.c","./lib_src/debuginput.c","./lib_src/readdata.c","./lib_src/readfile_bin.c","./lib_src/writefile.c","./lib_src/writefile_bin.c","./lib_src/testmemory.c","./lib_src/testopenfile.c","./lib_src/readdata3.c"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setup(ext_modules=[module_FFTMA])
|
setup(ext_modules=[module_FFTMA])
|
||||||
|
@ -1,103 +1,11 @@
|
|||||||
anyio==3.6.2
|
numpy
|
||||||
argon2-cffi==21.3.0
|
scipy
|
||||||
argon2-cffi-bindings==21.2.0
|
matplotlib
|
||||||
arrow==1.2.3
|
ipython
|
||||||
asttokens==2.2.1
|
jupyter
|
||||||
attrs==23.1.0
|
pandas
|
||||||
backcall==0.2.0
|
sympy
|
||||||
beautifulsoup4==4.12.2
|
nose
|
||||||
|
mpi4py
|
||||||
Benchmarker==4.0.1
|
Benchmarker==4.0.1
|
||||||
bleach==6.0.0
|
memory_profiler
|
||||||
cffi==1.15.1
|
|
||||||
comm==0.1.3
|
|
||||||
contourpy==1.0.7
|
|
||||||
cycler==0.11.0
|
|
||||||
debugpy==1.6.7
|
|
||||||
decorator==5.1.1
|
|
||||||
defusedxml==0.7.1
|
|
||||||
executing==1.2.0
|
|
||||||
fastjsonschema==2.16.3
|
|
||||||
fonttools==4.39.3
|
|
||||||
fqdn==1.5.1
|
|
||||||
idna==3.4
|
|
||||||
ipykernel==6.22.0
|
|
||||||
ipython==8.13.1
|
|
||||||
ipython-genutils==0.2.0
|
|
||||||
ipywidgets==8.0.6
|
|
||||||
isoduration==20.11.0
|
|
||||||
jedi==0.18.2
|
|
||||||
Jinja2==3.1.2
|
|
||||||
jsonpointer==2.3
|
|
||||||
jsonschema==4.17.3
|
|
||||||
jupyter==1.0.0
|
|
||||||
jupyter-console==6.6.3
|
|
||||||
jupyter-events==0.6.3
|
|
||||||
jupyter_client==8.2.0
|
|
||||||
jupyter_core==5.3.0
|
|
||||||
jupyter_server==2.5.0
|
|
||||||
jupyter_server_terminals==0.4.4
|
|
||||||
jupyterlab-pygments==0.2.2
|
|
||||||
jupyterlab-widgets==3.0.7
|
|
||||||
kiwisolver==1.4.4
|
|
||||||
MarkupSafe==2.1.2
|
|
||||||
matplotlib==3.7.1
|
|
||||||
matplotlib-inline==0.1.6
|
|
||||||
memory-profiler==0.61.0
|
|
||||||
mistune==2.0.5
|
|
||||||
mpi4py==3.1.4
|
|
||||||
mpmath==1.3.0
|
|
||||||
nbclassic==0.5.6
|
|
||||||
nbclient==0.7.4
|
|
||||||
nbconvert==7.3.1
|
|
||||||
nbformat==5.8.0
|
|
||||||
nest-asyncio==1.5.6
|
|
||||||
nose==1.3.7
|
|
||||||
notebook==6.5.4
|
|
||||||
notebook_shim==0.2.3
|
|
||||||
numpy==1.24.3
|
|
||||||
packaging==23.1
|
|
||||||
pandas==2.0.1
|
|
||||||
pandocfilters==1.5.0
|
|
||||||
parso==0.8.3
|
|
||||||
petsc==3.19.4
|
|
||||||
petsc4py==3.19.4
|
|
||||||
pexpect==4.8.0
|
|
||||||
pickleshare==0.7.5
|
|
||||||
Pillow==9.5.0
|
|
||||||
platformdirs==3.5.0
|
|
||||||
prometheus-client==0.16.0
|
|
||||||
prompt-toolkit==3.0.38
|
|
||||||
psutil==5.9.5
|
|
||||||
ptyprocess==0.7.0
|
|
||||||
pure-eval==0.2.2
|
|
||||||
pycparser==2.21
|
|
||||||
Pygments==2.15.1
|
|
||||||
pyparsing==3.0.9
|
|
||||||
pyrsistent==0.19.3
|
|
||||||
python-dateutil==2.8.2
|
|
||||||
python-json-logger==2.0.7
|
|
||||||
pytz==2023.3
|
|
||||||
PyYAML==6.0
|
|
||||||
pyzmq==25.0.2
|
|
||||||
qtconsole==5.4.2
|
|
||||||
QtPy==2.3.1
|
|
||||||
rfc3339-validator==0.1.4
|
|
||||||
rfc3986-validator==0.1.1
|
|
||||||
scipy==1.10.1
|
|
||||||
Send2Trash==1.8.2
|
|
||||||
six==1.16.0
|
|
||||||
sniffio==1.3.0
|
|
||||||
soupsieve==2.4.1
|
|
||||||
stack-data==0.6.2
|
|
||||||
sympy==1.11.1
|
|
||||||
terminado==0.17.1
|
|
||||||
tinycss2==1.2.1
|
|
||||||
tornado==6.3.1
|
|
||||||
traitlets==5.9.0
|
|
||||||
tzdata==2023.3
|
|
||||||
uri-template==1.2.0
|
|
||||||
wcwidth==0.2.6
|
|
||||||
webcolors==1.13
|
|
||||||
webencodings==0.5.1
|
|
||||||
websocket-client==1.5.1
|
|
||||||
widgetsnbextension==4.0.7
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#SBATCH -o perf-$j.out
|
|
||||||
#SBATCH -e perf-%j.err
|
|
||||||
#SBATCH -N 1
|
|
||||||
#SBATCH --ntasks-per-node 32
|
|
||||||
#SBATCH --partition=free-rider
|
|
||||||
|
|
||||||
hostname
|
|
||||||
date
|
|
||||||
|
|
||||||
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
|
||||||
|
|
||||||
# vuelca lista de nodos asignados a un archivo "nodefile"
|
|
||||||
nodelist=$(scontrol show hostname $SLURM_NODELIST)
|
|
||||||
printf "%s\n" "${nodelist[@]}" > nodefile
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
# ejecuta mpirun con el nodefile creado
|
|
||||||
make perf
|
|
||||||
|
|
||||||
rm nodefile
|
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#SBATCH -o simulation-%j.out
|
|
||||||
#SBATCH -e simulation-%j.err
|
|
||||||
#SBATCH -N 2
|
|
||||||
#SBATCH --ntasks-per-node 32
|
|
||||||
#SBATCH --partition=free-rider
|
|
||||||
|
|
||||||
hostname
|
|
||||||
date
|
|
||||||
|
|
||||||
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
|
||||||
|
|
||||||
# vuelca lista de nodos asignados a un archivo "nodefile"
|
|
||||||
nodelist=$(scontrol show hostname $SLURM_NODELIST)
|
|
||||||
printf "%s\n" "${nodelist[@]}" > nodefile
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
# ejecuta mpirun con el nodefile creado
|
|
||||||
mpirun --hostfile nodefile python3 ./mpirunner.py
|
|
||||||
|
|
||||||
rm nodefile
|
|
@ -1,23 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#SBATCH -o test-%j.out
|
|
||||||
#SBATCH -e test-%j.err
|
|
||||||
#SBATCH -N 1
|
|
||||||
#SBATCH --ntasks-per-node 32
|
|
||||||
#SBATCH --partition=free-rider
|
|
||||||
|
|
||||||
hostname
|
|
||||||
date
|
|
||||||
|
|
||||||
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
|
||||||
|
|
||||||
# vuelca lista de nodos asignados a un archivo "nodefile"
|
|
||||||
nodelist=$(scontrol show hostname $SLURM_NODELIST)
|
|
||||||
printf "%s\n" "${nodelist[@]}" > nodefile
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
# ejecuta mpirun con el nodefile creado
|
|
||||||
#mpirun --hostfile nodefile python3 ./mpirunner.py
|
|
||||||
make test
|
|
||||||
|
|
||||||
rm nodefile
|
|
@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
mpirun python3 mpirunner.py
|
mpirun python3 mpirunner.py
|
||||||
|
@ -1,9 +1,21 @@
|
|||||||
python3 -m venv venv
|
#!/bin/bash
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
export PETSC_CONFIGURE_OPTIONS="--download-fblaslapack --download-chaco --download-hdf5"
|
export WORKSPACE=$(pwd)
|
||||||
pip3 install -r requirements.txt
|
rm -r ~/.cache/pip
|
||||||
|
|
||||||
|
# gfortran
|
||||||
|
|
||||||
|
sudo apt install build-essential
|
||||||
|
sudo apt install gfortran
|
||||||
|
gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'
|
||||||
|
|
||||||
|
pip3 install --user numpy scipy matplotlib ipython jupyter pandas sympy nose mpi4py
|
||||||
|
|
||||||
./script_fortran.sh
|
# install open mpi latest version
|
||||||
|
|
||||||
cd fftma_module/gen && python3 setup.py install
|
sudo apt install openmpi-bin
|
||||||
|
|
||||||
|
# setup petsc4py
|
||||||
|
|
||||||
|
export PETSC_CONFIGURE_OPTIONS="--download-fblaslapack --download-chaco --download-hdf5"
|
||||||
|
pip3 install petsc petsc4py
|
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export WORKSPACE=$(pwd)
|
||||||
|
|
||||||
|
# gfortran
|
||||||
|
|
||||||
|
sudo apt install build-essential
|
||||||
|
sudo apt install gfortran
|
||||||
|
gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'
|
||||||
|
|
||||||
|
# install open mpi 2.1.1
|
||||||
|
|
||||||
|
curl https://download.open-mpi.org/release/open-mpi/v2.1/openmpi-2.1.1.tar.bz2 --output openmpi-2.1.1.tar.bz2
|
||||||
|
tar -jxf openmpi-2.1.1.tar.bz2
|
||||||
|
cd openmpi-2.1.1
|
||||||
|
|
||||||
|
./configure --prefix=$HOME/opt/openmpi
|
||||||
|
make all
|
||||||
|
make install
|
||||||
|
|
||||||
|
echo "export PATH=\$PATH:\$HOME/opt/openmpi/bin" >> $HOME/.bashrc
|
||||||
|
|
||||||
|
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/opt/openmpi/lib" >> $HOME/.bashrc
|
||||||
|
|
||||||
|
source ~/.$1rc
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# install miniconda
|
||||||
|
|
||||||
|
curl https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh --output Miniconda3-py39_4.10.3-Linux-x86_64.sh
|
||||||
|
|
||||||
|
bash Miniconda3-py39_4.10.3-Linux-x86_64.sh -b
|
||||||
|
|
||||||
|
source ~/.$1rc
|
||||||
|
|
||||||
|
# create python 2.7 environment
|
||||||
|
|
||||||
|
conda init $1
|
||||||
|
|
||||||
|
source ~/.$1rc
|
||||||
|
|
||||||
|
conda create -n py2_7 python=2.7
|
||||||
|
conda activate py2_7
|
||||||
|
|
||||||
|
pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
|
||||||
|
|
||||||
|
# setup petsc
|
||||||
|
|
||||||
|
git clone https://gitlab.com/petsc/petsc
|
||||||
|
|
||||||
|
cd petsc
|
||||||
|
|
||||||
|
git checkout maint-3.8
|
||||||
|
./configure --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --download-fblaslapack --with-debugging=0 COPTFLAGS='-O3 -march=native -mtune=native' CXXOPTFLAGS='-O3 -march=native -mtune=native' FOPTFLAGS='-O3 -march=native -mtune=native'
|
||||||
|
|
||||||
|
make PETSC_DIR=$WORKSPACE/petsc PETSC_ARCH=arch-linux2-c-opt all
|
||||||
|
|
||||||
|
make PETSC_DIR=$WORKSPACE/petsc PETSC_ARCH=arch-linux-c-opt check
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# setup petsc4py
|
||||||
|
|
||||||
|
git clone https://Icolecchio@bitbucket.org/petsc/petsc4py.git
|
||||||
|
cd petsc4py
|
||||||
|
git checkout maint-3.8
|
||||||
|
export PETSC_DIR=$WORKSPACE/petsc
|
||||||
|
python setup.py build
|
||||||
|
python setup.py install --user
|
||||||
|
python setup.py test
|
@ -1,17 +0,0 @@
|
|||||||
# nix-shell -p [ (python3Full.withPackages(ps: with ps; [ pip ])) gfortran zlib]
|
|
||||||
|
|
||||||
with import <nixpkgs> {};
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "python-env-petsc";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ m4 removeReferencesTo ];
|
|
||||||
buildInputs = [ (python3Full.withPackages(ps: with ps; [ pip ]))
|
|
||||||
gfortran
|
|
||||||
zlib
|
|
||||||
gcc
|
|
||||||
];
|
|
||||||
dontAddPrefix=true;
|
|
||||||
|
|
||||||
env.LD_LIBRARY_PATH = zlib + "/lib:" + stdenv.cc.cc.lib + "/lib";
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#SBATCH -o slurm.out
|
|
||||||
#SBATCH -e slurm.err
|
|
||||||
#SBATCH -N 2
|
|
||||||
#SBATCH --ntasks-per-node 32
|
|
||||||
#SBATCH --partition=free-rider
|
|
||||||
|
|
||||||
hostname
|
|
||||||
date
|
|
||||||
|
|
||||||
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
|
||||||
|
|
||||||
# vuelca lista de nodos asignados a un archivo "nodefile"
|
|
||||||
nodelist=$(scontrol show hostname $SLURM_NODELIST)
|
|
||||||
printf "%s\n" "${nodelist[@]}" > nodefile
|
|
||||||
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
# ejecuta mpirun con el nodefile creado
|
|
||||||
mpirun --hostfile nodefile python3 ./mpirunner.py
|
|
@ -0,0 +1,13 @@
|
|||||||
|
all: conec2d conec3d
|
||||||
|
libf2c.a:
|
||||||
|
cd libf2c && make
|
||||||
|
connec2d.o:
|
||||||
|
gcc ./src/connec2d.c -c -o connec2d.o
|
||||||
|
connec3d.o:
|
||||||
|
gcc ./src/connec3d.c -c -o connec3d.o
|
||||||
|
conec2d: connec2d.o libf2c.a
|
||||||
|
gcc connec2d.o ./libf2c/libf2c.a -lm -o conec2d
|
||||||
|
conec3d: connec3d.o libf2c.a
|
||||||
|
gcc connec3d.o ./libf2c/libf2c.a -lm -o conec3d
|
||||||
|
clean:
|
||||||
|
rm -f conec2d conec3d
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
/****************************************************************
|
||||||
|
Copyright 1990 - 1997 by AT&T, Lucent Technologies and Bellcore.
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software
|
||||||
|
and its documentation for any purpose and without fee is hereby
|
||||||
|
granted, provided that the above copyright notice appear in all
|
||||||
|
copies and that both that the copyright notice and this
|
||||||
|
permission notice and warranty disclaimer appear in supporting
|
||||||
|
documentation, and that the names of AT&T, Bell Laboratories,
|
||||||
|
Lucent or Bellcore or any of their entities not be used in
|
||||||
|
advertising or publicity pertaining to distribution of the
|
||||||
|
software without specific, written prior permission.
|
||||||
|
|
||||||
|
AT&T, Lucent and Bellcore disclaim all warranties with regard to
|
||||||
|
this software, including all implied warranties of
|
||||||
|
merchantability and fitness. In no event shall AT&T, Lucent or
|
||||||
|
Bellcore be liable for any special, indirect or consequential
|
||||||
|
damages or any damages whatsoever resulting from loss of use,
|
||||||
|
data or profits, whether in an action of contract, negligence or
|
||||||
|
other tortious action, arising out of or in connection with the
|
||||||
|
use or performance of this software.
|
||||||
|
****************************************************************/
|
||||||
|
|
@ -0,0 +1,374 @@
|
|||||||
|
As shipped, "makefile" is a copy of "makefile.u", a Unix makefile.
|
||||||
|
Variants for other systems have names of the form makefile.* and
|
||||||
|
have initial comments saying how to invoke them. You may wish to
|
||||||
|
copy one of the other makefile.* files to makefile.
|
||||||
|
|
||||||
|
If you use a C++ compiler, first say
|
||||||
|
|
||||||
|
make hadd
|
||||||
|
|
||||||
|
to create a suitable f2c.h from f2c.h0 and f2ch.add. Otherwise,
|
||||||
|
|
||||||
|
make f2c.h
|
||||||
|
|
||||||
|
will just copy f2c.h0 to f2c.h .
|
||||||
|
|
||||||
|
If your compiler does not recognize ANSI C headers,
|
||||||
|
compile with KR_headers defined: either add -DKR_headers
|
||||||
|
to the definition of CFLAGS in the makefile, or insert
|
||||||
|
|
||||||
|
#define KR_headers
|
||||||
|
|
||||||
|
at the top of f2c.h .
|
||||||
|
|
||||||
|
If your system lacks onexit() and you are not using an ANSI C
|
||||||
|
compiler, then you should compile main.c with NO_ONEXIT defined.
|
||||||
|
See the comments about onexit in makefile.u.
|
||||||
|
|
||||||
|
If your system has a double drem() function such that drem(a,b)
|
||||||
|
is the IEEE remainder function (with double a, b), then you may
|
||||||
|
wish to compile r_mod.c and d_mod.c with IEEE_drem defined.
|
||||||
|
|
||||||
|
To check for transmission errors, issue the command
|
||||||
|
make check
|
||||||
|
or
|
||||||
|
make -f makefile.u check
|
||||||
|
|
||||||
|
This assumes you have the xsum program whose source, xsum.c,
|
||||||
|
is distributed as part of "all from f2c/src", and that it
|
||||||
|
is installed somewhere in your search path. If you do not
|
||||||
|
have xsum, you can obtain xsum.c by sending the following E-mail
|
||||||
|
message to netlib@netlib.org
|
||||||
|
send xsum.c from f2c/src
|
||||||
|
|
||||||
|
For convenience, the f2c.h0 in this directory is a copy of netlib's
|
||||||
|
"f2c.h from f2c". It is best to install f2c.h in a standard place,
|
||||||
|
so "include f2c.h" will work in any directory without further ado.
|
||||||
|
Beware that the makefiles do not cause recompilation when f2c.h is
|
||||||
|
changed.
|
||||||
|
|
||||||
|
On machines, such as those using a DEC Alpha processor, on which
|
||||||
|
sizeof(short) == 2, sizeof(int) == sizeof(float) == 4, and
|
||||||
|
sizeof(long) == sizeof(double) == 8, it suffices to modify f2c.h by
|
||||||
|
removing the first occurrence of "long " on each line containing
|
||||||
|
"long ". On Unix systems, you can do this by issuing the commands
|
||||||
|
mv f2c.h f2c.h0
|
||||||
|
sed 's/long int /int /' f2c.h0 >f2c.h
|
||||||
|
On such machines, one can enable INTEGER*8 by uncommenting the typedefs
|
||||||
|
of longint and ulongint in f2c.h and adjusting them, so they read
|
||||||
|
typedef long longint;
|
||||||
|
typedef unsigned long ulongint;
|
||||||
|
and by compiling libf2c with -DAllow_TYQUAD, as discussed below.
|
||||||
|
|
||||||
|
|
||||||
|
Most of the routines in libf2c are support routines for Fortran
|
||||||
|
intrinsic functions or for operations that f2c chooses not
|
||||||
|
to do "in line". There are a few exceptions, summarized below --
|
||||||
|
functions and subroutines that appear to your program as ordinary
|
||||||
|
external Fortran routines.
|
||||||
|
|
||||||
|
If you use the REAL valued functions listed below (ERF, ERFC,
|
||||||
|
DTIME, and ETIME) with "f2c -R", then you need to compile the
|
||||||
|
corresponding source files with -DREAL=float. To do this, it is
|
||||||
|
perhaps simplest to add "-DREAL=float" to CFLAGS in the makefile.
|
||||||
|
|
||||||
|
1. CALL ABORT prints a message and causes a core dump.
|
||||||
|
|
||||||
|
2. ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION
|
||||||
|
error functions (with x REAL and d DOUBLE PRECISION);
|
||||||
|
DERF must be declared DOUBLE PRECISION in your program.
|
||||||
|
Both ERF and DERF assume your C library provides the
|
||||||
|
underlying erf() function (which not all systems do).
|
||||||
|
|
||||||
|
3. ERFC(r) and DERFC(d) are the complementary error functions:
|
||||||
|
ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)
|
||||||
|
(except that their results may be more accurate than
|
||||||
|
explicitly evaluating the above formulae would give).
|
||||||
|
Again, ERFC and r are REAL, and DERFC and d are DOUBLE
|
||||||
|
PRECISION (and must be declared as such in your program),
|
||||||
|
and ERFC and DERFC rely on your system's erfc().
|
||||||
|
|
||||||
|
4. CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER
|
||||||
|
variable, sets s to the n-th command-line argument (or to
|
||||||
|
all blanks if there are fewer than n command-line arguments);
|
||||||
|
CALL GETARG(0,s) sets s to the name of the program (on systems
|
||||||
|
that support this feature). See IARGC below.
|
||||||
|
|
||||||
|
5. CALL GETENV(name, value), where name and value are of type
|
||||||
|
CHARACTER, sets value to the environment value, $name, of
|
||||||
|
name (or to blanks if $name has not been set).
|
||||||
|
|
||||||
|
6. NARGS = IARGC() sets NARGS to the number of command-line
|
||||||
|
arguments (an INTEGER value).
|
||||||
|
|
||||||
|
7. CALL SIGNAL(n,func), where n is an INTEGER and func is an
|
||||||
|
EXTERNAL procedure, arranges for func to be invoked when n
|
||||||
|
occurs (on systems where this makes sense).
|
||||||
|
|
||||||
|
If your compiler complains about the signal calls in main.c, s_paus.c,
|
||||||
|
and signal_.c, you may need to adjust signal1.h suitably. See the
|
||||||
|
comments in signal1.h.
|
||||||
|
|
||||||
|
8. ETIME(ARR) and DTIME(ARR) are REAL functions that return
|
||||||
|
execution times. ARR is declared REAL ARR(2). The elapsed
|
||||||
|
user and system CPU times are stored in ARR(1) and ARR(2),
|
||||||
|
respectively. ETIME returns the total elapsed CPU time,
|
||||||
|
i.e., ARR(1) + ARR(2). DTIME returns total elapsed CPU
|
||||||
|
time since the previous call on DTIME.
|
||||||
|
|
||||||
|
9. CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
|
||||||
|
cmd to the system's command processor (on systems where
|
||||||
|
this can be done).
|
||||||
|
|
||||||
|
10. CALL FLUSH flushes all buffers.
|
||||||
|
|
||||||
|
11. FTELL(i) is an INTEGER function that returns the current
|
||||||
|
offset of Fortran unit i (or -1 if unit i is not open).
|
||||||
|
|
||||||
|
12. CALL FSEEK(i, offset, whence, *errlab) attemps to move
|
||||||
|
Fortran unit i to the specified offset: absolute offset
|
||||||
|
if whence = 0; relative to the current offset if whence = 1;
|
||||||
|
relative to the end of the file if whence = 2. It branches
|
||||||
|
to label errlab if unit i is not open or if the call
|
||||||
|
otherwise fails.
|
||||||
|
|
||||||
|
The routines whose objects are makefile.u's $(I77) are for I/O.
|
||||||
|
The following comments apply to them.
|
||||||
|
|
||||||
|
If your system lacks /usr/include/local.h ,
|
||||||
|
then you should create an appropriate local.h in
|
||||||
|
this directory. An appropriate local.h may simply
|
||||||
|
be empty, or it may #define VAX or #define CRAY
|
||||||
|
(or whatever else you must do to make fp.h work right).
|
||||||
|
Alternatively, edit fp.h to suite your machine.
|
||||||
|
|
||||||
|
If your system lacks /usr/include/fcntl.h , then you
|
||||||
|
should simply create an empty fcntl.h in this directory.
|
||||||
|
If your compiler then complains about creat and open not
|
||||||
|
having a prototype, compile with OPEN_DECL defined.
|
||||||
|
On many systems, open and creat are declared in fcntl.h .
|
||||||
|
|
||||||
|
If your system's sprintf does not work the way ANSI C
|
||||||
|
specifies -- specifically, if it does not return the
|
||||||
|
number of characters transmitted -- then insert the line
|
||||||
|
|
||||||
|
#define USE_STRLEN
|
||||||
|
|
||||||
|
at the end of fmt.h . This is necessary with
|
||||||
|
at least some versions of Sun software.
|
||||||
|
In particular, if you get a warning about an improper
|
||||||
|
pointer/integer combination in compiling wref.c, then
|
||||||
|
you need to compile with -DUSE_STRLEN .
|
||||||
|
|
||||||
|
If your system's fopen does not like the ANSI binary
|
||||||
|
reading and writing modes "rb" and "wb", then you should
|
||||||
|
compile open.c with NON_ANSI_RW_MODES #defined.
|
||||||
|
|
||||||
|
If you get error messages about references to cf->_ptr
|
||||||
|
and cf->_base when compiling wrtfmt.c and wsfe.c or to
|
||||||
|
stderr->_flag when compiling err.c, then insert the line
|
||||||
|
|
||||||
|
#define NON_UNIX_STDIO
|
||||||
|
|
||||||
|
at the beginning of fio.h, and recompile everything (or
|
||||||
|
at least those modules that contain NON_UNIX_STDIO).
|
||||||
|
|
||||||
|
Unformatted sequential records consist of a length of record
|
||||||
|
contents, the record contents themselves, and the length of
|
||||||
|
record contents again (for backspace). Prior to 17 Oct. 1991,
|
||||||
|
the length was of type int; now it is of type long, but you
|
||||||
|
can change it back to int by inserting
|
||||||
|
|
||||||
|
#define UIOLEN_int
|
||||||
|
|
||||||
|
at the beginning of fio.h. This affects only sue.c and uio.c .
|
||||||
|
|
||||||
|
If you have a really ancient K&R C compiler that does not understand
|
||||||
|
void, add -Dvoid=int to the definition of CFLAGS in the makefile.
|
||||||
|
|
||||||
|
On VAX, Cray, or Research Tenth-Edition Unix systems, you may
|
||||||
|
need to add -DVAX, -DCRAY, or -DV10 (respectively) to CFLAGS
|
||||||
|
to make fp.h work correctly. Alternatively, you may need to
|
||||||
|
edit fp.h to suit your machine.
|
||||||
|
|
||||||
|
If your compiler complains about the signal calls in main.c, s_paus.c,
|
||||||
|
and signal_.c, you may need to adjust signal1.h suitably. See the
|
||||||
|
comments in signal1.h.
|
||||||
|
|
||||||
|
You may need to supply the following non-ANSI routines:
|
||||||
|
|
||||||
|
fstat(int fileds, struct stat *buf) is similar
|
||||||
|
to stat(char *name, struct stat *buf), except that
|
||||||
|
the first argument, fileds, is the file descriptor
|
||||||
|
returned by open rather than the name of the file.
|
||||||
|
fstat is used in the system-dependent routine
|
||||||
|
canseek (in the libf2c source file err.c), which
|
||||||
|
is supposed to return 1 if it's possible to issue
|
||||||
|
seeks on the file in question, 0 if it's not; you may
|
||||||
|
need to suitably modify err.c . On non-UNIX systems,
|
||||||
|
you can avoid references to fstat and stat by compiling
|
||||||
|
with NON_UNIX_STDIO defined; in that case, you may need
|
||||||
|
to supply access(char *Name,0), which is supposed to
|
||||||
|
return 0 if file Name exists, nonzero otherwise.
|
||||||
|
|
||||||
|
char * mktemp(char *buf) is supposed to replace the
|
||||||
|
6 trailing X's in buf with a unique number and then
|
||||||
|
return buf. The idea is to get a unique name for
|
||||||
|
a temporary file.
|
||||||
|
|
||||||
|
On non-UNIX systems, you may need to change a few other,
|
||||||
|
e.g.: the form of name computed by mktemp() in endfile.c and
|
||||||
|
open.c; the use of the open(), close(), and creat() system
|
||||||
|
calls in endfile.c, err.c, open.c; and the modes in calls on
|
||||||
|
fopen() and fdopen() (and perhaps the use of fdopen() itself
|
||||||
|
-- it's supposed to return a FILE* corresponding to a given
|
||||||
|
an integer file descriptor) in err.c and open.c (component ufmt
|
||||||
|
of struct unit is 1 for formatted I/O -- text mode on some systems
|
||||||
|
-- and 0 for unformatted I/O -- binary mode on some systems).
|
||||||
|
Compiling with -DNON_UNIX_STDIO omits all references to creat()
|
||||||
|
and almost all references to open() and close(), the exception
|
||||||
|
being in the function f__isdev() (in open.c).
|
||||||
|
|
||||||
|
If you wish to use translated Fortran that has funny notions
|
||||||
|
of record length for direct unformatted I/O (i.e., that assumes
|
||||||
|
RECL= values in OPEN statements are not bytes but rather counts
|
||||||
|
of some other units -- e.g., 4-character words for VMS), then you
|
||||||
|
should insert an appropriate #define for url_Adjust at the
|
||||||
|
beginning of open.c . For VMS Fortran, for example,
|
||||||
|
#define url_Adjust(x) x *= 4
|
||||||
|
would suffice.
|
||||||
|
|
||||||
|
By default, Fortran I/O units 5, 6, and 0 are pre-connected to
|
||||||
|
stdin, stdout, and stderr, respectively. You can change this
|
||||||
|
behavior by changing f_init() in err.c to suit your needs.
|
||||||
|
Note that f2c assumes READ(*... means READ(5... and WRITE(*...
|
||||||
|
means WRITE(6... . Moreover, an OPEN(n,... statement that does
|
||||||
|
not specify a file name (and does not specify STATUS='SCRATCH')
|
||||||
|
assumes FILE='fort.n' . You can change this by editing open.c
|
||||||
|
and endfile.c suitably.
|
||||||
|
|
||||||
|
Unless you adjust the "#define MXUNIT" line in fio.h, Fortran units
|
||||||
|
0, 1, ..., 99 are available, i.e., the highest allowed unit number
|
||||||
|
is MXUNIT - 1.
|
||||||
|
|
||||||
|
Lines protected from compilation by #ifdef Allow_TYQUAD
|
||||||
|
are for a possible extension to 64-bit integers in which
|
||||||
|
integer = int = 32 bits and longint = long = 64 bits.
|
||||||
|
|
||||||
|
The makefile does not attempt to compile pow_qq.c, qbitbits.c,
|
||||||
|
and qbitshft.c, which are meant for use with INTEGER*8. To use
|
||||||
|
INTEGER*8, you must modify f2c.h to declare longint and ulongint
|
||||||
|
appropriately; then add $(QINT) to the end of the makefile's
|
||||||
|
dependency list for libf2c.a (if makefile is a copy of makefile.u;
|
||||||
|
for the PC makefiles, add pow_qq.obj qbitbits.obj qbitshft.obj
|
||||||
|
to the library's dependency list and adjust libf2c.lbc or libf2c.sy
|
||||||
|
accordingly). Also add -DAllow_TYQUAD to the makefile's CFLAGS
|
||||||
|
assignment. To make longint and ulongint available, it may suffice
|
||||||
|
to add -DINTEGER_STAR_8 to the CFLAGS assignment.
|
||||||
|
|
||||||
|
Following Fortran 90, s_cat.c and s_copy.c allow the target of a
|
||||||
|
(character string) assignment to be appear on its right-hand, at
|
||||||
|
the cost of some extra overhead for all run-time concatenations.
|
||||||
|
If you prefer the extra efficiency that comes with the Fortran 77
|
||||||
|
requirement that the left-hand side of a character assignment not
|
||||||
|
be involved in the right-hand side, compile s_cat.c and s_copy.c
|
||||||
|
with -DNO_OVERWRITE .
|
||||||
|
|
||||||
|
Extensions (Feb. 1993) to NAMELIST processing:
|
||||||
|
1. Reading a ? instead of &name (the start of a namelist) causes
|
||||||
|
the namelist being sought to be written to stdout (unit 6);
|
||||||
|
to omit this feature, compile rsne.c with -DNo_Namelist_Questions.
|
||||||
|
2. Reading the wrong namelist name now leads to an error message
|
||||||
|
and an attempt to skip input until the right namelist name is found;
|
||||||
|
to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip.
|
||||||
|
3. Namelist writes now insert newlines before each variable; to omit
|
||||||
|
this feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines.
|
||||||
|
4. (Sept. 1995) When looking for the &name that starts namelist
|
||||||
|
input, lines whose first non-blank character is something other
|
||||||
|
than &, $, or ? are treated as comment lines and ignored, unless
|
||||||
|
rsne.c is compiled with -DNo_Namelist_Comments.
|
||||||
|
|
||||||
|
Nonstandard extension (Feb. 1993) to open: for sequential files,
|
||||||
|
ACCESS='APPEND' (or access='anything else starting with "A" or "a"')
|
||||||
|
causes the file to be positioned at end-of-file, so a write will
|
||||||
|
append to the file.
|
||||||
|
|
||||||
|
Some buggy Fortran programs use unformatted direct I/O to write
|
||||||
|
an incomplete record and later read more from that record than
|
||||||
|
they have written. For records other than the last, the unwritten
|
||||||
|
portion of the record reads as binary zeros. The last record is
|
||||||
|
a special case: attempting to read more from it than was written
|
||||||
|
gives end-of-file -- which may help one find a bug. Some other
|
||||||
|
Fortran I/O libraries treat the last record no differently than
|
||||||
|
others and thus give no help in finding the bug of reading more
|
||||||
|
than was written. If you wish to have this behavior, compile
|
||||||
|
uio.c with -DPad_UDread .
|
||||||
|
|
||||||
|
If you want to be able to catch write failures (e.g., due to a
|
||||||
|
disk being full) with an ERR= specifier, compile dfe.c, due.c,
|
||||||
|
sfe.c, sue.c, and wsle.c with -DALWAYS_FLUSH. This will lead to
|
||||||
|
slower execution and more I/O, but should make ERR= work as
|
||||||
|
expected, provided fflush returns an error return when its
|
||||||
|
physical write fails.
|
||||||
|
|
||||||
|
Carriage controls are meant to be interpreted by the UNIX col
|
||||||
|
program (or a similar program). Sometimes it's convenient to use
|
||||||
|
only ' ' as the carriage control character (normal single spacing).
|
||||||
|
If you compile lwrite.c and wsfe.c with -DOMIT_BLANK_CC, formatted
|
||||||
|
external output lines will have an initial ' ' quietly omitted,
|
||||||
|
making use of the col program unnecessary with output that only
|
||||||
|
has ' ' for carriage control.
|
||||||
|
|
||||||
|
The Fortran 77 Standard leaves it up to the implementation whether
|
||||||
|
formatted writes of floating-point numbers of absolute value < 1 have
|
||||||
|
a zero before the decimal point. By default, libI77 omits such
|
||||||
|
superfluous zeros, but you can cause them to appear by compiling
|
||||||
|
lwrite.c, wref.c, and wrtfmt.c with -DWANT_LEAD_0 .
|
||||||
|
|
||||||
|
If your (Unix) system lacks a ranlib command, you don't need it.
|
||||||
|
Either comment out the makefile's ranlib invocation, or install
|
||||||
|
a harmless "ranlib" command somewhere in your PATH, such as the
|
||||||
|
one-line shell script
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
or (on some systems)
|
||||||
|
|
||||||
|
exec /usr/bin/ar lts $1 >/dev/null
|
||||||
|
|
||||||
|
By default, the routines that implement complex and double complex
|
||||||
|
division, c_div.c and z_div.c, call sig_die to print an error message
|
||||||
|
and exit if they see a divisor of 0, as this is sometimes helpful for
|
||||||
|
debugging. On systems with IEEE arithmetic, compiling c_div.c and
|
||||||
|
z_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set both
|
||||||
|
the real and imaginary parts of the result to +INFINITY if the
|
||||||
|
numerator is nonzero, or to NaN if it vanishes.
|
||||||
|
|
||||||
|
Nowadays most Unix and Linux systems have function
|
||||||
|
int ftruncate(int fildes, off_t len);
|
||||||
|
defined in system header file unistd.h that adjusts the length of file
|
||||||
|
descriptor fildes to length len. Unless endfile.c is compiled with
|
||||||
|
-DNO_TRUNCATE, endfile.c #includes "unistd.h" and calls ftruncate() if
|
||||||
|
necessary to shorten files. If your system lacks ftruncate(), compile
|
||||||
|
endfile.c with -DNO_TRUNCATE to make endfile.c use the older and more
|
||||||
|
portable scheme of shortening a file by copying to a temporary file
|
||||||
|
and back again.
|
||||||
|
|
||||||
|
The initializations for "f2c -trapuv" are done by _uninit_f2c(),
|
||||||
|
whose source is uninit.c, introduced June 2001. On IEEE-arithmetic
|
||||||
|
systems, _uninit_f2c should initialize floating-point variables to
|
||||||
|
signaling NaNs and, at its first invocation, should enable the
|
||||||
|
invalid operation exception. Alas, the rules for distinguishing
|
||||||
|
signaling from quiet NaNs were not specified in the IEEE P754 standard,
|
||||||
|
nor were the precise means of enabling and disabling IEEE-arithmetic
|
||||||
|
exceptions, and these details are thus system dependent. There are
|
||||||
|
#ifdef's in uninit.c that specify them for some popular systems. If
|
||||||
|
yours is not one of these systems, it may take some detective work to
|
||||||
|
discover the appropriate details for your system. Sometimes it helps
|
||||||
|
to look in the standard include directories for header files with
|
||||||
|
relevant-sounding names, such as ieeefp.h, nan.h, or trap.h, and
|
||||||
|
it may be simplest to run experiments to see what distinguishes a
|
||||||
|
signaling from a quiet NaN. (If x is initialized to a signaling
|
||||||
|
NaN and the invalid operation exception is masked off, as it should
|
||||||
|
be by default on IEEE-arithmetic systems, then computing, say,
|
||||||
|
y = x + 1 will yield a quiet NaN.)
|
@ -0,0 +1,22 @@
|
|||||||
|
#include "stdio.h"
|
||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern VOID sig_die();
|
||||||
|
|
||||||
|
int abort_()
|
||||||
|
#else
|
||||||
|
extern void sig_die(const char*,int);
|
||||||
|
|
||||||
|
int abort_(void)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
sig_die("Fortran abort routine called", 1);
|
||||||
|
return 0; /* not reached */
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
#define IEEE_8087
|
||||||
|
#define Arith_Kind_ASL 1
|
||||||
|
#define Long int
|
||||||
|
#define Intcast (int)(long)
|
||||||
|
#define Double_Align
|
||||||
|
#define X64_bit_pointers
|
||||||
|
#define QNaN0 0x0
|
||||||
|
#define QNaN1 0xfff80000
|
@ -0,0 +1,267 @@
|
|||||||
|
/****************************************************************
|
||||||
|
Copyright (C) 1997, 1998, 2000 Lucent Technologies
|
||||||
|
All Rights Reserved
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software and
|
||||||
|
its documentation for any purpose and without fee is hereby
|
||||||
|
granted, provided that the above copyright notice appear in all
|
||||||
|
copies and that both that the copyright notice and this
|
||||||
|
permission notice and warranty disclaimer appear in supporting
|
||||||
|
documentation, and that the name of Lucent or any of its entities
|
||||||
|
not be used in advertising or publicity pertaining to
|
||||||
|
distribution of the software without specific, written prior
|
||||||
|
permission.
|
||||||
|
|
||||||
|
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||||
|
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||||
|
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||||
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
|
THIS SOFTWARE.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
/* Try to deduce arith.h from arithmetic properties. */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h> /* possibly for ssize_t */
|
||||||
|
#include <math.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h> /* another possible place for ssize_t */
|
||||||
|
|
||||||
|
#ifdef NO_FPINIT
|
||||||
|
#define fpinit_ASL()
|
||||||
|
#else
|
||||||
|
#ifndef KR_headers
|
||||||
|
extern
|
||||||
|
#ifdef __cplusplus
|
||||||
|
"C"
|
||||||
|
#endif
|
||||||
|
void fpinit_ASL(void);
|
||||||
|
#endif /*KR_headers*/
|
||||||
|
#endif /*NO_FPINIT*/
|
||||||
|
|
||||||
|
static int dalign;
|
||||||
|
typedef struct
|
||||||
|
Akind {
|
||||||
|
char *name;
|
||||||
|
int kind;
|
||||||
|
} Akind;
|
||||||
|
|
||||||
|
static Akind
|
||||||
|
IEEE_8087 = { "IEEE_8087", 1 },
|
||||||
|
IEEE_MC68k = { "IEEE_MC68k", 2 },
|
||||||
|
IBM = { "IBM", 3 },
|
||||||
|
VAX = { "VAX", 4 },
|
||||||
|
CRAY = { "CRAY", 5};
|
||||||
|
|
||||||
|
static double t_nan;
|
||||||
|
|
||||||
|
static Akind *
|
||||||
|
Lcheck(void)
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
double d;
|
||||||
|
long L[2];
|
||||||
|
} u;
|
||||||
|
struct {
|
||||||
|
double d;
|
||||||
|
long L;
|
||||||
|
} x[2];
|
||||||
|
|
||||||
|
if (sizeof(x) > 2*(sizeof(double) + sizeof(long)))
|
||||||
|
dalign = 1;
|
||||||
|
u.L[0] = u.L[1] = 0;
|
||||||
|
u.d = 1e13;
|
||||||
|
if (u.L[0] == 1117925532 && u.L[1] == -448790528)
|
||||||
|
return &IEEE_MC68k;
|
||||||
|
if (u.L[1] == 1117925532 && u.L[0] == -448790528)
|
||||||
|
return &IEEE_8087;
|
||||||
|
if (u.L[0] == -2065213935 && u.L[1] == 10752)
|
||||||
|
return &VAX;
|
||||||
|
if (u.L[0] == 1267827943 && u.L[1] == 704643072)
|
||||||
|
return &IBM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Akind *
|
||||||
|
icheck(void)
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
double d;
|
||||||
|
int L[2];
|
||||||
|
} u;
|
||||||
|
struct {
|
||||||
|
double d;
|
||||||
|
int L;
|
||||||
|
} x[2];
|
||||||
|
|
||||||
|
if (sizeof(x) > 2*(sizeof(double) + sizeof(int)))
|
||||||
|
dalign = 1;
|
||||||
|
u.L[0] = u.L[1] = 0;
|
||||||
|
u.d = 1e13;
|
||||||
|
if (u.L[0] == 1117925532 && u.L[1] == -448790528)
|
||||||
|
return &IEEE_MC68k;
|
||||||
|
if (u.L[1] == 1117925532 && u.L[0] == -448790528)
|
||||||
|
return &IEEE_8087;
|
||||||
|
if (u.L[0] == -2065213935 && u.L[1] == 10752)
|
||||||
|
return &VAX;
|
||||||
|
if (u.L[0] == 1267827943 && u.L[1] == 704643072)
|
||||||
|
return &IBM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *emptyfmt = ""; /* avoid possible warning message with printf("") */
|
||||||
|
|
||||||
|
static Akind *
|
||||||
|
ccheck(void)
|
||||||
|
{
|
||||||
|
union {
|
||||||
|
double d;
|
||||||
|
long L;
|
||||||
|
} u;
|
||||||
|
long Cray1;
|
||||||
|
|
||||||
|
/* Cray1 = 4617762693716115456 -- without overflow on non-Crays */
|
||||||
|
Cray1 = printf(emptyfmt) < 0 ? 0 : 4617762;
|
||||||
|
if (printf(emptyfmt, Cray1) >= 0)
|
||||||
|
Cray1 = 1000000*Cray1 + 693716;
|
||||||
|
if (printf(emptyfmt, Cray1) >= 0)
|
||||||
|
Cray1 = 1000000*Cray1 + 115456;
|
||||||
|
u.d = 1e13;
|
||||||
|
if (u.L == Cray1)
|
||||||
|
return &CRAY;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fzcheck(void)
|
||||||
|
{
|
||||||
|
double a, b;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
a = 1.;
|
||||||
|
b = .1;
|
||||||
|
for(i = 155;; b *= b, i >>= 1) {
|
||||||
|
if (i & 1) {
|
||||||
|
a *= b;
|
||||||
|
if (i == 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b = a * a;
|
||||||
|
return b == 0.;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
need_nancheck(void)
|
||||||
|
{
|
||||||
|
double t;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
t = log(t_nan);
|
||||||
|
if (errno == 0)
|
||||||
|
return 1;
|
||||||
|
errno = 0;
|
||||||
|
t = sqrt(t_nan);
|
||||||
|
return errno == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
get_nanbits(unsigned int *b, int k)
|
||||||
|
{
|
||||||
|
union { double d; unsigned int z[2]; } u, u1, u2;
|
||||||
|
|
||||||
|
k = 2 - k;
|
||||||
|
u1.z[k] = u2.z[k] = 0x7ff00000;
|
||||||
|
u1.z[1-k] = u2.z[1-k] = 0;
|
||||||
|
u.d = u1.d - u2.d; /* Infinity - Infinity */
|
||||||
|
b[0] = u.z[0];
|
||||||
|
b[1] = u.z[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
Akind *a = 0;
|
||||||
|
int Ldef = 0;
|
||||||
|
size_t sa, sb;
|
||||||
|
unsigned int nanbits[2];
|
||||||
|
|
||||||
|
fpinit_ASL();
|
||||||
|
#ifdef WRITE_ARITH_H /* for Symantec's buggy "make" */
|
||||||
|
f = fopen("arith.h", "w");
|
||||||
|
if (!f) {
|
||||||
|
printf("Cannot open arith.h\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
f = stdout;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (sizeof(double) == 2*sizeof(long))
|
||||||
|
a = Lcheck();
|
||||||
|
else if (sizeof(double) == 2*sizeof(int)) {
|
||||||
|
Ldef = 1;
|
||||||
|
a = icheck();
|
||||||
|
}
|
||||||
|
else if (sizeof(double) == sizeof(long))
|
||||||
|
a = ccheck();
|
||||||
|
if (a) {
|
||||||
|
fprintf(f, "#define %s\n#define Arith_Kind_ASL %d\n",
|
||||||
|
a->name, a->kind);
|
||||||
|
if (Ldef)
|
||||||
|
fprintf(f, "#define Long int\n#define Intcast (int)(long)\n");
|
||||||
|
if (dalign)
|
||||||
|
fprintf(f, "#define Double_Align\n");
|
||||||
|
if (sizeof(char*) == 8)
|
||||||
|
fprintf(f, "#define X64_bit_pointers\n");
|
||||||
|
#ifndef NO_LONG_LONG
|
||||||
|
if (sizeof(long long) > sizeof(long)
|
||||||
|
&& sizeof(long long) == sizeof(void*))
|
||||||
|
fprintf(f, "#define LONG_LONG_POINTERS\n");
|
||||||
|
if (sizeof(long long) < 8)
|
||||||
|
#endif
|
||||||
|
fprintf(f, "#define NO_LONG_LONG\n");
|
||||||
|
#ifdef NO_SSIZE_T /*{{*/
|
||||||
|
if (sizeof(size_t) == sizeof(long))
|
||||||
|
fprintf(f, "#define ssize_t long\n");
|
||||||
|
else if (sizeof(size_t) == sizeof(int))
|
||||||
|
fprintf(f, "#define ssize_t int\n");
|
||||||
|
#ifndef NO_LONG_LONG
|
||||||
|
else if (sizeof(size_t) == sizeof(long long))
|
||||||
|
fprintf(f, "#define ssize_t long long\n");
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
fprintf(f, "#define ssize_t signed size_t\n"); /* punt */
|
||||||
|
#else /*}{*/
|
||||||
|
if (sizeof(size_t) != sizeof(ssize_t))
|
||||||
|
fprintf(f, "/* sizeof(size_t) = %d but sizeof(ssize_t) = %d */\n",
|
||||||
|
(int)sizeof(size_t), (int)sizeof(ssize_t));
|
||||||
|
#endif /*}}*/
|
||||||
|
if (a->kind <= 2) {
|
||||||
|
if (fzcheck())
|
||||||
|
fprintf(f, "#define Sudden_Underflow\n");
|
||||||
|
t_nan = -a->kind;
|
||||||
|
if (need_nancheck())
|
||||||
|
fprintf(f, "#define NANCHECK\n");
|
||||||
|
if (sizeof(double) == 2*sizeof(unsigned int)) {
|
||||||
|
get_nanbits(nanbits, a->kind);
|
||||||
|
fprintf(f, "#define QNaN0 0x%x\n", nanbits[0]);
|
||||||
|
fprintf(f, "#define QNaN1 0x%x\n", nanbits[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fprintf(f, "/* Unknown arithmetic */\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __sun
|
||||||
|
#ifdef __i386
|
||||||
|
/* kludge for Intel Solaris */
|
||||||
|
void fpsetprec(int x) { }
|
||||||
|
#endif
|
||||||
|
#endif
|
@ -0,0 +1,76 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#include "fio.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#ifdef KR_headers
|
||||||
|
integer f_back(a) alist *a;
|
||||||
|
#else
|
||||||
|
integer f_back(alist *a)
|
||||||
|
#endif
|
||||||
|
{ unit *b;
|
||||||
|
OFF_T v, w, x, y, z;
|
||||||
|
uiolen n;
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
f__curunit = b = &f__units[a->aunit]; /* curunit for error messages */
|
||||||
|
if(a->aunit >= MXUNIT || a->aunit < 0)
|
||||||
|
err(a->aerr,101,"backspace")
|
||||||
|
if(b->useek==0) err(a->aerr,106,"backspace")
|
||||||
|
if(b->ufd == NULL) {
|
||||||
|
fk_open(1, 1, a->aunit);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(b->uend==1)
|
||||||
|
{ b->uend=0;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if(b->uwrt) {
|
||||||
|
t_runc(a);
|
||||||
|
if (f__nowreading(b))
|
||||||
|
err(a->aerr,errno,"backspace")
|
||||||
|
}
|
||||||
|
f = b->ufd; /* may have changed in t_runc() */
|
||||||
|
if(b->url>0)
|
||||||
|
{
|
||||||
|
x=FTELL(f);
|
||||||
|
y = x % b->url;
|
||||||
|
if(y == 0) x--;
|
||||||
|
x /= b->url;
|
||||||
|
x *= b->url;
|
||||||
|
(void) FSEEK(f,x,SEEK_SET);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b->ufmt==0)
|
||||||
|
{ FSEEK(f,-(OFF_T)sizeof(uiolen),SEEK_CUR);
|
||||||
|
fread((char *)&n,sizeof(uiolen),1,f);
|
||||||
|
FSEEK(f,-(OFF_T)n-2*sizeof(uiolen),SEEK_CUR);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
w = x = FTELL(f);
|
||||||
|
z = 0;
|
||||||
|
loop:
|
||||||
|
while(x) {
|
||||||
|
x -= x < 64 ? x : 64;
|
||||||
|
FSEEK(f,x,SEEK_SET);
|
||||||
|
for(y = x; y < w; y++) {
|
||||||
|
if (getc(f) != '\n')
|
||||||
|
continue;
|
||||||
|
v = FTELL(f);
|
||||||
|
if (v == w) {
|
||||||
|
if (z)
|
||||||
|
goto break2;
|
||||||
|
goto loop;
|
||||||
|
}
|
||||||
|
z = v;
|
||||||
|
}
|
||||||
|
err(a->aerr,(EOF),"backspace")
|
||||||
|
}
|
||||||
|
break2:
|
||||||
|
FSEEK(f, z, SEEK_SET);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,20 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double f__cabs();
|
||||||
|
|
||||||
|
double c_abs(z) complex *z;
|
||||||
|
#else
|
||||||
|
extern double f__cabs(double, double);
|
||||||
|
|
||||||
|
double c_abs(complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( f__cabs( z->r, z->i ) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double sin(), cos(), sinh(), cosh();
|
||||||
|
|
||||||
|
VOID c_cos(r, z) complex *r, *z;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void c_cos(complex *r, complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double zi = z->i, zr = z->r;
|
||||||
|
r->r = cos(zr) * cosh(zi);
|
||||||
|
r->i = - sin(zr) * sinh(zi);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,53 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern VOID sig_die();
|
||||||
|
VOID c_div(c, a, b)
|
||||||
|
complex *a, *b, *c;
|
||||||
|
#else
|
||||||
|
extern void sig_die(const char*,int);
|
||||||
|
void c_div(complex *c, complex *a, complex *b)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double ratio, den;
|
||||||
|
double abr, abi, cr;
|
||||||
|
|
||||||
|
if( (abr = b->r) < 0.)
|
||||||
|
abr = - abr;
|
||||||
|
if( (abi = b->i) < 0.)
|
||||||
|
abi = - abi;
|
||||||
|
if( abr <= abi )
|
||||||
|
{
|
||||||
|
if(abi == 0) {
|
||||||
|
#ifdef IEEE_COMPLEX_DIVIDE
|
||||||
|
float af, bf;
|
||||||
|
af = bf = abr;
|
||||||
|
if (a->i != 0 || a->r != 0)
|
||||||
|
af = 1.;
|
||||||
|
c->i = c->r = af / bf;
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
sig_die("complex division by zero", 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
ratio = (double)b->r / b->i ;
|
||||||
|
den = b->i * (1 + ratio*ratio);
|
||||||
|
cr = (a->r*ratio + a->i) / den;
|
||||||
|
c->i = (a->i*ratio - a->r) / den;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ratio = (double)b->i / b->r ;
|
||||||
|
den = b->r * (1 + ratio*ratio);
|
||||||
|
cr = (a->r + a->i*ratio) / den;
|
||||||
|
c->i = (a->i - a->r*ratio) / den;
|
||||||
|
}
|
||||||
|
c->r = cr;
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,25 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double exp(), cos(), sin();
|
||||||
|
|
||||||
|
VOID c_exp(r, z) complex *r, *z;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void c_exp(complex *r, complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double expx, zi = z->i;
|
||||||
|
|
||||||
|
expx = exp(z->r);
|
||||||
|
r->r = expx * cos(zi);
|
||||||
|
r->i = expx * sin(zi);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double log(), f__cabs(), atan2();
|
||||||
|
VOID c_log(r, z) complex *r, *z;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
extern double f__cabs(double, double);
|
||||||
|
|
||||||
|
void c_log(complex *r, complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double zi, zr;
|
||||||
|
r->i = atan2(zi = z->i, zr = z->r);
|
||||||
|
r->r = log( f__cabs(zr, zi) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double sin(), cos(), sinh(), cosh();
|
||||||
|
|
||||||
|
VOID c_sin(r, z) complex *r, *z;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void c_sin(complex *r, complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double zi = z->i, zr = z->r;
|
||||||
|
r->r = sin(zr) * cosh(zi);
|
||||||
|
r->i = cos(zr) * sinh(zi);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,41 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double sqrt(), f__cabs();
|
||||||
|
|
||||||
|
VOID c_sqrt(r, z) complex *r, *z;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
extern double f__cabs(double, double);
|
||||||
|
|
||||||
|
void c_sqrt(complex *r, complex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double mag, t;
|
||||||
|
double zi = z->i, zr = z->r;
|
||||||
|
|
||||||
|
if( (mag = f__cabs(zr, zi)) == 0.)
|
||||||
|
r->r = r->i = 0.;
|
||||||
|
else if(zr > 0)
|
||||||
|
{
|
||||||
|
r->r = t = sqrt(0.5 * (mag + zr) );
|
||||||
|
t = zi / t;
|
||||||
|
r->i = 0.5 * t;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = sqrt(0.5 * (mag - zr) );
|
||||||
|
if(zi < 0)
|
||||||
|
t = -t;
|
||||||
|
r->i = t;
|
||||||
|
t = zi / t;
|
||||||
|
r->r = 0.5 * t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,33 @@
|
|||||||
|
#ifdef KR_headers
|
||||||
|
extern double sqrt();
|
||||||
|
double f__cabs(real, imag) double real, imag;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double f__cabs(double real, double imag)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
|
||||||
|
if(real < 0)
|
||||||
|
real = -real;
|
||||||
|
if(imag < 0)
|
||||||
|
imag = -imag;
|
||||||
|
if(imag > real){
|
||||||
|
temp = real;
|
||||||
|
real = imag;
|
||||||
|
imag = temp;
|
||||||
|
}
|
||||||
|
if((real+imag) == real)
|
||||||
|
return(real);
|
||||||
|
|
||||||
|
temp = imag/real;
|
||||||
|
temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/
|
||||||
|
return(temp);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,101 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#include "fio.h"
|
||||||
|
#ifdef KR_headers
|
||||||
|
integer f_clos(a) cllist *a;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#include "stdlib.h"
|
||||||
|
#ifdef NON_UNIX_STDIO
|
||||||
|
#ifndef unlink
|
||||||
|
#define unlink remove
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef MSDOS
|
||||||
|
#include "io.h"
|
||||||
|
#else
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" int unlink(const char*);
|
||||||
|
#else
|
||||||
|
extern int unlink(const char*);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
integer f_clos(cllist *a)
|
||||||
|
#endif
|
||||||
|
{ unit *b;
|
||||||
|
|
||||||
|
if(a->cunit >= MXUNIT) return(0);
|
||||||
|
b= &f__units[a->cunit];
|
||||||
|
if(b->ufd==NULL)
|
||||||
|
goto done;
|
||||||
|
if (b->uscrtch == 1)
|
||||||
|
goto Delete;
|
||||||
|
if (!a->csta)
|
||||||
|
goto Keep;
|
||||||
|
switch(*a->csta) {
|
||||||
|
default:
|
||||||
|
Keep:
|
||||||
|
case 'k':
|
||||||
|
case 'K':
|
||||||
|
if(b->uwrt == 1)
|
||||||
|
t_runc((alist *)a);
|
||||||
|
if(b->ufnm) {
|
||||||
|
fclose(b->ufd);
|
||||||
|
free(b->ufnm);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
case 'D':
|
||||||
|
Delete:
|
||||||
|
fclose(b->ufd);
|
||||||
|
if(b->ufnm) {
|
||||||
|
unlink(b->ufnm); /*SYSDEP*/
|
||||||
|
free(b->ufnm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
b->ufd=NULL;
|
||||||
|
done:
|
||||||
|
b->uend=0;
|
||||||
|
b->ufnm=NULL;
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
void
|
||||||
|
#ifdef KR_headers
|
||||||
|
f_exit()
|
||||||
|
#else
|
||||||
|
f_exit(void)
|
||||||
|
#endif
|
||||||
|
{ int i;
|
||||||
|
static cllist xx;
|
||||||
|
if (!xx.cerr) {
|
||||||
|
xx.cerr=1;
|
||||||
|
xx.csta=NULL;
|
||||||
|
for(i=0;i<MXUNIT;i++)
|
||||||
|
{
|
||||||
|
xx.cunit=i;
|
||||||
|
(void) f_clos(&xx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int
|
||||||
|
#ifdef KR_headers
|
||||||
|
flush_()
|
||||||
|
#else
|
||||||
|
flush_(void)
|
||||||
|
#endif
|
||||||
|
{ int i;
|
||||||
|
for(i=0;i<MXUNIT;i++)
|
||||||
|
if(f__units[i].ufd != NULL && f__units[i].uwrt)
|
||||||
|
fflush(f__units[i].ufd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,13 @@
|
|||||||
|
%*
|
||||||
|
if errorlevel 1 goto nolonglong
|
||||||
|
exit 0
|
||||||
|
:nolonglong
|
||||||
|
%* -DNO_LONG_LONG
|
||||||
|
if errorlevel 1 goto nossizet
|
||||||
|
exit 0
|
||||||
|
:nossizet
|
||||||
|
%* -DNO_SSIZE_T
|
||||||
|
if errorlevel 1 goto noboth
|
||||||
|
exit 0
|
||||||
|
:noboth
|
||||||
|
%* -DNO_LONG_LONG -DNO_SSIZE_T
|
@ -0,0 +1,2 @@
|
|||||||
|
#define My_ctype_DEF
|
||||||
|
#include "ctype.h"
|
@ -0,0 +1,47 @@
|
|||||||
|
/* Custom ctype.h to overcome trouble with recent versions of Linux libc.a */
|
||||||
|
|
||||||
|
#ifdef NO_My_ctype
|
||||||
|
#include <ctype.h>
|
||||||
|
#else /*{*/
|
||||||
|
#ifndef My_ctype_DEF
|
||||||
|
extern char My_ctype[];
|
||||||
|
#else /*{*/
|
||||||
|
char My_ctype[264] = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 2, 2, 2, 2, 2, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
2, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
#endif /*}*/
|
||||||
|
|
||||||
|
#define isdigit(x) (My_ctype[(x)+8] & 1)
|
||||||
|
#define isspace(x) (My_ctype[(x)+8] & 2)
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,18 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double d_abs(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
double d_abs(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if(*x >= 0)
|
||||||
|
return(*x);
|
||||||
|
return(- *x);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double acos();
|
||||||
|
double d_acos(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_acos(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( acos(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double asin();
|
||||||
|
double d_asin(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_asin(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( asin(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double atan();
|
||||||
|
double d_atan(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_atan(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( atan(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double atan2();
|
||||||
|
double d_atn2(x,y) doublereal *x, *y;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_atn2(doublereal *x, doublereal *y)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( atan2(*x,*y) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VOID
|
||||||
|
#ifdef KR_headers
|
||||||
|
d_cnjg(r, z) doublecomplex *r, *z;
|
||||||
|
#else
|
||||||
|
d_cnjg(doublecomplex *r, doublecomplex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
doublereal zi = z->i;
|
||||||
|
r->r = z->r;
|
||||||
|
r->i = -zi;
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double cos();
|
||||||
|
double d_cos(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_cos(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( cos(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double cosh();
|
||||||
|
double d_cosh(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_cosh(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( cosh(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double d_dim(a,b) doublereal *a, *b;
|
||||||
|
#else
|
||||||
|
double d_dim(doublereal *a, doublereal *b)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( *a > *b ? *a - *b : 0);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double exp();
|
||||||
|
double d_exp(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_exp(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( exp(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double d_imag(z) doublecomplex *z;
|
||||||
|
#else
|
||||||
|
double d_imag(doublecomplex *z)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return(z->i);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double floor();
|
||||||
|
double d_int(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_int(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( (*x>0) ? floor(*x) : -floor(- *x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,21 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#define log10e 0.43429448190325182765
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double log();
|
||||||
|
double d_lg10(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_lg10(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( log10e * log(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double log();
|
||||||
|
double d_log(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_log(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( log(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,46 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
#ifdef IEEE_drem
|
||||||
|
double drem();
|
||||||
|
#else
|
||||||
|
double floor();
|
||||||
|
#endif
|
||||||
|
double d_mod(x,y) doublereal *x, *y;
|
||||||
|
#else
|
||||||
|
#ifdef IEEE_drem
|
||||||
|
double drem(double, double);
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
double d_mod(doublereal *x, doublereal *y)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#ifdef IEEE_drem
|
||||||
|
double xa, ya, z;
|
||||||
|
if ((ya = *y) < 0.)
|
||||||
|
ya = -ya;
|
||||||
|
z = drem(xa = *x, ya);
|
||||||
|
if (xa > 0) {
|
||||||
|
if (z < 0)
|
||||||
|
z += ya;
|
||||||
|
}
|
||||||
|
else if (z > 0)
|
||||||
|
z -= ya;
|
||||||
|
return z;
|
||||||
|
#else
|
||||||
|
double quotient;
|
||||||
|
if( (quotient = *x / *y) >= 0)
|
||||||
|
quotient = floor(quotient);
|
||||||
|
else
|
||||||
|
quotient = -floor(-quotient);
|
||||||
|
return(*x - (*y) * quotient );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,20 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double floor();
|
||||||
|
double d_nint(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_nint(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( (*x)>=0 ?
|
||||||
|
floor(*x + .5) : -floor(.5 - *x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,16 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double d_prod(x,y) real *x, *y;
|
||||||
|
#else
|
||||||
|
double d_prod(real *x, real *y)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( (*x) * (*y) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,18 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double d_sign(a,b) doublereal *a, *b;
|
||||||
|
#else
|
||||||
|
double d_sign(doublereal *a, doublereal *b)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
double x;
|
||||||
|
x = (*a >= 0 ? *a : - *a);
|
||||||
|
return( *b >= 0 ? x : -x);
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double sin();
|
||||||
|
double d_sin(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_sin(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( sin(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double sinh();
|
||||||
|
double d_sinh(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_sinh(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( sinh(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double sqrt();
|
||||||
|
double d_sqrt(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_sqrt(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( sqrt(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double tan();
|
||||||
|
double d_tan(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_tan(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( tan(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,19 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double tanh();
|
||||||
|
double d_tanh(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
#undef abs
|
||||||
|
#include "math.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
double d_tanh(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( tanh(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,18 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
double erf();
|
||||||
|
double derf_(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
extern double erf(double);
|
||||||
|
double derf_(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( erf(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
@ -0,0 +1,20 @@
|
|||||||
|
#include "f2c.h"
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef KR_headers
|
||||||
|
extern double erfc();
|
||||||
|
|
||||||
|
double derfc_(x) doublereal *x;
|
||||||
|
#else
|
||||||
|
extern double erfc(double);
|
||||||
|
|
||||||
|
double derfc_(doublereal *x)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return( erfc(*x) );
|
||||||
|
}
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue