File: intdlassq.c

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (49 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "stack-c.h"
/*      SUBROUTINE DLASSQ( N, X, INCX, SCALE, SUMSQ )     */
/*      [scale,sumsq]=dlassq(x,[ scale, [sumsq]])     */
int intdlassq(fname)
     char* fname;
{ 
  int ierr=0,un=1,deux=2,trois=3;
  int mX,nX,lX,N;
  int mSCALE,nSCALE,lSCALE,mSUMSQ,nSUMSQ,lSUMSQ;
  double SUMSQ, SCALE;
  int NRHS;

  static int minlhs=1, minrhs=1, maxlhs=2, maxrhs=3;
  CheckRhs(minrhs,maxrhs) ;  CheckLhs(minlhs,maxlhs) ;
  
  GetRhsVar(1,MATRIX_OF_DOUBLE_DATATYPE, &mX, &nX, &lX);   /* X */
  N=mX*nX;
  NRHS=Rhs;
  switch ( NRHS ) {
  case 3:
    /*    dlassq(x, scale, sumsq)   */
    GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE, &mSCALE, &nSCALE, &lSCALE);   /* SCALE */
    GetRhsVar(3,MATRIX_OF_DOUBLE_DATATYPE, &mSUMSQ, &nSUMSQ, &lSUMSQ);   /* SUMSQ */
    break;
  case 2:
    /*    dlassq(x, scale)   */
    SUMSQ=0;
    GetRhsVar(2,MATRIX_OF_DOUBLE_DATATYPE, &mSCALE, &nSCALE, &lSCALE);   /* SCALE */
    CreateVar(3,MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &lSUMSQ);
    *stk(lSUMSQ)=SUMSQ;   /*  default  */
    break;
  case 1:
    /*    dlassq(x)   */
    SUMSQ=0;SCALE=0;
    CreateVar(2,MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &lSCALE);
    CreateVar(3,MATRIX_OF_DOUBLE_DATATYPE, &un, &un, &lSUMSQ);
    *stk(lSUMSQ)=SUMSQ; *stk(lSCALE)=SCALE;  /*  default  */
    break;
  default:
    sciprint("%s: bad call to dassq",fname);
    Error(9999); return 0;
  }
  C2F(dlassq)(&N , stk(lX), &un, stk(lSCALE), stk(lSUMSQ));
  LhsVar(1) = 2;  LhsVar(2) = 3; /*  Return var #2 (SCALE) and #3 (SUMSQ) */
  return(0);
}