Changeset 1099 in Sophya for trunk/SophyaLib/TArray/tmatrix.cc


Ignore:
Timestamp:
Jul 26, 2000, 6:29:46 PM (25 years ago)
Author:
ansari
Message:

Protection integrite TMatrix,TVector - operateur = (BaseArray & pour TVector et operations entre matrices avec <> MemMapping (Pas termine) Reza 27/6/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/tmatrix.cc

    r1081 r1099  
    1 // $Id: tmatrix.cc,v 1.13 2000-07-24 12:51:27 ansari Exp $
     1// $Id: tmatrix.cc,v 1.14 2000-07-26 16:29:45 ansari Exp $
    22//                         C.Magneville          04/99
    33#include "machdefs.h"
     
    2222  : TArray<T>()
    2323{
    24   ck_memo_vt_ = true;
     24  arrtype_ = 1;   // Type = Matrix
    2525}
    2626
     
    3939  if ( (r == 0) || (c == 0) )
    4040    throw ParmError("TMatrix<T>::TMatrix(uint_4 r,uint_4 c) NRows or NCols = 0");
     41  arrtype_ = 1;   // Type = Matrix
    4142  ReSize(r, c, mm);
    4243}
     
    5253  : TArray<T>(a)
    5354{
     55  arrtype_ = 1;   // Type = Matrix
    5456}
    5557
     
    6365: TArray<T>(a, share)
    6466{
     67  arrtype_ = 1;   // Type = Matrix
    6568}
    6669
     
    7780    ndim_ = 2;
    7881  }
     82  arrtype_ = 1;   // Type = Matrix
    7983  UpdateMemoryMapping(a, SameMemoryMapping);
    8084}
     
    97101    ndim_ = 2;
    98102  }
     103  arrtype_ = 1;   // Type = Matrix
    99104  UpdateMemoryMapping(a, mm);
    100105}
    101106
     107//! Constructor of a matrix from a TArray \b a , with a different data type
    102108template <class T>
    103109TMatrix<T>::TMatrix(const BaseArray& a)
    104110: TArray<T>()
    105111{
     112  arrtype_ = 1;   // Type = Matrix
    106113  SetBA(a);
    107114}
     
    125132  if (a.NbDimensions() > 2)
    126133    throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) a.NbDimensions() > 2");
     134  if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) )
     135    throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector");
    127136  TArray<T>::Set(a);
    128137  if (NbDimensions() == 1) {
     
    140149  if (a.NbDimensions() > 2)
    141150    throw SzMismatchError("TMatrix<T>::SetBA(const BaseArray& a) a.NbDimensions() > 2");
     151  if ((arrtype_ == 2) && (a.NbDimensions() > 1) && (a.Size(0) > 1) && (a.Size(1) > 1) )
     152    throw SzMismatchError("TMatrix<T>::Set(const TArray<T>& a) Size(0,1)>1 for Vector");
    142153  TArray<T>::SetBA(a);
    143154  if (NbDimensions() == 1) {
     
    165176  if(r==0||c==0)
    166177    throw(SzMismatchError("TMatrix::ReSize r or c==0 "));
     178  if ((arrtype_ == 2) && (r > 1) && (c > 1))
     179    throw(SzMismatchError("TMatrix::ReSize r>1&&c>1 for Vector "));
    167180  uint_4 size[BASEARRAY_MAXNDIMS];
    168181  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
     
    194207  if(r==0||c==0)
    195208    throw(SzMismatchError("TMatrix::Realloc r or c==0 "));
     209  if ((arrtype_ == 2) && (r > 1) && (c > 1))
     210    throw(SzMismatchError("TMatrix::Realloc r>1&&c>1 for Vector "));
    196211  uint_4 size[BASEARRAY_MAXNDIMS];
    197212  for(int kk=0; kk<BASEARRAY_MAXNDIMS; kk++)  size[kk] = 0;
Note: See TracChangeset for help on using the changeset viewer.