Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

matvec::Dblock Class Reference

#include <dblock.h>

List of all members.


Detailed Description

This is a array of Matrix.

See also:
Array Matrix

Definition at line 37 of file dblock.h.

Public Methods

 Dblock (void)
 Dblock (int nd, int nr, int nc)
void resize (int nd, int nr, int nc)
void resize (int nd, int nr, int nc, double init)
doubleMatrixoperator[] (int i)
double & operator() (int i, int j, int k)
int get_ndim (void)
int get_nrow (void)
int get_ncol (void)
void init (double val)

Public Attributes

int iw

Protected Attributes

int ndim
int nrow
int ncol
Vector< doubleMatrixblock

Friends

std::ostream & operator<< (std::ostream &stream, Dblock &D)


Constructor & Destructor Documentation

matvec::Dblock::Dblock void    [inline]
 

Definition at line 45 of file dblock.h.

References ncol, ndim, and nrow.

00045 {ndim=0,nrow=0,ncol=0;}          //Constructor 1

matvec::Dblock::Dblock int    nd,
int    nr,
int    nc
 

Definition at line 26 of file dblock.cpp.

References block, ncol, ndim, nrow, and matvec::Vector< doubleMatrix >::resize().

00026                                      { 
00027   if (nd<=0) {
00028     std::cerr <<"Depth of block is not positive \n" << std::flush;
00029   }
00030   else if (nr<=0) {
00031     std::cerr <<"Number of rows Block is not positive \n" << std::flush;
00032   }
00033   else if (nc<=0) {
00034     std::cerr <<"Number of columns Block is not positive \n" << std::flush;
00035   }
00036   else {
00037     ndim=nd;
00038     nrow=nr; 
00039     ncol=nc;
00040     block.resize(nd);
00041     for (int i=1;i<=nd;i++){
00042       block(i).resize(nr,nc);
00043     }
00044   }
00045 }


Member Function Documentation

int matvec::Dblock::get_ncol void    [inline]
 

Definition at line 54 of file dblock.h.

References ncol.

00054 {return ncol;}

int matvec::Dblock::get_ndim void    [inline]
 

Definition at line 52 of file dblock.h.

References ndim.

Referenced by matvec::Individual::cal_gprobs(), matvec::Individual::collapse_antpost(), and matvec::Individual::get_m_posterior().

00052 {return ndim;}

int matvec::Dblock::get_nrow void    [inline]
 

Definition at line 53 of file dblock.h.

References nrow.

Referenced by matvec::Individual::initial_multi_anterior().

00053 {return nrow;}

void matvec::Dblock::init double    val
 

Definition at line 89 of file dblock.cpp.

References block, ncol, ndim, and nrow.

Referenced by matvec::NuFamily::multi_fullsibs_prob(), matvec::Population::multi_geno_dist_peeling(), matvec::NuFamily::multi_llh(), and resize().

00089                            {
00090   int i,j,k;
00091   for (i=0;i<ndim;i++){
00092        for (j=0;j<nrow;j++){
00093          for (k=0;k<ncol;k++){
00094              block[i][j][k]=val;
00095          }
00096        }
00097   }
00098 }

double& matvec::Dblock::operator() int    i,
int    j,
int    k
[inline]
 

Definition at line 51 of file dblock.h.

References block.

00051 {return block(i)(j,k);};

doubleMatrix& matvec::Dblock::operator[] int    i [inline]
 

Definition at line 50 of file dblock.h.

00050 {return block[i];};

void matvec::Dblock::resize int    nd,
int    nr,
int    nc,
double    init
 

Definition at line 68 of file dblock.cpp.

References block, init(), ncol, ndim, nrow, and matvec::Vector< doubleMatrix >::resize().

00068                                                        {
00069   if (nd<=0) {
00070     std::cerr <<"Depth of block is not positive \n" << std::flush;
00071   }
00072   else if (nr<=0) {
00073     std::cerr <<"Number of rows Block is not positive \n" << std::flush;
00074   }
00075   else if (nc<=0) {
00076     std::cerr <<"Number of columns Block is not positive \n" << std::flush;
00077   }
00078   else {
00079     ndim=nd;
00080     nrow=nr; 
00081     ncol=nc;
00082     block.resize(nd);
00083     for (int i=1;i<=nd;i++){
00084       block(i).resize(nr,nc,init);
00085     }
00086   }
00087 }

void matvec::Dblock::resize int    nd,
int    nr,
int    nc
 

Definition at line 47 of file dblock.cpp.

References block, ncol, ndim, nrow, and matvec::Vector< doubleMatrix >::resize().

Referenced by matvec::Individual::initial_multi_anterior(), matvec::Population::multipoint_likelihood(), and matvec::Fpmm::setup_trm().

00047                                           {
00048   if (nd<=0) {
00049     std::cerr <<"Depth of block is not positive \n" << std::flush;
00050   }
00051   else if (nr<=0) {
00052     std::cerr <<"Number of rows Block is not positive \n" << std::flush;
00053   }
00054   else if (nc<=0) {
00055     std::cerr <<"Number of columns Block is not positive \n" << std::flush;
00056   }
00057   else {
00058     ndim=nd;
00059     nrow=nr; 
00060     ncol=nc;
00061     block.resize(nd);
00062     for (int i=1;i<=nd;i++){
00063       block(i).resize(nr,nc);
00064     }
00065   }
00066 }


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &    stream,
Dblock &    D
[friend]
 

Definition at line 100 of file dblock.cpp.

00101 {
00102    stream << "\n";
00103    int k,i,j,jstart,jend,ncols_remaining;
00104 
00105    for (k=1;k<=D.ndim; k++){
00106     ncols_remaining = D.ncol;
00107     jend = 0;
00108     while (ncols_remaining > 0) {
00109       jstart = jend + 1;
00110       jend = jstart + ncols_remaining - 1;
00111       ncols_remaining -= 10;
00112       if (ncols_remaining < 0) {
00113         ncols_remaining = 0;
00114       }
00115       else {
00116         jend = jstart + 9;
00117       } 
00118       stream << "\n Block " << k <<"\n" << "          ";
00119       stream.width(2);
00120       for (j=jstart;j<=jend;j++){
00121         stream << " column " << j;
00122       }
00123       stream << "\n";
00124       for (i=1;i<=D.nrow; i++) {
00125         stream << "\n" << "Row ";
00126         stream.width(4);
00127         stream << i << "  ";
00128         for (j=jstart;j<=jend;j++){
00129           stream.width(9);
00130           stream << D(k,i,j);
00131         } 
00132       }
00133     }
00134    stream << "\n" ;     
00135    }
00136    stream << "\n" << "\n" ;     
00137    return stream;
00138 }


Member Data Documentation

Vector< doubleMatrix > matvec::Dblock::block [protected]
 

Definition at line 41 of file dblock.h.

Referenced by Dblock(), init(), operator()(), and resize().

int matvec::Dblock::iw
 

Definition at line 44 of file dblock.h.

int matvec::Dblock::ncol [protected]
 

Definition at line 40 of file dblock.h.

Referenced by Dblock(), get_ncol(), init(), matvec::operator<<(), and resize().

int matvec::Dblock::ndim [protected]
 

Definition at line 40 of file dblock.h.

Referenced by Dblock(), get_ndim(), init(), matvec::operator<<(), and resize().

int matvec::Dblock::nrow [protected]
 

Definition at line 40 of file dblock.h.

Referenced by Dblock(), get_nrow(), init(), matvec::operator<<(), and resize().


The documentation for this class was generated from the following files:
Generated on Thu Jun 16 17:14:19 2005 for Matvec by doxygen1.2.16