All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.expression.fn.algebra.Vector Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.expression.fn.algebra;

import com.scudata.dm.Sequence;

public class Vector {

	private double[] vector;
	
	/**
	 * ??ʼ??????
	 * @param value	?????ʾ??????ֵ
	 */
	public Vector(double[] value) {
		this.vector = value;
	}
	
	/**
	 * ??ʼ??????
	 * @param value	??ά?????ʾ?ľ???ֵ
	 */
	public Vector(Sequence seq) {
		if (seq.length() > 0){
			this.vector = Matrix.getRow(seq, 0);
		}
	}
	
	/**
	 * ????????
	 * @return
	 */
	public int len() {
		if (this.vector == null) return 0;
		return this.vector.length;
	}
	
	/**
	 * ָ????ţ???ȡ??????Աֵ????ֵ????0
	 * @param i	??ţ???0??ʼ
	 * @return
	 */
	public double get(int i) {
		if (this.len() > i) {
			return this.vector[i];
		}
		return 0;
	}
	
	/**
	 * ??ȡ????
	 * @return
	 */
	public double[] getValue() {
		return this.vector;
	}
    
    /**
     * ???????з???
     * @return
     */
    public Sequence toSequence() {
    	int rows = this.vector.length;
    	Sequence seq = new Sequence(rows);;
        for(int i=0, iSize = this.vector.length; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy