| 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 | Commonly used macros in the matrix library. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _MATRIXMACROS_H_ |
| 29 | #define _MATRIXMACROS_H_ |
| 30 | |
| 31 | /* |
| 32 | Returns the array offset index of element located in row i and column j (both 0-indexed). The matrix has "numRows" rows, and is stored in LAPACK-style column-major order. |
| 33 | */ |
| 34 | #ifndef ELT |
| 35 | #define ELT(numRows,i,j) (((long)j)*((long)numRows)+((long)i)) |
| 36 | #endif |
| 37 | |
| 38 | #ifndef MIN |
| 39 | #define MIN(x,y) ((x)<(y) ? (x) : (y)) |
| 40 | #endif |
| 41 | |
| 42 | #ifndef MAX |
| 43 | #define MAX(x,y) ((x)>(y) ? (x) : (y)) |
| 44 | #endif |
| 45 | |
| 46 | |
| 47 | #endif |