svFSIplus
Functions | Variables
mat_fun Namespace Reference

The classes defined here duplicate the data structures in the Fortran MATFUN module defined in MATFUN.f. More...

Functions

double mat_ddot (const Array< double > &A, const Array< double > &B, const int nd)
 Double dot product of 2 square matrices. More...
 
double mat_det (const Array< double > &A, const int nd)
 
Array< double > mat_dev (const Array< double > &A, const int nd)
 
Array< double > mat_dyad_prod (const Vector< double > &u, const Vector< double > &v, const int nd)
 Create a matrix from outer product of two vectors. More...
 
Array< double > mat_id (const int nd)
 
Array< double > mat_inv (const Array< double > &A, const int nd, bool debug)
 This function computes inverse of a square matrix. More...
 
Array< double > mat_inv_ge (const Array< double > &Ain, const int n, bool debug)
 This function computes inverse of a square matrix using Gauss Elimination method. More...
 
Array< double > mat_inv_ge_orig (const Array< double > &A, const int nd, bool debug)
 This function computes inverse of a square matrix using Gauss Elimination method. More...
 
Array< double > mat_inv_lp (const Array< double > &A, const int nd)
 This function computes inverse of a square matrix using Lapack functions (DGETRF + DGETRI) More...
 
Array< double > mat_inv_lp_eigen (const Array< double > &A, const int nd)
 not used, just a test. More...
 
Vector< double > mat_mul (const Array< double > &A, const Vector< double > &v)
 Multiply a matrix by a vector. More...
 
Array< double > mat_mul (const Array< double > &A, const Array< double > &B)
 Multiply a matrix by a matrix. More...
 
void mat_mul (const Array< double > &A, const Array< double > &B, Array< double > &result)
 Multiply a matrix by a matrix. More...
 
Array< double > mat_symm (const Array< double > &A, const int nd)
 Symmetric part of a matrix, S = (A + A.T)/2. More...
 
Array< double > mat_symm_prod (const Vector< double > &u, const Vector< double > &v, const int nd)
 Create a matrix from symmetric product of two vectors. More...
 
double mat_trace (const Array< double > &A, const int nd)
 Trace of second order matrix of rank nd. More...
 
Tensor4< double > ten_asym_prod12 (const Array< double > &A, const Array< double > &B, const int nd)
 Create a 4th order tensor from antisymmetric outer product of two matrices. More...
 
Tensor4< double > ten_ddot (const Tensor4< double > &A, const Tensor4< double > &B, const int nd)
 Double dot product of 2 4th order tensors T_ijkl = A_ijmn * B_klmn. More...
 
Tensor4< double > ten_ddot_2412 (const Tensor4< double > &A, const Tensor4< double > &B, const int nd)
 T_ijkl = A_imjn * B_mnkl. More...
 
Tensor4< double > ten_ddot_3424 (const Tensor4< double > &A, const Tensor4< double > &B, const int nd)
 
void ten_init (const int nd)
 Initialize tensor index pointer. More...
 
Tensor4< double > ten_dyad_prod (const Array< double > &A, const Array< double > &B, const int nd)
 Create a 4th order tensor from outer product of two matrices. More...
 
Tensor4< double > ten_ids (const int nd)
 Create a 4th order order symmetric identity tensor. More...
 
Array< double > ten_mddot (const Tensor4< double > &A, const Array< double > &B, const int nd)
 Double dot product of a 4th order tensor and a 2nd order tensor. More...
 
Tensor4< double > ten_symm_prod (const Array< double > &A, const Array< double > &B, const int nd)
 Create a 4th order tensor from symmetric outer product of two matrices. More...
 
Tensor4< double > ten_transpose (const Tensor4< double > &A, const int nd)
 
Array< double > transpose (const Array< double > &A)
 Reproduces Fortran TRANSPOSE. More...
 
template<size_t N>
double mat_det (const double A[N][N])
 
template<size_t N>
void mat_id (double A[N][N])
 
template<size_t N>
void transpose (const double A[N][N], double result[N][N])
 
template<size_t N>
void mat_mul (const double A[N][N], const double B[N][N], double result[N][N])
 
template<size_t N>
void mat_mul (const double A[N][N], const Vector< double > &v, double result[N])
 
template<size_t N>
void mat_inv (const double A[N][N], double Ainv[N][N])
 
template<size_t N>
double mat_trace (const double A[N][N])
 
template<size_t N>
void ten_dyad_prod (const double A[N][N], const double B[N][N], double C[N][N][N][N])
 
template<size_t N>
void ten_ids (double A[N][N][N][N])
 
template<size_t N>
void mat_dyad_prod (const Vector< double > &u, const Vector< double > &v, double result[N][N])
 
template<size_t N>
void ten_symm_prod (const double A[N][N], const double B[N][N], double C[N][N][N][N])
 
template<size_t N>
double mat_ddot (const double A[N][N], const double B[N][N])
 
template<size_t N>
void ten_transpose (const double A[N][N][N][N], double result[N][N][N][N])
 
template<size_t N>
void ten_init ()
 
template<size_t N>
void ten_ddot (const double A[N][N][N][N], const double B[N][N][N][N], double C[N][N][N][N])
 
template<size_t N>
double norm (const Vector< double > &u, const double v[N])
 
template<size_t N>
void print (const std::string &name, const double A[N][N])
 

Variables

Array< int > t_ind
 

Detailed Description

The classes defined here duplicate the data structures in the Fortran MATFUN module defined in MATFUN.f.

Copyright (c) Stanford University, The Regents of the University of California, and others.

All Rights Reserved.

See Copyright-SimVascular.txt for additional details.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

Copyright (c) Stanford University, The Regents of the University of California, and others.

All Rights Reserved.

See Copyright-SimVascular.txt for additional details.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

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.

This module defines data structures for generally performed matrix and tensor operations.

Todo:
[TODO:DaveP] this should just be a namespace?

Function Documentation

◆ mat_ddot()

double mat_fun::mat_ddot ( const Array< double > &  A,
const Array< double > &  B,
const int  nd 
)

Double dot product of 2 square matrices.

◆ mat_dyad_prod()

Array< double > mat_fun::mat_dyad_prod ( const Vector< double > &  u,
const Vector< double > &  v,
const int  nd 
)

Create a matrix from outer product of two vectors.

◆ mat_inv()

Array< double > mat_fun::mat_inv ( const Array< double > &  A,
const int  nd,
bool  debug 
)

This function computes inverse of a square matrix.

◆ mat_inv_ge()

Array< double > mat_fun::mat_inv_ge ( const Array< double > &  Ain,
const int  n,
bool  debug 
)

This function computes inverse of a square matrix using Gauss Elimination method.

◆ mat_inv_ge_orig()

Array<double> mat_fun::mat_inv_ge_orig ( const Array< double > &  A,
const int  nd,
bool  debug 
)

This function computes inverse of a square matrix using Gauss Elimination method.

Todo:
[TODO:DaveP] The original version sometimes produced NaNs.

◆ mat_inv_lp()

Array< double > mat_fun::mat_inv_lp ( const Array< double > &  A,
const int  nd 
)

This function computes inverse of a square matrix using Lapack functions (DGETRF + DGETRI)

Replaces 'FUNCTION MAT_INV_LP(A, nd) RESULT(Ainv)' defined in MATFUN.f.

◆ mat_inv_lp_eigen()

Array<double> mat_fun::mat_inv_lp_eigen ( const Array< double > &  A,
const int  nd 
)

not used, just a test.

◆ mat_mul() [1/3]

Array< double > mat_fun::mat_mul ( const Array< double > &  A,
const Array< double > &  B 
)

Multiply a matrix by a matrix.

Reproduces Fortran MATMUL.

◆ mat_mul() [2/3]

void mat_fun::mat_mul ( const Array< double > &  A,
const Array< double > &  B,
Array< double > &  result 
)

Multiply a matrix by a matrix.

Compute result directly into the passed argument.

◆ mat_mul() [3/3]

Vector< double > mat_fun::mat_mul ( const Array< double > &  A,
const Vector< double > &  v 
)

Multiply a matrix by a vector.

Reproduces Fortran MATMUL.

◆ mat_symm()

Array< double > mat_fun::mat_symm ( const Array< double > &  A,
const int  nd 
)

Symmetric part of a matrix, S = (A + A.T)/2.

◆ mat_symm_prod()

Array< double > mat_fun::mat_symm_prod ( const Vector< double > &  u,
const Vector< double > &  v,
const int  nd 
)

Create a matrix from symmetric product of two vectors.

◆ mat_trace()

double mat_fun::mat_trace ( const Array< double > &  A,
const int  nd 
)

Trace of second order matrix of rank nd.

◆ ten_asym_prod12()

Tensor4< double > mat_fun::ten_asym_prod12 ( const Array< double > &  A,
const Array< double > &  B,
const int  nd 
)

Create a 4th order tensor from antisymmetric outer product of two matrices.

Cijkl = Aij*Bkl-Ail*Bjk

◆ ten_ddot()

Tensor4< double > mat_fun::ten_ddot ( const Tensor4< double > &  A,
const Tensor4< double > &  B,
const int  nd 
)

Double dot product of 2 4th order tensors T_ijkl = A_ijmn * B_klmn.

Reproduces 'FUNCTION TEN_DDOT_3434(A, B, nd) RESULT(C)'.

◆ ten_ddot_2412()

Tensor4< double > mat_fun::ten_ddot_2412 ( const Tensor4< double > &  A,
const Tensor4< double > &  B,
const int  nd 
)

T_ijkl = A_imjn * B_mnkl.

◆ ten_dyad_prod()

Tensor4< double > mat_fun::ten_dyad_prod ( const Array< double > &  A,
const Array< double > &  B,
const int  nd 
)

Create a 4th order tensor from outer product of two matrices.

◆ ten_ids()

Tensor4< double > mat_fun::ten_ids ( const int  nd)

Create a 4th order order symmetric identity tensor.

◆ ten_init()

void mat_fun::ten_init ( const int  nd)

Initialize tensor index pointer.

◆ ten_mddot()

Array< double > mat_fun::ten_mddot ( const Tensor4< double > &  A,
const Array< double > &  B,
const int  nd 
)

Double dot product of a 4th order tensor and a 2nd order tensor.

C_ij = (A_ijkl * B_kl)

◆ ten_symm_prod()

Tensor4< double > mat_fun::ten_symm_prod ( const Array< double > &  A,
const Array< double > &  B,
const int  nd 
)

Create a 4th order tensor from symmetric outer product of two matrices.

Reproduces 'FUNCTION TEN_SYMMPROD(A, B, nd) RESULT(C)'.

◆ transpose()

Array< double > mat_fun::transpose ( const Array< double > &  A)

Reproduces Fortran TRANSPOSE.