[fflas-ffpack] Rebuild for GCC 4.7.

Jerry James jjames at fedoraproject.org
Mon Jan 9 23:54:03 UTC 2012


commit f5ef54038656b2a6a771fae7bbab7389d3512876
Author: Jerry James <loganjerry at gmail.com>
Date:   Mon Jan 9 16:53:50 2012 -0700

    Rebuild for GCC 4.7.

 fflas-ffpack-gcc47.patch |  262 ++++++++++++++++++++++++++++++++++++++++++++++
 fflas-ffpack.spec        |    7 +-
 2 files changed, 268 insertions(+), 1 deletions(-)
---
diff --git a/fflas-ffpack-gcc47.patch b/fflas-ffpack-gcc47.patch
new file mode 100644
index 0000000..d610fa7
--- /dev/null
+++ b/fflas-ffpack-gcc47.patch
@@ -0,0 +1,262 @@
+--- ./fflas-ffpack/fflas/fflas.h.orig	2011-10-04 10:36:42.000000000 -0600
++++ ./fflas-ffpack/fflas/fflas.h	2012-01-09 15:46:29.049831680 -0700
+@@ -17,6 +17,7 @@
+ #define __FFLASFFPACK_fflas_H
+ 
+ #include <cmath>
++#include <cstring>
+ 
+ #ifndef MAX
+ #define MAX(a,b) ((a < b)?b:a)
+--- ./fflas-ffpack/ffpack/ffpack.h.orig	2011-10-04 10:24:10.000000000 -0600
++++ ./fflas-ffpack/ffpack/ffpack.h	2012-01-09 15:51:57.959555855 -0700
+@@ -163,6 +163,120 @@ namespace FFPACK  {
+ 		return det;
+ 	}
+ 
++	/** Apply a permutation submatrix of P (between ibeg and iend) to a matrix
++	 * to (iend-ibeg) vectors of size M stored in A (as column for NoTrans
++	 * and rows for Trans).
++	 * Side==FFLAS::FflasLeft for row permutation Side==FFLAS::FflasRight for a column
++	 * permutation
++	 * Trans==FFLAS::FflasTrans for the inverse permutation of P
++	 * @param F
++	 * @param Side
++	 * @param Trans
++	 * @param M
++	 * @param ibeg
++	 * @param iend
++	 * @param A
++	 * @param lda
++	 * @param P
++	 * @warning not sure the submatrix is still a permutation and the one we expect in all cases... examples for iend=2, ibeg=1 and P=[2,2,2]
++	 */
++	template<class Field>
++	void
++	applyP( const Field& F,
++		const FFLAS::FFLAS_SIDE Side,
++		const FFLAS::FFLAS_TRANSPOSE Trans,
++		const size_t M, const int ibeg, const int iend,
++		typename Field::Element * A, const size_t lda, const size_t * P )
++	{
++
++		if ( Side == FFLAS::FflasRight ) {
++			if ( Trans == FFLAS::FflasTrans )
++				for (size_t j = 0 ; j < M ; ++j){
++					for ( size_t i=ibeg; i<(size_t) iend; ++i)
++						if ( P[i]> i )
++							std::swap(A[j*lda+P[i]],A[j*lda+i]);
++					//FFLAS::fswap( F, M, A + P[i]*1, lda, A + i*1, lda );
++				}
++			else // Trans == FFLAS::FflasNoTrans
++				for (size_t j = 0 ; j < M ; ++j){
++					for (int i=iend; i-->ibeg; )
++						if ( P[i]>(size_t)i )
++							std::swap(A[j*lda+P[i]],A[j*lda+i]);
++					//FFLAS::fswap( F, M, A + P[i]*1, lda, A + i*1, lda );
++				}
++		}
++		else { // Side == FFLAS::FflasLeft
++			if ( Trans == FFLAS::FflasNoTrans )
++				for (size_t i=ibeg; i<(size_t)iend; ++i){
++					if ( P[i]> (size_t) i )
++						FFLAS::fswap( F, M,
++							      A + P[i]*lda, 1,
++							      A + i*lda, 1 );
++				}
++			else // Trans == FFLAS::FflasTrans
++				for (int i=iend; i-->ibeg; ){
++					if ( P[i]> (size_t) i ){
++						FFLAS::fswap( F, M,
++							      A + P[i]*lda, 1,
++							      A + i*lda, 1 );
++					}
++				}
++		}
++
++	}
++
++	// Solve L X = B in place
++	// L is M*M or N*N, B is M*N.
++	// Only the R non trivial column of L are stored in the M*R matrix L
++	template<class Field>
++	void
++	solveLB2( const Field& F, const FFLAS::FFLAS_SIDE Side,
++		  const size_t M, const size_t N, const size_t R,
++		  typename Field::Element * L, const size_t ldl,
++		  const size_t * Q,
++		  typename Field::Element * B, const size_t ldb )
++	{
++		typename Field::Element * Lcurr,* Rcurr,* Bcurr;
++		size_t ib,  Ldim;
++		int k;
++		if ( Side == FFLAS::FflasLeft ){
++			size_t j = 0;
++			while ( j<R ) {
++				 ib = Q[j];
++				k = (int)ib ;
++				while ((j<R) && ( (int) Q[j] == k)  ) {k++;j++;}
++				Ldim = k-ib;
++				Lcurr = L + j-Ldim + ib*ldl;
++				Bcurr = B + ib*ldb;
++				Rcurr = Lcurr + Ldim*ldl;
++
++				ftrsm( F, Side, FFLAS::FflasLower, FFLAS::FflasNoTrans, FFLAS::FflasUnit, Ldim, N, F.one,
++				       Lcurr, ldl , Bcurr, ldb );
++
++				fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, M-k, N, Ldim, F.mone,
++				       Rcurr , ldl, Bcurr, ldb, F.one, Bcurr+Ldim*ldb, ldb);
++			}
++		}
++		else{ // Side == FFLAS::FflasRight
++			int j=(int)R-1;
++			while ( j >= 0 ) {
++				ib = Q[j];
++				k = (int) ib;
++				while ( (j >= 0) &&  ( (int)Q[j] == k)  ) {--k;--j;}
++				Ldim = ib-k;
++				Lcurr = L + j+1 + (k+1)*ldl;
++				Bcurr = B + ib+1;
++				Rcurr = Lcurr + Ldim*ldl;
++
++				fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, M,  Ldim, N-ib-1, F.mone,
++				       Bcurr, ldb, Rcurr, ldl,  F.one, Bcurr-Ldim, ldb);
++
++				ftrsm (F, Side, FFLAS::FflasLower, FFLAS::FflasNoTrans, FFLAS::FflasUnit, M, Ldim, F.one,
++				       Lcurr, ldl , Bcurr-Ldim, ldb );
++			}
++		}
++	}
++
+ 	/**
+ 	 * Solve the system \f$A X = B\f$ or \f$X A = B\f$, using the \c LQUP decomposition of \p A
+ 	 * already computed inplace with \c LUdivine(FFLAS::FflasNoTrans, FFLAS::FflasNonUnit).
+@@ -1025,69 +1139,6 @@ else { // Left NullSpace
+ 			const FFPACK_LUDIVINE_TAG LuTag=FfpackLQUP);
+ 
+ 
+-	/** Apply a permutation submatrix of P (between ibeg and iend) to a matrix
+-	 * to (iend-ibeg) vectors of size M stored in A (as column for NoTrans
+-	 * and rows for Trans).
+-	 * Side==FFLAS::FflasLeft for row permutation Side==FFLAS::FflasRight for a column
+-	 * permutation
+-	 * Trans==FFLAS::FflasTrans for the inverse permutation of P
+-	 * @param F
+-	 * @param Side
+-	 * @param Trans
+-	 * @param M
+-	 * @param ibeg
+-	 * @param iend
+-	 * @param A
+-	 * @param lda
+-	 * @param P
+-	 * @warning not sure the submatrix is still a permutation and the one we expect in all cases... examples for iend=2, ibeg=1 and P=[2,2,2]
+-	 */
+-	template<class Field>
+-	void
+-	applyP( const Field& F,
+-		const FFLAS::FFLAS_SIDE Side,
+-		const FFLAS::FFLAS_TRANSPOSE Trans,
+-		const size_t M, const int ibeg, const int iend,
+-		typename Field::Element * A, const size_t lda, const size_t * P )
+-	{
+-
+-		if ( Side == FFLAS::FflasRight ) {
+-			if ( Trans == FFLAS::FflasTrans )
+-				for (size_t j = 0 ; j < M ; ++j){
+-					for ( size_t i=ibeg; i<(size_t) iend; ++i)
+-						if ( P[i]> i )
+-							std::swap(A[j*lda+P[i]],A[j*lda+i]);
+-					//FFLAS::fswap( F, M, A + P[i]*1, lda, A + i*1, lda );
+-				}
+-			else // Trans == FFLAS::FflasNoTrans
+-				for (size_t j = 0 ; j < M ; ++j){
+-					for (int i=iend; i-->ibeg; )
+-						if ( P[i]>(size_t)i )
+-							std::swap(A[j*lda+P[i]],A[j*lda+i]);
+-					//FFLAS::fswap( F, M, A + P[i]*1, lda, A + i*1, lda );
+-				}
+-		}
+-		else { // Side == FFLAS::FflasLeft
+-			if ( Trans == FFLAS::FflasNoTrans )
+-				for (size_t i=ibeg; i<(size_t)iend; ++i){
+-					if ( P[i]> (size_t) i )
+-						FFLAS::fswap( F, M,
+-							      A + P[i]*lda, 1,
+-							      A + i*lda, 1 );
+-				}
+-			else // Trans == FFLAS::FflasTrans
+-				for (int i=iend; i-->ibeg; ){
+-					if ( P[i]> (size_t) i ){
+-						FFLAS::fswap( F, M,
+-							      A + P[i]*lda, 1,
+-							      A + i*lda, 1 );
+-					}
+-				}
+-		}
+-
+-	}
+-
+-
+ 	/**
+ 	 * Compute the inverse of a triangular matrix.
+ 	 * @param F
+@@ -1562,58 +1613,6 @@ else {
+ 			}
+ 		}
+ 	}
+-
+-	// Solve L X = B in place
+-	// L is M*M or N*N, B is M*N.
+-	// Only the R non trivial column of L are stored in the M*R matrix L
+-	template<class Field>
+-	void
+-	solveLB2( const Field& F, const FFLAS::FFLAS_SIDE Side,
+-		  const size_t M, const size_t N, const size_t R,
+-		  typename Field::Element * L, const size_t ldl,
+-		  const size_t * Q,
+-		  typename Field::Element * B, const size_t ldb )
+-	{
+-		typename Field::Element * Lcurr,* Rcurr,* Bcurr;
+-		size_t ib,  Ldim;
+-		int k;
+-		if ( Side == FFLAS::FflasLeft ){
+-			size_t j = 0;
+-			while ( j<R ) {
+-				 ib = Q[j];
+-				k = (int)ib ;
+-				while ((j<R) && ( (int) Q[j] == k)  ) {k++;j++;}
+-				Ldim = k-ib;
+-				Lcurr = L + j-Ldim + ib*ldl;
+-				Bcurr = B + ib*ldb;
+-				Rcurr = Lcurr + Ldim*ldl;
+-
+-				ftrsm( F, Side, FFLAS::FflasLower, FFLAS::FflasNoTrans, FFLAS::FflasUnit, Ldim, N, F.one,
+-				       Lcurr, ldl , Bcurr, ldb );
+-
+-				fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, M-k, N, Ldim, F.mone,
+-				       Rcurr , ldl, Bcurr, ldb, F.one, Bcurr+Ldim*ldb, ldb);
+-			}
+-		}
+-		else{ // Side == FFLAS::FflasRight
+-			int j=(int)R-1;
+-			while ( j >= 0 ) {
+-				ib = Q[j];
+-				k = (int) ib;
+-				while ( (j >= 0) &&  ( (int)Q[j] == k)  ) {--k;--j;}
+-				Ldim = ib-k;
+-				Lcurr = L + j+1 + (k+1)*ldl;
+-				Bcurr = B + ib+1;
+-				Rcurr = Lcurr + Ldim*ldl;
+-
+-				fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, M,  Ldim, N-ib-1, F.mone,
+-				       Bcurr, ldb, Rcurr, ldl,  F.one, Bcurr-Ldim, ldb);
+-
+-				ftrsm (F, Side, FFLAS::FflasLower, FFLAS::FflasNoTrans, FFLAS::FflasUnit, M, Ldim, F.one,
+-				       Lcurr, ldl , Bcurr-Ldim, ldb );
+-			}
+-		}
+-	}
+ 
+ 
+ 	template<class Field>
diff --git a/fflas-ffpack.spec b/fflas-ffpack.spec
index a614529..5f1e98e 100644
--- a/fflas-ffpack.spec
+++ b/fflas-ffpack.spec
@@ -6,7 +6,7 @@
 
 Name:           fflas-ffpack
 Version:        1.4.3
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Finite field linear algebra subroutines
 
 Group:          Development/Libraries
@@ -14,6 +14,7 @@ Group:          Development/Libraries
 License:        LGPLv2+ and CeCILL-B
 URL:            http://linalg.org/projects/fflas-ffpack
 Source0:        http://linalg.org/%{name}-%{version}.tar.gz
+Patch0:         %{name}-gcc47.patch
 
 BuildRequires:  atlas-devel
 BuildRequires:  doxygen
@@ -48,6 +49,7 @@ API documentation for fflas-ffpack.
 
 %prep
 %setup -q
+%patch0
 
 # Fix character encodings
 for f in AUTHORS TODO; do
@@ -97,6 +99,9 @@ make check
 %doc doc/fflas-ffpack.html doc/fflas-ffpack-html doc/fflas-ffpack-dev-html
 
 %changelog
+* Mon Jan  9 2012 Jerry James <loganjerry at gmail.com> - 1.4.3-2
+- Rebuild for GCC 4.7
+
 * Tue Nov  1 2011 Jerry James <loganjerry at gmail.com> - 1.4.3-1
 - New upstream version
 - Tests have been fixed; restore %%check script


More information about the scm-commits mailing list