next up previous contents
Next: Final Thoughts Up: Slate++ Version 1.2 TUTORIAL Previous: Interfacing Slate with External   Contents

Subsections

Multiple Slate Matrices

Arrays of Slate Matrices


#include <slate.h>

int main() {

  //
  // Make an array of slate Matrices.  Each Matrix is uninitialized.
  //
  Matrix<double> a[10];

  //
  // Initialize each Matrix.
  //
  for (int i=0; i<10; i++) {
    a[i].set_size(1,4,1,4);
    a[i] = (double)i;
  }

  cout << a[0] << endl;
  cout << a[5] << endl;
  cout << a[9] << endl;

  //
  // Make an array of array of slate Matrices.
  //
  Matrix<int> b[4][5];

  //
  // Initialize each Matrix.
  //
  for (int i=0; i<4; i++) 
    for (int j=0; j<5; j++) {
      b[i][j].set_size(i,2*i+1,j,2*j+1);
      b[i][j] = i+j;
    }

  cout << b[0][0] << endl;
  cout << b[2][3] << endl;
  cout << b[3][4] << endl;
}

Pointers to Slate Matrices


#include <slate.h>

int main() {

  //
  // Make a pointer to slate Matrices.  Each Matrix is uninitialized.
  //
  Matrix<double> *a;
  a = new Matrix<double>[6];

  //
  // Initialize each Matrix.
  //
  for (int i=0; i<6; i++) {
    a[i].set_size(1,4,1,4);
    a[i] = (double)i;
  }

  cout << a[0] << endl;
  cout << a[2] << endl;
  cout << a[5] << endl;
}



Brian Thorndyke 2003-11-15