Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Meschach by eigen #2470

Merged
merged 21 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "external/CLI11"]
path = external/CLI11
url = https://github.com/CLIUtils/CLI11.git
[submodule "external/eigen"]
path = external/eigen
url = https://gitlab.com/libeigen/eigen.git
3 changes: 3 additions & 0 deletions .sanitizers/undefined.supp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
function:constructor(Object*)
function:ctng.cpp
implicit-integer-sign-change:double vector[2] Eigen::internal::pabs<double vector[2]>(double vector[2] const&)
implicit-integer-sign-change:double vector[2] Eigen::internal::pnegate<double vector[2]>(double vector[2] const&)
implicit-integer-sign-change:Eigen::internal::Packet1cd Eigen::internal::pconj<Eigen::internal::Packet1cd>(Eigen::internal::Packet1cd const&)
implicit-integer-sign-change:Eigen::internal::Packet1cd Eigen::internal::pmul<Eigen::internal::Packet1cd>(Eigen::internal::Packet1cd const&, Eigen::internal::Packet1cd const&)
implicit-integer-sign-change:fgets_unlimited_nltrans(HocStr*, _IO_FILE*, int)
implicit-integer-sign-change:invlfiresha.c
implicit-integer-sign-change:ivRegexp::Search(char const*, int, int, int)
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ if(NOT EXISTS "${CODING_CONV_CMAKE}/3rdparty.cmake")
endif()
include("${CODING_CONV_CMAKE}/3rdparty.cmake")
cpp_cc_git_submodule(Random123)
cpp_cc_git_submodule(eigen)

# =================================================================================================
# Enable sanitizer support if the NRN_SANITIZERS variable is set. Comes befores PythonHelper.cmake.
Expand Down
71 changes: 0 additions & 71 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -316,76 +316,6 @@ nrn_create_file_list(
sundialsmath.c)
set(NRN_SUNDIALS_SRC_FILES ${SUNDIALS_CVODES} ${SUNDIALS_IDA} ${SUNDIALS_SHARED})

# meschach matrix sources
set(MESCH_FILES_LIST
arnoldi.c
bdfactor.c
bkpfacto.c
chfactor.c
arnoldi.c
bdfactor.c
bkpfacto.c
chfactor.c
conjgrad.c
copy.c
dmacheps.c
err.c
extras.c
fft.c
givens.c
hessen.c
hsehldr.c
init.c
iter0.c
iternsym.c
itersym.c
ivecop.c
lanczos.c
lufactor.c
machine.c
matlab.c
matop.c
matrixio.c
meminfo.c
memory.c
memstat.c
mfunc.c
norm.c
otherio.c
pxop.c
qrfactor.c
schur.c
solve.c
sparse.c
sparseio.c
spbkp.c
spchfctr.c
splufctr.c
sprow.c
spswap.c
submat.c
svd.c
symmeig.c
update.c
vecop.c
version.c
zcopy.c
zfunc.c
zgivens.c
zhessen.c
zhsehldr.c
zlufctr.c
zmachine.c
zmatio.c
zmatlab.c
zmatop.c
zmemory.c
znorm.c
zqrfctr.c
zschur.c
zsolve.c
zvecop.c)

set(SPARSE_FILES_LIST bksub.cpp getelm.cpp lineq.cpp prmat.cpp subrows.cpp)

# scopmath sources
Expand Down Expand Up @@ -530,7 +460,6 @@ nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/nrniv
nvector_nrnparallel_ld.cpp)
nrn_create_file_list(NRN_PARALLEL_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sundials/shared
nvector_parallel.c)
nrn_create_file_list(NRN_MESCH_SRC_FILES ${PROJECT_SOURCE_DIR}/src/mesch ${MESCH_FILES_LIST})
nrn_create_file_list(NRN_SPARSE_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sparse ${SPARSE_FILES_LIST})
nrn_create_file_list(NRN_SCOPMATH_SRC_FILES ${PROJECT_SOURCE_DIR}/src/scopmath
${SCOPMATH_FILES_LIST})
Expand Down
26 changes: 0 additions & 26 deletions docs/python/programming/math/matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,6 @@ Matrix



.. warning::
Implemented only for full and sparse matrices.


----


Expand Down Expand Up @@ -660,9 +656,6 @@ Matrix
print()
m.solv(b,1).printf("%8.3f", 475, 535)

.. warning::
Implemented only for full and sparse matrices.


----

Expand Down Expand Up @@ -790,9 +783,6 @@ Matrix
m.printf()


.. warning::
Implemented only for full and sparse matrices.


----

Expand All @@ -813,9 +803,6 @@ Matrix

Otherwise fill the matrix row with a constant.

.. warning::
Implemented only for full matrices and sparse.


----

Expand All @@ -836,9 +823,6 @@ Matrix

Otherwise fill the matrix column with a constant.

.. warning::
Implemented only for full matrices.


----

Expand Down Expand Up @@ -883,9 +867,6 @@ Matrix
m.printf()


.. warning::
Implemented only for full and sparse matrices.


----

Expand All @@ -901,9 +882,6 @@ Matrix
Description:
Fills the matrix with 0.

.. warning::
Implemented only for full matrices.


----

Expand All @@ -929,10 +907,6 @@ Matrix
m.printf()


.. warning::
Implemented only for full matrices.


----


Expand Down
1 change: 1 addition & 0 deletions external/eigen
Submodule eigen added at 328b5f
15 changes: 11 additions & 4 deletions share/lib/hoc/import3d/import3d_gui.hoc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,21 @@ proc contour2centroid() {local i, j, imax, imin, ok localobj mean, pts, d, max,
tobj = m.symmeig(m)
// major axis is the one with largest eigenvalue
major = m.getcol(tobj.max_ind)
// For plotting and round-off error consistency
// between meschach and eigen use the heuristic that
// major axis points in positive direction.
// i.e. if greatest value is negative, reverse orientation.
if (major.x[major.c.abs().max_ind()] < 0) {
major.mul(-1)
}
// minor is normal and in xy plane
minor = m.getcol(3-tobj.min_ind-tobj.max_ind)
minor.x[2] = 0
minor.div(minor.mag)
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
d = new Vector(pts.ncol)
rad = new Vector(pts.ncol)
for i=0, pts.ncol-1 {
Expand Down
11 changes: 0 additions & 11 deletions src/ivoc/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ extern int hoc_return_type_code;
extern double hoc_scan(FILE*);
extern Object** hoc_temp_objptr(Object*);

#if 0
extern void install_matrix_method(const char* name, double (*)(...));
extern void* matrix_arg(int);
extern double* matrix_pelm(void*, int i, int j);
extern int matrix_nrow(void*);
extern int matrix_ncol(void*);
extern int matrix_type(void*); // FULL 1, SPARSE 2, BAND 3
extern MAT* matrix_full(void*); // hoc_execerror if void* not right type
extern SPMAT* matrix_sparse(void*);
#endif

static void check_domain(int i, int j) {
if (i > j || i < 0) {
auto const tmp = "index=" + std::to_string(i) + " max_index=" + std::to_string(j) + "\n";
Expand Down
Loading