/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: i_scpy.c,v 1.2 1997/09/25 17:31:01 ae59 Exp $ */
/*
$Log: i_scpy.c,v $
 * Revision 1.2  1997/09/25  17:31:01  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:23:04  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : i_scpy.c                              */
/*                                                              */
/*      Entries         : a_intv i_scpy(r,s,rnd)                */
/*                        y_desc *r;                            */
/*                        y_desc *s;                            */
/*                        a_intg rnd;                           */
/*                                                              */
/*      Arguments       : r   = dynamic interval vector         */
/*                        s   = dynamic interval vector         */
/*                        rnd = mode                            */
/*                              0  clears accus first           */
/*                              4  does not clear accus first   */
/*                                                              */
/*      Function value  : Real interval dotproduct              */
/*                                                              */
/*      Description     : Dotproduct for dynamic real interval  */
/*                        arrays.                               */
/*                                                              */
/*      Date            : 1991-04-22                            */
/*      1991-04-22 : real assignment replaced by R_ASSIGN()     */
/*      1991-01-22 : VAX_VMS_C considered                       */
/*      1990-12-11 : initialization of result                   */
/*      1990-11-12 : E_TPUSH+E_TPOPP                            */
/*      1990-10-31 : force linkage of global variables          */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
extern dotprecision b_acrl;
extern dotprecision b_acru;
extern a_real *r_zero;
#endif

#ifdef LINT_ARGS
local a_intv i_scpy(y_desc *r,y_desc *s,a_intg rnd)
#else
local a_intv i_scpy(r,s,rnd)

y_desc *r;
y_desc *s;
a_intg rnd;
#endif
        {
        a_intg i,k;
        a_intv res;

        E_TPUSH("i_scpy")

        /* force linkage of module containing global variables only */
#if VAX_VMS_C
        b_accu();
#endif

        R_ASSIGN(res.INF,*r_zero);
        R_ASSIGN(res.SUP,*r_zero);

        if (r->numdim!=1 || s->numdim!=1)
           {
           i = r->numdim;
           k = s->numdim;
           e_trap(INV_ARG,6,E_TMSG,26,E_TINT+E_TEXT(11),&i,
                                      E_TINT+E_TEXT(11),&k);
           }
        else if (r->elnum!=s->elnum)
           {
           i = r->elnum;
           k = s->elnum;
           e_trap(INV_ARG,6,E_TMSG,27,E_TINT+E_TEXT(12),&i,
                                      E_TINT+E_TEXT(12),&k);
           }
        else
           {
           if (rnd<3)
              {
              d_clr(&b_acrl);
              d_clr(&b_acru);
              }

           for (i=0;i<r->elnum;i++)
              /* possible pointer allignment problems              */
              i_padd(&b_acrl,&b_acru,
                  *(a_intv *)y_inxn(r,(r->fd[0]).lbound+i),
                  *(a_intv *)y_inxn(s,(s->fd[0]).lbound+i));

           res = i_ista(b_acrl,b_acru);
           }

        E_TPOPP("i_scpy")
        return(res);
        }

