/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.quantlib;

public class TridiagonalOperator {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected TridiagonalOperator(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(TridiagonalOperator obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        QuantLibJNI.delete_TridiagonalOperator(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public TridiagonalOperator(Array low, Array mid, Array high) {
    this(QuantLibJNI.new_TridiagonalOperator(Array.getCPtr(low), low, Array.getCPtr(mid), mid, Array.getCPtr(high), high), true);
  }

  public Array solveFor(Array rhs) {
    return new Array(QuantLibJNI.TridiagonalOperator_solveFor(swigCPtr, this, Array.getCPtr(rhs), rhs), true);
  }

  public Array applyTo(Array v) {
    return new Array(QuantLibJNI.TridiagonalOperator_applyTo(swigCPtr, this, Array.getCPtr(v), v), true);
  }

  public long size() {
    return QuantLibJNI.TridiagonalOperator_size(swigCPtr, this);
  }

  public void setFirstRow(double arg0, double arg1) {
    QuantLibJNI.TridiagonalOperator_setFirstRow(swigCPtr, this, arg0, arg1);
  }

  public void setMidRow(long arg0, double arg1, double arg2, double arg3) {
    QuantLibJNI.TridiagonalOperator_setMidRow(swigCPtr, this, arg0, arg1, arg2, arg3);
  }

  public void setMidRows(double arg0, double arg1, double arg2) {
    QuantLibJNI.TridiagonalOperator_setMidRows(swigCPtr, this, arg0, arg1, arg2);
  }

  public void setLastRow(double arg0, double arg1) {
    QuantLibJNI.TridiagonalOperator_setLastRow(swigCPtr, this, arg0, arg1);
  }

  public static TridiagonalOperator identity(long size) {
    return new TridiagonalOperator(QuantLibJNI.TridiagonalOperator_identity(size), true);
  }

}
