Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into public
Browse files Browse the repository at this point in the history
Conflicts:
	flens/lapack/Makefile
  • Loading branch information
michael-lehn committed May 11, 2014
2 parents 1624787 + 67eb201 commit 2e5f1b3
Show file tree
Hide file tree
Showing 31 changed files with 1,302 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flens/blas/level1/copy.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ copy(Transpose trans, const MA &A, MB &&B)
// when the left hand side is an empty matrix (such that it is no actual
// resizing but rather an initialization).
//
if (trans==NoTrans) {
if (trans==NoTrans || trans==Conj) {
if ((A.numRows()!=B.numRows()) || (A.numCols()!=B.numCols())) {
# ifndef FLENS_DEBUG_CLOSURES
ASSERT(B.numRows()==0 || B.numCols()==0);
Expand Down
6 changes: 6 additions & 0 deletions flens/blas/level1extensions/conj.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ template <typename VX>
void>::Type
conj(VX &&x);

//-- conj
template <typename MA>
typename RestrictTo<IsGeMatrix<MA>::value,
void>::Type
conj(MA &&A);

} } // namespace blas, flens

#endif // FLENS_BLAS_LEVEL1EXTENSIONS_CONJ_H
21 changes: 21 additions & 0 deletions flens/blas/level1extensions/conj.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ conj(VX &&x)
FLENS_BLASLOG_UNSETTAG;
}

//-- conj
template <typename MA>
typename RestrictTo<IsGeMatrix<MA>::value,
void>::Type
conj(MA &&A)
{
FLENS_BLASLOG_SETTAG("--> ");
FLENS_BLASLOG_BEGIN_MCOTR(Conj, A);

# ifdef HAVE_CXXBLAS_GECOTR
cxxblas::gecotr(A.order(), Conj,
A.numRows(), A.numCols(),
A.data(), A.leadingDimension());
# else
ASSERT(0);
# endif

FLENS_BLASLOG_END;
FLENS_BLASLOG_UNSETTAG;
}

} } // namespace blas, flens

#endif // FLENS_BLAS_LEVEL1EXTENSIONS_CONJ_TCC
39 changes: 39 additions & 0 deletions flens/examples/howto-conjugate.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <iostream>
#include <flens/flens.cxx>

using namespace flens;
using namespace std;

int
main()
{
typedef complex<double> ZComplex;
typedef GeMatrix<FullStorage<ZComplex> > ZGeMatrix;

ZComplex I(0,1);

ZGeMatrix A(2,3);

A = 2.*I, 3.+I, 1.,
4., 2.+2.*I, 4.;

cout << "A = " << A << endl;

// in-place conjugate (via overloaded operators)
A = conjugate(A);
cout << "A = " << A << endl;

// in-place conjugate (via explicit copy call)
blas::copy(Conj, A, A);
cout << "A = " << A << endl;

// in-place conjugate (via explicit call) (new)
blas::conj(A);
cout << "A = " << A << endl;

// elementwise variant
ZGeMatrix::IndexVariable k, l;

A(k,l) = Real(A(k,l)) - Imag(A(k,l)) * I;
cout << "A = " << A << endl;
}
4 changes: 3 additions & 1 deletion flens/lapack/ge/hrd.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ hrd_impl(IndexType iLo,
// left
//
GeView Work(n-i-ib+1, ib, work, ldWork);
larfb(Left, ConjTrans, Forward, ColumnWise,
larfb(Left,
IsComplex<T>::value ? ConjTrans : Trans,
Forward, ColumnWise,
A(_(i+1,iHi),_(i,i+ib-1)),
Tr,
A(_(i+1,iHi),_(i+ib,n)),
Expand Down
2 changes: 0 additions & 2 deletions flens/lapack/interface/src/gees.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ LAPACK_DECL(dgees)(const char *JOBVS,
LOGICAL *BWORK,
INTEGER *INFO)
{
std::cerr << "dgees: N = " << *N << std::endl;

using std::max;
using std::min;
//
Expand Down
2 changes: 0 additions & 2 deletions flens/lapack/interface/src/geesx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ LAPACK_DECL(dgeesx)(const char *JOBVS,
LOGICAL *BWORK,
INTEGER *INFO)
{
std::cerr << "dgeesx: N = " << *N << std::endl;

using std::max;
using std::min;
//
Expand Down
2 changes: 0 additions & 2 deletions flens/lapack/interface/src/geevx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ LAPACK_DECL(dgeevx)(const char *BALANC,
INTEGER *IWORK,
INTEGER *INFO)
{
std::cerr << "dgeevx: N = " << *N << std::endl;

using std::max;
using std::min;
//
Expand Down
Binary file modified flens/lapack/test.tgz
Binary file not shown.
57 changes: 57 additions & 0 deletions flens/scalaroperations/acos.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2014, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FLENS_SCALAROPERATIONS_ACOS_H
#define FLENS_SCALAROPERATIONS_ACOS_H 1

#include <cxxblas/auxiliary/complex.h>
#include <flens/auxiliary/auxiliary.h>
#include <flens/scalartypes/impl/scalarclosure.h>

namespace flens {

struct ScalarOpACos {};

template <typename S>
const typename ScalarClosure<ScalarOpACos, S, S>::ElementType
evalScalarClosure(const ScalarClosure<ScalarOpACos, S, S> &exp);

//-- operator overloading
template <typename S>
const ScalarClosure<ScalarOpACos,
typename S::Impl,
typename S::Impl>
ACos(const Scalar<S> &s);

} // namespace flens

#endif // FLENS_SCALAROPERATIONS_ACOS_H
64 changes: 64 additions & 0 deletions flens/scalaroperations/acos.tcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2014, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FLENS_SCALAROPERATIONS_ACOS_TCC
#define FLENS_SCALAROPERATIONS_ACOS_TCC 1

#include <cmath>
#include <cxxblas/auxiliary/complex.h>
#include <flens/auxiliary/auxiliary.h>
#include <flens/scalaroperations/acos.h>
#include <flens/scalartypes/impl/scalarclosure.h>

namespace flens {

template <typename S>
const typename ScalarClosure<ScalarOpACos, S, S>::ElementType
evalScalarClosure(const ScalarClosure<ScalarOpACos, S, S> &exp)
{
return acos(exp.left().value());
}

//-- operator overloading
template <typename S>
const ScalarClosure<ScalarOpACos,
typename S::Impl,
typename S::Impl>
ACos(const Scalar<S> &s)
{
typedef ScalarClosure<ScalarOpACos, typename S::Impl, typename S::Impl> SC;
return SC(s.impl(), s.impl());
}

} // namespace flens

#endif // FLENS_SCALAROPERATIONS_ACOS_TCC
57 changes: 57 additions & 0 deletions flens/scalaroperations/asin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2014, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FLENS_SCALAROPERATIONS_ASIN_H
#define FLENS_SCALAROPERATIONS_ASIN_H 1

#include <cxxblas/auxiliary/complex.h>
#include <flens/auxiliary/auxiliary.h>
#include <flens/scalartypes/impl/scalarclosure.h>

namespace flens {

struct ScalarOpASin {};

template <typename S>
const typename ScalarClosure<ScalarOpASin, S, S>::ElementType
evalScalarClosure(const ScalarClosure<ScalarOpASin, S, S> &exp);

//-- operator overloading
template <typename S>
const ScalarClosure<ScalarOpASin,
typename S::Impl,
typename S::Impl>
ASin(const Scalar<S> &s);

} // namespace flens

#endif // FLENS_SCALAROPERATIONS_ASIN_H
64 changes: 64 additions & 0 deletions flens/scalaroperations/asin.tcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2014, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef FLENS_SCALAROPERATIONS_ASIN_TCC
#define FLENS_SCALAROPERATIONS_ASIN_TCC 1

#include <cmath>
#include <cxxblas/auxiliary/complex.h>
#include <flens/auxiliary/auxiliary.h>
#include <flens/scalaroperations/asin.h>
#include <flens/scalartypes/impl/scalarclosure.h>

namespace flens {

template <typename S>
const typename ScalarClosure<ScalarOpASin, S, S>::ElementType
evalScalarClosure(const ScalarClosure<ScalarOpASin, S, S> &exp)
{
return asin(exp.left().value());
}

//-- operator overloading
template <typename S>
const ScalarClosure<ScalarOpASin,
typename S::Impl,
typename S::Impl>
ASin(const Scalar<S> &s)
{
typedef ScalarClosure<ScalarOpASin, typename S::Impl, typename S::Impl> SC;
return SC(s.impl(), s.impl());
}

} // namespace flens

#endif // FLENS_SCALAROPERATIONS_ASIN_TCC
Loading

0 comments on commit 2e5f1b3

Please sign in to comment.