• Welcome to the new Internet Infidels Discussion Board, formerly Talk Freethought.

The Programming Thread

lpetrich, Some systems had full float arithmetics without integer multiplication-division.
Nowadays
SPARC initially no integer multiply or divide, later got those instructions. Floating point always
Yes, I had one - full float arithmetics without integer multiplication-division.
Of course, it was a separate giant FPU chip, cpu itself was pretty small.
 
An historical footnote in math computing.

They did it initially without large scale integrated circuits. In the 80s at a Lockheed division nobody had PCs, we had terminals connected to DEC VAX computers. When I ran code if I wmated to use the math compressor the group was charged more for the CPU time.



Floating Point Systems, Inc. (FPS), was a Beaverton, Oregon vendor of attached array processors and minisupercomputers. The company was founded in 1970 by former Tektronix engineer Norm Winningstad,[1] with partners Tom Prince, Frank Bouton and Robert Carter. Carter was a salesman for Data General Corp. who persuaded Bouton and Prince to leave Tektronix to start the new company. Winningstad was the fourth partner.[2]
History

The original goal of the company was to supply economical, but high-performance, floating point coprocessors for minicomputers. In 1976, the AP-120B array processor was produced. This was soon followed by a unit for larger systems and IBM mainframes, the FPS AP-190. In 1981, the follow-on FPS-164 was produced, followed by the FPS-264, which had the same architecture. This was five times faster, using ECL instead of TTL chips.

These processors were widely used as attached processors for scientific applications in reflection seismology, physical chemistry, NSA cryptology and other disciplines requiring large numbers of computations. Attached array processors were usually used in facilities where larger supercomputers were either not needed or not affordable. Hundreds if not thousands of FPS boxes were delivered and highly regarded. FPS's primary competition up to this time was IBM (3838 array processor) and CSP Inc.

Cornell University, led by physicist Kenneth G. Wilson, made a supercomputer proposal to NSF with IBM to produce a processor array of FPS boxes attached to an IBM mainframe with the name lCAP.
 
 Floating Point Systems - I remember its computers from long ago, hosted by an IBM mainframe. I'd compile code for them with a cross-compiler on the host system. FPS's computers were  Vector processor ones, with instructions that do the same thing on the contents of a sequence of memory locations. These were common in the 1970's to 1990's, but they went into decline as more conventional chips because cheap competition for them.

Vector processing is a SIMD sort of operation, and variable-length, while the most common form of SIMD in CPU chips is fixed-length, like MMX and SSE for x86.
 
In the late 70s I was a field engineer for Automatic Data Procession corp.

I maintained Microdata mini computers. The CPU was a made with discrete logic chips, bit slice. You could actually trouble shoot and repair the CPU.

 
Installed gnuplot. Easy install.

It is command line but callable from Python and C/C++ system functions.

Python has a module that interfaces.
 
Gnuplot is fussy about data file encoding.

When I used Python to create data sets to plot, gnuplot would not correctly read the file unless I explicitly defined utf-8 when opening the file.

wgnuplot.exe has a window with pull down menus.
 
Using Gnuplot from Python and C. Gnuplot has the C operators and can function as a calcultor.

Gnuplot script files are .plt and data files .dat.

Python

import os
os.chdir('c:\\python')
os.system('sig.plt')

C
system("sig.plt");

A project would be to create class objects to set the Gnuplot variables and create a .plt file.

sig.plt, copied it from a Gnuplot demo file.

reset
set term windows
set autoscale xfixmin # axis range automatically scaled to include the range
set autoscale xfixmax # of data to be plotted
set tics font ",18"
set xlabel "x" font ",18"
set ylabel "y" font ",18"
set lmargin at screen 0.1 # set size of left margin
set rmargin at screen 0.82 # set size of right margin
set bmargin at screen 0.12 # set size of bottom margin
set tmargin at screen 0.95 # set size of top margin
set grid
plot 'sig.dat'
 
A function that takes an arbitrary number of int and double arrays and prints on the console.

The format string rakes ints, doubles, and the the %e display specifier.

Code:
#include<stdarg.h>
#include <strings.h>

void print_arrays(int nrow,char *prspec, ...){
    //print arrays of same length to the console
    // prpec forma stringas as in printf()
    // narg numer of arrays passed to function,
    //picnt pdcnt counters for number of int and double array pointers
    // pi pd arrays of pointers to arrays
    cout<<"print arrays "<<endl;
    int i,j,narg = 0,picnt = 0,pdcnt = 0;
    int * pi[20];
    double *pd[20];
    //--------------------------------------
    //split format string into substrigs for printf()
    char fdel[2] = " ";  //split delimiter
    char pfmt[10][10];
    char * token = strtok(prspec,fdel);
    while( token != NULL ) {
        strcpy(pfmt[narg++],token);
        //printf( " %s\n", token ); //printing each token
        token = strtok(NULL, fdel);
    }
   //-------------------------------------
   // make var_args format string
   int nfmt = 100;
   char *fmt = new char[nfmt];
   for(i=0;i<nfmt;i++)fmt[i] = '\0'; //null the array so strcat() starts at fmt[0]
   for(i=0;i<narg;i++){
        if(strchr(pfmt[i],'d') != NULL)strcat(fmt," d");
        if(strchr(pfmt[i],'f') != NULL)strcat(fmt," f");
        if(strchr(pfmt[i],'e') != NULL)strcat(fmt," f");
   }
   //cout<<"fmt   "<<fmt<<endl;
    //--------------------------------------
    //get pointers to arrays
    va_list args;
    va_start(args, fmt);
    while (*fmt != '\0') {
        if(*fmt == 'd')pi[picnt++] = va_arg(args, int*);
        if(*fmt == 'f')pd[pdcnt++] = va_arg(args, double*);
        if(*fmt == 'e')pd[pdcnt++] = va_arg(args, double*);
        //cout<<*fmt;
       ++fmt;
        }//while
      //cout<<endl;
    va_end(args);
    //printf("counts  %d  %d\n",picnt,pdcnt);
    //--------------------------------------------
    //print arrays
    for(i = 0;i<nrow;i++){
        picnt = 0;
        pdcnt = 0;
        for(j=0;j<narg;j++){
            if(strchr(pfmt[j],'d') != NULL)printf(pfmt[j],*(pi[picnt++]+i));
            if(strchr(pfmt[j],'f') != NULL)printf(pfmt[j],*(pd[pdcnt++]+i));
            if(strchr(pfmt[j],'e') != NULL)printf(pfmt[j],*(pd[pdcnt++]+i));
            if(j<narg-1)printf("\t"); //no tab after last column
            }//for j
        printf("\n");
        }//for i
}//print_arrays()

int main(){
    int n = 4;
    int xi2[n] = {10,20,30,40},xi1[n] = {1,2,3,4};
    double xd1[n] = {1.1,2.2,3.3,4.1};
    double xd2[n] = {10.1,20.2,30.3,40.4};
    char fmt[] = "%10d %5.3f %5d %1.2e";
    print_arrays(n,fmt,xi1,xd1,xi2,xd2);


    return 0;
}
 
Back
Top Bottom