1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      36
      37
      38
      39
      40
      41
      42
      43
      44
      45
      46
      47
<doc  48
      49
      50
      51
      52

      53
      54
<doc  55
      56
      57
      58
      59

      60
      61
      62
      63
      64
      65
      66
      67
      68
      69
      70
      71
      72
      73
<doc  74
      75
      76
      77
      78

      79
      80
<doc  81
      82
      83
      84
      85

      86
      87
      88
      89
<doc  90
      91
      92
      93
      94

      95
      96
<doc  97
      98
      99
     100
     101

     102
     103
<doc 104
     105
     106
     107
     108

     109
     110
     111
     112
<doc 113
     114
     115
     116
     117

     118
     119
<doc 120
     121
     122
     123
     124

     125
     126
<doc 127
     128
     129
     130
     131

     132
     133
     134
     135
     136
<doc 137
     138
     139
     140
     141

     142
     143
<doc 144
     145
     146
     147
     148

     149
     150
<doc 151
     152
     153
     154
     155

     156
     157
     158
     159
     160
     161
     162
<doc 163
     164
     165
     166
     167

     168
     169
<doc 170
     171
     172
     173
     174

     175
     176
     177
     178
<doc 179
     180
     181
     182
     183

     184
     185
<doc 186
     187
     188
     189
     190

     191
     192
     193
     194
<doc 195
     196
     197
     198
     199

     200
     201
<doc 202
     203
     204
     205
     206

     207
     208
     209
     210
     211
     212
     213
<doc 214
     215
     216
     217
     218

     219
     220
<doc 221
     222
     223
     224
     225

     226
     227
<doc 228
     229
     230
     231
     232

     233
     234
     235
     236
     237
<doc 238
     239
     240
     241
     242

     243
     244
<doc 245
     246
     247
     248
     249

     250
     251
     252
     253
     254
<doc 255
     256
     257
     258
     259

     260
     261
<doc 262
     263
     264
     265
     266

     267
     268
     269
     270
     271
     272
<doc 273
     274
     275
     276
     277

     278
     279
<doc 280
     281
     282
     283
     284

     285
     286
     287
     288
<doc 289
     290
     291
     292
     293

     294
     295
<doc 296
     297
     298
     299
     300

     301
     302
     303
     304
<doc 305
     306
     307
     308
     309

     310
     311
<doc 312
     313
     314
     315
     316

     317
     318
     319
     320
/*
 *   Copyright (c) 2009, Michael Lehn
 *   Copyright (c) 2012, Michael Lehn, Klaus Pototzky
 *
 *   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_BLAS_LEVEL1_COPY_H
#define FLENS_BLAS_LEVEL1_COPY_H 1

#include <cxxblas/cxxblas.h>
#include <flens/auxiliary/auxiliary.h>
#include <flens/matrixtypes/matrixtypes.h>
#include <flens/typedefs.h>
#include <flens/vectortypes/vectortypes.h>

namespace flens { namespace blas {

//-- BLAS Level 1 --------------------------------------------------------------

//-- copy
template <typename VX, typename VY>
    typename RestrictTo<IsDenseVector<VX>::value
                     && IsDenseVector<VY>::value,
             void>::Type
    copy(const VX &x, VY &&y);

//-- copy
template <typename VX, typename VY>
    typename RestrictTo<IsTinyVector<VX>::value
                     && IsTinyVector<VY>::value,
             void>::Type
    copy(const VX &x, VY &&y);


//-- BLAS Level 1 extensions ---------------------------------------------------

//== GeneralMatrix

//-- gbcopy
template <typename MA, typename MB>
    typename RestrictTo<IsGbMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- gecopy
template <typename MA, typename MB>
    typename RestrictTo<IsGeMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- (tiny) gecopy
template <typename MA, typename MB>
    typename RestrictTo<IsGeTinyMatrix<MA>::value
                     && IsGeTinyMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//== HermitianMatrix

//-- hbcopy
template <typename MA, typename MB>
    typename RestrictTo<IsHbMatrix<MA>::value
                     && IsHbMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- hecopy
template <typename MA, typename MB>
    typename RestrictTo<IsHeMatrix<MA>::value
                     && IsHeMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- hpcopy
template <typename MA, typename MB>
    typename RestrictTo<IsHpMatrix<MA>::value
                     && IsHpMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//== SymmetricMatrix

//-- sbcopy
template <typename MA, typename MB>
    typename RestrictTo<IsSbMatrix<MA>::value
                     && IsSbMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- spcopy
template <typename MA, typename MB>
    typename RestrictTo<IsSpMatrix<MA>::value
                     && IsSpMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- sycopy
template <typename MA, typename MB>
    typename RestrictTo<IsSyMatrix<MA>::value
                     && IsSyMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);


//== TriangularMatrix

//-- tbcopy
template <typename MA, typename MB>
    typename RestrictTo<IsTbMatrix<MA>::value
                     && IsTbMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- tpcopy
template <typename MA, typename MB>
    typename RestrictTo<IsTpMatrix<MA>::value
                     && IsTpMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- trcopy
template <typename MA, typename MB>
    typename RestrictTo<IsTrMatrix<MA>::value
                     && IsTrMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);


//-- Sparse BLAS extensions ----------------------------------------------------

//== GeneralMatrix

//-- copy: GeCoordMatrix -> GeCCSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsGeCoordMatrix<MA>::value
                     && IsGeCCSMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- copy: GeCoordMatrix -> GeCRSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsGeCoordMatrix<MA>::value
                     && IsGeCRSMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//== HermitianMatrix

//-- copy: HeCoordMatrix -> HeCCSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHeCoordMatrix<MA>::value
                     && IsHeCCSMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: HeCoordMatrix -> HeCRSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHeCoordMatrix<MA>::value
                     && IsHeCRSMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//== SymmetricMatrix

//-- copy: SyCoordMatrix -> SyCCSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSyCoordMatrix<MA>::value
                     && IsSyCCSMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: SyCoordMatrix -> SyCRSMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSyCoordMatrix<MA>::value
                     && IsSyCRSMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);


//-- Densify Sparse Matrices ---------------------------------------------------

//== GeneralMatrix

//-- copy: GeCCSMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsGeCCSMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- copy: GeCRSMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsGeCRSMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- copy: GeCoordMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsGeCoordMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);


//== HermitianMatrix

//-- copy: HeCCSMatrix -> HeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHeCCSMatrix<MA>::value
                     && IsHeMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: HeCRSMatrix -> HeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHeCRSMatrix<MA>::value
                     && IsHeMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);


//== SymmetricMatrix

//-- copy: SyCCSMatrix -> SyMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSyCCSMatrix<MA>::value
                     && IsSyMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: SyCRSMatrix -> SyMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSyCRSMatrix<MA>::value
                     && IsSyMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- Convenience Extensions ----------------------------------------------------

//== HermitianMatrix

//-- copy: HbMatrix -> GbMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHbMatrix<MA>::value
                     && IsGbMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: HeMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsHeMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//== SymmetricMatrix

//-- copy: SbMatrix -> GbMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSbMatrix<MA>::value
                     && IsGbMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//-- copy: SyMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsSyMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(const MA &A, MB &&B);

//== TriangularMatrix

//-- copy: TbMatrix -> GbMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsTbMatrix<MA>::value
                     && IsGbMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

//-- copy: TrMatrix -> GeMatrix
template <typename MA, typename MB>
    typename RestrictTo<IsTrMatrix<MA>::value
                     && IsGeMatrix<MB>::value,
             void>::Type
    copy(Transpose trans, const MA &A, MB &&B);

} } // namespace blas, flens

#endif // FLENS_BLAS_LEVEL1_COPY_H