//#####################################################################
// Copyright 2002-2007, Ronald Fedkiw, Geoffrey Irving, Igor Neverov, Craig Schroeder, Tamar Shinar, Eftychios Sifakis, Huamin Wang, Rachel Weinstein.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class MATRIX_BASE
//#####################################################################
#include <Core/Matrices/MATRIX_BASE.h>
#include <Core/Math_Tools/minmax.h>
#include <Core/Matrices/MATRIX.h>
#include <Core/Matrices/MATRIX_MXN.h>
#include <Core/Matrices/MATRIX_VIEW.h>
#include <Core/Matrices/SYMMETRIC_MATRIX.h>
#include <Core/Random_Numbers/RANDOM_NUMBERS.h>
#include <Core/Read_Write/READ_WRITE.h>
#include <Core/Symbolics/SYMBOLIC.h>
#include <Core/Vectors/VECTOR.h>
#include <cfloat>
#include <limits>
namespace PhysBAM{
using std::sqrt;
using std::pair;
//#####################################################################
// Function In_Place_Cholesky_Inverse
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_Cholesky_Inverse(MATRIX_BASE<T,T_MATRIX1>& inverse)
{
    assert(Rows()==Columns());
    inverse.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    LEFT_VECTOR b((INITIAL_SIZE)Rows()); // holds piece of the identity matrix
    In_Place_Cholesky_Factorization();
    for(int j=0;j<Columns();j++){
        b(j)=1;
        inverse.Set_Column(j,Transpose_Upper_Triangular_Solve(Lower_Triangular_Solve(b)));
        b(j)=0;}
}
//#####################################################################
// Function In_Place_PLU_Inverse
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_PLU_Inverse(MATRIX_BASE<T,T_MATRIX1>& inverse)
{
    assert(Rows()==Columns());
    inverse.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    COLUMN_PERMUTATION p;
    T_MATRIX L;
    In_Place_PLU_Factorization(L,p);
    RIGHT_VECTOR b((INITIAL_SIZE)Columns()); // used for piece of the identity matrix
    for(int j=0;j<Columns();j++){
        b(j)=1;
        inverse.Set_Column(j,Upper_Triangular_Solve(L.Lower_Triangular_Solve(b.Subset(p))));
        b(j)=0;}
}
//#####################################################################
// Function In_Place_LU_Inverse
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_LU_Inverse(MATRIX_BASE<T,T_MATRIX1>& inverse) // don't assume ARRAY
{
    assert(Rows()==Columns());
    inverse.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    T_MATRIX L;
    RIGHT_VECTOR b(Columns()); // used forpiece of the identity matrix
    In_Place_LU_Factorization(L);
    for(int j=0;j<Columns();j++){
        b(j)=1;
        inverse.Set_Column(j,Upper_Triangular_Solve(L.Lower_Triangular_Solve(b)));
        b(j)=0;}
}
//#####################################################################
// Function Householder_QR_Factorization
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1,class T_MATRIX2> void MATRIX_BASE<T,T_MATRIX>::
Householder_QR_Factorization(MATRIX_BASE<T,T_MATRIX1>& V,MATRIX_BASE<T,T_MATRIX2>& R) const
{
    V.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    R.Derived()=T_MATRIX2((INITIAL_SIZE)Columns(),(INITIAL_SIZE)Columns());
    T_MATRIX temp(*this);
    LEFT_VECTOR a((INITIAL_SIZE)Rows()),v,new_a;
    for(int j=0;j<Columns();j++){ // for each column
        for(int i=0;i<Rows();i++) a(i)=temp(i,j);
        v=a.Householder_Vector(j);
        for(int i=0;i<Rows();i++) V(i,j)=v(i); // store the v's in V
        for(int k=j;k<Columns();k++){ // Householder transform each column
            for(int i=0;i<Rows();i++) a(i)=temp(i,k);
            new_a=a.Householder_Transform(v);
            for(int i=0;i<Rows();i++) temp(i,k)=new_a(i);}}
    for(int i=0;i<Columns();i++) for(int j=i;j<Columns();j++) R(i,j)=temp(i,j); // store R
    for(int i=0;i<Columns();i++) for(int j=0;j<i;j++) R(i,j)=0;
}
//#####################################################################
// Function Robust_Householder_QR_Solve
//#####################################################################
template<class T,class T_MATRIX> template<class T_VECTOR0,class T_VECTOR1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_Robust_Householder_QR_Solve(ARRAY_BASE<T,T_VECTOR0>& b,ARRAY_BASE<int,T_VECTOR1>& p)
{
    assert(Rows()==b.Size() && Columns()==p.Size());
    LEFT_VECTOR a((INITIAL_SIZE)Rows());
    for(int i=0;i<Columns();i++) p(i)=i;
    RIGHT_VECTOR column_norm((INITIAL_SIZE)Columns());
    for(int j=0;j<Columns();j++) for(int i=0;i<Rows();i++) column_norm(j)+=sqr((*this)(i,j));
    for(int j=0;j<Columns();j++){
        int max_column=0;
        T max_column_norm=0;
        for(int k=j;k<Columns();k++)
            if(column_norm(k)>max_column_norm){
                max_column_norm=column_norm(k);
                max_column=k;}
        if(max_column_norm<FLT_MIN) return;
        if(max_column!=j){
            exchange(column_norm(j),column_norm(max_column));
            exchange(p(j),p(max_column));
            for(int i=0;i<Rows();i++)
                exchange((*this)(i,j),(*this)(i,max_column));}
        if(j==Rows()) return;
        a=Get_Column(j);
        LEFT_VECTOR v=a.Householder_Vector(j);
        T two_over_v_dot_v=(T)2/v.Magnitude_Squared();
        if((*this)(j,j)>=0)(*this)(j,j)=-sqrt(max_column_norm);
        else (*this)(j,j)=sqrt(max_column_norm);
        for(int i=j+1;i<Rows();i++)(*this)(i,j)=(T)0;
        for(int k=j+1;k<Columns();k++){
            T v_dot_a=0;
            for(int i=j;i<Rows();i++) v_dot_a+=v(i)*(*this)(i,k);
            T coefficient=v_dot_a*two_over_v_dot_v;
            for(int i=j;i<Rows();i++) (*this)(i,k)-=coefficient*v(i);}
        T v_dot_b=0;
        for(int i=j;i<Rows();i++) v_dot_b+=v(i)*b(i);
        T coefficient=v_dot_b*two_over_v_dot_v;
        for(int i=j;i<Rows();i++) b(i)-=coefficient*v(i);
        for(int k=j+1;k<Columns();k++) column_norm(k)-=sqr((*this)(j,k));}
}
//#####################################################################
// Function In_Place_PLU_Factorization
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_PLU_Factorization(MATRIX_BASE<T,T_MATRIX1>& L,COLUMN_PERMUTATION& p)
{
    assert((INITIAL_SIZE)Rows()==(INITIAL_SIZE)Columns());
    L.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    p=COLUMN_PERMUTATION(INITIAL_SIZE(Columns()));
    for(int i=0;i<Columns();i++) p(i)=i; // initialize p
    for(int j=0;j<Columns();j++){ // for each column
        // find the largest element and switch rows
        int row=j;
        T value=abs((*this)(j,j));
        for(int i=j+1;i<Columns();i++)
            if(abs((*this)(i,j))>value){
                row=i;
                value=abs((*this)(i,j));}
        if(row!=j){ // need to switch rows
            exchange(p(j),p(row)); // update permutation matrix
            for(int k=0;k<j;k++) exchange(L(j,k),L(row,k)); // update L
            for(int k=j;k<Columns();k++) exchange((*this)(j,k),(*this)(row,k));} // update U
        // standard LU factorization steps
        T diagonal_inverse=1/(*this)(j,j);
        // fill in the column for L
        for(int i=j;i<Columns();i++) L(i,j)=(*this)(i,j)*diagonal_inverse;
        // sweep across each row below row j  TODO: can order be changed?
        for(int i=j+1;i<Columns();i++)
            for(int k=j;k<Columns();k++)
                (*this)(i,k)-=L(i,j)*(*this)(j,k);}
}
//#####################################################################
// Function In_Place_Cholesky_Factorization
//#####################################################################
template<class T,class T_MATRIX> void MATRIX_BASE<T,T_MATRIX>::
In_Place_Cholesky_Factorization()
{
    assert(Rows()==Columns());
    for(int j=0;j<Columns();j++){ // for each column
        // subtract off the known stuff in previous columns
        for(int k=0;k<j;k++)
            for(int i=j;i<Rows();i++)
                (*this)(i,j)-=(*this)(j,k)*(*this)(i,k);
        (*this)(j,j)=sqrt((*this)(j,j));
        T diagonal_inverse=1/(*this)(j,j);
        for(int i=j+1;i<Columns();i++)
            (*this)(i,j)*=diagonal_inverse;} // update L
    // zero out upper triangular part  TODO: Loop the other way around
    for(int i=0;i<Rows();i++)
        for(int j=i+1;j<Columns();j++)
            (*this)(i,j)=0;
}
//#####################################################################
// Function In_Place_Cholesky_Factorization
//#####################################################################
template<class T,class T_MATRIX> template<class T_MATRIX1> void MATRIX_BASE<T,T_MATRIX>::
In_Place_LU_Factorization(MATRIX_BASE<T,T_MATRIX1>& L)
{
    assert(Rows()==Columns());
    L.Derived()=T_MATRIX1((INITIAL_SIZE)Rows(),(INITIAL_SIZE)Columns());
    for(int j=0;j<Columns();j++){ // for each column
        T diagonal_inverse=1/(*this)(j,j);
        // fill in the column for L
        for(int i=j;i<Columns();i++)
            L(i,j)=(*this)(i,j)*diagonal_inverse;
        // sweep across each row below row j  TODO: can the order of these loops be swapped?
        for(int i=j+1;i<Columns();i++)
            for(int k=j;k<Columns();k++)
                (*this)(i,k)-=L(i,j)*(*this)(j,k);}
}
namespace{
template<class T> static void 
Update_Max_Off_Diagonal_Element_Of_Row_After_Row_Change(const MATRIX_MXN<T>& A,
    ARRAY<pair<int,T> >& max_off_diagonal_element_of_row,int i)
{
    max_off_diagonal_element_of_row(i)=pair<int,T>();
    for(int j=0;j<A.n;j++)
        if(i!=j)
            if(abs(A(i,j))>max_off_diagonal_element_of_row(i).y){
                max_off_diagonal_element_of_row(i).y=abs(A(i,j));
                max_off_diagonal_element_of_row(i).x=j;}
}
template<class T> static void 
Update_Max_Off_Diagonal_Element_Of_Row_After_Column_Change(const MATRIX_MXN<T>& A,
    ARRAY<pair<int,T> >& max_off_diagonal_element_of_row,int j)
{
    for(int i=0;i<A.m;i++)
        if(i!=j){
            if(abs(A(i,j))>max_off_diagonal_element_of_row(i).y){
                max_off_diagonal_element_of_row(i).y=abs(A(i,j));
                max_off_diagonal_element_of_row(i).x=j;}
            else if(max_off_diagonal_element_of_row(i).x==j)
                Update_Max_Off_Diagonal_Element_Of_Row_After_Row_Change(A,max_off_diagonal_element_of_row,i);}
}
}
//#####################################################################
// Function exp
//#####################################################################
template<class T,class T_MATRIX> T_MATRIX PhysBAM::
exp(const MATRIX_BASE<T,T_MATRIX>& M)
{
    PHYSBAM_ASSERT(M.Rows()==M.Columns());
    if(M.Rows()==0) return M.Derived();
    T limit=sizeof(T)==4?0.25:0.03125; // Enough so 7 Taylor terms suffice
    T shift=M.Trace()/M.Rows();
    T_MATRIX A=M.Derived()-shift;
    T tol=min(sqrt(limit/M.Rows()),limit);
    T max_abs=A.Max_Abs()/tol;
    int s=max_abs<1?0:(int)ceil(log(max_abs)/log(2));
    A/=1LL<<s;
    T_MATRIX A2=A*A;
    T_MATRIX B=(((T)0.00138888888888889*A2+(T)0.00833333333333333*A+(T)0.04166666666666666)*A2+((T)0.16666666666666666*A+(T)0.5))*A2+(A+1);
    for(int i=0;i<s;i++) B=B*B;
    return B*exp(shift);
}
//#####################################################################
// Function Fill_Uniform
//#####################################################################
template<class T,class T_MATRIX> void MATRIX_BASE<T,T_MATRIX>::
Fill_Uniform(RANDOM_NUMBERS<T>& rand,T a,T b)
{
    for(int i=0;i<Rows();i++)
        for(int j=0;j<Columns();j++)
            rand.Fill_Uniform((*this)(i,j),a,b);
}
//#####################################################################
// Function Write_Text_Matrix
//#####################################################################
template<class T_MATRIX> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Write_Text_Matrix(UNTYPED_OSTREAM<char>& output,const T_MATRIX& m)
{
    Beg(output,'[');
    for(int i=0;i<m.Rows();i++)
    {
        if(i) Sep(output,';');
        for(int j=0;j<m.Columns();j++)
            Write_Binary(output,m(i,j));
    }
    End(output,']');
}
//#####################################################################
// Function Write_Text_Matrix
//#####################################################################
template<class T_MATRIX> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Write_Text_Matrix_Upper(UNTYPED_OSTREAM<char>& output,const T_MATRIX& m)
{
    Beg(output,'[');
    typename T_MATRIX::SCALAR a{};
    for(int i=0;i<m.m;i++)
    {
        if(i) Sep(output,';');
        for(int j=0;j<i;j++)
            Write_Binary(output,a);
        for(int j=i;j<m.n;j++)
            Write_Binary(output,m(i,j));
    }
    End(output,']');
}
//#####################################################################
// Function Write_Text_Matrix
//#####################################################################
template<class T_MATRIX> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Read_Text_Matrix(UNTYPED_ISTREAM<char>& input,T_MATRIX& m)
{
    Get(input,'[');
    for(int i=0;i<m.m;i++)
    {
        if(i) Get(input,';');
        for(int j=0;j<m.n;j++)
            Read_Binary(input,m(i,j));
    }
    Get(input,']');
}
//#####################################################################
// Function Write_Text_Matrix
//#####################################################################
template<class T_MATRIX> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Read_Text_Matrix_Upper(UNTYPED_ISTREAM<char>& input,T_MATRIX& m)
{
    typename T_MATRIX::SCALAR a;
    Get(input,'[');
    for(int i=0;i<m.m;i++)
    {
        if(i) Get(input,';');
        for(int j=0;j<i;j++)
            Read_Binary(input,a);
        for(int j=i;j<m.n;j++)
            Read_Binary(input,m.Element_Upper(i,j));
    }
    Get(input,']');
}
//#####################################################################
// Function Write_Fixed_Matrix
//#####################################################################
template<class RW,class T,class T_MATRIX,int s> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Write_Fixed_Matrix(UNTYPED_OSTREAM<RW>& output,const T_MATRIX& m,T(& x)[s])
{
    if constexpr(is_same<RW,char>::value)
        Write_Text_Matrix(output,m);
    else Write_Binary_Array(output,x,s);
}
//#####################################################################
// Function Write_Fixed_Matrix
//#####################################################################
template<class RW,class T,class T_MATRIX,int s> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Write_Fixed_Matrix_Upper(UNTYPED_OSTREAM<RW>& output,const T_MATRIX& m,T(& x)[s])
{
    if constexpr(is_same<RW,char>::value)
        Write_Text_Matrix_Upper(output,m);
    else Write_Binary_Array(output,x,s);
}
//#####################################################################
// Function Read_Fixed_Matrix
//#####################################################################
template<class RW,class T,class T_MATRIX,int s> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Read_Fixed_Matrix(UNTYPED_ISTREAM<RW>& input,T_MATRIX& m,T(& x)[s])
{
    if constexpr(is_same<RW,char>::value)
        Read_Text_Matrix(input,m);
    else Read_Binary_Array(input,x,s);
}
//#####################################################################
// Function Read_Fixed_Matrix_Upper
//#####################################################################
template<class RW,class T,class T_MATRIX,int s> std::enable_if_t<IS_MATRIX<T_MATRIX>::value>
Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<RW>& input,T_MATRIX& m,T(& x)[s])
{
    if constexpr(is_same<RW,char>::value)
        Read_Text_Matrix_Upper(input,m);
    else Read_Binary_Array(input,x,s);
}
//#####################################################################
// Function Determinant
//#####################################################################
template<class T,class T_MATRIX>
T MATRIX_BASE<T,T_MATRIX>::
Determinant() const
{
    assert(Rows()==Columns());
    if(!Rows()) return 0;
    T_MATRIX M(Derived()),L;
    COLUMN_PERMUTATION p;
    M.In_Place_PLU_Factorization(L,p);
    T det=1;
    for(int i=0;i<p.Size();i++)
        while(p(i)!=i)
        {
            std::swap(p(i),p(p(i)));
            det=-det;
        }
    for(int i=0;i<Columns();i++) det*=M(i,i);
    return det;
}
//#####################################################################
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_Robust_Householder_QR_Solve(ARRAY_BASE<float,ARRAY<float> >&,ARRAY_BASE<int,ARRAY<int> >&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_LU_Factorization(MATRIX_BASE<float,MATRIX_MXN<float> >&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::Householder_QR_Factorization(MATRIX_BASE<float,MATRIX_MXN<float> >&,MATRIX_BASE<float,MATRIX_MXN<float> >&) const;
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_Robust_Householder_QR_Solve(ARRAY_BASE<double,ARRAY<double> >&,ARRAY_BASE<int,ARRAY<int> >&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_LU_Factorization(MATRIX_BASE<double,MATRIX_MXN<double> >&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::Householder_QR_Factorization(MATRIX_BASE<double,MATRIX_MXN<double> >&,MATRIX_BASE<double,MATRIX_MXN<double> >&) const;

template void MATRIX_BASE<float,MATRIX<float,0,0> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,1,1> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,2,2> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,3,3> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,4,4> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,5,5> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX<float,6,6> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,0,0> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,1,1> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,2,2> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,3,3> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,4,4> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,5,5> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX<double,6,6> >::In_Place_Cholesky_Factorization();
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_Cholesky_Factorization();

template void MATRIX_BASE<float,MATRIX<float,0,0> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,0,0> >&,VECTOR<int,0>&);
template void MATRIX_BASE<float,MATRIX<float,1,1> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,1,1> >&,VECTOR<int,1>&);
template void MATRIX_BASE<float,MATRIX<float,2,2> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,2,2> >&,VECTOR<int,2>&);
template void MATRIX_BASE<float,MATRIX<float,3,3> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,3,3> >&,VECTOR<int,3>&);
template void MATRIX_BASE<float,MATRIX<float,4,4> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,4,4> >&,VECTOR<int,4>&);
template void MATRIX_BASE<float,MATRIX<float,5,5> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,5,5> >&,VECTOR<int,5>&);
template void MATRIX_BASE<float,MATRIX<float,6,6> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX<float,6,6> >&,VECTOR<int,6>&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_PLU_Factorization(MATRIX_BASE<float,MATRIX_MXN<float> >&,ARRAY<int>&);
template void MATRIX_BASE<double,MATRIX<double,0,0> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,0,0> >&,VECTOR<int,0>&);
template void MATRIX_BASE<double,MATRIX<double,1,1> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,1,1> >&,VECTOR<int,1>&);
template void MATRIX_BASE<double,MATRIX<double,2,2> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,2,2> >&,VECTOR<int,2>&);
template void MATRIX_BASE<double,MATRIX<double,3,3> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,3,3> >&,VECTOR<int,3>&);
template void MATRIX_BASE<double,MATRIX<double,4,4> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,4,4> >&,VECTOR<int,4>&);
template void MATRIX_BASE<double,MATRIX<double,5,5> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,5,5> >&,VECTOR<int,5>&);
template void MATRIX_BASE<double,MATRIX<double,6,6> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX<double,6,6> >&,VECTOR<int,6>&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_PLU_Factorization(MATRIX_BASE<double,MATRIX_MXN<double> >&,ARRAY<int>&);
template void MATRIX_BASE<double,MATRIX<double,1,1> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX<double,1,1> >&);
template void MATRIX_BASE<double,MATRIX<double,2,2> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX<double,2,2> >&);
template void MATRIX_BASE<double,MATRIX<double,3,3> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX<double,3,3> >&);
template void MATRIX_BASE<double,MATRIX<double,4,4> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX<double,4,4> >&);
template void MATRIX_BASE<double,MATRIX<double,6,6> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX<double,6,6> >&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_Cholesky_Inverse(MATRIX_BASE<double,MATRIX_MXN<double> >&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_LU_Inverse(MATRIX_BASE<double,MATRIX_MXN<double> >&);
template void MATRIX_BASE<float,MATRIX<float,1,1> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX<float,1,1> >&);
template void MATRIX_BASE<float,MATRIX<float,2,2> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX<float,2,2> >&);
template void MATRIX_BASE<float,MATRIX<float,3,3> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX<float,3,3> >&);
template void MATRIX_BASE<float,MATRIX<float,4,4> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX<float,4,4> >&);
template void MATRIX_BASE<float,MATRIX<float,6,6> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX<float,6,6> >&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_Cholesky_Inverse(MATRIX_BASE<float,MATRIX_MXN<float> >&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_LU_Inverse(MATRIX_BASE<float,MATRIX_MXN<float> >&);
template MATRIX<double,0,0> exp<double,MATRIX<double,0,0> >(MATRIX_BASE<double,MATRIX<double,0,0> > const&);
template MATRIX<double,1,1> exp<double,MATRIX<double,1,1> >(MATRIX_BASE<double,MATRIX<double,1,1> > const&);
template MATRIX<double,2,2> exp<double,MATRIX<double,2,2> >(MATRIX_BASE<double,MATRIX<double,2,2> > const&);
template MATRIX<double,3,3> exp<double,MATRIX<double,3,3> >(MATRIX_BASE<double,MATRIX<double,3,3> > const&);
template MATRIX<double,4,4> exp<double,MATRIX<double,4,4> >(MATRIX_BASE<double,MATRIX<double,4,4> > const&);
template MATRIX<double,5,5> exp<double,MATRIX<double,5,5> >(MATRIX_BASE<double,MATRIX<double,5,5> > const&);
template MATRIX<double,6,6> exp<double,MATRIX<double,6,6> >(MATRIX_BASE<double,MATRIX<double,6,6> > const&);
template MATRIX_MXN<double> exp<double,MATRIX_MXN<double> >(MATRIX_BASE<double,MATRIX_MXN<double> > const&);
template MATRIX<float,0,0> exp<float,MATRIX<float,0,0> >(MATRIX_BASE<float,MATRIX<float,0,0> > const&);
template MATRIX<float,1,1> exp<float,MATRIX<float,1,1> >(MATRIX_BASE<float,MATRIX<float,1,1> > const&);
template MATRIX<float,2,2> exp<float,MATRIX<float,2,2> >(MATRIX_BASE<float,MATRIX<float,2,2> > const&);
template MATRIX<float,3,3> exp<float,MATRIX<float,3,3> >(MATRIX_BASE<float,MATRIX<float,3,3> > const&);
template MATRIX<float,4,4> exp<float,MATRIX<float,4,4> >(MATRIX_BASE<float,MATRIX<float,4,4> > const&);
template MATRIX<float,5,5> exp<float,MATRIX<float,5,5> >(MATRIX_BASE<float,MATRIX<float,5,5> > const&);
template MATRIX<float,6,6> exp<float,MATRIX<float,6,6> >(MATRIX_BASE<float,MATRIX<float,6,6> > const&);
template MATRIX_MXN<float> exp<float,MATRIX_MXN<float> >(MATRIX_BASE<float,MATRIX_MXN<float> > const&);
template void MATRIX_BASE<double,MATRIX<double,6,6> >::Householder_QR_Factorization(MATRIX_BASE<double,MATRIX<double,6,6> >&,MATRIX_BASE<double,MATRIX<double,6,6> >&) const;
template void MATRIX_BASE<float,MATRIX<float,6,6> >::Householder_QR_Factorization(MATRIX_BASE<float,MATRIX<float,6,6> >&,MATRIX_BASE<float,MATRIX<float,6,6> >&) const;
template void MATRIX_BASE<double,MATRIX_MXN<double> >::In_Place_PLU_Inverse(MATRIX_BASE<double,MATRIX_MXN<double> >&);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::In_Place_PLU_Inverse(MATRIX_BASE<float,MATRIX_MXN<float> >&);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,1,1>&,double (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,2,2>&,double (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,3,3>&,double (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,1,1>&,float (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,2,2>&,float (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,3,3>&,float (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,1,1>&,double (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,2,2>&,double (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,3,3>&,double (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,1,1>&,float (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,2,2>&,float (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,3,3>&,float (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,1,1>&,double (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,2,2>&,double (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,3,3>&,double (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,1,1>&,float (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,2,2>&,float (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,3,3>&,float (&) [9]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,1>&,double (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,2>&,double (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,3>&,double (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,1>&,float (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,2>&,float (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,3>&,float (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,1>&,double (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,2>&,double (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,3>&,double (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,1>&,float (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,2>&,float (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,3>&,float (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,1>&,double (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,2>&,double (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,3>&,double (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,1>&,float (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,2>&,float (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,3>&,float (&) [6]);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,0,0>&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,0,0>&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,0>&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,0>&);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,1,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,2,2> const&,double const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,3,3> const&,double const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,2> const&,double const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,1,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,2,2> const&,float const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,3,3> const&,float const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,2> const&,float const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,3> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,1,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,2,2> const&,double const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,3,3> const&,double const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,2> const&,double const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,1,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,2,2> const&,float const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,3,3> const&,float const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,2> const&,float const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,3> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,1,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,2,2> const&,double const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,3,3> const&,double const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,2> const&,double const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,1,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,2,2> const&,float const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,3,3> const&,float const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,1> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,2> const&,float const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,3> const&,float const (&) [6]);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,0,0> const&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,0,0> const&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,0> const&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,0> const&);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<SYMBOLIC,1,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<SYMBOLIC,2,2>&,SYMBOLIC (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<SYMBOLIC,3,3>&,SYMBOLIC (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<SYMBOLIC,1,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<SYMBOLIC,2,2>&,SYMBOLIC (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<SYMBOLIC,3,3>&,SYMBOLIC (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<SYMBOLIC,1,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<SYMBOLIC,2,2>&,SYMBOLIC (&) [4]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<SYMBOLIC,3,3>&,SYMBOLIC (&) [9]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,2>&,SYMBOLIC (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,3>&,SYMBOLIC (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,2>&,SYMBOLIC (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,3>&,SYMBOLIC (&) [6]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,1>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,2>&,SYMBOLIC (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,3>&,SYMBOLIC (&) [6]);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<SYMBOLIC,0,0>&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,0>&);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<SYMBOLIC,1,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<SYMBOLIC,2,2> const&,SYMBOLIC const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<SYMBOLIC,3,3> const&,SYMBOLIC const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,2> const&,SYMBOLIC const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,3> const&,SYMBOLIC const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<SYMBOLIC,1,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<SYMBOLIC,2,2> const&,SYMBOLIC const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<SYMBOLIC,3,3> const&,SYMBOLIC const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,2> const&,SYMBOLIC const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,3> const&,SYMBOLIC const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<SYMBOLIC,1,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<SYMBOLIC,2,2> const&,SYMBOLIC const (&) [4]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<SYMBOLIC,3,3> const&,SYMBOLIC const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,1> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,2> const&,SYMBOLIC const (&) [3]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,3> const&,SYMBOLIC const (&) [6]);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<SYMBOLIC,0,0> const&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,0> const&);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<VECTOR<double,5>,3,3> const&,VECTOR<double,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<VECTOR<float,5>,3,3> const&,VECTOR<float,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,2,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,2,3> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<VECTOR<double,5>,3,3> const&,VECTOR<double,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<VECTOR<float,5>,3,3> const&,VECTOR<float,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,2,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,2,3> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<VECTOR<double,5>,3,3> const&,VECTOR<double,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<VECTOR<float,5>,3,3> const&,VECTOR<float,5> const (&) [9]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,2,3> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,2,3> const&,float const (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<VECTOR<double,5>,3,3>&,VECTOR<double,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<VECTOR<float,5>,3,3>&,VECTOR<float,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,2,3>&,double (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,2,3>&,float (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<VECTOR<double,5>,3,3>&,VECTOR<double,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<VECTOR<float,5>,3,3>&,VECTOR<float,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,2,3>&,double (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,2,3>&,float (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<VECTOR<double,5>,3,3>&,VECTOR<double,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<VECTOR<float,5>,3,3>&,VECTOR<float,5> (&) [9]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,2,3>&,double (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,2,3>&,float (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,6,6>&,double (&) [36]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,6,6>&,float (&) [36]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,6,6>&,double (&) [36]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,6,6>&,float (&) [36]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,6,6>&,double (&) [36]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,6,6>&,float (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,6,6> const&,double const (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,6,6> const&,float const (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,6,6> const&,double const (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,6,6> const&,float const (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,6,6> const&,double const (&) [36]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,6,6> const&,float const (&) [36]);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX_MXN<double> const&);
template void MATRIX_BASE<SYMBOLIC,MATRIX_MXN<SYMBOLIC> >::In_Place_Cholesky_Factorization();
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,4> const&,double const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,5> const&,double const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,6> const&,double const (&) [21]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,4> const&,float const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,5> const&,float const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,6> const&,float const (&) [21]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,4> const&,double const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,5> const&,double const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,6> const&,double const (&) [21]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,4> const&,float const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,5> const&,float const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,6> const&,float const (&) [21]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,4> const&,double const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,5> const&,double const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,6> const&,double const (&) [21]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,4> const&,float const (&) [10]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,5> const&,float const (&) [15]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,6> const&,float const (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,4>&,double (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,5>&,double (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,6>&,double (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,4>&,float (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,5>&,float (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,6>&,float (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,4>&,double (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,5>&,double (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,6>&,double (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,4>&,float (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,5>&,float (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,6>&,float (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,4>&,double (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,5>&,double (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,6>&,double (&) [21]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,4>&,float (&) [10]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,5>&,float (&) [15]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,6>&,float (&) [21]);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX_MXN<float> const&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,MATRIX_VIEW<double>&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX_VIEW<double> const&);
template void Read_Text_Matrix(UNTYPED_ISTREAM<char>&,MATRIX_VIEW<float>&);
template void Write_Text_Matrix(UNTYPED_OSTREAM<char>&,MATRIX_VIEW<float> const&);
template void MATRIX_BASE<double,MATRIX_MXN<double> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<float,MATRIX_MXN<float> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<double,MATRIX<double,2,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<float,MATRIX<float,2,2> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,3,3> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<double,MATRIX<double,1,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,2,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,2,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,2,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,2,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,2,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,3,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,4,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,5,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,1> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,2> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,3> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,4> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,5> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,6,6> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,0,0> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<double,MATRIX<double,1,0> >::Fill_Uniform(RANDOM_NUMBERS<double>&,double,double);
template void MATRIX_BASE<float,MATRIX<float,0,0> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,1,0> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,1,1> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,1,2> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,2,1> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,2,3> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,3,2> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,3,4> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,4,4> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,5,5> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void MATRIX_BASE<float,MATRIX<float,6,6> >::Fill_Uniform(RANDOM_NUMBERS<float>&,float,float);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,1,0>&,double (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,1,0>&,double (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,1,0>&,double (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,1,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,1,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,1,0> const&,double const (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,1,2>&,double (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,1,2>&,double (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,1,2>&,double (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,1,2> const&,double const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,1,2> const&,double const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,1,2> const&,double const (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,2,1>&,double (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,2,1>&,double (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,2,1>&,double (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,2,1> const&,double const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,2,1> const&,double const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,2,1> const&,double const (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,3,2>&,double (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,3,2>&,double (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,3,2>&,double (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,3,2> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,3,2> const&,double const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,3,2> const&,double const (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,3,4>&,double (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,3,4>&,double (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,3,4>&,double (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,3,4> const&,double const (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,3,4> const&,double const (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,3,4> const&,double const (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,4,4>&,double (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,4,4>&,double (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,4,4>&,double (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,4,4> const&,double const (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,4,4> const&,double const (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,4,4> const&,double const (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<double,5,5>&,double (&) [25]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<double,5,5>&,double (&) [25]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<double,5,5>&,double (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<double,5,5> const&,double const (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<double,5,5> const&,double const (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<double,5,5> const&,double const (&) [25]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,1,0>&,float (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,1,0>&,float (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,1,0>&,float (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,1,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,1,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,1,0> const&,float const (&) [1]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,1,2>&,float (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,1,2>&,float (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,1,2>&,float (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,1,2> const&,float const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,1,2> const&,float const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,1,2> const&,float const (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,2,1>&,float (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,2,1>&,float (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,2,1>&,float (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,2,1> const&,float const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,2,1> const&,float const (&) [2]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,2,1> const&,float const (&) [2]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,3,2>&,float (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,3,2>&,float (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,3,2>&,float (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,3,2> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,3,2> const&,float const (&) [6]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,3,2> const&,float const (&) [6]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,3,4>&,float (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,3,4>&,float (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,3,4>&,float (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,3,4> const&,float const (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,3,4> const&,float const (&) [12]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,3,4> const&,float const (&) [12]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,4,4>&,float (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,4,4>&,float (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,4,4>&,float (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,4,4> const&,float const (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,4,4> const&,float const (&) [16]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,4,4> const&,float const (&) [16]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<char>&,MATRIX<float,5,5>&,float (&) [25]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<double>&,MATRIX<float,5,5>&,float (&) [25]);
template void Read_Fixed_Matrix(UNTYPED_ISTREAM<float>&,MATRIX<float,5,5>&,float (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,MATRIX<float,5,5> const&,float const (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,MATRIX<float,5,5> const&,float const (&) [25]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,MATRIX<float,5,5> const&,float const (&) [25]);
template void Write_Fixed_Matrix<char,std::complex<double> const,MATRIX<std::complex<double>,2,2>,4>(UNTYPED_OSTREAM<char>&,MATRIX<std::complex<double>,2,2> const&,std::complex<double> const (&) [4]);
template void Write_Fixed_Matrix<char,std::complex<double> const,MATRIX<std::complex<double>,3,3>,9>(UNTYPED_OSTREAM<char>&,MATRIX<std::complex<double>,3,3> const&,std::complex<double> const (&) [9]);
template double MATRIX_BASE<double,MATRIX<double,4,4> >::Determinant() const;
template double MATRIX_BASE<double,MATRIX<double,5,5> >::Determinant() const;
template double MATRIX_BASE<double,MATRIX<double,6,6> >::Determinant() const;
template double MATRIX_BASE<double,MATRIX_MXN<double> >::Determinant() const;
template float MATRIX_BASE<float,MATRIX<float,4,4> >::Determinant() const;
template float MATRIX_BASE<float,MATRIX<float,5,5> >::Determinant() const;
template float MATRIX_BASE<float,MATRIX<float,6,6> >::Determinant() const;
template float MATRIX_BASE<float,MATRIX_MXN<float> >::Determinant() const;
template void Read_Fixed_Matrix<char,SYMBOLIC,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_ISTREAM<char>&,MATRIX<SYMBOLIC,0,0>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix<double,SYMBOLIC,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_ISTREAM<double>&,MATRIX<SYMBOLIC,0,0>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix<float,SYMBOLIC,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_ISTREAM<float>&,MATRIX<SYMBOLIC,0,0>&,SYMBOLIC (&) [1]);
template void Write_Fixed_Matrix<char,SYMBOLIC const,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_OSTREAM<char>&,MATRIX<SYMBOLIC,0,0> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix<double,SYMBOLIC const,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_OSTREAM<double>&,MATRIX<SYMBOLIC,0,0> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix<float,SYMBOLIC const,MATRIX<SYMBOLIC,0,0>,1>(UNTYPED_OSTREAM<float>&,MATRIX<SYMBOLIC,0,0> const&,SYMBOLIC const (&) [1]);
template void Read_Fixed_Matrix<char,double,MATRIX<double,0,0>,1>(UNTYPED_ISTREAM<char>&,MATRIX<double,0,0>&,double (&) [1]);
template void Read_Fixed_Matrix<double,double,MATRIX<double,0,0>,1>(UNTYPED_ISTREAM<double>&,MATRIX<double,0,0>&,double (&) [1]);
template void Read_Fixed_Matrix<float,double,MATRIX<double,0,0>,1>(UNTYPED_ISTREAM<float>&,MATRIX<double,0,0>&,double (&) [1]);
template void Write_Fixed_Matrix<char,double const,MATRIX<double,0,0>,1>(UNTYPED_OSTREAM<char>&,MATRIX<double,0,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix<double,double const,MATRIX<double,0,0>,1>(UNTYPED_OSTREAM<double>&,MATRIX<double,0,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix<float,double const,MATRIX<double,0,0>,1>(UNTYPED_OSTREAM<float>&,MATRIX<double,0,0> const&,double const (&) [1]);
template void Read_Fixed_Matrix<char,float,MATRIX<float,0,0>,1>(UNTYPED_ISTREAM<char>&,MATRIX<float,0,0>&,float (&) [1]);
template void Read_Fixed_Matrix<double,float,MATRIX<float,0,0>,1>(UNTYPED_ISTREAM<double>&,MATRIX<float,0,0>&,float (&) [1]);
template void Read_Fixed_Matrix<float,float,MATRIX<float,0,0>,1>(UNTYPED_ISTREAM<float>&,MATRIX<float,0,0>&,float (&) [1]);
template void Write_Fixed_Matrix<char,float const,MATRIX<float,0,0>,1>(UNTYPED_OSTREAM<char>&,MATRIX<float,0,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix<double,float const,MATRIX<float,0,0>,1>(UNTYPED_OSTREAM<double>&,MATRIX<float,0,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix<float,float const,MATRIX<float,0,0>,1>(UNTYPED_OSTREAM<float>&,MATRIX<float,0,0> const&,float const (&) [1]);
template void Read_Fixed_Matrix_Upper<char,SYMBOLIC,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,0>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix_Upper<double,SYMBOLIC,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,0>&,SYMBOLIC (&) [1]);
template void Read_Fixed_Matrix_Upper<float,SYMBOLIC,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,0>&,SYMBOLIC (&) [1]);
template void Write_Fixed_Matrix<char,SYMBOLIC const,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<SYMBOLIC,0> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix<double,SYMBOLIC const,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<SYMBOLIC,0> const&,SYMBOLIC const (&) [1]);
template void Write_Fixed_Matrix<float,SYMBOLIC const,SYMMETRIC_MATRIX<SYMBOLIC,0>,1>(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<SYMBOLIC,0> const&,SYMBOLIC const (&) [1]);
template void Read_Fixed_Matrix_Upper<char,double,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,0>&,double (&) [1]);
template void Read_Fixed_Matrix_Upper<double,double,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,0>&,double (&) [1]);
template void Read_Fixed_Matrix_Upper<float,double,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,0>&,double (&) [1]);
template void Write_Fixed_Matrix<char,double const,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix<double,double const,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,0> const&,double const (&) [1]);
template void Write_Fixed_Matrix<float,double const,SYMMETRIC_MATRIX<double,0>,1>(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,0> const&,double const (&) [1]);
template void Read_Fixed_Matrix_Upper<char,float,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,0>&,float (&) [1]);
template void Read_Fixed_Matrix_Upper<double,float,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,0>&,float (&) [1]);
template void Read_Fixed_Matrix_Upper<float,float,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,0>&,float (&) [1]);
template void Write_Fixed_Matrix<char,float const,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix<double,float const,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,0> const&,float const (&) [1]);
template void Write_Fixed_Matrix<float,float const,SYMMETRIC_MATRIX<float,0>,1>(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,0> const&,float const (&) [1]);
template void MATRIX_BASE<double,MATRIX<double,4,4> >::In_Place_PLU_Inverse<MATRIX<double,4,4> >(MATRIX_BASE<double,MATRIX<double,4,4> >&);
template void Write_Fixed_Matrix<char,double const,MATRIX<double,0,1>,1>(UNTYPED_OSTREAM<char>&,MATRIX<double,0,1> const&,double const (&) [1]);
template void Write_Fixed_Matrix<char,double const,MATRIX<double,1,3>,3>(UNTYPED_OSTREAM<char>&,MATRIX<double,1,3> const&,double const (&) [3]);
template void Write_Fixed_Matrix<char,double const,MATRIX<double,3,1>,3>(UNTYPED_OSTREAM<char>&,MATRIX<double,3,1> const&,double const (&) [3]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<double,9>&,double (&) [45]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<double,9>&,double (&) [45]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<double,9>&,double (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<double,9> const&,double const (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<double,9> const&,double const (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<double,9> const&,double const (&) [45]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<char>&,SYMMETRIC_MATRIX<float,9>&,float (&) [45]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<double>&,SYMMETRIC_MATRIX<float,9>&,float (&) [45]);
template void Read_Fixed_Matrix_Upper(UNTYPED_ISTREAM<float>&,SYMMETRIC_MATRIX<float,9>&,float (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<char>&,SYMMETRIC_MATRIX<float,9> const&,float const (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<double>&,SYMMETRIC_MATRIX<float,9> const&,float const (&) [45]);
template void Write_Fixed_Matrix(UNTYPED_OSTREAM<float>&,SYMMETRIC_MATRIX<float,9> const&,float const (&) [45]);
template void MATRIX_BASE<double,MATRIX<double,9,9> >::In_Place_PLU_Factorization<MATRIX<double,9,9> >(MATRIX_BASE<double,MATRIX<double,9,9> >&,VECTOR<int,9>&);
template void MATRIX_BASE<double,MATRIX<double,9,9> >::In_Place_PLU_Inverse<MATRIX<double,9,9> >(MATRIX_BASE<double,MATRIX<double,9,9> >&);
template std::enable_if<IS_MATRIX<MATRIX<double,9,9> >::value,void>::type Read_Fixed_Matrix<char,double,MATRIX<double,9,9>,81>(UNTYPED_ISTREAM<char>&,MATRIX<double,9,9>&,double (&) [81]);
template std::enable_if<IS_MATRIX<MATRIX<double,9,9> >::value,void>::type Write_Fixed_Matrix<char,double const,MATRIX<double,9,9>,81>(UNTYPED_OSTREAM<char>&,MATRIX<double,9,9> const&,double const (&) [81]);
template std::enable_if<IS_MATRIX<MATRIX<double,3,0> >::value,void>::type Write_Fixed_Matrix<char,double const,MATRIX<double,3,0>,1>(UNTYPED_OSTREAM<char>&,MATRIX<double,3,0> const&,double const (&) [1]);
template std::enable_if<IS_MATRIX<MATRIX_VIEW<double const> >::value,void>::type Write_Text_Matrix<MATRIX_VIEW<double const> >(UNTYPED_OSTREAM<char>&,MATRIX_VIEW<double const> const&);
template void MATRIX_BASE<float,MATRIX<float,4,4> >::In_Place_PLU_Inverse<MATRIX<float,4,4> >(MATRIX_BASE<float,MATRIX<float,4,4> >&);
}
