pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/math math/qrupdate: add package for QR and Cholesky ma...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d5ee48ed6fd6
branches:  trunk
changeset: 453370:d5ee48ed6fd6
user:      thor <thor%pkgsrc.org@localhost>
date:      Sat May 29 09:55:14 2021 +0000

description:
math/qrupdate: add package for QR and Cholesky matrix decomposition

This is scheduled to be a dependency for math/octave to support the
named operations.

Qrupdate is a linear algebra library for fast updating of QR and Cholesky
decompositions.

Supported operations:

- QR rank-1 update (qr1up)
- QR column insert (qrinc)
- QR column delete (qrdec)
- QR column shift (qrshc)
- QR row insert (qrinr)
- QR row delete (qrder)
- Cholesky rank-1 update (ch1up)
- Cholesky rank-1 downdate (ch1dn)
- Cholesky symmetric insert (chinx)
- Cholesky symmetric insert (chdex)
- Cholesky symmetric shift (chshx)
- LU rank-1 update (lu1up)
- LU pivoted rank-1 update (lup1up)

diffstat:

 math/Makefile                                    |   3 +-
 math/qrupdate/DESCR                              |  18 ++++
 math/qrupdate/Makefile                           |  26 +++++++
 math/qrupdate/PLIST                              |   5 +
 math/qrupdate/buildlink3.mk                      |  15 ++++
 math/qrupdate/distinfo                           |  10 ++
 math/qrupdate/patches/patch-src_Makefile         |  37 ++++++++++
 math/qrupdate/patches/patch-test_Makefile        |  15 ++++
 math/qrupdate/patches/patch-test_report__results |  43 +++++++++++
 math/qrupdate/patches/patch-test_utils.f         |  87 ++++++++++++++++++++++++
 10 files changed, 258 insertions(+), 1 deletions(-)

diffs (truncated from 309 to 300 lines):

diff -r d6783587a030 -r d5ee48ed6fd6 math/Makefile
--- a/math/Makefile     Sat May 29 09:53:58 2021 +0000
+++ b/math/Makefile     Sat May 29 09:55:14 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.500 2021/05/20 07:52:37 wiz Exp $
+# $NetBSD: Makefile,v 1.501 2021/05/29 09:55:14 thor Exp $
 
 COMMENT=       Mathematics
 
@@ -405,6 +405,7 @@
 SUBDIR+=       qalculate
 SUBDIR+=       qalculate-gtk
 SUBDIR+=       qhull
+SUBDIR+=       qrupdate
 SUBDIR+=       quadpack
 SUBDIR+=       randlib
 SUBDIR+=       ranger
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/DESCR       Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,18 @@
+Qrupdate is a linear algebra library for fast updating of QR and Cholesky
+decompositions.
+
+Supported operations:
+
+- QR rank-1 update (qr1up)
+- QR column insert (qrinc)
+- QR column delete (qrdec)
+- QR column shift (qrshc)
+- QR row insert (qrinr)
+- QR row delete (qrder)
+- Cholesky rank-1 update (ch1up)
+- Cholesky rank-1 downdate (ch1dn)
+- Cholesky symmetric insert (chinx)
+- Cholesky symmetric insert (chdex)
+- Cholesky symmetric shift (chshx)
+- LU rank-1 update (lu1up)
+- LU pivoted rank-1 update (lup1up)
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/Makefile    Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,26 @@
+# $NetBSD: Makefile,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+DISTNAME=      qrupdate-1.1.2
+CATEGORIES=    math
+MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=qrupdate/}
+
+MAINTAINER=    thomas.orgis%uni-hamburg.de@localhost
+HOMEPAGE=      https://qrupdate.sourceforge.io/
+COMMENT=       Library for fast updating of QR and Cholesky decompositions
+LICENSE=       gnu-gpl-v2
+
+USE_LANGUAGES= fortran
+USE_TOOLS=     gmake
+REPLACE_SH=    test/report_results
+
+TEST_TARGET=   test
+
+MAKE_FLAGS=    FC=${FC:Q} LDFLAGS=${LDFLAGS:Q} FFLAGS=${FFLAGS:Q} PREFIX=${PREFIX} LIBDIR=lib
+MAKE_FLAGS+=   BLAS=${BLAS_LIBS} LAPACK=${LAPACK_LIBS}
+
+do-build:
+       cd ${WRKSRC} && gmake ${MAKE_FLAGS} FPICFLAGS= lib \
+       && rm src/*.o && gmake ${MAKE_FLAGS} FPICFLAGS=-fPIC solib
+
+.include "../../mk/blas.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/PLIST       Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,5 @@
+@comment $NetBSD: PLIST,v 1.1 2021/05/29 09:55:14 thor Exp $
+lib/libqrupdate.a
+lib/libqrupdate.so
+lib/libqrupdate.so.1
+lib/libqrupdate.so.1.1
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/buildlink3.mk       Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,15 @@
+# $NetBSD: buildlink3.mk,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+BUILDLINK_TREE+=       qrupdate
+
+.if !defined(QRUPDATE_BUILDLINK3_MK)
+QRUPDATE_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.qrupdate+=       qrupdate>=1.1.2
+BUILDLINK_PKGSRCDIR.qrupdate?=         ../../math/qrupdate
+
+.include "../../mk/blas.buildlink3.mk"
+
+.endif # QRUPDATE_BUILDLINK3_MK
+
+BUILDLINK_TREE+=       -qrupdate
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/distinfo    Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,10 @@
+$NetBSD: distinfo,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+SHA1 (qrupdate-1.1.2.tar.gz) = f7403b646ace20f4a2b080b4933a1e9152fac526
+RMD160 (qrupdate-1.1.2.tar.gz) = 9d23b2d13278c335f6208ebb6775df4b4049785c
+SHA512 (qrupdate-1.1.2.tar.gz) = cc4e466ea91958e15c66be82b0c4c8ad813fbe4643f21259a9cb3ca8e0a411dd764bb2397ece848a7045f322d30316801d1540c4ebf7912030bef6995b44917c
+Size (qrupdate-1.1.2.tar.gz) = 49734 bytes
+SHA1 (patch-src_Makefile) = 55be251bc4e6ce1d0760f090c28ed14a7aeecc0e
+SHA1 (patch-test_Makefile) = 85f21cf81834ae9a3301ed79b4b5472981e8a15a
+SHA1 (patch-test_report__results) = f40092414fdd6ec673e051a23d388fdbd1a4708f
+SHA1 (patch-test_utils.f) = 1788deb4692c264fb5fe469d5ddbb64179db8d5d
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/patches/patch-src_Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/patches/patch-src_Makefile  Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,37 @@
+$NetBSD: patch-src_Makefile,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+Use LDFLAGS also for the .so library and fix non-portable install -D usage.
+Also … the permissions 644 seem wrong for shared libs.
+
+--- src/Makefile.orig  2010-01-19 11:35:49.000000000 +0000
++++ src/Makefile
+@@ -47,7 +47,7 @@ solib: ../libqrupdate$(SOEXT)
+       ar -cr $@ $(OBJS)
+ 
+ ../libqrupdate.so: $(OBJS)
+-      $(FC) $(FFLAGS) -shared -o $@ -Wl,-soname=libqrupdate.so.$(MAJOR) $(OBJS) \
++      $(FC) $(FFLAGS) $(LDFLAGS) -shared -o $@ -Wl,-soname=libqrupdate.so.$(MAJOR) $(OBJS) \
+               $(BLAS) $(LAPACK)
+ 
+ ../libqrupdate.dylib: $(OBJS)
+@@ -65,14 +65,17 @@ install: install-shlib install-staticlib
+ install-shlib: ../libqrupdate$(SOEXT) install-lib$(SOEXT)
+ 
+ install-lib.so:
+-      install -D -m644 ../libqrupdate.so $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.so.$(VERSION)
++      install -d -m755 $(DESTDIR)$(PREFIX)/$(LIBDIR)
++      install -m755 ../libqrupdate.so $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.so.$(VERSION)
+       ln -s libqrupdate.so.$(VERSION) $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.so.$(MAJOR)
+       ln -s libqrupdate.so.$(VERSION) $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.so
+ 
+ install-lib.dylib:
+-      install -D -m644 ../libqrupdate.dylib $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.$(VERSION).dylib
++      install -d -m755 $(DESTDIR)$(PREFIX)/$(LIBDIR)
++      install -m755 ../libqrupdate.dylib $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.$(VERSION).dylib
+       ln -s libqrupdate.$(VERSION).dylib $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.$(MAJOR).dylib
+       ln -s libqrupdate.$(VERSION).dylib $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.dylib
+ 
+ install-staticlib: ../libqrupdate.a
+-      install -D -m644 ../libqrupdate.a $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.a
++      install -d -m755 $(DESTDIR)$(PREFIX)/$(LIBDIR)
++      install -m644 ../libqrupdate.a $(DESTDIR)$(PREFIX)/$(LIBDIR)/libqrupdate.a
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/patches/patch-test_Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/patches/patch-test_Makefile Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-test_Makefile,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+Use LDFLAGS for tests!
+
+--- test/Makefile.orig 2021-05-29 09:14:58.376660614 +0000
++++ test/Makefile
+@@ -35,7 +35,7 @@ $(OUTS): %.out: %
+       ./$< | tee $@
+ 
+ $(PROGS): % : %.f utils.o ../libqrupdate.a
+-      $(FC) $(FFLAGS) -o $@ $^ $(LIBS)
++      $(FC) $(FFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ 
+ utils.o: utils.f
+       $(FC) $(FFLAGS) -c $<
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/patches/patch-test_report__results
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/patches/patch-test_report__results  Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,43 @@
+$NetBSD: patch-test_report__results,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+Drop awk usage and make the test script actually count and evaluate errors
+itself so that the test target has a meaningful result as return value.
+
+--- test/report_results.orig   2010-02-11 10:45:19.000000000 +0000
++++ test/report_results
+@@ -1,22 +1,30 @@
+ #!/bin/sh
+ OUTS=$*
+ passed_total=0
+ failed_total=0
+ cat $OUTS
+ 
+-# if awk exists, use it to print total statistics
+-if which awk > /dev/null ; then
+-      awk '/total:/ { passed += $3; failed += $5; }
+-      END { printf " TOTAL:     PASSED %3d     FAILED %3d\n", passed, failed; }' $OUTS
+-fi
++ret=0
+ for out in $OUTS ; do
+       if [ ! -s $out ] ; then
+               echo " $out file empty (test crashed)!"
++              ret=1
+       else
+               if grep -q WARNING $out ; then
+                       echo " $out produced warnings:"
+                       grep WARNING $out
++                      ret=1
++              fi
++              passed=$(grep total: $out | (read a b num d; echo $num))
++              passed_total=$((passed_total+passed))
++              failed=$(grep total: $out | (read a b c d num f; echo $num))
++              failed_total=$((failed_total+failed))
++              if test "$failed" -gt 0; then
++                      echo " $out has failures"
++                      ret=1
+               fi
+       fi
+ done
++printf "\n TOTAL:     PASSED %3d     FAILED %3d\n" "$passed_total" "$failed_total"
+ 
++exit $ret
diff -r d6783587a030 -r d5ee48ed6fd6 math/qrupdate/patches/patch-test_utils.f
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/math/qrupdate/patches/patch-test_utils.f  Sat May 29 09:55:14 2021 +0000
@@ -0,0 +1,87 @@
+$NetBSD: patch-test_utils.f,v 1.1 2021/05/29 09:55:14 thor Exp $
+
+Fix the fortran code for modern compilers who do not like to silently
+treat complex arrays as real arrays of twice the size and increase the
+error threshold for tests a bit, as the zch1dn test in tch1dn is quite
+at the edge.
+
+--- test/utils.f.orig  2021-05-29 07:46:09.748438877 +0000
++++ test/utils.f
+@@ -58,18 +58,48 @@ c
+       end do
+       end subroutine
+ 
++c In the old days, you would have treated the complex array as twice as
++c much of a real array, but modern compilers do not like that. So
++c resort to a buffer and explicit conversion. This is not
++c performance-relevant code, anyway.
++c Incidentally, this change in random numbers (strides of real and
++c imaginary parts) subtly reduces error in tch1dn to make it pass again.
++c Further hint that the error margin had to be just be a bit widenend.
++
+       subroutine crandg(m,n,x,ldx)
+       integer m,n,ldx
+       complex x(ldx,*)
++      real buf(128,2)
++      integer j,k,b,i
+       external srandg
+-      call srandg(2*m,n,x,2*ldx)
++      do j=1,n
++        do k=1,m,128
++          b=min(m-k+1,128)
++          call srandg(b,1,buf(1,1),b)
++          call srandg(b,1,buf(1,2),b)
++          do i=1,b
++            x(k+i-1,j) = cmplx(buf(i,1), buf(i,2))
++          end do
++        end do
++      end do
+       end subroutine
+ 
+       subroutine zrandg(m,n,x,ldx)
+       integer m,n,ldx
+       double complex x(ldx,*)
++      double precision buf(128,2)
++      integer j,k,b,i
+       external srandg
+-      call drandg(2*m,n,x,2*ldx)
++      do j=1,n
++        do k=1,m,128
++          b=min(m-k+1,128)
++          call drandg(b,1,buf(1,1),b)
++          call drandg(b,1,buf(1,2),b)
++          do i=1,b
++            x(k+i-1,j) = cmplx(buf(i,1), buf(i,2))
++          end do
++        end do
++      end do
+       end subroutine
+ 
+       block data xrandi
+@@ -218,12 +248,16 @@ c
+  1002 format (1x,F6.3,SP,F6.3,'i',$)
+       end subroutine
+ 
++c 200*?lamch('p') is a bit tight, some tests are at the fringe, being pushed
++c over by details of the random number generation. Trying 250 as error
++c limit factor.
++
+       character*4 function spftol(rnrm)
+       real rnrm,slamch
+       external slamch
+       common /stats/ passed,failed
+       integer passed,failed
+-      if (rnrm < 2e2*slamch('p')) then
++      if (rnrm < 2.5e2*slamch('p')) then
+         spftol = 'PASS'
+         passed = passed + 1
+       else


Home | Main Index | Thread Index | Old Index