*** empty log message ***
This commit is contained in:
parent
d09b80178a
commit
3056732b52
14
mat.cc
14
mat.cc
@ -45,7 +45,7 @@ return r;
|
|||||||
//direct product
|
//direct product
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const NRMat<T> NRMat<T>::otimes(const NRMat<T> &rhs) const
|
const NRMat<T> NRMat<T>::otimes(const NRMat<T> &rhs, bool reversecolumns) const
|
||||||
{
|
{
|
||||||
if(nn==0 && mm == 0) return *this;
|
if(nn==0 && mm == 0) return *this;
|
||||||
if(rhs.nn==0 && rhs.mm== 0) return rhs;
|
if(rhs.nn==0 && rhs.mm== 0) return rhs;
|
||||||
@ -54,12 +54,24 @@ NRMat<T> r((T)0,nn*rhs.nn,mm*rhs.mm);
|
|||||||
|
|
||||||
int i,j,k,l;
|
int i,j,k,l;
|
||||||
|
|
||||||
|
if(reversecolumns)
|
||||||
|
{
|
||||||
|
for(i=0;i<nn;i++) for(j=0;j<mm;j++)
|
||||||
|
{
|
||||||
|
T c=(*this)(i,j);
|
||||||
|
for(k=0;k<rhs.mm;k++) for(l=0;l<rhs.mm;l++)
|
||||||
|
r( i*rhs.nn+k , l*nn+j ) = c *rhs(k,l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for(i=0;i<nn;i++) for(j=0;j<mm;j++)
|
for(i=0;i<nn;i++) for(j=0;j<mm;j++)
|
||||||
{
|
{
|
||||||
T c=(*this)(i,j);
|
T c=(*this)(i,j);
|
||||||
for(k=0;k<rhs.mm;k++) for(l=0;l<rhs.mm;l++)
|
for(k=0;k<rhs.mm;k++) for(l=0;l<rhs.mm;l++)
|
||||||
r( i*rhs.nn+k , j*rhs.nn+l ) = c *rhs(k,l);
|
r( i*rhs.nn+k , j*rhs.nn+l ) = c *rhs(k,l);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
2
mat.h
2
mat.h
@ -59,7 +59,7 @@ public:
|
|||||||
const T dot(const NRMat &rhs) const; // scalar product of Mat.Mat//@@@for complex do conjugate
|
const T dot(const NRMat &rhs) const; // scalar product of Mat.Mat//@@@for complex do conjugate
|
||||||
const NRMat operator*(const NRMat &rhs) const; // Mat * Mat
|
const NRMat operator*(const NRMat &rhs) const; // Mat * Mat
|
||||||
const NRMat oplus(const NRMat &rhs) const; //direct sum
|
const NRMat oplus(const NRMat &rhs) const; //direct sum
|
||||||
const NRMat otimes(const NRMat &rhs) const; //direct product
|
const NRMat otimes(const NRMat &rhs, bool reversecolumns=false) const; //direct product
|
||||||
void diagmultl(const NRVec<T> &rhs); //multiply by a diagonal matrix from L
|
void diagmultl(const NRVec<T> &rhs); //multiply by a diagonal matrix from L
|
||||||
void diagmultr(const NRVec<T> &rhs); //multiply by a diagonal matrix from R
|
void diagmultr(const NRVec<T> &rhs); //multiply by a diagonal matrix from R
|
||||||
const NRSMat<T> transposedtimes() const; //A^T . A
|
const NRSMat<T> transposedtimes() const; //A^T . A
|
||||||
|
Loading…
Reference in New Issue
Block a user