diff --git a/cmake/configure_files/ElVars.in b/cmake/configure_files/ElVars.in index ff7e9ad8f7..7cd6aeb658 100644 --- a/cmake/configure_files/ElVars.in +++ b/cmake/configure_files/ElVars.in @@ -1,7 +1,7 @@ # To help simplify including Elemental in external projects EL_INC = @CMAKE_INSTALL_PREFIX@/include -EL_LIB = @CMAKE_INSTALL_PREFIX@/lib +EL_LIB = @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ CC = @CMAKE_C_COMPILER@ CXX = @CMAKE_CXX_COMPILER@ diff --git a/examples/interface/LPAffine.py b/examples/interface/LPAffine.py index 4823e4adb4..7129d851d3 100644 --- a/examples/interface/LPAffine.py +++ b/examples/interface/LPAffine.py @@ -11,8 +11,6 @@ m = 2000 n = 4000 k = 3000 -testMehrotra = True -testIPF = False manualInit = False display = False progress = True @@ -98,55 +96,28 @@ def Rectang(height,width): z = El.DistMultiVec() s = El.DistMultiVec() -if testMehrotra: - ctrl.approach = El.LP_MEHROTRA - ctrl.mehrotraCtrl.primalInit = manualInit - ctrl.mehrotraCtrl.dualInit = manualInit - ctrl.mehrotraCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startMehrotra = El.mpi.Time() - El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) - endMehrotra = El.mpi.Time() - if worldRank == 0: - print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) +ctrl.approach = El.LP_MEHROTRA +ctrl.mehrotraCtrl.primalInit = manualInit +ctrl.mehrotraCtrl.dualInit = manualInit +ctrl.mehrotraCtrl.progress = progress +El.Copy( xOrig, x ) +El.Copy( yOrig, y ) +El.Copy( zOrig, z ) +El.Copy( sOrig, s ) +startMehrotra = El.mpi.Time() +El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) +endMehrotra = El.mpi.Time() +if worldRank == 0: + print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) - if display: - El.Display( x, "x Mehrotra" ) - El.Display( y, "y Mehrotra" ) - El.Display( z, "z Mehrotra" ) - El.Display( s, "s Mehrotra" ) - - obj = El.Dot(c,x) - if worldRank == 0: - print('Mehrotra c^T x = {}'.format(obj)) - -if testIPF: - ctrl.approach = El.LP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startIPF = El.mpi.Time() - El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - El.Display( s, "s IPF" ) +if display: + El.Display( x, "x Mehrotra" ) + El.Display( y, "y Mehrotra" ) + El.Display( z, "z Mehrotra" ) + El.Display( s, "s Mehrotra" ) - obj = El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) +obj = El.Dot(c,x) +if worldRank == 0: + print('Mehrotra c^T x = {}'.format(obj)) El.Finalize() diff --git a/examples/interface/LPAffineDense.py b/examples/interface/LPAffineDense.py index f7342bb4b5..bbff3affa2 100644 --- a/examples/interface/LPAffineDense.py +++ b/examples/interface/LPAffineDense.py @@ -11,8 +11,6 @@ m = 500 n = 1000 k = 750 -testMehrotra = True -testIPF = False manualInit = False display = False progress = True @@ -80,55 +78,28 @@ def RectangDense(height,width): z = El.DistMatrix() s = El.DistMatrix() -if testMehrotra: - ctrl.approach = El.LP_MEHROTRA - ctrl.mehrotraCtrl.primalInit = manualInit - ctrl.mehrotraCtrl.dualInit = manualInit - ctrl.mehrotraCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startMehrotra = El.mpi.Time() - El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) - endMehrotra = El.mpi.Time() - if worldRank == 0: - print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) +ctrl.approach = El.LP_MEHROTRA +ctrl.mehrotraCtrl.primalInit = manualInit +ctrl.mehrotraCtrl.dualInit = manualInit +ctrl.mehrotraCtrl.progress = progress +El.Copy( xOrig, x ) +El.Copy( yOrig, y ) +El.Copy( zOrig, z ) +El.Copy( sOrig, s ) +startMehrotra = El.mpi.Time() +El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) +endMehrotra = El.mpi.Time() +if worldRank == 0: + print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) - if display: - El.Display( x, "x Mehrotra" ) - El.Display( y, "y Mehrotra" ) - El.Display( z, "z Mehrotra" ) - El.Display( s, "s Mehrotra" ) - - obj = El.Dot(c,x) - if worldRank == 0: - print('Mehrotra c^T x = {}'.format(obj)) - -if testIPF: - ctrl.approach = El.LP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startIPF = El.mpi.Time() - El.LPAffine(A,G,b,c,h,x,y,z,s,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - El.Display( s, "s IPF" ) +if display: + El.Display( x, "x Mehrotra" ) + El.Display( y, "y Mehrotra" ) + El.Display( z, "z Mehrotra" ) + El.Display( s, "s Mehrotra" ) - obj = El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) +obj = El.Dot(c,x) +if worldRank == 0: + print('Mehrotra c^T x = {}'.format(obj)) El.Finalize() diff --git a/examples/interface/LPDirect.py b/examples/interface/LPDirect.py index 007a5ed89d..c0522fe1a7 100644 --- a/examples/interface/LPDirect.py +++ b/examples/interface/LPDirect.py @@ -10,8 +10,6 @@ m = 2000 n = 4000 -testMehrotra = True -testIPF = False manualInit = False display = False progress = True @@ -79,51 +77,26 @@ def Rectang(height,width): y = El.DistMultiVec() z = El.DistMultiVec() -if testMehrotra: - ctrl.approach = El.LP_MEHROTRA - ctrl.mehrotraCtrl.primalInit = manualInit - ctrl.mehrotraCtrl.dualInit = manualInit - ctrl.mehrotraCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startMehrotra = El.mpi.Time() - El.LPDirect(A,b,c,x,y,z,ctrl) - endMehrotra = El.mpi.Time() - if worldRank == 0: - print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) +ctrl.approach = El.LP_MEHROTRA +ctrl.mehrotraCtrl.primalInit = manualInit +ctrl.mehrotraCtrl.dualInit = manualInit +ctrl.mehrotraCtrl.progress = progress +El.Copy( xOrig, x ) +El.Copy( yOrig, y ) +El.Copy( zOrig, z ) +startMehrotra = El.mpi.Time() +El.LPDirect(A,b,c,x,y,z,ctrl) +endMehrotra = El.mpi.Time() +if worldRank == 0: + print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) - if display: - El.Display( x, "x Mehrotra" ) - El.Display( y, "y Mehrotra" ) - El.Display( z, "z Mehrotra" ) - - obj = El.Dot(c,x) - if worldRank == 0: - print('Mehrotra c^T x = {}'.format(obj)) - -if testIPF: - ctrl.approach = El.LP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startIPF = El.mpi.Time() - El.LPDirect(A,b,c,x,y,z,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) +if display: + El.Display( x, "x Mehrotra" ) + El.Display( y, "y Mehrotra" ) + El.Display( z, "z Mehrotra" ) - obj = El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) +obj = El.Dot(c,x) +if worldRank == 0: + print('Mehrotra c^T x = {}'.format(obj)) El.Finalize() diff --git a/examples/interface/LPDirectDense.py b/examples/interface/LPDirectDense.py index 1900a9112a..f620438108 100644 --- a/examples/interface/LPDirectDense.py +++ b/examples/interface/LPDirectDense.py @@ -11,7 +11,6 @@ m = 1000 n = 2000 testMehrotra = True -testIPF = False testADMM = False manualInit = False display = False @@ -85,30 +84,6 @@ def RectangDense(height,width): if worldRank == 0: print('Mehrotra c^T x = {}'.format(obj)) -if testIPF: - ctrl.approach = El.LP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startIPF = El.mpi.Time() - El.LPDirect(A,b,c,x,y,z,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - - obj = El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) - if testADMM: ctrl.approach = El.LP_ADMM ctrl.admmCtrl.progress = progress diff --git a/examples/interface/QPAffine.py b/examples/interface/QPAffine.py index b1c335ba58..dbf59f34ff 100644 --- a/examples/interface/QPAffine.py +++ b/examples/interface/QPAffine.py @@ -11,8 +11,6 @@ m = 2000 n = 4000 k = 3000 -testMehrotra = True -testIPF = False manualInit = False display = False progress = True @@ -114,63 +112,33 @@ def Rectang(height,width): z = El.DistMultiVec() s = El.DistMultiVec() -if testMehrotra: - ctrl.approach = El.QP_MEHROTRA - ctrl.mehrotraCtrl.solveCtrl.progress = progress - ctrl.mehrotraCtrl.primalInit = manualInit - ctrl.mehrotraCtrl.dualInit = manualInit - ctrl.mehrotraCtrl.progress = progress - ctrl.mehrotraCtrl.time = True - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startMehrotra = El.mpi.Time() - El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl) - endMehrotra = El.mpi.Time() - if worldRank == 0: - print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) +ctrl.approach = El.QP_MEHROTRA +ctrl.mehrotraCtrl.solveCtrl.progress = progress +ctrl.mehrotraCtrl.primalInit = manualInit +ctrl.mehrotraCtrl.dualInit = manualInit +ctrl.mehrotraCtrl.progress = progress +ctrl.mehrotraCtrl.time = True +El.Copy( xOrig, x ) +El.Copy( yOrig, y ) +El.Copy( zOrig, z ) +El.Copy( sOrig, s ) +startMehrotra = El.mpi.Time() +El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl) +endMehrotra = El.mpi.Time() +if worldRank == 0: + print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) - if display: - El.Display( x, "x Mehrotra" ) - El.Display( y, "y Mehrotra" ) - El.Display( z, "z Mehrotra" ) - El.Display( s, "s Mehrotra" ) - - d = El.DistMultiVec() - El.Zeros( d, n, 1 ) - El.Multiply( El.NORMAL, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) - -if testIPF: - ctrl.approach = El.QP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startIPF = El.mpi.Time() - El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {}'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - El.Display( s, "s IPF" ) - - d = El.DistMultiVec() - El.Zeros( d, n, 1 ) - El.Multiply( El.NORMAL, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('IPF (1/2) x^T Q x + c^T x = {}'.format(obj)) +if display: + El.Display( x, "x Mehrotra" ) + El.Display( y, "y Mehrotra" ) + El.Display( z, "z Mehrotra" ) + El.Display( s, "s Mehrotra" ) + +d = El.DistMultiVec() +El.Zeros( d, n, 1 ) +El.Multiply( El.NORMAL, 1., Q, x, 0., d ) +obj = El.Dot(x,d)/2 + El.Dot(c,x) +if worldRank == 0: + print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) El.Finalize() diff --git a/examples/interface/QPAffineDense.py b/examples/interface/QPAffineDense.py index 32badc56cb..fa4929359d 100644 --- a/examples/interface/QPAffineDense.py +++ b/examples/interface/QPAffineDense.py @@ -12,7 +12,6 @@ n = 2000 k = 1500 testMehrotra = True -testIPF = False testADMM = False manualInit = False display = False @@ -118,33 +117,4 @@ def RectangDense(height,width): if worldRank == 0: print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) -if testIPF: - ctrl.approach = El.QP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - El.Copy( sOrig, s ) - startIPF = El.mpi.Time() - El.QPAffine(Q,A,G,b,c,h,x,y,z,s,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - El.Display( s, "s IPF" ) - - d = El.DistMatrix() - El.Zeros( d, n, 1 ) - El.Hemv( El.LOWER, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) - El.Finalize() diff --git a/examples/interface/QPDirect.py b/examples/interface/QPDirect.py index b7a9f1ab32..aa72d65108 100644 --- a/examples/interface/QPDirect.py +++ b/examples/interface/QPDirect.py @@ -10,8 +10,6 @@ m = 2000 n = 4000 -testMehrotra = True -testIPF = False manualInit = False display = False progress = True @@ -95,59 +93,31 @@ def Rectang(height,width): y = El.DistMultiVec() z = El.DistMultiVec() -if testMehrotra: - ctrl.approach = El.QP_MEHROTRA - ctrl.mehrotraCtrl.solveCtrl.progress = progress - ctrl.mehrotraCtrl.primalInit = manualInit - ctrl.mehrotraCtrl.dualInit = manualInit - ctrl.mehrotraCtrl.progress = progress - ctrl.mehrotraCtrl.time = True - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startMehrotra = El.mpi.Time() - El.QPDirect(Q,A,b,c,x,y,z,ctrl) - endMehrotra = El.mpi.Time() - if worldRank == 0: - print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) +ctrl.approach = El.QP_MEHROTRA +ctrl.mehrotraCtrl.solveCtrl.progress = progress +ctrl.mehrotraCtrl.primalInit = manualInit +ctrl.mehrotraCtrl.dualInit = manualInit +ctrl.mehrotraCtrl.progress = progress +ctrl.mehrotraCtrl.time = True +El.Copy( xOrig, x ) +El.Copy( yOrig, y ) +El.Copy( zOrig, z ) +startMehrotra = El.mpi.Time() +El.QPDirect(Q,A,b,c,x,y,z,ctrl) +endMehrotra = El.mpi.Time() +if worldRank == 0: + print('Mehrotra time: {} seconds'.format(endMehrotra-startMehrotra)) - if display: - El.Display( x, "x Mehrotra" ) - El.Display( y, "y Mehrotra" ) - El.Display( z, "z Mehrotra" ) - - d = El.DistMultiVec() - El.Zeros( d, n, 1 ) - El.Multiply( El.NORMAL, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) - -if testIPF: - ctrl.approach = El.QP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startIPF = El.mpi.Time() - El.QPDirect(Q,A,b,c,x,y,z,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - - d = El.DistMultiVec() - El.Zeros( d, n, 1 ) - El.Multiply( El.NORMAL, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('IPF (1/2) x^T Q x + c^T x = {}'.format(obj)) +if display: + El.Display( x, "x Mehrotra" ) + El.Display( y, "y Mehrotra" ) + El.Display( z, "z Mehrotra" ) + +d = El.DistMultiVec() +El.Zeros( d, n, 1 ) +El.Multiply( El.NORMAL, 1., Q, x, 0., d ) +obj = El.Dot(x,d)/2 + El.Dot(c,x) +if worldRank == 0: + print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) El.Finalize() diff --git a/examples/interface/QPDirectDense.py b/examples/interface/QPDirectDense.py index 9e08c483a6..2c44258298 100644 --- a/examples/interface/QPDirectDense.py +++ b/examples/interface/QPDirectDense.py @@ -11,7 +11,6 @@ m = 1000 n = 2000 testMehrotra = True -testIPF = True testADMM = False manualInit = False display = False @@ -97,31 +96,4 @@ def RectangDense(height,width): if worldRank == 0: print('Mehrotra (1/2) x^T Q x + c^T x = {}'.format(obj)) -if testIPF: - ctrl.approach = El.QP_IPF - ctrl.ipfCtrl.primalInit = manualInit - ctrl.ipfCtrl.dualInit = manualInit - ctrl.ipfCtrl.progress = progress - ctrl.ipfCtrl.lineSearchCtrl.progress = progress - El.Copy( xOrig, x ) - El.Copy( yOrig, y ) - El.Copy( zOrig, z ) - startIPF = El.mpi.Time() - El.QPDirect(Q,A,b,c,x,y,z,ctrl) - endIPF = El.mpi.Time() - if worldRank == 0: - print('IPF time: {} seconds'.format(endIPF-startIPF)) - - if display: - El.Display( x, "x IPF" ) - El.Display( y, "y IPF" ) - El.Display( z, "z IPF" ) - - d = El.DistMatrix() - El.Zeros( d, n, 1 ) - El.Hemv( El.LOWER, 1., Q, x, 0., d ) - obj = El.Dot(x,d)/2 + El.Dot(c,x) - if worldRank == 0: - print('IPF c^T x = {}'.format(obj)) - El.Finalize() diff --git a/examples/lapack_like/PerfectShifts.cpp b/examples/lapack_like/PerfectShifts.cpp index 5a734f00ae..fb4b83bd1a 100644 --- a/examples/lapack_like/PerfectShifts.cpp +++ b/examples/lapack_like/PerfectShifts.cpp @@ -127,13 +127,9 @@ void TestRandom( El::Int n, const El::HessenbergSchurCtrl& ctrl, bool print ) int main( int argc, char* argv[] ) { El::Environment env( argc, argv ); - El::mpi::Comm comm = El::mpi::COMM_WORLD; try { - typedef double Real; - typedef El::Complex Scalar; - const El::Int n = El::Input("--n","random matrix size",60); const El::Int algInt = El::Input("--alg","AED: 0, MultiBulge: 1, Simple: 2",0); diff --git a/include/El/core/types.hpp b/include/El/core/types.hpp index e78fb4dcd5..0b154f996d 100644 --- a/include/El/core/types.hpp +++ b/include/El/core/types.hpp @@ -2,8 +2,8 @@ Copyright (c) 2009-2016, Jack Poulson All rights reserved. - This file is part of Elemental and is under the BSD 2-Clause License, - which can be found in the LICENSE file in the root directory, or at + This file is part of Elemental and is under the BSD 2-Clause License, + which can be found in the LICENSE file in the root directory, or at http://opensource.org/licenses/BSD-2-Clause */ #ifndef EL_TYPES_HPP @@ -18,11 +18,15 @@ struct Range Range() : beg(0), end(0) { } Range( T begArg, T endArg ) : beg(begArg), end(endArg) { } - Range operator+( T shift ) const + Range operator+( T shift ) const { return Range(beg+shift,end+shift); } - Range operator-( T shift ) const + Range operator-( T shift ) const { return Range(beg-shift,end-shift); } + + Range operator*( T scale ) const + { return Range(beg*scale,end*scale); } + }; static const Int END = -100; @@ -35,18 +39,25 @@ struct Range Range( Int index ) : beg(index), end(index+1) { } Range( Int begArg, Int endArg ) : beg(begArg), end(endArg) { } - Range operator+( Int shift ) const - { + Range operator+( Int shift ) const + { if( end == END ) throw std::logic_error("Unsupported shift"); - return Range(beg+shift,end+shift); + return Range(beg+shift,end+shift); } - Range operator-( Int shift ) const - { + Range operator-( Int shift ) const + { + if( end == END ) + throw std::logic_error("Unsupported shift"); + return Range(beg-shift,end-shift); + } + + Range operator*( Int scale ) const + { if( end == END ) throw std::logic_error("Unsupported shift"); - return Range(beg-shift,end-shift); + return Range(beg*scale,end*scale); } }; typedef Range IR; @@ -77,16 +88,16 @@ struct ValueInt> static bool Lesser ( const ValueInt>& a, const ValueInt>& b ) - { + { return RealPart(a.value) < RealPart(b.value) || - (RealPart(a.value) == RealPart(b.value) && + (RealPart(a.value) == RealPart(b.value) && ImagPart(a.value) < ImagPart(b.value)); } static bool Greater ( const ValueInt>& a, const ValueInt>& b ) { return RealPart(a.value) > RealPart(b.value) || - (RealPart(a.value) == RealPart(b.value) && + (RealPart(a.value) == RealPart(b.value) && ImagPart(a.value) > ImagPart(b.value)); } }; @@ -108,24 +119,24 @@ struct Entry> { Int i, j; Complex value; - + static bool Lesser ( const Entry>& a, const Entry>& b ) - { + { return RealPart(a.value) < RealPart(b.value) || - (RealPart(a.value) == RealPart(b.value) && + (RealPart(a.value) == RealPart(b.value) && ImagPart(a.value) < ImagPart(b.value)); } static bool Greater ( const Entry>& a, const Entry>& b ) { return RealPart(a.value) > RealPart(b.value) || - (RealPart(a.value) == RealPart(b.value) && + (RealPart(a.value) == RealPart(b.value) && ImagPart(a.value) > ImagPart(b.value)); } }; -// For the safe computation of products. The result is given by +// For the safe computation of products. The result is given by // product = rho * exp(kappa*n) // where rho lies in (usually on) the unit circle and kappa is real-valued. template @@ -153,7 +164,7 @@ enum MatrixClass GENERAL, HERMITIAN, HERMITIAN_LOWER, - HERMITIAN_UPPER, + HERMITIAN_UPPER, SYMMETRIC, SYMMETRIC_LOWER, SYMMETRIC_UPPER, @@ -234,7 +245,7 @@ template<> constexpr Dist DiagRow() { return STAR; } // Runtime // ------- inline Dist DiagCol( Dist U, Dist V ) EL_NO_EXCEPT -{ +{ if( U == MC && V == MR ) return MD; else if( U == MR && V == MC ) @@ -292,8 +303,8 @@ template<> constexpr Dist Partial() { return MR; } // Run-time // -------- inline Dist Partial( Dist U ) EL_NO_EXCEPT -{ - if( U == VC ) +{ + if( U == VC ) return MC; else if( U == VR ) return MR; @@ -307,12 +318,12 @@ inline Dist Partial( Dist U ) EL_NO_EXCEPT // ------------ template constexpr Dist PartialUnionRow() { return V; } template<> constexpr Dist PartialUnionRow() { return MR; } -template<> constexpr Dist PartialUnionRow() { return MC; }template constexpr Dist PartialUnionCol() +template<> constexpr Dist PartialUnionRow() { return MC; }template constexpr Dist PartialUnionCol() { return PartialUnionRow(); } // Run-time // -------- inline Dist PartialUnionRow( Dist U, Dist V ) EL_NO_EXCEPT -{ +{ if( U == VC ) return MR; else if( U == VR ) @@ -341,9 +352,9 @@ template<> constexpr Dist ProductDist() { return VC; } template<> constexpr Dist ProductDist() { return VR; } template<> constexpr Dist ProductDist() { return VC; } template<> constexpr Dist ProductDist() { return VR; } -template +template constexpr Dist ProductDistPartner() { return STAR; } -template<> +template<> constexpr Dist ProductDistPartner() { return CIRC; } // Runtime // ------- diff --git a/src/core/Grid.cpp b/src/core/Grid.cpp index d32cb09418..0b96a13521 100644 --- a/src/core/Grid.cpp +++ b/src/core/Grid.cpp @@ -1,10 +1,10 @@ /* Copyright (c) 2009-2016, Jack Poulson - 2013, Jed Brown + 2013, Jed Brown All rights reserved. - This file is part of Elemental and is under the BSD 2-Clause License, - which can be found in the LICENSE file in the root directory, or at + This file is part of Elemental and is under the BSD 2-Clause License, + which can be found in the LICENSE file in the root directory, or at http://opensource.org/licenses/BSD-2-Clause */ #include @@ -15,7 +15,7 @@ Grid* Grid::defaultGrid = 0; void Grid::InitializeDefault() { - defaultGrid = new Grid( mpi::COMM_WORLD ); + defaultGrid = new Grid( mpi::COMM_WORLD ); } void Grid::FinalizeDefault() @@ -168,7 +168,7 @@ void Grid::SetUpGrid() } } mpi::AllGather - ( myDiagAndRank.data(), 2, + ( myDiagAndRank.data(), 2, diagsAndRanks_.data(), 2, vcComm_ ); mpi::Split( cartComm_, mdPerpRank_, mdRank_, mdComm_ ); @@ -187,7 +187,7 @@ void Grid::SetUpGrid() { mcComm_ = mpi::COMM_NULL; mrComm_ = mpi::COMM_NULL; - mdComm_ = mpi::COMM_NULL; + mdComm_ = mpi::COMM_NULL; mdPerpComm_ = mpi::COMM_NULL; vcComm_ = mpi::COMM_NULL; vrComm_ = mpi::COMM_NULL; @@ -332,7 +332,7 @@ int Grid::VRToVC( int vrRank ) const EL_NO_EXCEPT } int Grid::CoordsToVC -( Dist colDist, Dist rowDist, +( Dist colDist, Dist rowDist, int distRank, int crossRank, int redundantRank ) const EL_NO_RELEASE_EXCEPT { if( colDist == CIRC && rowDist == CIRC ) @@ -343,7 +343,7 @@ int Grid::CoordsToVC { return distRank; } - else if( (colDist == MC && rowDist == STAR) || + else if( (colDist == MC && rowDist == STAR) || (rowDist == MC && colDist == STAR) ) { return distRank + redundantRank*Height(); @@ -390,7 +390,7 @@ mpi::Comm Grid::OwningComm() const EL_NO_EXCEPT { return owningComm_; } mpi::Comm Grid::ViewingComm() const EL_NO_EXCEPT { return viewingComm_; } int Grid::Diag() const EL_NO_RELEASE_EXCEPT -{ +{ const int vcRank = VCRank(); if( vcRank != mpi::UNDEFINED ) return diagsAndRanks_[2*vcRank]; @@ -399,15 +399,15 @@ int Grid::Diag() const EL_NO_RELEASE_EXCEPT } int Grid::Diag( int vcRank ) const EL_NO_EXCEPT -{ +{ if( vcRank != mpi::UNDEFINED ) - return diagsAndRanks_[2*vcRank]; + return diagsAndRanks_[2*vcRank]; else return mpi::UNDEFINED; } int Grid::DiagRank() const EL_NO_RELEASE_EXCEPT -{ +{ const int vcRank = VCRank(); if( vcRank != mpi::UNDEFINED ) return diagsAndRanks_[2*vcRank+1]; @@ -416,9 +416,9 @@ int Grid::DiagRank() const EL_NO_RELEASE_EXCEPT } int Grid::DiagRank( int vcRank ) const EL_NO_EXCEPT -{ +{ if( vcRank != mpi::UNDEFINED ) - return diagsAndRanks_[2*vcRank+1]; + return diagsAndRanks_[2*vcRank+1]; else return mpi::UNDEFINED; } diff --git a/src/optimization/models/DS.cpp b/src/optimization/models/DS.cpp index 491669a462..1fc790f49f 100644 --- a/src/optimization/models/DS.cpp +++ b/src/optimization/models/DS.cpp @@ -378,7 +378,7 @@ void Var2 // c := [1;1;0;0] // ============== - Zeros( c, 3*n, 1 ); + Zeros( c, 3*n+m, 1 ); auto cuv = c( IR(0,2*n), ALL ); Fill( cuv, Real(1) ); diff --git a/src/optimization/models/SparseInvCov.cpp b/src/optimization/models/SparseInvCov.cpp index 7c8c7dec24..0b5d863034 100644 --- a/src/optimization/models/SparseInvCov.cpp +++ b/src/optimization/models/SparseInvCov.cpp @@ -51,7 +51,7 @@ Int SparseInvCov // X := f(X), f(gamma) = (gamma+sqrt(gamma+4*rho)) / (2*rho) auto eigMap = - [ctrl](Real gamma) + [&](const Real& gamma) { return (gamma+Sqrt(gamma*gamma+4*ctrl.rho))/(2*ctrl.rho); }; HermitianFunction( LOWER, X, MakeFunction(eigMap) ); // Make X explicitly Hermitian since HermitianHilbertSchmidt is not @@ -144,7 +144,7 @@ Int SparseInvCov // X := f(X), f(gamma) = (gamma+sqrt(gamma+4*rho)) / (2*rho) auto eigMap = - [ctrl](Real gamma) + [&](const Real& gamma) { return (gamma+Sqrt(gamma*gamma+4*ctrl.rho))/(2*ctrl.rho); }; HermitianFunction( LOWER, X, MakeFunction(eigMap) ); // Make X explicitly Hermitian since HermitianHilbertSchmidt is not diff --git a/src/optimization/solvers/QP/affine/IPM/util/Initialize.cpp b/src/optimization/solvers/QP/affine/IPM/util/Initialize.cpp index 2dd6084013..4b2cf400e0 100644 --- a/src/optimization/solvers/QP/affine/IPM/util/Initialize.cpp +++ b/src/optimization/solvers/QP/affine/IPM/util/Initialize.cpp @@ -332,7 +332,7 @@ void Initialize { EL_DEBUG_CSE const Int m = b.Height(); - const Int n = c.Width(); + const Int n = c.Height(); const Int k = h.Height(); if( primalInit ) {