-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
21 changed files
with
261 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
# Codac tests | ||
# --------------------------------------------------------------------------- | ||
# \date 2023 | ||
# \author Simon Rohou | ||
# \copyright Copyright 2023 Codac Team | ||
# \license This program is distributed under the terms of | ||
# the GNU Lesser General Public License (LGPL). | ||
|
||
import unittest | ||
import numpy as np | ||
from codac import * | ||
|
||
class TestNumpyMatrices(unittest.TestCase): | ||
|
||
def test_numpytocodac(self): | ||
|
||
cdA=IntervalMatrix(2,6) | ||
cdA[0][0]=Interval(1) | ||
cdA[0][1]=Interval(3) | ||
cdA[0][2]=Interval(5) | ||
cdA[0][3]=Interval(7) | ||
cdA[0][4]=Interval(9) | ||
cdA[0][5]=Interval(11) | ||
cdA[1][0]=Interval(2) | ||
cdA[1][1]=Interval(4) | ||
cdA[1][2]=Interval(6) | ||
cdA[1][3]=Interval(8) | ||
cdA[1][4]=Interval(10) | ||
cdA[1][5]=Interval(12) | ||
|
||
npA=np.array([[1.,3.,5.,7.,9.,11.],[2.,4.,6.,8.,10.,12.]]) | ||
self.assertEqual(IntervalMatrix(npA), cdA) | ||
|
||
def test_numpytocodac_withtranspose(self): | ||
|
||
cdA=IntervalMatrix(2,6) | ||
cdA[0][0]=Interval(1) | ||
cdA[0][1]=Interval(3) | ||
cdA[0][2]=Interval(5) | ||
cdA[0][3]=Interval(7) | ||
cdA[0][4]=Interval(9) | ||
cdA[0][5]=Interval(11) | ||
cdA[1][0]=Interval(2) | ||
cdA[1][1]=Interval(4) | ||
cdA[1][2]=Interval(6) | ||
cdA[1][3]=Interval(8) | ||
cdA[1][4]=Interval(10) | ||
cdA[1][5]=Interval(12) | ||
|
||
npA=np.array([[1.,2.],[3.,4.],[5.,6.],[7.,8.],[9.,10.],[11.,12.]]).T | ||
self.assertEqual(IntervalMatrix(npA), cdA) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* \file | ||
* Ctc3BCid Python binding | ||
* ---------------------------------------------------------------------------- | ||
* \date 2023 | ||
* \author Simon Rohou, Benoît Desrochers | ||
* \copyright Copyright 2023 Codac Team | ||
* \license This program is distributed under the terms of | ||
* the GNU Lesser General Public License (LGPL). | ||
*/ | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
#include <pybind11/operators.h> | ||
#include <pybind11/functional.h> | ||
#include "codac_type_caster.h" | ||
|
||
#include "codac_py_Ctc.h" | ||
#include "codac_Ctc.h" | ||
#include "ibex_Ctc3BCid.h" | ||
// Generated file from Doxygen XML (doxygen2docstring.py): | ||
//#include "codac_py_Ctc3BCid_docs.h" | ||
|
||
using namespace std; | ||
using namespace codac; | ||
namespace py = pybind11; | ||
using namespace pybind11::literals; | ||
|
||
|
||
void export_Ctc3BCid(py::module& m, py::class_<Ctc, pyCtc>& ctc) | ||
{ | ||
py::class_<ibex::Ctc3BCid> ctc_3bcid(m, "Ctc3BCid", ctc, "todo"); | ||
ctc_3bcid | ||
|
||
.def(py::init<Ctc&,int,int,int,double>(), | ||
py::keep_alive<1,2>(), | ||
"ctc"_a.noconvert(), | ||
"s3b"_a.noconvert()=ibex::Ctc3BCid::default_s3b, | ||
"scid"_a.noconvert()=ibex::Ctc3BCid::default_scid, | ||
"vhandled"_a.noconvert()=-1, | ||
"var_min_width"_a.noconvert()=ibex::Ctc3BCid::default_var_min_width) | ||
|
||
.def("contract", (void (Ctc::*) (IntervalVector&)) &ibex::Ctc3BCid::contract, "todo") | ||
; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.