| 1 | /************************************************************************* |
| 2 | * * |
| 3 | * Vega FEM Simulation Library Version 3.1 * |
| 4 | * * |
| 5 | * "matrix" library , Copyright (C) 2007 CMU, 2009 MIT * |
| 6 | * All rights reserved. * |
| 7 | * * |
| 8 | * Code author: Jernej Barbic * |
| 9 | * http://www.jernejbarbic.com/code * |
| 10 | * Research: Jernej Barbic, Doug L. James, Jovan Popovic * |
| 11 | * Funding: NSF, Link Foundation, Singapore-MIT GAMBIT Game Lab * |
| 12 | * * |
| 13 | * This library is free software; you can redistribute it and/or * |
| 14 | * modify it under the terms of the BSD-style license that is * |
| 15 | * included with this library in the file LICENSE.txt * |
| 16 | * * |
| 17 | * This library is distributed in the hope that it will be useful, * |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * |
| 20 | * LICENSE.TXT for more details. * |
| 21 | * * |
| 22 | *************************************************************************/ |
| 23 | |
| 24 | /* |
| 25 | Wrappers to matrix BLAS routines. |
| 26 | See also matrix.h. |
| 27 | */ |
| 28 | |
| 29 | #ifndef _MATRIX_BLAS_H_ |
| 30 | #define _MATRIX_BLAS_H_ |
| 31 | |
| 32 | #include <stdlib.h> |
| 33 | |
| 34 | template<class real> |
| 35 | real * SumMatrices(int m, int n, real * mtx1, real * mtx2, real * output = NULL); |
| 36 | |
| 37 | template<class real> |
| 38 | real * SubtractMatrices(int m, int n, real * mtx1, real * mtx2, real * output = NULL); |
| 39 | |
| 40 | // output = mtx1 * mtx2 |
| 41 | // mtx1 is m x p |
| 42 | // mtx2 is p x n |
| 43 | template<class real> |
| 44 | real * MultiplyMatrices(int m, int p, int n, real * mtx1, real * mtx2, real * output = NULL); |
| 45 | |
| 46 | // output = trans(mtx1) * mtx2 |
| 47 | // trans(mtx1) is m x p |
| 48 | // mtx2 is p x n |
| 49 | template<class real> |
| 50 | real * MultiplyMatricesT(int m, int p, int n, real * mtx1, real * mtx2, real * output = NULL); |
| 51 | |
| 52 | template<class real> |
| 53 | real * ScalarMultiplyMatrix(int m, int n, real alpha, real * mtx, real * output = NULL); |
| 54 | |
| 55 | // transposes the matrix (without making a separate copy) |
| 56 | template <class real> |
| 57 | void InPlaceTransposeMatrix(int m, int n, real * mtx); |
| 58 | |
| 59 | // computes Euclidean norm of a vector |
| 60 | template <class real> |
| 61 | real VectorNorm(int m, real * vec); |
| 62 | |
| 63 | #endif |
| 64 |