Пример #1
0
	Vector Matrix::subdiagonalVector ( const size_t offset ) {
		// To circumvent GSL limitation to allow 0-dimensional vectors
		// This use of static data relies on the immutability of 0-dim Vectors.
		static Vector nullDimVector( 0, NULL, 0 );
		if ( 0 == countColumns() ) return nullDimVector;
		return Vector( gsl_matrix_subdiagonal( &matrix, offset ) );
	}
Пример #2
0
/*forms asymmetric matrix with the same lower triangular part*/
inline void asym(double* a,int n){
	int i;
	gsl_matrix_view av=gsl_matrix_view_array(a,n,n);
	for (i=1;i<n;i++){
		gsl_vector_view vsup=gsl_matrix_superdiagonal(&av.matrix,i);
		gsl_vector_view vsub=gsl_matrix_subdiagonal(&av.matrix,i);
		gsl_vector_memcpy(&vsup.vector,&vsub.vector);
		gsl_vector_scale(&vsup.vector,-1);
	}
	gsl_vector_view vsup=gsl_matrix_superdiagonal(&av.matrix,0);
	gsl_vector_set_zero(&vsup.vector);
}
Пример #3
0
void HLayeredBlWStructure::computeVkParams() {
  size_t k, l, i, imax, sum_nl, rep;
  gsl_matrix *zk;
  gsl_matrix_view wi, zkl;

  myA = (gsl_matrix**) malloc(getMaxLag() * sizeof(gsl_matrix *));
  
  /* construct w */
  for (k = 0; k < getMaxLag(); k++) { 
    zk   = gsl_matrix_alloc(getM(), getM());
    gsl_matrix_set_zero(zk);

    for (sum_nl = 0, l = 0; l < getQ(); sum_nl += getLayerLag(l), ++l) { 
      zkl = gsl_matrix_submatrix(zk, sum_nl, sum_nl, getLayerLag(l), 
                getLayerLag(l)); 
      if (k < getLayerLag(l)) {
        gsl_vector_view diag = gsl_matrix_subdiagonal(&zkl.matrix, k);
        gsl_vector_set_all(&diag.vector, getLayerInvWeight(l)); 
      }
    }
    myA[k] = zk;
  }
}