The R Project SVN R

Rev

Rev 48062 | Rev 48574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 48062 Rev 48092
Line 150... Line 150...
150
	default:
150
	default:
151
	    /* don't fill with anything */
151
	    /* don't fill with anything */
152
	    ;
152
	    ;
153
	}
153
	}
154
    }
154
    }
155
    if(!isNull(dimnames)&& length(dimnames) > 0) 
155
    if(!isNull(dimnames)&& length(dimnames) > 0)
156
	ans = dimnamesgets(ans, dimnames);
156
	ans = dimnamesgets(ans, dimnames);
157
    UNPROTECT(1);
157
    UNPROTECT(1);
158
    return ans;
158
    return ans;
159
}
159
}
160
 
160
 
Line 600... Line 600...
600
    }
600
    }
601
 
601
 
602
    sym = isNull(y);
602
    sym = isNull(y);
603
    if (sym && (PRIMVAL(op) > 0)) y = x;
603
    if (sym && (PRIMVAL(op) > 0)) y = x;
604
    if ( !(isNumeric(x) || isComplex(x)) || !(isNumeric(y) || isComplex(y)) )
604
    if ( !(isNumeric(x) || isComplex(x)) || !(isNumeric(y) || isComplex(y)) )
605
	errorcall(call, _("requires numeric matrix/vector arguments"));
605
	errorcall(call, _("requires numeric/complex matrix/vector arguments"));
606
 
606
 
607
    xdims = getAttrib(x, R_DimSymbol);
607
    xdims = getAttrib(x, R_DimSymbol);
608
    ydims = getAttrib(y, R_DimSymbol);
608
    ydims = getAttrib(y, R_DimSymbol);
609
    ldx = length(xdims);
609
    ldx = length(xdims);
610
    ldy = length(ydims);
610
    ldy = length(ydims);
Line 627... Line 627...
627
	nrx = 0;
627
	nrx = 0;
628
	ncx = 0;
628
	ncx = 0;
629
	if (PRIMVAL(op) == 0) {
629
	if (PRIMVAL(op) == 0) {
630
	    if (LENGTH(x) == nry) {	/* x as row vector */
630
	    if (LENGTH(x) == nry) {	/* x as row vector */
631
		nrx = 1;
631
		nrx = 1;
632
		ncx = LENGTH(x);
632
		ncx = nry; /* == LENGTH(x) */
633
	    }
633
	    }
634
	    else if (nry == 1) {	/* x as col vector */
634
	    else if (nry == 1) {	/* x as col vector */
635
		nrx = LENGTH(x);
635
		nrx = LENGTH(x);
636
		ncx = 1;
636
		ncx = 1;
637
	    }
637
	    }
638
	}
638
	}
639
	else { /* crossprod */
639
	else { /* crossprod */
640
	    if (LENGTH(x) == nry) {	/* x is a col vector */
640
	    if (LENGTH(x) == nry) {	/* x is a col vector */
641
		nrx = LENGTH(x);
641
		nrx = nry; /* == LENGTH(x) */
642
		ncx = 1;
642
		ncx = 1;
643
	    }
643
	    }
644
	}
644
	}
645
    }
645
    }
646
    else if (ldy != 2) {		/* y not a matrix */
646
    else if (ldy != 2) {		/* y not a matrix */
Line 648... Line 648...
648
	ncx = INTEGER(xdims)[1];
648
	ncx = INTEGER(xdims)[1];
649
	nry = 0;
649
	nry = 0;
650
	ncy = 0;
650
	ncy = 0;
651
	if (PRIMVAL(op) == 0) {
651
	if (PRIMVAL(op) == 0) {
652
	    if (LENGTH(y) == ncx) {	/* y as col vector */
652
	    if (LENGTH(y) == ncx) {	/* y as col vector */
653
		nry = LENGTH(y);
653
		nry = ncx; /* == LENGTH(y) */
654
		ncy = 1;
654
		ncy = 1;
655
	    }
655
	    }
656
	    else if (ncx == 1) {	/* y as row vector */
656
	    else if (ncx == 1) {	/* y as row vector */
657
		nry = 1;
657
		nry = 1;
658
		ncy = LENGTH(y);
658
		ncy = LENGTH(y);
659
	    }
659
	    }
660
	}
660
	}
661
	else {
661
	else {
662
	    if (LENGTH(y) == nrx) {	/* y is a col vector */
662
	    if (LENGTH(y) == nrx) {	/* y is a col vector */
663
		nry = LENGTH(y);
663
		nry = nrx; /* == LENGTH(y) */
664
		ncy = 1;
664
		ncy = 1;
665
	    }
665
	    }
666
	}
666
	}
667
    }
667
    }
668
    else {				/* x and y matrices */
668
    else {				/* x and y matrices */