ONE_CLASS_Q(svm_problem prob, svm_parameter param) { super(prob.l, prob.x, param); cache = new Cache(prob.l,(long)(param.cache_size*(1<<20))); QD = new double[prob.l]; for(int i=0;i<prob.l;i++) QD[i] = kernel_function(i,i); }
float[] get_Q(int i, int len) { float[][] data = new float[1][]; int start, j; if((start = cache.get_data(i,data,len)) < len) { for(j=start;j<len;j++) data[0][j] = (float)(y[i]*y[j]*kernel_function(i,j)); } return data[0]; }
void swap_index(int i, int j) { if(i==j) return; if(head[i].len > 0) lru_delete(head[i]); if(head[j].len > 0) lru_delete(head[j]); do {float[] _=head[i].data; head[i].data=head[j].data; head[j].data=_;} while(false); do {int _=head[i].len; head[i].len=head[j].len; head[j].len=_;} while(false); if(head[i].len > 0) lru_insert(head[i]); if(head[j].len > 0) lru_insert(head[j]); if(i>j) do {int _=i; i=j; j=_;} while(false); for(head_t h = lru_head.next; h!=lru_head; h=h.next) { if(h.len > i) { if(h.len > j) do {float _=h.data[i]; h.data[i]=h.data[j]; h.data[j]=_;} while(false); else { // give up lru_delete(h); size += h.len; h.data = null; h.len = 0; } } } } }
void swap_index(int i, int j) { cache.swap_index(i,j); super.swap_index(i,j); do {double _=QD[i]; QD[i]=QD[j]; QD[j]=_;} while(false); } }
@Override void swap_index(int i, int j) { cache.swap_index(i,j); super.swap_index(i,j); do {float _=QD[i]; QD[i]=QD[j]; QD[j]=_;} while(false); } }
void swap_index(int i, int j) { if(i==j) return; if(head[i].len > 0) lru_delete(head[i]); if(head[j].len > 0) lru_delete(head[j]); do {float[] tmp=head[i].data; head[i].data=head[j].data; head[j].data=tmp;} while(false); do {int tmp=head[i].len; head[i].len=head[j].len; head[j].len=tmp;} while(false); if(head[i].len > 0) lru_insert(head[i]); if(head[j].len > 0) lru_insert(head[j]); if(i>j) do {int tmp=i; i=j; j=tmp;} while(false); for(head_t h = lru_head.next; h!=lru_head; h=h.next) { if(h.len > i) { if(h.len > j) do {float tmp=h.data[i]; h.data[i]=h.data[j]; h.data[j]=tmp;} while(false); else { // give up lru_delete(h); size += h.len; h.data = null; h.len = 0; } } } } }
float[] get_Q(int i, int len) { float[][] data = new float[1][]; int start, j; if((start = cache.get_data(i,data,len)) < len) { for(j=start;j<len;j++) data[0][j] = (float)kernel_function(i,j); } return data[0]; }
ONE_CLASS_Q(svm_problem prob, svm_parameter param) { super(prob.l, prob.x, param); cache = new Cache(prob.l,(long)(param.cache_size*(1<<20))); QD = new double[prob.l]; for(int i=0;i<prob.l;i++) QD[i] = kernel_function(i,i); }
void swap_index(int i, int j) { cache.swap_index(i,j); super.swap_index(i,j); do {double tmp=QD[i]; QD[i]=QD[j]; QD[j]=tmp;} while(false); } }
void swap_index(int i, int j) { if(i==j) return; if(head[i].len > 0) lru_delete(head[i]); if(head[j].len > 0) lru_delete(head[j]); do {float[] _=head[i].data; head[i].data=head[j].data; head[j].data=_;} while(false); do {int _=head[i].len; head[i].len=head[j].len; head[j].len=_;} while(false); if(head[i].len > 0) lru_insert(head[i]); if(head[j].len > 0) lru_insert(head[j]); if(i>j) do {int _=i; i=j; j=_;} while(false); for(head_t h = lru_head.next; h!=lru_head; h=h.next) { if(h.len > i) { if(h.len > j) do {float _=h.data[i]; h.data[i]=h.data[j]; h.data[j]=_;} while(false); else { // give up lru_delete(h); size += h.len; h.data = null; h.len = 0; } } } } }
@Override float[] get_Q(int i, int len) { float[][] data = new float[1][]; int start, j; if((start = cache.get_data(i,data,len)) < len) { for(j=start;j<len;j++) data[0][j] = (float)kernel_function(i,j); } return data[0]; }
ONE_CLASS_Q(svm_problem prob, svm_parameter param) { super(prob.l, prob.x, param); cache = new Cache(prob.l,(long)(param.cache_size*(1<<20))); QD = new float[prob.l]; for(int i=0;i<prob.l;i++) QD[i]= (float)kernel_function(i,i); }
void swap_index(int i, int j) { cache.swap_index(i,j); super.swap_index(i,j); do {byte _=y[i]; y[i]=y[j]; y[j]=_;} while(false); do {double _=QD[i]; QD[i]=QD[j]; QD[j]=_;} while(false); } }
int get_data(int index, float[][] data, int len) { head_t h = head[index]; if(h.len > 0) lru_delete(h); int more = len - h.len; if(more > 0) { // free old space while(size < more) { head_t old = lru_head.next; lru_delete(old); size += old.len; old.data = null; old.len = 0; } // allocate new space float[] new_data = new float[len]; if(h.data != null) System.arraycopy(h.data,0,new_data,0,h.len); h.data = new_data; size -= more; do {int tmp=h.len; h.len=len; len=tmp;} while(false); } lru_insert(h); data[0] = h.data; return len; }
float[] get_Q(int i, int len) { float[][] data = new float[1][]; int start, j; if((start = cache.get_data(i,data,len)) < len) { for(j=start;j<len;j++) data[0][j] = (float)(y[i]*y[j]*kernel_function(i,j)); } return data[0]; }
SVR_Q(svm_problem prob, svm_parameter param) { super(prob.l, prob.x, param); l = prob.l; cache = new Cache(l,(long)(param.cache_size*(1<<20))); QD = new double[2*l]; sign = new byte[2*l]; index = new int[2*l]; for(int k=0;k<l;k++) { sign[k] = 1; sign[k+l] = -1; index[k] = k; index[k+l] = k; QD[k] = kernel_function(k,k); QD[k+l] = QD[k]; } buffer = new float[2][2*l]; next_buffer = 0; }
void swap_index(int i, int j) { cache.swap_index(i,j); super.swap_index(i,j); do {byte tmp=y[i]; y[i]=y[j]; y[j]=tmp;} while(false); do {double tmp=QD[i]; QD[i]=QD[j]; QD[j]=tmp;} while(false); } }
int get_data(int index, float[][] data, int len) { head_t h = head[index]; if(h.len > 0) lru_delete(h); int more = len - h.len; if(more > 0) { // free old space while(size < more) { head_t old = lru_head.next; lru_delete(old); size += old.len; old.data = null; old.len = 0; } // allocate new space float[] new_data = new float[len]; if(h.data != null) System.arraycopy(h.data,0,new_data,0,h.len); h.data = new_data; size -= more; do {int _=h.len; h.len=len; len=_;} while(false); } lru_insert(h); data[0] = h.data; return len; }
float[] get_Q(int i, int len) { float[][] data = new float[1][]; int start, j; if((start = cache.get_data(i,data,len)) < len) { for(j=start;j<len;j++) data[0][j] = (float)kernel_function(i,j); } return data[0]; }
SVR_Q(svm_problem prob, svm_parameter param) { super(prob.l, prob.x, param); l = prob.l; cache = new Cache(l,(long)(param.cache_size*(1<<20))); QD = new float[2*l]; sign = new byte[2*l]; index = new int[2*l]; for(int k=0;k<l;k++) { sign[k] = 1; sign[k+l] = -1; index[k] = k; index[k+l] = k; QD[k] = (float)kernel_function(k,k); QD[k+l] = QD[k]; } buffer = new float[2][2*l]; next_buffer = 0; }