Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
spherelib
Spherelib
Commits
983c4385
Commit
983c4385
authored
Sep 09, 2010
by
Maude Le Jeune
Browse files
+ nilc
parent
1e454347
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
0 deletions
+140
-0
python/spherelib/spherelib_bin.cpp
python/spherelib/spherelib_bin.cpp
+61
-0
python/spherelib/spherelib_bin.h
python/spherelib/spherelib_bin.h
+34
-0
python/spherelib/spherelib_bin.i
python/spherelib/spherelib_bin.i
+45
-0
No files found.
python/spherelib/spherelib_bin.cpp
0 → 100644
View file @
983c4385
// Copyright (C) 2009 APC CNRS Universite Paris Diderot
// <lejeune@apc.univ-paris7.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see http://www.gnu.org/licenses/gpl.html
#include "arr.h"
#include "window.h"
#include "Python.h"
void
_make_prolate
(
int
*
tabbands
,
int
nband
,
double
*
arrbins
,
int
nwin
,
int
nell
,
float
*
tabthetas
,
int
nwin2
,
int
rule
){
if
((
nwin2
!=
nwin
))
PyErr_Format
(
PyExc_ValueError
,
"Arrays of different lengths (%d %d)"
,
nwin2
,
nwin
);
if
(
nwin
!=
nband
-
2
)
PyErr_Format
(
PyExc_ValueError
,
"Arrays of different lengths (%d %d)"
,
nwin
,
nband
-
2
);
arr2
<
double
>
bins
;
arr
<
int
>
bands
(
tabbands
,
nband
);
arr
<
float
>
thetas
(
tabthetas
,
nwin
);
Prolate
(
bands
,
bins
,
thetas
,
rule
);
int
k
=
0
;
for
(
int
i
=
0
;
i
<
nwin
;
i
++
)
for
(
int
j
=
0
;
j
<
nell
;
j
++
){
arrbins
[
k
]
=
(
double
)
bins
[
i
][
j
];
k
++
;}
}
void
_make_spline
(
int
*
tabbands
,
int
nband
,
double
*
arrbins
,
int
nwin
,
int
nell
,
int
order
){
if
(
nwin
!=
nband
-
2
)
PyErr_Format
(
PyExc_ValueError
,
"Arrays of different lengths (%d %d)"
,
nwin
,
nband
-
2
);
arr2
<
double
>
bins
;
arr
<
int
>
bands
(
tabbands
,
nband
);
// to do copute spline for all orders
Spline
(
bands
,
bins
);
int
k
=
0
;
for
(
int
i
=
0
;
i
<
nwin
;
i
++
)
for
(
int
j
=
0
;
j
<
nell
;
j
++
){
arrbins
[
k
]
=
(
double
)
bins
[
i
][
j
];
k
++
;}
}
python/spherelib/spherelib_bin.h
0 → 100644
View file @
983c4385
// Copyright (C) 2009 APC CNRS Universite Paris Diderot
// <lejeune@apc.univ-paris7.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see http://www.gnu.org/licenses/gpl.html
/*
** spherelib_bin.h
**
** Made by Maude Le Jeune
** Login <lejeune@localhost.localdomain>
**
** Started on Mon Sep 6 13:32:40 2010 Maude Le Jeune
** Last update Mon Sep 6 13:32:40 2010 Maude Le Jeune
*/
#ifndef SPHERELIB_BIN_H_
# define SPHERELIB_BIN_H_
void
_make_prolate
(
int
*
bands
,
int
nband
,
double
*
bins
,
int
nwin
,
int
nell
,
float
*
thetas
,
int
nwin2
,
int
rule
);
void
_make_spline
(
int
*
bands
,
int
nband
,
double
*
bins
,
int
nwin
,
int
nell
,
int
order
);
#endif
/* !SPHERELIB_BIN_H_ */
python/spherelib/spherelib_bin.i
0 → 100644
View file @
983c4385
// Copyright (C) 2009 APC CNRS Universite Paris Diderot
// <lejeune@apc.univ-paris7.fr>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see http://www.gnu.org/licenses/gpl.html
%
module
spherelib_bin
%
{
#
define
SWIG_FILE_WITH_INIT
#
include
"spherelib_bin.h"
%
}
%
include
"numpy.i"
%
init
%
{
import_array
()
;
%
}
// prolate
%
apply
(
int
*
IN_ARRAY1
,
int
DIM1
)
{
(
int
*
bands
,
int
nband
)
}
;
%
apply
(
double
*
INPLACE_ARRAY2
,
int
DIM1
,
int
DIM2
)
{
(
double
*
bins
,
int
nwin
,
int
nell
)
}
;
%
apply
(
float
*
IN_ARRAY1
,
int
DIM1
)
{
(
float
*
thetas
,
int
nwin2
)
}
;
%
feature
(
"docstring"
,
"Build prolate window functions"
)
_make_prolate
;
%
feature
(
"autodoc"
,
0
)
_make_prolate
;
// spline
%
apply
(
int
*
IN_ARRAY1
,
int
DIM1
)
{
(
int
*
bands
,
int
nband
)
}
;
%
apply
(
double
*
INPLACE_ARRAY2
,
int
DIM1
,
int
DIM2
)
{
(
double
*
bins
,
int
nwin
,
int
nell
)
}
;
%
feature
(
"docstring"
,
"Build spline window functions"
)
_make_spline
;
%
feature
(
"autodoc"
,
0
)
_make_spline
;
%
include
"spherelib_bin.h"
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