Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
McMule
handyG
Commits
0193b6c4
Commit
0193b6c4
authored
Jul 08, 2019
by
Luca Naterop
Browse files
Merge branch 'master' of
https://github.com/lucnat/gpl
parents
884a6a25
5919f09d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
12 deletions
+101
-12
.gitignore
.gitignore
+3
-0
makefile
makefile
+42
-12
src/gpl.tm
src/gpl.tm
+47
-0
src/gpl_module.f90
src/gpl_module.f90
+9
-0
No files found.
.gitignore
View file @
0193b6c4
...
...
@@ -9,6 +9,9 @@
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
build/mcc*
build/*.c
gpl
*.out
*.o
*.mod
...
...
makefile
View file @
0193b6c4
SHELL
=
/bin/sh
UNAME_S
:=
$(
shell
uname
-s
)
SHA1
=
sha1sum
MODE
=
DEBUG
FC
=
gfortran
AR
=
ar rcs
AR
=
ar rcs
CC
=
gcc
MCC
=
mcc
LD
=
gfortran
FFLAGS
=
-fdefault-real-8
-cpp
-pedantic-errors
-std
=
f2008
FFLAGS
+=
-Werror
-Wall
-Wno-maybe-uninitialized
-Wno-uninitialized
...
...
@@ -19,9 +17,10 @@ else
FFLAGS
+=
-ffpe-trap
=
invalid,overflow
-fdump-core
-fbacktrace
endif
LD
=
gfortran
files
=
globals.o ieps.o utils.o shuffle.o maths_functions.o mpl_module.o gpl_module.o
objects
=
$(
addprefix
build/,
$(files)
)
objects
=
build/globals.o build/ieps.o build/utils.o build/shuffle.o build/maths_functions.o build/mpl_module.o build/gpl_module.o
all
:
libgpl.a gpl eval test
libgpl.a
:
$(objects)
@
echo
"AR
$@
"
...
...
@@ -32,6 +31,34 @@ build/%.o: src/%.f90
@
echo
"F90
$@
"
@
$(FC)
$(FFLAGS)
-c
$<
-J
build
-o
$@
# Mathlink related
build/mcc.internals.tmp
:
@
echo
"MCC --internals"
@
$(MCC)
--internals
>
$@
build/mcc.internals
:
build/mcc.internals.tmp
@
echo
"Base path"
>
$@
@
cat
$@
.tmp |
grep
"MLDK Directory"
|
cut
-f2
-d
":"
>>
$@
@
echo
"Compiler"
>>
$@
@
arch
=
`
cat
$@
.tmp |
grep
"Library Bit Type:"
|
cut
-f2
-d
":"
`
;
\
cat
$@
.tmp |
grep
"Compile Flags
$$
arch:"
|
cut
-f2
-d
":"
>>
$@
@
echo
"Linker"
>>
$@
@
cat
$@
.tmp |
grep
"Linker Libraries"
|
cut
-f2
-d
":"
>>
$@
build/%.tm.c
:
src/%.tm build/mcc.internals
@
echo
"MPREP
$@
"
@
$(
shell
sed
-n
'2p'
build/mcc.internals
)
/mprep
$<
-o
$@
build/gpl.o
:
build/gpl.tm.c build/mcc.internals
@
echo
"CC
$<
"
@
$(CC)
$(
shell
sed
-n
'4p'
build/mcc.internals
)
-o
$@
-c
$<
gpl
:
build/gpl.o libgpl.a build/mcc.internals
@
echo
"LD
$@
"
@
$(LD)
$<
libgpl.a
-o
$@
$(
shell
sed
-n
'6p'
build/mcc.internals
)
-lgfortran
eval
:
libgpl.a build/eval.o
@
echo
"LD
$@
"
@
$(LD)
-o
$@
build/eval.o
-L
.
-lgpl
...
...
@@ -40,6 +67,9 @@ test: $(objects) build/test.o
@
echo
"LD
$@
"
@
$(LD)
-o
$@
$^
$(LFLAGS)
check
:
test
./
$<
clean
:
@
rm
-f
build/
*
.o build/
*
.mod
@
rm
-f
test eval
@
rm
-f
build/
*
.o build/
*
.mod
build/
*
.c build/mcc.internals
*
@
rm
-f
test eval
libgpl.a gpl
src/gpl.tm
0 → 100644
View file @
0193b6c4
:
Begin
:
:
Function
:
gpl
:
Pattern
:
G
[
a__
]
/
;
And
@@
(
NumberQ
/
@
({
a
}
/
.
SubPlus
|
SubMinus
->
Identity
))
:
Arguments
:
{
Re
@
N
[{
a
}],
Im
@
N
[{
a
}]}
:
ArgumentTypes
:
{
RealList
,
RealList
}
:
ReturnType
:
Manual
:
End
:
#include "mathlink.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
typedef
struct
{
double
r
,
i
;}
complex
;
extern
complex
__gpl_module_MOD_g_superflatn
(
complex
*
,
long
*
);
void
gpl
(
double
*
re
,
long
nr
,
double
*
im
,
long
ni
)
{
assert
(
nr
==
ni
);
complex
input
[
nr
],
ans
;
for
(
long
i
=
0
;
i
<
nr
;
i
++
)
{
input
[
i
].
r
=
*
(
re
+
i
);
input
[
i
].
i
=
*
(
im
+
i
);
}
ans
=
__gpl_module_MOD_g_superflatn
(
&
input
[
0
],
&
nr
);
if
(
ans
.
i
==
0
)
MLPutReal
(
stdlink
,
ans
.
r
);
else
{
MLPutFunction
(
stdlink
,
"Complex"
,
2
);
MLPutReal
(
stdlink
,
ans
.
r
);
MLPutReal
(
stdlink
,
ans
.
i
);
}
}
int
main
(
int
argc
,
char
**
argv
)
{
return
MLMain
(
argc
,
argv
);
}
src/gpl_module.f90
View file @
0193b6c4
...
...
@@ -418,5 +418,14 @@ CONTAINS
res
=
(
-1
)
**
k
*
MPL
(
m
,
x
)
END
FUNCTION
G_condensed
FUNCTION
G_SUPERFLATN
(
c0
,
n
)
integer
,
intent
(
in
)
::
n
complex
(
kind
=
prec
),
intent
(
in
)
::
c0
(
n
)
complex
(
kind
=
prec
)
g_superflatn
G_superflatn
=
G_superflat
(
c0
)
END
FUNCTION
END
MODULE
gpl_module
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment