interp.c

来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 49 行

C
49
字号
/**********Copyright 1990 Regents of the University of California.  All rights reserved.Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group **********//* * Polynomial interpolation code. */#include "ngspice.h"#include "cpdefs.h"#include "ftedefs.h"#include "dvec.h"#include "interp.h"voidlincopy(struct dvec *ov, double *newscale, int newlen, struct dvec *oldscale){    struct dvec *v;    double *nd;    if (!isreal(ov)) {        fprintf(cp_err, "Warning: %s is not real\n", ov->v_name);        return;    }    if (ov->v_length < oldscale->v_length) {        fprintf(cp_err, "Warning: %s is too short\n", ov->v_name);        return;    }    v = alloc(struct dvec);    v->v_name = copy(ov->v_name);    v->v_type = ov->v_type;    v->v_flags = ov->v_flags;    v->v_flags |= VF_PERMANENT;    v->v_length = newlen;    nd = (double *) tmalloc(newlen * sizeof (double));    if (!ft_interpolate(ov->v_realdata, nd, oldscale->v_realdata,            oldscale->v_length, newscale, newlen, 1)) {        fprintf(cp_err, "Error: can't interpolate %s\n", ov->v_name);        return;    }    v->v_realdata = nd;    vec_new(v);    return;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?