/* JRG, the Resource Geology Seismic Processing System for Java, and Viewmat for Java are Copyright 1998, 1999 by John N. Louie The software and methods here are the subject of academic research, not commercial products. I would like to know what use you make of my methods, and have your feedback on their success or failure. Also, by letting me know who you are, I can inform you if bugs or errors are discovered. Please send me an email message with: your name and email address; whether you are a student or faculty member, consultant or employee; the name of your university or company, and department; and a sentence or two describing what use you intend to make of these methods. Send your message to louie@seismo.unr.edu */ /* Include the usual classes */ import java.util.*; import java.io.*; import java.lang.Math; class testcomplexvec { public static void main(String args[]) { int i; System.out.println("Starting construction and reading."); FltVec fltvec = new FltVec(210*1000); /* read test */ fltvec.readBinaryFile("test.flt", 0); ComplexVec cvec = new ComplexVec(fltvec, fltvec); cvec.realtoFltVec(fltvec); System.out.println("Real max=" + fltvec.max() + " rms=" + fltvec.rms() + " dot=" + fltvec.dot(fltvec)); cvec.imtoFltVec(fltvec); System.out.println("Imaginary max=" + fltvec.max() + " rms=" + fltvec.rms() + " dot=" + fltvec.dot(fltvec)); cvec.amptoFltVec(fltvec); System.out.println("Amp max=" + fltvec.max() + " rms=" + fltvec.rms() + " dot=" + fltvec.dot(fltvec)); cvec.phasedegtoFltVec(fltvec); System.out.println("Phase max=" + fltvec.max() + " rms=" + fltvec.rms() + " dot=" + fltvec.dot(fltvec)); } } public class ComplexVec implements RGData, RGNotice { public int NDims; public String AmpUnits; public float Amp0; public float AmpFac; public String ElemUnits; public float Elem0; public float DElem; public boolean noticeon; public Complex vec[]; public static void filt(ComplexVec cdata, int ld, int lu, int hu, int hd, int spec) { int i; /*fft(cdata, -1F, (float)(Math.sqrt(1.0/(double)(cdata.vec.length))));*/ fft(cdata, -1F, cdata.getDUnitofDim(0)); if (spec == 1 || spec == 2) return; for(i=0; i m-1) { j = j - m; m = m/2; if (m < 1) break; } j = j + m; } do { istep = 2*k; for (m=0; m= NDims) return 1; else return 0; } public String getAmpUnits() { return AmpUnits; } public void setAmpUnits(String Ampunits) { AmpUnits = new String(Ampunits); } public float getAmp0() { return Amp0; } public void setAmp0(float Amp0) { this.Amp0 = Amp0; } public float getAmpFac() { return AmpFac; } public void setAmpFac(float Ampfac) { this.AmpFac = Ampfac; } public String getUnitsofDim(int Dim) { if (Dim == 0) return ElemUnits; return ""; } public void setUnitsofDim(int Dim, String Dimunits) { if (Dim == 0) ElemUnits = new String(Dimunits); } public float getUnit0ofDim(int Dim) { if (Dim == 0) return Elem0; return 0F; } public void setUnit0ofDim(int Dim, float Unit0) { if (Dim == 0) Elem0 = Unit0; } public float getDUnitofDim(int Dim) { if (Dim == 0) return DElem; return 1F; } public void setDUnitofDim(int Dim, float DUnit) { if (Dim == 0) DElem = DUnit; } public void Errout(String Error) { System.out.println(Error); System.out.flush(); } public void Noticeln(String Note) { if (noticeon) { System.out.println(Note); System.out.flush(); } } public void Notice(String Note) { if (noticeon) { System.out.print(Note); System.out.flush(); } } public void setNoticeOn(boolean on) { this.noticeon = on; } }