Added doc comments [skip ci]
This commit is contained in:
@@ -46,6 +46,7 @@ pub struct MfModel {
|
||||
pub q: *const c_float,
|
||||
}
|
||||
|
||||
/// Loss functions.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Loss {
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::error;
|
||||
use std::ffi::NulError;
|
||||
use std::fmt;
|
||||
|
||||
/// An error.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum Error {
|
||||
Io,
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
use crate::bindings::{MfNode, MfProblem};
|
||||
|
||||
/// A matrix.
|
||||
pub struct Matrix {
|
||||
data: Vec<MfNode>,
|
||||
}
|
||||
|
||||
impl Matrix {
|
||||
/// Creates a new matrix.
|
||||
pub fn new() -> Self {
|
||||
Self { data: Vec::new() }
|
||||
}
|
||||
|
||||
/// Creates a new matrix with a minimum capacity.
|
||||
pub fn with_capacity(capacity: usize) -> Self {
|
||||
Self {
|
||||
data: Vec::with_capacity(capacity),
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds a value to the matrix.
|
||||
pub fn push(&mut self, row_index: i32, column_index: i32, value: f32) {
|
||||
assert!(row_index >= 0);
|
||||
assert!(column_index >= 0);
|
||||
|
||||
@@ -4,6 +4,7 @@ use std::ffi::CString;
|
||||
use std::path::Path;
|
||||
use std::slice::Chunks;
|
||||
|
||||
/// A model.
|
||||
#[derive(Debug)]
|
||||
pub struct Model {
|
||||
pub(crate) model: *mut MfModel,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use crate::bindings::*;
|
||||
use crate::{Error, Loss, Matrix, Model};
|
||||
|
||||
/// A set of parameters.
|
||||
pub struct Params {
|
||||
param: MfParameter,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user